44#include < pybind11/operators.h>
55
66#include < MimeType.h>
7+ #include < Bitmap.h>
78
89namespace py = pybind11;
910using namespace BPrivate ;
1011using namespace BPrivate ::Storage;
1112using namespace BPrivate ::Storage::Mime;
1213
13- void define_MimeType (py::module_& m)
14+ PYBIND11_MODULE (MimeType, m)
1415{
1516py::enum_<app_verb>(m," app_verb" ," " )
1617.value (" B_OPEN" , app_verb::B_OPEN," " )
1718.export_values ();
1819
19- m.attr (" B_META_MIME_CHANGED" ) =py::cast (B_META_MIME_CHANGED) ;
20+ m.attr (" B_META_MIME_CHANGED" ) =' MMCH ' ;
2021
21- m.attr (" B_ICON_CHANGED" ) =py::cast (B_ICON_CHANGED) ;
22- m.attr (" B_PREFERRED_APP_CHANGED" ) =py::cast (B_PREFERRED_APP_CHANGED) ;
23- m.attr (" B_ATTR_INFO_CHANGED" ) =py::cast (B_ATTR_INFO_CHANGED) ;
24- m.attr (" B_FILE_EXTENSIONS_CHANGED" ) =py::cast (B_FILE_EXTENSIONS_CHANGED) ;
25- m.attr (" B_SHORT_DESCRIPTION_CHANGED" ) =py::cast (B_SHORT_DESCRIPTION_CHANGED) ;
26- m.attr (" B_LONG_DESCRIPTION_CHANGED" ) =py::cast (B_LONG_DESCRIPTION_CHANGED) ;
27- m.attr (" B_ICON_FOR_TYPE_CHANGED" ) =py::cast (B_ICON_FOR_TYPE_CHANGED) ;
28- m.attr (" B_APP_HINT_CHANGED" ) =py::cast (B_APP_HINT_CHANGED) ;
29- m.attr (" B_MIME_TYPE_CREATED" ) =py::cast (B_MIME_TYPE_CREATED) ;
30- m.attr (" B_MIME_TYPE_DELETED" ) =py::cast (B_MIME_TYPE_DELETED) ;
31- m.attr (" B_SNIFFER_RULE_CHANGED" ) =py::cast (B_SNIFFER_RULE_CHANGED) ;
32- m.attr (" B_SUPPORTED_TYPES_CHANGED" ) =py::cast (B_SUPPORTED_TYPES_CHANGED) ;
33- m.attr (" B_EVERYTHING_CHANGED" ) =py::cast (B_EVERYTHING_CHANGED) ;
22+ m.attr (" B_ICON_CHANGED" ) =0x00000001 ;
23+ m.attr (" B_PREFERRED_APP_CHANGED" ) =0x00000002 ;
24+ m.attr (" B_ATTR_INFO_CHANGED" ) =0x00000004 ;
25+ m.attr (" B_FILE_EXTENSIONS_CHANGED" ) =0x00000008 ;
26+ m.attr (" B_SHORT_DESCRIPTION_CHANGED" ) =0x00000010 ;
27+ m.attr (" B_LONG_DESCRIPTION_CHANGED" ) =0x00000020 ;
28+ m.attr (" B_ICON_FOR_TYPE_CHANGED" ) =0x00000040 ;
29+ m.attr (" B_APP_HINT_CHANGED" ) =0x00000080 ;
30+ m.attr (" B_MIME_TYPE_CREATED" ) =0x00000100 ;
31+ m.attr (" B_MIME_TYPE_DELETED" ) =0x00000200 ;
32+ m.attr (" B_SNIFFER_RULE_CHANGED" ) =0x00000400 ;
33+ m.attr (" B_SUPPORTED_TYPES_CHANGED" ) =0x00000800 ;
34+ m.attr (" B_EVERYTHING_CHANGED" ) =( int ) 0xFFFFFFFF ;
3435
35- m.attr (" B_META_MIME_MODIFIED" ) =py::cast (B_META_MIME_MODIFIED) ;
36- m.attr (" B_META_MIME_DELETED" ) =py::cast (B_META_MIME_DELETED) ;
36+ m.attr (" B_META_MIME_MODIFIED" ) =' MMMD ' ;
37+ m.attr (" B_META_MIME_DELETED" ) =' MMDL ' ;
3738
38- m.attr (" MimeDatabase" ) =py::cast (MimeDatabase);
39+ // m.attr("MimeDatabase") = py::cast(BPrivate:: MimeDatabase);
3940
40- m.attr (" CreateAppMetaMimeThread" ) =py::cast (CreateAppMetaMimeThread);
41+ // m.attr("CreateAppMetaMimeThread") = py::cast(CreateAppMetaMimeThread);
4142
4243m.attr (" B_APP_MIME_TYPE" ) =py::cast (B_APP_MIME_TYPE);
4344
@@ -58,25 +59,25 @@ py::class_<BMimeType>(m, "BMimeType")
5859.def (" Unset" , &BMimeType::Unset," " )
5960.def (" InitCheck" , &BMimeType::InitCheck," " )
6061.def (" Type" , &BMimeType::Type," " )
61- .def (" IsValid" , py::overload_cast<>(&BMimeType::IsValid)," " )
62+ .def (" IsValid" , py::overload_cast<>(&BMimeType::IsValid, py::const_ )," " )
6263.def (" IsSupertypeOnly" , &BMimeType::IsSupertypeOnly," " )
6364.def (" GetSupertype" , &BMimeType::GetSupertype," " ,py::arg (" supertype" ))
64- .def (" __eq__" , py::overload_cast<const BMimeType &>(&BMimeType::operator ==)," " ,py::arg (" type" ))
65- .def (" __eq__" , py::overload_cast<const char *>(&BMimeType::operator ==)," " ,py::arg (" type" ))
65+ .def (" __eq__" , py::overload_cast<const BMimeType &>(&BMimeType::operator ==, py::const_ )," " ,py::arg (" type" ))
66+ .def (" __eq__" , py::overload_cast<const char *>(&BMimeType::operator ==, py::const_ )," " ,py::arg (" type" ))
6667.def (" Contains" , &BMimeType::Contains," " ,py::arg (" type" ))
6768.def (" Install" , &BMimeType::Install," " )
6869.def (" Delete" , &BMimeType::Delete," " )
6970.def (" IsInstalled" , &BMimeType::IsInstalled," " )
70- .def (" GetIcon" , py::overload_cast<BBitmap *, icon_size>(&BMimeType::GetIcon)," " ,py::arg (" icon" ),py::arg (" size" ))
71- .def (" GetIcon" , py::overload_cast<unsigned char ,size_t *>(&BMimeType::GetIcon)," " ,py::arg (" _data" ),py::arg (" _size" ))
71+ .def (" GetIcon" , py::overload_cast<BBitmap *, icon_size>(&BMimeType::GetIcon, py::const_ )," " ,py::arg (" icon" ),py::arg (" size" ))
72+ // .def("GetIcon", py::overload_cast<unsigned char, size_t *>(&BMimeType::GetIcon, py::const_ ), "", py::arg("_data"), py::arg("_size"))
7273.def (" GetPreferredApp" , &BMimeType::GetPreferredApp," " ,py::arg (" signature" ),py::arg (" verb" )=B_OPEN)
7374.def (" GetAttrInfo" , &BMimeType::GetAttrInfo," " ,py::arg (" info" ))
7475.def (" GetFileExtensions" , &BMimeType::GetFileExtensions," " ,py::arg (" extensions" ))
7576.def (" GetShortDescription" , &BMimeType::GetShortDescription," " ,py::arg (" description" ))
7677.def (" GetLongDescription" , &BMimeType::GetLongDescription," " ,py::arg (" description" ))
7778.def (" GetSupportingApps" , &BMimeType::GetSupportingApps," " ,py::arg (" signatures" ))
7879.def (" SetIcon" , py::overload_cast<const BBitmap *, icon_size>(&BMimeType::SetIcon)," " ,py::arg (" icon" ),py::arg (" size" ))
79- .def (" SetIcon" , py::overload_cast<unsigned char ,size_t >(&BMimeType::SetIcon)," " ,py::arg (" data" ),py::arg (" size" ))
80+ // .def("SetIcon", py::overload_cast<unsigned char, size_t>(&BMimeType::SetIcon), "", py::arg("data"), py::arg("size"))
8081.def (" SetPreferredApp" , &BMimeType::SetPreferredApp," " ,py::arg (" signature" ),py::arg (" verb" )=B_OPEN)
8182.def (" SetAttrInfo" , &BMimeType::SetAttrInfo," " ,py::arg (" info" ))
8283.def (" SetFileExtensions" , &BMimeType::SetFileExtensions," " ,py::arg (" extensions" ))
@@ -86,18 +87,18 @@ py::class_<BMimeType>(m, "BMimeType")
8687.def_static (" GetInstalledTypes" , py::overload_cast<BMessage *>(&BMimeType::GetInstalledTypes)," " ,py::arg (" types" ))
8788.def_static (" GetInstalledTypes" , py::overload_cast<const char *, BMessage *>(&BMimeType::GetInstalledTypes)," " ,py::arg (" supertype" ),py::arg (" subtypes" ))
8889.def_static (" GetWildcardApps" , &BMimeType::GetWildcardApps," " ,py::arg (" wildcardApps" ))
89- .def_static (" IsValid " , py::overload_cast<const char *>(&BMimeType::IsValid)," " ,py::arg (" mimeType" ))
90+ .def_static (" IsValid_static " , py::overload_cast<const char *>(&BMimeType::IsValid)," " ,py::arg (" mimeType" ))
9091.def (" GetAppHint" , &BMimeType::GetAppHint," " ,py::arg (" ref" ))
9192.def (" SetAppHint" , &BMimeType::SetAppHint," " ,py::arg (" ref" ))
92- .def (" GetIconForType" , py::overload_cast<const char *, BBitmap *, icon_size>(&BMimeType::GetIconForType)," " ,py::arg (" type" ),py::arg (" icon" ),py::arg (" which" ))
93- .def (" GetIconForType" , py::overload_cast<const char *,unsigned char ,size_t *>(&BMimeType::GetIconForType)," " ,py::arg (" type" ),py::arg (" _data" ),py::arg (" _size" ))
93+ .def (" GetIconForType" , py::overload_cast<const char *, BBitmap *, icon_size>(&BMimeType::GetIconForType, py::const_ )," " ,py::arg (" type" ),py::arg (" icon" ),py::arg (" which" ))
94+ // .def("GetIconForType", py::overload_cast<const char *, unsigned char, size_t *>(&BMimeType::GetIconForType, py::const_ ), "", py::arg("type"), py::arg("_data"), py::arg("_size"))
9495.def (" SetIconForType" , py::overload_cast<const char *,const BBitmap *, icon_size>(&BMimeType::SetIconForType)," " ,py::arg (" type" ),py::arg (" icon" ),py::arg (" which" ))
95- .def (" SetIconForType" , py::overload_cast<const char *,unsigned char ,size_t >(&BMimeType::SetIconForType)," " ,py::arg (" type" ),py::arg (" data" ),py::arg (" size" ))
96+ .def (" SetIconForType" , py::overload_cast<const char *,const uint8* ,size_t >(&BMimeType::SetIconForType)," " ,py::arg (" type" ),py::arg (" data" ),py::arg (" size" ))
9697.def (" GetSnifferRule" , &BMimeType::GetSnifferRule," " ,py::arg (" result" ))
9798.def (" SetSnifferRule" , &BMimeType::SetSnifferRule," " ,py::arg (" " ))
9899.def_static (" CheckSnifferRule" , &BMimeType::CheckSnifferRule," " ,py::arg (" rule" ),py::arg (" parseError" ))
99100.def_static (" GuessMimeType" , py::overload_cast<const entry_ref *, BMimeType *>(&BMimeType::GuessMimeType)," " ,py::arg (" file" ),py::arg (" type" ))
100- .def_static (" GuessMimeType" , py::overload_cast<const void *,int , BMimeType *>(&BMimeType::GuessMimeType)," " ,py::arg (" buffer" ),py::arg (" length" ),py::arg (" type" ))
101+ .def_static (" GuessMimeType" , py::overload_cast<const void *,int32 , BMimeType *>(&BMimeType::GuessMimeType)," " ,py::arg (" buffer" ),py::arg (" length" ),py::arg (" type" ))
101102.def_static (" GuessMimeType" , py::overload_cast<const char *, BMimeType *>(&BMimeType::GuessMimeType)," " ,py::arg (" filename" ),py::arg (" type" ))
102103.def_static (" StartWatching" , &BMimeType::StartWatching," " ,py::arg (" target" ))
103104.def_static (" StopWatching" , &BMimeType::StopWatching," " ,py::arg (" target" ))