BNodeInfo
provides file type information about a particular node;
specifically:
The (MIME) file type.
The node's icons, including the node-specific icon that the Tracker displays.
The "preferred app"; this is the application that's used to access the node's contents.
Except for the Tracker icon, all this information can also be set through
the BNodeInfo
class. None of the information is passed on to the File
Type database; if you want to record a node's file type information with
the database, you have to create a
BMimeType
object (based on the node's
file type) and go from there.
You initialize a BNodeInfo
object by passing it a
BNode
object. Although
you can pass any flavor of node, you typically only care about files;
passing a BFile
object (or any subclass of
BNode
) is, of course,
acceptable. The BNodeInfo
object maintains its own pointer to the BNode
you pass in. You don't have to avoid touching the
BNode
while a BNodeInfo
is looking at it (or changing it); the only thing you shouldn't do is
delete the BNode
.
BNodeInfo
doesn't care if the
BNode
is locked—there's no particular
reason to lock the
BNode
before passing it in,
but the BNodeInfo
won't
balk if you do. If you pass in a
BFile
object,
BNodeInfo
does not obey
the BFile
's
read/write flags. For example, you can set the node info for
a BFile
even if you've opened it in read-only mode.
The BNodeInfo
class does nothing more than look in a node's attributes
for the information it sets or gets. The attribute names for the various
information particles are given in the function descriptions, below. If
you want, you can bypass BNodeInfo
and get the node information directly
by passing the attribute names to
BNode
's
ReadAttr()
and
WriteAttr()
functions.
The one exception to this is
GetTrackerIcon()
: This function starts by
looking in the node's attributes, but then it goes out hunting if it has
to (if the icon isn't found in the attributes).
BNodeInfo
has a single subclass:
BAppFileInfo
.
You use a BAppFileInfo
object to get more information about a specific executable image (file).