After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -57,6 +57,7 @@ enum {
|
||||
B_MIME_TYPE_CREATED = 0x00000100,
|
||||
B_MIME_TYPE_DELETED = 0x00000200,
|
||||
B_SNIFFER_RULE_CHANGED = 0x00000400,
|
||||
B_SUPPORTED_TYPES_CHANGED = 0x00000800,
|
||||
|
||||
B_EVERYTHING_CHANGED = (int)0xFFFFFFFF
|
||||
};
|
||||
@@ -121,9 +122,9 @@ public:
|
||||
status_t SetShortDescription(const char *description);
|
||||
status_t SetLongDescription(const char *description);
|
||||
|
||||
static status_t GetInstalledSupertypes(BMessage *super_types);
|
||||
static status_t GetInstalledSupertypes(BMessage *supertypes);
|
||||
static status_t GetInstalledTypes(BMessage *types);
|
||||
static status_t GetInstalledTypes(const char *super_type,
|
||||
static status_t GetInstalledTypes(const char *supertype,
|
||||
BMessage *subtypes);
|
||||
static status_t GetWildcardApps(BMessage *wild_ones);
|
||||
static bool IsValid(const char *mimeType);
|
||||
@@ -156,15 +157,16 @@ public:
|
||||
status_t SetType(const char *mimeType);
|
||||
|
||||
/* Brand new Delete() methods */
|
||||
status_t DeleteIcon(icon_size size);
|
||||
status_t DeletePreferredApp(app_verb verb = B_OPEN);
|
||||
status_t DeleteAppHint();
|
||||
status_t DeleteAttrInfo();
|
||||
status_t DeleteFileExtensions();
|
||||
status_t DeleteShortDescription();
|
||||
status_t DeleteLongDescription();
|
||||
status_t DeleteSnifferRule();
|
||||
status_t DeleteFileExtensions();
|
||||
status_t DeleteIcon(icon_size size);
|
||||
status_t DeleteIconForType(const char *type, icon_size which);
|
||||
status_t DeleteAppHint();
|
||||
status_t DeletePreferredApp(app_verb verb = B_OPEN);
|
||||
status_t DeleteSnifferRule();
|
||||
status_t DeleteSupportedTypes();
|
||||
|
||||
private:
|
||||
BMimeType(const char *mimeType, const char *mimePath);
|
||||
@@ -192,24 +194,24 @@ private:
|
||||
BMimeType &operator=(const BMimeType &);
|
||||
BMimeType(const BMimeType &);
|
||||
|
||||
/*
|
||||
void InitData(const char *type);
|
||||
void InitData(const char *type);
|
||||
status_t OpenFile(bool create_file = false, dev_t dev = -1) const;
|
||||
status_t CloseFile() const;
|
||||
|
||||
// void InitData(const char *type);
|
||||
// void InitData(const char *type);
|
||||
// status_t OpenFile(bool create_file = false, dev_t dev = -1) const;
|
||||
// status_t CloseFile() const;
|
||||
status_t GetSupportedTypes(BMessage *types);
|
||||
status_t SetSupportedTypes(const BMessage *types);
|
||||
void MimeChanged(int32 w, const char *type = NULL,
|
||||
bool large = true) const;
|
||||
*/
|
||||
// void MimeChanged(int32 w, const char *type = NULL,
|
||||
// bool large = true) const;
|
||||
|
||||
char *fType;
|
||||
BFile *fMeta;
|
||||
BPrivate::MimeDatabase *fMimeDatabase; // Was: "void *_unused;"
|
||||
entry_ref fRef;
|
||||
int fWhere;
|
||||
status_t fCStatus;
|
||||
uint32 _reserved[3];
|
||||
|
||||
char *fType;
|
||||
BFile *fMeta;
|
||||
void *_unused;
|
||||
entry_ref fRef;
|
||||
int fWhere;
|
||||
status_t fCStatus;
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user