In file include/Attribute.h:

class Attribute : public BPositionIO

This class provides a friendly representation of an attribute

Inheritance:

Attribute


Public Methods

Attribute(const BNode *node, const char *name, bool createNew=false)
Opens (or creates) an attribute of the given name and type on a given node
~Attribute()
Rewrites the attribute to disk, then destroys the object
static bool Exists(const BNode *node, const char *name)
Returns true if the named attribute exists for the given node
virtual ssize_t Read(void *buffer, size_t size)
Inherited from BPositionIO.
virtual ssize_t Write(const void *buffer, size_t size)
Inherited from BPositionIO.
virtual ssize_t ReadAt(off_t pos, void *buffer, size_t size)
Inherited from BPositionIO.
virtual ssize_t WriteAt(off_t pos, const void *buffer, size_t size)
Inherited from BPositionIO.
virtual off_t Seek(off_t position, uint32 seek_mode)
Inherited from BPositionIO.
virtual off_t Position() const
Inherited from BPositionIO.
off_t Size()
The size of data contained in the attribute.
status_t Flush()
Writes the attribute data in memory out to disk

Documentation

This class provides a friendly representation of an attribute. It models this by using the BPositionIO class from the Support Kit, which lets you seek, read, and write at arbitrary points within the attribute's data stream.

You can use Attribute in two ways: first, as a stand-alone utility class that you instantiate, use to manipulate an attribute, then throw away. Second, as parent class for an object in your application that corresponds directly to an attribute on a file. You can use the Attribute methods to update your attribute when your object's state changes, and call Flush as needed.

This class is not well-suited for especially large attributes, since the entire data stream is pulled into memory.

To remove an attribute, see BNode::RemoveAttr.

Attribute(const BNode *node, const char *name, bool createNew=false)
Opens (or creates) an attribute of the given name and type on a given node. Refer to the BNode class documentation to see what attributes can do for you.
Parameters:
node - The node to open the attribute on.
name - The name of the attribute.
type - One of the B_*_TYPE constants.

~Attribute()
Rewrites the attribute to disk, then destroys the object. Note that writing may fail for a variety of reasons, including read-only files and volumes, and a lack of disk space. For this reason it's better to use Flush.
See Also:
Flush

static bool Exists(const BNode *node, const char *name)
Returns true if the named attribute exists for the given node

virtual ssize_t Read(void *buffer, size_t size)
Inherited from BPositionIO.

virtual ssize_t Write(const void *buffer, size_t size)
Inherited from BPositionIO.

virtual ssize_t ReadAt(off_t pos, void *buffer, size_t size)
Inherited from BPositionIO.

virtual ssize_t WriteAt(off_t pos, const void *buffer, size_t size)
Inherited from BPositionIO.

virtual off_t Seek(off_t position, uint32 seek_mode)
Inherited from BPositionIO.

virtual off_t Position() const
Inherited from BPositionIO.

off_t Size()
The size of data contained in the attribute.

status_t Flush()
Writes the attribute data in memory out to disk
Returns:
The result of the operation, as indicated by BNode::WriteAttr.


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de