+ Added GetInstalled[Super]Types functionality
+ Cleaned up warnings + Added documentation git-svn-id: file:///srv/svn/repos/haiku/trunk/current@899 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
// mime/Database.h
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file Database.cpp
|
||||
Database class declarations
|
||||
*/
|
||||
|
||||
#ifndef _MIME_DATABASE_H
|
||||
#define _MIME_DATABASE_H
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// mime/InstalledTypes.h
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file InstalledTypes.h
|
||||
InstalledTypes class declarations
|
||||
*/
|
||||
|
||||
#ifndef _MIME_INSTALLED_TYPES_H
|
||||
#define _MIME_INSTALLED_TYPES_H
|
||||
@@ -24,15 +31,29 @@ public:
|
||||
status_t GetInstalledTypes(const char *supertype, BMessage *types);
|
||||
status_t GetInstalledSupertypes(BMessage *types);
|
||||
|
||||
void AddType(const char *type);
|
||||
void AddSupertype(const char *type);
|
||||
void AddSubtype(const char *super, const char *sub);
|
||||
status_t AddType(const char *type);
|
||||
status_t RemoveType(const char *type);
|
||||
private:
|
||||
void FillMessageWithTypes(BMessage *msg);
|
||||
status_t AddSupertype(const char *super, std::map<std::string, Supertype>::iterator &i);
|
||||
status_t AddSubtype(const char *super, const char *sub);
|
||||
status_t AddSubtype(Supertype &super, const char *sub);
|
||||
|
||||
status_t RemoveSupertype(const char *super);
|
||||
status_t RemoveSubtype(const char *super, const char *sub);
|
||||
|
||||
void Unset();
|
||||
void ClearCachedMessages();
|
||||
|
||||
status_t CreateMessageWithTypes(BMessage **result) const;
|
||||
status_t CreateMessageWithSupertypes(BMessage **result) const;
|
||||
void FillMessageWithSupertypes(BMessage *msg);
|
||||
|
||||
status_t BuildInstalledTypesList();
|
||||
|
||||
std::map<std::string, Supertype> fSupertypes;
|
||||
BMessage *fCachedMessage;
|
||||
BMessage *fCachedSupertypesMessage;
|
||||
bool fHaveDoneFullBuild;
|
||||
};
|
||||
|
||||
} // namespace Mime
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// mime/Supertype.h
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file Supertype.h
|
||||
Supertype class declarations
|
||||
*/
|
||||
|
||||
#ifndef _MIME_SUPERTYPE_H
|
||||
#define _MIME_SUPERTYPE_H
|
||||
@@ -16,15 +23,24 @@ namespace Mime {
|
||||
|
||||
class Supertype {
|
||||
public:
|
||||
Supertype(const char *super);
|
||||
Supertype(const char *super = NULL);
|
||||
~Supertype();
|
||||
|
||||
status_t GetInstalledSubtypes(BMessage *types);
|
||||
|
||||
void AddSubtype(const char *sub);
|
||||
void FillMessageWithTypes(BMessage *msg);
|
||||
status_t AddSubtype(const char *sub);
|
||||
status_t RemoveSubtype(const char *sub);
|
||||
|
||||
void SetName(const char *super);
|
||||
const char* GetName();
|
||||
|
||||
status_t FillMessageWithTypes(BMessage &msg) const;
|
||||
private:
|
||||
status_t CreateMessageWithTypes(BMessage **result) const;
|
||||
|
||||
std::set<std::string> fSubtypes;
|
||||
BMessage *fCachedMessage;
|
||||
std::string fType;
|
||||
std::string fName;
|
||||
};
|
||||
|
||||
} // namespace Mime
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// mime/database_access.h
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file database_access.h
|
||||
Mime database atomic read function declarations
|
||||
*/
|
||||
|
||||
#ifndef _MIME_DATABASE_ACCESS_H
|
||||
#define _MIME_DATABASE_ACCESS_H
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// mime/database_support.h
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file database_support.h
|
||||
Private mime database function and constant declarations
|
||||
*/
|
||||
|
||||
#ifndef _MIME_DATABASE_SUPPORT_H
|
||||
#define _MIME_DATABASE_SUPPORT_H
|
||||
@@ -49,6 +56,10 @@ extern const int32 kPreferredAppType;
|
||||
extern const int32 kSnifferRuleType;
|
||||
extern const int32 kSupportedTypesType;
|
||||
|
||||
// Message fields
|
||||
extern const char *kTypesField;
|
||||
extern const char *kSupertypesField;
|
||||
|
||||
std::string type_to_filename(const char *type);
|
||||
|
||||
status_t open_type(const char *type, BNode *result);
|
||||
|
||||
Reference in New Issue
Block a user