2007-10-16 00:13:55 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2002-2007, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
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
2002-08-24 09:04:02 +04:00
|
|
|
#ifndef _MIME_DATABASE_SUPPORT_H
|
|
|
|
#define _MIME_DATABASE_SUPPORT_H
|
|
|
|
|
2007-10-16 00:13:55 +04:00
|
|
|
|
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
2002-08-24 09:04:02 +04:00
|
|
|
#include <StorageDefs.h>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
class BNode;
|
|
|
|
class BMessage;
|
2007-10-16 00:13:55 +04:00
|
|
|
class BString;
|
|
|
|
|
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
2002-08-24 09:04:02 +04:00
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
namespace Storage {
|
|
|
|
namespace Mime {
|
|
|
|
|
|
|
|
// Database directory
|
2009-12-01 11:52:13 +03:00
|
|
|
const std::string get_database_directory();
|
|
|
|
const std::string get_application_database_directory();
|
|
|
|
|
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
2002-08-24 09:04:02 +04:00
|
|
|
// Attribute Prefixes
|
|
|
|
extern const char *kMiniIconAttrPrefix;
|
2009-12-01 11:52:13 +03:00
|
|
|
extern const char *kLargeIconAttrPrefix;
|
|
|
|
extern const char *kIconAttrPrefix;
|
|
|
|
|
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
2002-08-24 09:04:02 +04:00
|
|
|
// 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;
|
2006-08-26 20:21:15 +04:00
|
|
|
extern const char *kIconAttr;
|
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
2002-08-24 09:04:02 +04:00
|
|
|
extern const char *kPreferredAppAttr;
|
|
|
|
extern const char *kSnifferRuleAttr;
|
|
|
|
extern const char *kSupportedTypesAttr;
|
|
|
|
|
2009-12-01 11:52:13 +03:00
|
|
|
// Attribute Datatypes
|
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
2002-08-24 09:04:02 +04:00
|
|
|
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;
|
2006-08-26 20:21:15 +04:00
|
|
|
extern const int32 kIconType;
|
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
2002-08-24 09:04:02 +04:00
|
|
|
extern const int32 kPreferredAppType;
|
|
|
|
extern const int32 kSnifferRuleType;
|
|
|
|
extern const int32 kSupportedTypesType;
|
|
|
|
|
2002-08-27 12:26:11 +04:00
|
|
|
// Message fields
|
2002-08-29 03:58:08 +04:00
|
|
|
extern const char *kApplicationsField;
|
2002-09-24 09:36:03 +04:00
|
|
|
extern const char *kExtensionsField;
|
2002-08-27 12:26:11 +04:00
|
|
|
extern const char *kSupertypesField;
|
2002-08-29 03:58:08 +04:00
|
|
|
extern const char *kSupportingAppsSubCountField;
|
|
|
|
extern const char *kSupportingAppsSuperCountField;
|
|
|
|
extern const char *kTypesField;
|
2002-08-27 12:26:11 +04:00
|
|
|
|
2002-09-24 09:36:03 +04:00
|
|
|
// Mime types
|
|
|
|
extern const char *kGenericFileType;
|
|
|
|
extern const char *kDirectoryType;
|
|
|
|
extern const char *kSymlinkType;
|
2002-10-01 11:29:32 +04:00
|
|
|
extern const char *kMetaMimeType;
|
2002-09-24 09:36:03 +04:00
|
|
|
|
|
|
|
// Error codes (to be used only by BPrivate::Storage::Mime members)
|
|
|
|
extern const status_t kMimeGuessFailureError;
|
|
|
|
|
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
2002-08-24 09:04:02 +04:00
|
|
|
std::string type_to_filename(const char *type);
|
|
|
|
|
|
|
|
status_t open_type(const char *type, BNode *result);
|
|
|
|
status_t open_or_create_type(const char *type, BNode *result, bool *didCreate);
|
|
|
|
|
|
|
|
ssize_t read_mime_attr(const char *type, const char *attr, void *data,
|
|
|
|
size_t len, type_code datatype);
|
|
|
|
status_t read_mime_attr_message(const char *type, const char *attr, BMessage *msg);
|
2002-09-24 09:36:03 +04:00
|
|
|
status_t read_mime_attr_string(const char *type, const char *attr, BString *str);
|
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
2002-08-24 09:04:02 +04:00
|
|
|
status_t write_mime_attr(const char *type, const char *attr, const void *data,
|
2009-12-01 11:52:13 +03:00
|
|
|
size_t len, type_code datatype, bool *didCreate);
|
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
2002-08-24 09:04:02 +04:00
|
|
|
status_t write_mime_attr_message(const char *type, const char *attr,
|
2009-12-01 11:52:13 +03:00
|
|
|
const BMessage *msg, bool *didCreate);
|
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
2002-08-24 09:04:02 +04:00
|
|
|
|
|
|
|
status_t delete_attribute(const char *type, const char *attr);
|
|
|
|
|
|
|
|
} // namespace Mime
|
|
|
|
} // namespace Storage
|
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
|
|
#endif // _MIME_DATABASE_SUPPORT_H
|