Provides access to file type meta data on a node.
More...
Inherited by BAppFileInfo.
|
| BNodeInfo () |
| Creates an uninitialized BNodeInfo object.
|
|
| BNodeInfo (BNode *node) |
| Creates a BNodeInfo object and initializes it to the supplied node.
|
|
virtual | ~BNodeInfo () |
| Frees the object and associated resources.
|
|
|
status_t | SetTo (BNode *node) |
| Initializes the BNodeInfo to the supplied node.
|
|
status_t | InitCheck () const |
| Checks whether or not the object has been properly initialized.
|
|
|
virtual status_t | GetType (char *type) const |
| Writes the MIME-type of the node into type.
|
|
virtual status_t | SetType (const char *type) |
| Sets the MIME-type of the node. If type is NULL the BEOS:TYPE attribute is removed instead.
|
|
|
status_t | GetPreferredApp (char *signature, app_verb verb=B_OPEN) const |
| Gets the preferred application of the node.
|
|
status_t | SetPreferredApp (const char *signature, app_verb verb=B_OPEN) |
| Sets the preferred application of the node. If signature is NULL , the BEOS:PREF_APP attribute is removed instead.
|
|
|
status_t | GetAppHint (entry_ref *ref) const |
| Fills out ref with a pointer to a hint about the application that will open this node.
|
|
status_t | SetAppHint (const entry_ref *ref) |
| Sets the application that will open the file type of the node. If ref is NULL , the BEOS:PPATH attribute is removed instead.
|
|
|
virtual status_t | GetIcon (BBitmap *icon, icon_size which=B_LARGE_ICON) const |
| Gets the icon of the node.
|
|
virtual status_t | SetIcon (const BBitmap *icon, icon_size which=B_LARGE_ICON) |
| Sets the icon of the node. If icon is NULL , the attribute is removed instead.
|
|
status_t | GetIcon (uint8 **data, size_t *size, type_code *type) const |
| Gets the icon of the node.
|
|
status_t | SetIcon (const uint8 *data, size_t size) |
| Sets the node icon of the node. If data is NULL or size is 0, the BEOS:ICON attribute is removed instead.
|
|
status_t | GetTrackerIcon (BBitmap *icon, icon_size which=B_LARGE_ICON) const |
| Gets the icon displayed by Tracker for the icon.
|
|
static status_t | GetTrackerIcon (const entry_ref *ref, BBitmap *icon, icon_size which=B_LARGE_ICON) |
| Gets the icon displayed by Tracker for the node referred to by ref.
|
|
Provides access to file type meta data on a node.
BNodeInfo provides a nice wrapper to all sorts of useful meta data such as the MIME-type, the file's icon and the application that will open the file.
- Since
- BeOS R3
◆ BNodeInfo() [1/2]
◆ BNodeInfo() [2/2]
BNodeInfo::BNodeInfo |
( |
BNode * |
node | ) |
|
Creates a BNodeInfo object and initializes it to the supplied node.
- Parameters
-
node | The node to initialize to and gather information. |
- Since
- BeOS R3
◆ ~BNodeInfo()
BNodeInfo::~BNodeInfo |
( |
| ) |
|
|
virtual |
Frees the object and associated resources.
The internal BNode object is not deleted.
- Since
- BeOS R3
◆ GetAppHint()
Fills out ref with a pointer to a hint about the application that will open this node.
The path contained in the BEOS:PPATH
attribute of the node is converted into an entry_ref and returned. ref should be pre-allocated before being passed into this method.
- Parameters
-
ref | A pointer to a pre-allocated entry_ref into which the app hint is written. |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_BAD_DATA | Attribute size greater than B_PATH_NAME_LENGTH . |
B_BAD_TYPE | The stored type string attribute has the wrong type. |
B_BAD_VALUE | The ref object passed in was NULL . |
B_ERROR | Unable to read BEOS:PPATH attribute. |
B_NO_INIT | The object was not properly initialized. |
◆ GetIcon() [1/2]
Gets the icon of the node.
The icon stored in the BEOS:L:STD_ICON
attribute (large) or BEOS:M:STD_ICON
attribute (mini) is retrieved.
- Parameters
-
icon | A pointer to a pre-allocated BBitmap object of the correct dimension to store the requested icon: 16x16 for the mini or 32x32 for the large icon. |
which | The size of the icon to be retrieved: B_MINI_ICON for a 16x16 icon and B_LARGE_ICON for a 32x32 icon. |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_NO_INIT | The object was not properly initialized. |
B_BAD_VALUE | NULL icon, unsupported icon size k or bitmap dimensions (icon) and icon size (k) do not match. |
- Since
- BeOS R3
Reimplemented in BAppFileInfo.
◆ GetIcon() [2/2]
Gets the icon of the node.
The icon stored in the BEOS:ICON
attribute of the node is retrieved. The caller is responsible to delete[]
the data if the icon was retrieved.
- Parameters
-
data | A pointer in which a pointer to the icon data will be filled in. |
size | A pointer in which the size of the found icon data will be filled in. |
type | A pointer in which the type of the found icon data will be filled in. |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_NO_INIT | The object was not properly initialized. |
B_BAD_VALUE | NULL data, NULL size or NULL type. |
B_NO_MEMORY | No memory to allocate the data buffer. |
- Since
- Haiku R1
◆ GetPreferredApp()
status_t BNodeInfo::GetPreferredApp |
( |
char * |
signature, |
|
|
app_verb |
verb = B_OPEN |
|
) |
| const |
Gets the preferred application of the node.
Writes the contents of the BEOS:PREF_APP
attribute into the signature buffer. The preferred application can be identified by its signature. signature should be at least B_MIME_TYPE_LENGTH
or longer and pre-allocated before it is passed into this method.
- Parameters
-
signature | A pointer to a pre-allocated character buffer of size B_MIME_TYPE_LENGTH or larger into which the MIME-type of the preferred application is written. |
verb | The type of access the preferred application is requested. Currently B_OPEN is the only meaningful option. |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_NO_INIT | The object was not properly initialized. |
B_BAD_VALUE | NULL signature or bad app_verb. |
◆ GetTrackerIcon() [1/2]
Gets the icon displayed by Tracker for the icon.
This method tries really hard to find an icon for the node:
- If the node has no type this method returns the icon for
B_FILE_MIME_TYPE
if it's a regular file or B_DIRECTORY_MIME_TYPE
if it's a directory, even if the node has its own icon!
- Next it will ask GetIcon() for an icon.
- If this fails it will get the preferred application and ask the MIME database if the application has an icon for the file type of the node.
- Next it will ask the MIME database whether there is an icon for the file type of the node.
- Then it will ask the MIME database for the preferred application for the file type of the node and whether this application has a special icon for the type.
- Finally it will return a generic icon for whatever type of file type (file/dir/etc.) the node is from the MIME database.
The first action that provides an icon is used. In the case that none of them yield an icon this method fails, this is very unlikely though.
- Parameters
-
icon | A pointer to a pre-allocated BBitmap of the correct dimension to store the requested icon (16x16 for the mini and 32x32 for the large icon). |
which | The size of the icon to be retrieved: B_MINI_ICON for a 16x16 icon or B_LARGE_ICON for a 32x32 icon. |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_NO_INIT | The object was not properly initialized. |
B_BAD_VALUE | NULL icon, unsupported icon size which or bitmap dimensions (icon) and icon size (which) do not match. |
- Since
- BeOS R3
◆ GetTrackerIcon() [2/2]
Gets the icon displayed by Tracker for the node referred to by ref.
This methods works similarly to the non-static version but ref identifies the node. icon must be pre-allocated to the size requested using which before being passed to this method.
- Parameters
-
ref | An entry_ref referring to the node for which the icon is retrieved. |
icon | A pointer to a pre-allocated BBitmap object of the correct dimension to store the requested icon (16x16 for the mini and 32x32 for the large icon). |
which | The size of the icon to be retrieved: B_MINI_ICON for a 16x16 icon or B_LARGE_ICON for a 32x32 icon. |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_NO_INIT | The object is not properly initialized. |
B_BAD_VALUE | NULL ref or icon, unsupported icon size which or bitmap dimensions (icon) and icon size (which) do not match. |
- Since
- BeOS R3
◆ GetType()
status_t BNodeInfo::GetType |
( |
char * |
type | ) |
const |
|
virtual |
Writes the MIME-type of the node into type.
The source of the type information is the BEOS:TYPE
attribute of the node. The type buffer should be pre-allocated before it is passed into GetType(), it should be at least B_MIME_TYPE_LENGTH
in length.
- Parameters
-
type | A pointer to a pre-allocated char buffer of at least B_MIME_TYPE_LENGTH length into which the MIME-type of the node is written. |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_NO_INIT | The object is not properly initialized. |
B_BAD_VALUE | NULL type or the type string stored in the attribute is longer than B_MIME_TYPE_LENGTH . |
B_BAD_TYPE | The stored type string attribute has the wrong type. |
B_ENTRY_NOT_FOUND | No type is set on the node. |
- Since
- BeOS R3
Reimplemented in BAppFileInfo.
◆ InitCheck()
Checks whether or not the object has been properly initialized.
- Returns
- A status code.
- Return values
-
B_OK | The object was properly initialized. |
B_BAD_VALUE | The object was not properly initialized. |
- Since
- BeOS R3
◆ SetAppHint()
Sets the application that will open the file type of the node. If ref is NULL
, the BEOS:PPATH
attribute is removed instead.
ref is converted into a path and stored in the BEOS:PPATH
attribute of the node. If ref is NULL BEOS:PPATH
is removed instead.
- Parameters
-
ref | A pointer to an entry_ref referring to the application. May be NULL . |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_BAD_VALUE | The ref object passed in was NULL . |
B_ENTRY_NOT_FOUND | BEOS:PPATH attribute not found. |
B_ERROR | Unable to write BEOS:PPATH attribute. |
B_NO_INIT | The object was not properly initialized. |
◆ SetIcon() [1/2]
Sets the icon of the node. If icon is NULL
, the attribute is removed instead.
The icon is stored in the BEOS:L:STD_ICON
attribute (large) or BEOS:M:STD_ICON
attribute (mini). If icon is NULL
the respective attribute is removed instead.
- Parameters
-
icon | A pointer to a BBitmap object containing the icon to be set. May be NULL . |
which | The size of the icon to be set: B_MINI_ICON for the mini or B_LARGE_ICON for the large icon. |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_NO_INIT | The object is not properly initialized. |
B_BAD_VALUE | Unknown icon size k or bitmap dimensions (icon) and icon size (k) do not match. |
- Since
- BeOS R3
Reimplemented in BAppFileInfo.
◆ SetIcon() [2/2]
Sets the node icon of the node. If data is NULL
or size is 0, the BEOS:ICON
attribute is removed instead.
The icon is stored in the BEOS:ICON
attribute of the node.
- Parameters
-
data | A pointer to valid icon data. May be NULL . |
size | The size of the provided data buffer. May be 0. |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_NO_INIT | The object was not properly initialized. |
- Since
- Haiku R1
◆ SetPreferredApp()
status_t BNodeInfo::SetPreferredApp |
( |
const char * |
signature, |
|
|
app_verb |
verb = B_OPEN |
|
) |
| |
Sets the preferred application of the node. If signature is NULL
, the BEOS:PREF_APP
attribute is removed instead.
The supplied string is written into the BEOS:PREF_APP
attribute of the node. If signature is NULL
, the respective attribute is removed instead. signature must not be longer than B_MIME_TYPE_LENGTH
(including the terminating NUL
).
- Parameters
-
signature | The signature of the preferred application to be set. May be NULL . |
verb | The type of access set to the preferred application. Currently only B_OPEN is meaningful. |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_NO_INIT | The object is not properly initialized. |
B_BAD_VALUE | NULL signature, signature is longer than B_MIME_TYPE_LENGTH or bad app_verb. |
◆ SetTo()
Initializes the BNodeInfo to the supplied node.
The BNodeInfo object does not copy the supplied node object, it uses it directly instead. You must not delete the supply node while the BNodeInfo object exists. The BNodeInfo does not take over ownership of the node and it doesn't delete it on destruction either.
- Parameters
-
node | The node to gather information on. |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_BAD_VALUE | The node was not properly initialized. |
- Since
- BeOS R3
◆ SetType()
status_t BNodeInfo::SetType |
( |
const char * |
type | ) |
|
|
virtual |
Sets the MIME-type of the node. If type is NULL
the BEOS:TYPE
attribute is removed instead.
The type string is written into the BEOS:TYPE
attribute of the node. If type is NULL
, the BEOS:TYPE
attribute is removed instead. The type parameter may not by longer than B_MIME_TYPE_LENGTH
in length including the terminating \0 character.
- Parameters
-
type | The MIME-type to be assigned to the node. Must not be longer than B_MIME_TYPE_LENGTH (including the terminating NUL ). May be NULL to remove the attribute. |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_NO_INIT | The object was not properly initialized. |
B_BAD_VALUE | type is longer than B_MIME_TYPE_LENGTH . |
- Since
- BeOS R3
Reimplemented in BAppFileInfo.