Ocean
|
This class holds a path. More...
Public Types | |
enum | Type { TYPE_INVALID = 0 , TYPE_FILE = 1 , TYPE_DIRECTORY = 2 , TYPE_ABSOLUTE = 4 , TYPE_RELATIVE = 8 , TYPE_NETWORK = 16 } |
Definition of different path types. More... | |
enum | Separator { SEPARATOR_UNDEFINED = 0 , SEPARATOR_SLASH = '/' , SEPARATOR_BACKSLASH = '\\' } |
Definition of path separators. More... | |
Public Member Functions | |
virtual | ~Path ()=default |
Destructs a path. More... | |
Type | type () const |
Returns the type of this path. More... | |
bool | isAbsolute () const |
Returns whether this path is absolute. More... | |
bool | isRelative () const |
Returns whether this path is relative. More... | |
virtual bool | isValid () const =0 |
Returns whether the path is valid. More... | |
bool | isNull () const |
Returns whether this path holds no valid. More... | |
virtual bool | exists () const =0 |
Returns whether the path exists already. More... | |
bool | operator== (const Path &right) const |
Returns whether two paths are equal. More... | |
bool | operator!= (const Path &path) const |
Returns whether two paths are not equal. More... | |
const std::string & | operator() () const |
Returns the value of this path. More... | |
bool | operator< (const Path &path) const |
Less operator comparing the actual strings of two paths. More... | |
Static Public Member Functions | |
static bool | isSeparator (const char character) |
Returns whether a given character is a separator. More... | |
static char | defaultSeparator () |
Returns the default separator of a path. More... | |
Protected Member Functions | |
Path ()=default | |
Creates a new undefined path. More... | |
Path (const Path &path)=default | |
Copy constructor. More... | |
Path (const std::string &value) | |
Creates a new path. More... | |
void | checkPath (const Type expectType) |
Checks the type of this path and trims it. More... | |
void | trim () |
Trims this path. More... | |
Path & | operator= (const Path &path)=default |
Default assign operator. More... | |
Protected Attributes | |
Type | pathType_ = TYPE_INVALID |
Path type. More... | |
std::string | pathValue_ |
Path value. More... | |
This class holds a path.
A path is the base for a file or a directory.
Each path can be absolute or relative.
Files do not end with a separator, directories must end with a separator.
|
virtualdefault |
Destructs a path.
|
protecteddefault |
Creates a new undefined path.
|
protecteddefault |
Copy constructor.
path | The path to copy |
|
explicitprotected |
Creates a new path.
value | Path value |
|
protected |
Checks the type of this path and trims it.
expectType | Expected path type |
|
static |
Returns the default separator of a path.
|
pure virtual |
Returns whether the path exists already.
Implemented in Ocean::IO::File, and Ocean::IO::Directory.
|
inline |
Returns whether this path is absolute.
If the path is invalid the result is False.
|
inline |
Returns whether this path holds no valid.
|
inline |
Returns whether this path is relative.
If the path is invalid the result is False.
|
static |
Returns whether a given character is a separator.
character | Character to check for a separator |
|
pure virtual |
Returns whether the path is valid.
Implemented in Ocean::IO::File, and Ocean::IO::Directory.
|
inline |
Returns whether two paths are not equal.
path | Right path to compare |
|
inline |
Returns the value of this path.
|
inline |
Less operator comparing the actual strings of two paths.
path | The second path to compare |
Default assign operator.
path | The path to assign |
bool Ocean::IO::Path::operator== | ( | const Path & | right | ) | const |
Returns whether two paths are equal.
right | Right path to compare |
|
protected |
Trims this path.
|
inline |
Returns the type of this path.
|
protected |
Path type.
|
protected |
Path value.