|
Ocean
|
This class holds a path. More...
#include <Path.h>
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. | |
| Type | type () const |
| Returns the type of this path. | |
| bool | isAbsolute () const |
| Returns whether this path is absolute. | |
| bool | isRelative () const |
| Returns whether this path is relative. | |
| virtual bool | isValid () const =0 |
| Returns whether the path is valid. | |
| bool | isNull () const |
| Returns whether this path holds no valid. | |
| virtual bool | exists () const =0 |
| Returns whether the path exists already. | |
| bool | operator== (const Path &right) const |
| Returns whether two paths are equal. | |
| bool | operator!= (const Path &path) const |
| Returns whether two paths are not equal. | |
| const std::string & | operator() () const |
| Returns the value of this path. | |
| bool | operator< (const Path &path) const |
| Less operator comparing the actual strings of two paths. | |
Static Public Member Functions | |
| static bool | isSeparator (const char character) |
| Returns whether a given character is a separator. | |
| static char | defaultSeparator () |
| Returns the default separator of a path. | |
Protected Member Functions | |
| Path ()=default | |
| Creates a new undefined path. | |
| Path (const Path &path)=default | |
| Copy constructor. | |
| Path (const std::string &value) | |
| Creates a new path. | |
| void | checkPath (const Type expectType) |
| Checks the type of this path and trims it. | |
| void | trim () |
| Trims this path. | |
| Path & | operator= (const Path &path)=default |
| Default assign operator. | |
Protected Attributes | |
| Type | pathType_ = TYPE_INVALID |
| Path type. | |
| std::string | pathValue_ |
| Path value. | |
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::Directory, and Ocean::IO::File.
|
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::Directory, and Ocean::IO::File.
|
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.