haiku/headers/private/storage/mime/database_support.h
Ingo Weinhold b94857b322 Refactor MIME DB access
* Add class DatabaseLocation. It contains a list of the MIME DB
  directory paths plus methods to access type files.
* Move all low-level MIME DB access functions from
  database_{support,access} to DatabaseLocation. All code that formerly
  used those now requires a DatabaseLocation object. In BMimeType and in
  the registrar the default object is used, but the low-level classes
  can now be reused with different locations.
* Move get_icon_data() from database_access to database_support and
  delete the former, which is now empty.
2013-05-07 23:15:36 +02:00

91 lines
2.3 KiB
C++

/*
* Copyright 2002-2013, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _MIME_DATABASE_SUPPORT_H
#define _MIME_DATABASE_SUPPORT_H
#include <Mime.h>
#include <SupportDefs.h>
class BBitmap;
namespace BPrivate {
namespace Storage {
namespace Mime {
class DatabaseLocation;
// Attribute Prefixes
extern const char *kMiniIconAttrPrefix;
extern const char *kLargeIconAttrPrefix;
extern const char *kIconAttrPrefix;
// Attribute names
extern const char *kFileTypeAttr;
extern const char *kTypeAttr;
extern const char *kAttrInfoAttr;
extern const char *kAppHintAttr;
extern const char *kShortDescriptionAttr;
extern const char *kLongDescriptionAttr;
extern const char *kFileExtensionsAttr;
extern const char *kMiniIconAttr;
extern const char *kLargeIconAttr;
extern const char *kIconAttr;
extern const char *kPreferredAppAttr;
extern const char *kSnifferRuleAttr;
extern const char *kSupportedTypesAttr;
// Attribute Datatypes
extern const int32 kFileTypeType;
extern const int32 kTypeType;
extern const int32 kAppHintType;
extern const int32 kAttrInfoType;
extern const int32 kShortDescriptionType;
extern const int32 kLongDescriptionType;
extern const int32 kFileExtensionsType;
extern const int32 kMiniIconType;
extern const int32 kLargeIconType;
extern const int32 kIconType;
extern const int32 kPreferredAppType;
extern const int32 kSnifferRuleType;
extern const int32 kSupportedTypesType;
// Message fields
extern const char *kApplicationsField;
extern const char *kExtensionsField;
extern const char *kSupertypesField;
extern const char *kSupportingAppsSubCountField;
extern const char *kSupportingAppsSuperCountField;
extern const char *kTypesField;
// Mime types
extern const char *kGenericFileType;
extern const char *kDirectoryType;
extern const char *kSymlinkType;
extern const char *kMetaMimeType;
// Error codes (to be used only by BPrivate::Storage::Mime members)
extern const status_t kMimeGuessFailureError;
DatabaseLocation* default_database_location();
// Called by BMimeType to get properly formatted icon data ready
// to be shipped off to SetIcon*() and written to the database
status_t get_icon_data(const BBitmap *icon, icon_size size, void **data,
int32 *dataSize);
} // namespace Mime
} // namespace Storage
} // namespace BPrivate
#endif // _MIME_DATABASE_SUPPORT_H