lfilesystem
0.0.1
C++ filesystem library
|
This class represents a logical filesystem volume. More...
#include <lfilesystem_Volume.h>
Public Types | |
enum class | Type { CDRom , HardDisk , Removable , Network , RAM , Unknown } |
Represents the type of a filesystem volume. More... | |
Public Member Functions | |
Volume (const Path &path=dirs::cwd().getAbsolutePath()) | |
Creates a Volume object representing the volume that the passed path exists on. More... | |
std::uintmax_t | bytesFree () const |
Returns the number of available bytes on this volume. More... | |
bool | contains (const FilesystemEntry &file) const noexcept |
Returns true if this volume contains the passed FilesystemEntry. More... | |
std::string | getLabel () const |
Returns this volume's label. More... | |
Path | getPath () const noexcept |
Returns the root path of this volume. More... | |
int | getSerialNumber () const |
Returns this volume's serial number. More... | |
Type | getType () const |
Returns the type of this volume. More... | |
bool | isCaseSensitive () const |
Returns true if paths on this volume are case-sensitive. More... | |
bool | isReadOnly () const |
Returns true if this volume is read-only. More... | |
std::uintmax_t | totalBytes () const |
Returns the total size of this volume in bytes. More... | |
Equality comparison | |
Compares the root paths of two volumes for equality. | |
bool | operator== (const Volume &other) const noexcept |
bool | operator!= (const Volume &other) const noexcept |
Static Public Member Functions | |
static std::vector< Volume > | getAll () noexcept |
Returns all currently mounted volumes. More... | |
static std::optional< Volume > | tryCreate (const Path &path=dirs::cwd().getAbsolutePath()) noexcept |
A noexcept method for creating a volume object. More... | |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &os, const Volume &value) |
Writes the Volume object's path to the output stream. More... | |
This class represents a logical filesystem volume.
You can construct a Volume object from any path, and the resulting Volume object will refer to the logical volume where the passed path was mounted at the time of the Volume object's construction.
ConstructionError custom exception type? This could allow more specific error checking. The error could contain the original passed path.
supportsHardLinks()?
Definition at line 58 of file lfilesystem_Volume.h.
|
strong |
Represents the type of a filesystem volume.
Definition at line 131 of file lfilesystem_Volume.h.
|
explicit |
Creates a Volume object representing the volume that the passed path exists on.
std::runtime_error | An exception will be thrown if the volume cannot be determined for the passed path. |
std::uintmax_t limes::files::Volume::bytesFree | ( | ) | const |
Returns the number of available bytes on this volume.
|
noexcept |
Returns true if this volume contains the passed FilesystemEntry.
If the volume of the passed FilesystemEntry cannot be determined, this function will return false by default.
|
staticnoexcept |
Returns all currently mounted volumes.
Currently mounted volumes are rescanned every time you call this function.
std::string limes::files::Volume::getLabel | ( | ) | const |
Returns this volume's label.
This will always return an empty string on iOS/watchOS/tvOS.
|
noexcept |
Returns the root path of this volume.
On Windows, this might be a drive letter such as C:\
or D:\
; on Linux this might be something like /media/usb/drive-1/
.
int limes::files::Volume::getSerialNumber | ( | ) | const |
Returns this volume's serial number.
If the serial number cannot be retrieved, this will return 0. This will always return 0 on Apple systems. Note than on Linux systems, this may fail (and return 0) if the calling process does not have root privileges.
Type limes::files::Volume::getType | ( | ) | const |
Returns the type of this volume.
bool limes::files::Volume::isCaseSensitive | ( | ) | const |
Returns true if paths on this volume are case-sensitive.
bool limes::files::Volume::isReadOnly | ( | ) | const |
Returns true if this volume is read-only.
std::uintmax_t limes::files::Volume::totalBytes | ( | ) | const |
Returns the total size of this volume in bytes.
|
staticnoexcept |
A noexcept
method for creating a volume object.
This will return a null optional if the volume cannot be correctly determined for the passed path.