Provides an interface for querying information about a volume. More...
Public Member Functions | |
BVolume () | |
Creates an uninitialized BVolume object. | |
BVolume (const BVolume &volume) | |
Creates a copy of the supplied BVolume object. | |
BVolume (dev_t device) | |
Creates a BVolume and initializes it to the volume specified by the supplied device ID. | |
virtual | ~BVolume () |
Destroys the object and frees all associated resources. | |
Constructor Helpers | |
status_t | InitCheck () const |
Returns the initialization status. | |
status_t | SetTo (dev_t device) |
Initializes the object to refer to the volume specified by the supplied device ID. | |
void | Unset () |
Brings the BVolume object to an uninitialized state. | |
Volume Information | |
dev_t | Device () const |
Returns the device ID of the volume the object refers to. | |
status_t | GetRootDirectory (BDirectory *directory) const |
Writes the root directory of the volume referred to by this object into directory. | |
off_t | Capacity () const |
Returns the total storage capacity of the volume. | |
off_t | FreeBytes () const |
Returns the amount of unused space on the volume (in bytes). | |
off_t | BlockSize () const |
Returns the size of one block (in bytes). The meaning of this depends on the underlying file system. | |
Volume Name | |
status_t | GetName (char *name) const |
Writes the volume's name into the provided buffer. | |
status_t | SetName (const char *name) |
Sets the volume's name to name. | |
Volume Icon | |
status_t | GetIcon (BBitmap *icon, icon_size which) const |
Writes the volume's icon into the supplied BBitmap. | |
status_t | GetIcon (uint8 **_data, size_t *_size, type_code *_type) const |
Writes the volume's icon data into the supplied uint8 array. | |
Volume Capabilities | |
bool | IsRemovable () const |
Returns whether or not the volume is removable. | |
bool | IsReadOnly () const |
Returns whether or not the volume is read-only. | |
bool | IsPersistent () const |
Returns whether or not the volume is persistent. | |
bool | IsShared () const |
Returns whether or not the volume is shared. | |
bool | KnowsMime () const |
Returns whether or not the volume supports MIME-types. | |
bool | KnowsAttr () const |
Returns whether or not the volume supports attributes. | |
bool | KnowsQuery () const |
Returns whether or not the volume supports queries. | |
Operators | |
bool | operator== (const BVolume &volume) const |
Returns whether or not the supplied BVolume object is equal to this object. | |
bool | operator!= (const BVolume &volume) const |
Returns whether or not the supplied BVolume object is NOT equal to this object. | |
BVolume & | operator= (const BVolume &volume) |
Assigns the supplied BVolume object to this volume, this object is made to be an exact clone of the supplied one. | |
Provides an interface for querying information about a volume.
The class is a simple wrapper for a dev_t
and the function fs_stat_dev(). The sole exception is the SetName() method which sets the name of the volume.
BVolume::BVolume | ( | ) |
Creates an uninitialized BVolume object.
InitCheck() will return B_NO_INIT
.
BVolume::BVolume | ( | dev_t | device | ) |
Creates a BVolume and initializes it to the volume specified by the supplied device ID.
InitCheck() should be called afterwards to check if initialization was successful.
device | The device ID of the volume. |
BVolume::BVolume | ( | const BVolume & | volume | ) |
Creates a copy of the supplied BVolume object.
Afterwards the object refers to the same device the supplied object does. If the latter is not properly initialized, this result isn't either.
volume | The volume object to be copied. |
|
virtual |
Destroys the object and frees all associated resources.
off_t BVolume::BlockSize | ( | ) | const |
Returns the size of one block (in bytes). The meaning of this depends on the underlying file system.
B_NO_INIT
if the volume is not initialized or other errors forwarded from the file system.off_t BVolume::Capacity | ( | ) | const |
Returns the total storage capacity of the volume.
B_BAD_VALUE
if the object is not properly initialized.dev_t BVolume::Device | ( | ) | const |
Returns the device ID of the volume the object refers to.
off_t BVolume::FreeBytes | ( | ) | const |
Returns the amount of unused space on the volume (in bytes).
B_BAD_VALUE
if the object is not properly initialized.Writes the volume's icon into the supplied BBitmap.
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 icon size to be retrieved: B_MINI_ICON for the mini or B_LARGE_ICON for the large icon. |
Writes the volume's icon data into the supplied uint8
array.
_data | A pointer to a pointer to a pre-allocated uint8 array of the correct size to store the requested icon. |
_size | The size of the retrieved icon (in bytes). |
_type | The type code of the retrieve icon. |
B_OK | Everything went fine. |
B_NO_INIT | Object was not properly initialized. |
status_t BVolume::GetName | ( | char * | name | ) | const |
Writes the volume's name into the provided buffer.
name | A pointer to a pre-allocated character buffer of size B_FILE_NAME_LENGTH or larger into which the name of the volume is written. |
B_OK | Everything went fine. |
B_BAD_VALUE | name was NULL or the object was not properly initialized. |
status_t BVolume::GetRootDirectory | ( | BDirectory * | directory | ) | const |
Writes the root directory of the volume referred to by this object into directory.
directory | A pointer to a pre-allocated BDirectory to be initialized to the volume's root directory. |
B_OK | Everything went fine. |
B_BAD_VALUE | directory was NULL or the object was not properly initialized. |
status_t BVolume::InitCheck | ( | void | ) | const |
Returns the initialization status.
B_OK
if the object was properly initialized, or an error code otherwise.bool BVolume::IsPersistent | ( | void | ) | const |
Returns whether or not the volume is persistent.
true
, if the volume was properly initialized and is persistent, false
otherwise.bool BVolume::IsReadOnly | ( | void | ) | const |
Returns whether or not the volume is read-only.
true
, if the volume was properly initialized and is read-only, false
otherwise.bool BVolume::IsRemovable | ( | ) | const |
Returns whether or not the volume is removable.
true
, if the volume was properly initialized and is removable, false
otherwise.bool BVolume::IsShared | ( | void | ) | const |
Returns whether or not the volume is shared.
return true
, if the volume was properly initialized and is shared, false
otherwise.
bool BVolume::KnowsAttr | ( | void | ) | const |
Returns whether or not the volume supports attributes.
true
, if the volume was properly initialized and supports attributes, false
otherwise.bool BVolume::KnowsMime | ( | void | ) | const |
Returns whether or not the volume supports MIME-types.
true
, if the volume was properly initialized and supports MIME-types, false
otherwise.bool BVolume::KnowsQuery | ( | void | ) | const |
Returns whether or not the volume supports queries.
true
, if the volume was properly initialized and supports queries, false
otherwise.bool BVolume::operator!= | ( | const BVolume & | volume | ) | const |
Returns whether or not the supplied BVolume object is NOT equal to this object.
Two volume objects are said to be unequal if one is initialized and the other is not or if they are both initialized and refer to the different volumes.
volume | The volume to be tested for inequality. |
true
, if the objects and unequal, false
otherwise.Assigns the supplied BVolume object to this volume, this object is made to be an exact clone of the supplied one.
volume | The volume to be assigned. |
bool BVolume::operator== | ( | const BVolume & | volume | ) | const |
Returns whether or not the supplied BVolume object is equal to this object.
Two volume objects are said to be equal if they are both uninitialized, or they are both initialized and refer to the same volume.
volume | The volume to be tested for equality. |
true
, if the objects are equal, false
otherwise.status_t BVolume::SetName | ( | const char * | name | ) |
Sets the volume's name to name.
name | The new name of the volume, must not be longer than B_FILE_NAME_LENGTH (including the terminating NULL ). |
B_OK | Everything went fine. |
B_BAD_VALUE | name was NULL or the object was not properly initialized. |
B_NAME_TOO_LONG | name was >= B_FILE_NAME_LENGTH . |
status_t BVolume::SetTo | ( | dev_t | device | ) |
Initializes the object to refer to the volume specified by the supplied device ID.
device | The device ID of the volume to set. |
B_OK
if the object was properly initialized, or an error code otherwise.void BVolume::Unset | ( | ) |
Brings the BVolume object to an uninitialized state.
InitCheck() will return B_NO_INIT
.