2 * Copyright 2013, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Ingo Weinhold <ingo_weinhold@gmx.de>
8 #ifndef _MIME_DATABASE_LOCATION_H
9 #define _MIME_DATABASE_LOCATION_H
13 #include <StringList.h>
21 class DatabaseLocation
{
26 bool AddDirectory(const BString
& directory
);
30 const BStringList
& Directories() const
31 { return fDirectories
; }
32 BString
WritableDirectory() const
33 { return fDirectories
.StringAt(0); }
35 BString
WritablePathForType(const char* type
) const
36 { return _TypeToFilename(type
, 0); }
40 status_t
OpenType(const char* type
, BNode
& _node
) const;
41 status_t
OpenWritableType(const char* type
,
42 BNode
& _node
, bool create
,
43 bool* _didCreate
= NULL
) const;
45 // generic type attributes access
47 ssize_t
ReadAttribute(const char* type
,
48 const char* attribute
, void* data
,
49 size_t length
, type_code datatype
) const;
50 status_t
ReadMessageAttribute(const char* type
,
51 const char* attribute
, BMessage
& _message
)
53 status_t
ReadStringAttribute(const char* type
,
54 const char* attribute
, BString
& _string
)
57 status_t
WriteAttribute(const char* type
,
58 const char* attribute
, const void* data
,
59 size_t length
, type_code datatype
,
60 bool* _didCreate
) const;
61 status_t
WriteMessageAttribute(const char* type
,
62 const char* attribute
,
63 const BMessage
& message
, bool* _didCreate
)
66 status_t
DeleteAttribute(const char* type
,
67 const char* attribute
) const;
69 // type attribute convenience getters
71 status_t
GetAppHint(const char* type
, entry_ref
& _ref
);
72 status_t
GetAttributesInfo(const char* type
,
74 status_t
GetShortDescription(const char* type
,
76 status_t
GetLongDescription(const char* type
,
78 status_t
GetFileExtensions(const char* type
,
79 BMessage
& _extensions
);
80 status_t
GetIcon(const char* type
, BBitmap
& _icon
,
82 status_t
GetIcon(const char* type
, uint8
*& _data
,
84 status_t
GetIconForType(const char* type
,
85 const char* fileType
, BBitmap
& _icon
,
87 status_t
GetIconForType(const char* type
,
88 const char* fileType
, uint8
*& _data
,
90 status_t
GetPreferredApp(const char* type
,
91 char* signature
, app_verb verb
);
92 status_t
GetSnifferRule(const char* type
,
94 status_t
GetSupportedTypes(const char* type
,
97 bool IsInstalled(const char* type
);
100 BString
_TypeToFilename(const char* type
, int32 index
)
102 status_t
_OpenType(const char* type
, BNode
& _node
,
103 int32
& _index
) const;
104 status_t
_CreateTypeNode(const char* type
, BNode
& _node
)
106 status_t
_CopyTypeNode(BNode
& source
, const char* type
,
107 BNode
& _target
) const;
110 BStringList fDirectories
;
115 } // namespace Storage
116 } // namespace BPrivate
119 #endif // _MIME_DATABASE_LOCATION_H