TGUI
0.9.5
|
Object to represent paths on a filesystem. More...
#include <TGUI/Filesystem.hpp>
Public Member Functions | |
Path ()=default | |
Default constructor that creates an empty path object. | |
Path (const String &path) | |
Constructor that creates a Path object from the given path string. | |
bool | isEmpty () const |
Check if this object is empty. | |
bool | isAbsolute () const |
Checks whether the path is absolute. | |
bool | isRelative () const |
Checks whether the path is relative. | |
String | asString () const |
Returns the path as a string. | |
Path | getParentPath () const |
Returns to path to the parent directory. | |
String | getFilename () const |
Returns to filename component of the path (where the path consists of getParentPath() / getFilename()) | |
Path | getNormalForm () const |
Returns the lexically normal form of the path (path with '.' and '..' resolved) | |
std::string | asNativeString () const |
Returns the path as a string, but with a string type and contents that depends on the OS. | |
Path | operator/ (const Path &path) const |
Returns a new path that consists of this object joined with another path. | |
Path | operator/ (const String &path) const |
Returns a new path that consists of this object joined with another path. | |
Path & | operator/= (const Path &path) |
Joins this object with another path. | |
Path & | operator/= (const String &path) |
Joins this object with another path. | |
bool | operator== (const Path &other) const |
Checks whether the paths are equal. | |
bool | operator!= (const Path &other) const |
Checks whether the paths are not equal. | |
Object to represent paths on a filesystem.
|
explicit |
Constructor that creates a Path object from the given path string.
path | The path to be parsed and stored in this object |
std::string tgui::Filesystem::Path::asNativeString | ( | ) | const |
Returns the path as a string, but with a string type and contents that depends on the OS.
An std::wstring is returned on Windows with backslashes as separator. On other platforms, a UTF-8 encoded std::string is returned with slashes as separator.
String tgui::Filesystem::Path::asString | ( | ) | const |
Returns the path as a string.
Slashes are always used as separator on any OS so that relative paths are portable.
String tgui::Filesystem::Path::getFilename | ( | ) | const |
Returns to filename component of the path (where the path consists of getParentPath() / getFilename())
Path tgui::Filesystem::Path::getNormalForm | ( | ) | const |
Returns the lexically normal form of the path (path with '.' and '..' resolved)
Path tgui::Filesystem::Path::getParentPath | ( | ) | const |
Returns to path to the parent directory.
If the path has a filename then the parent directory is the directory containing that file.
bool tgui::Filesystem::Path::isAbsolute | ( | ) | const |
Checks whether the path is absolute.
An absolute path is a path that unambiguously identifies the location of a file without reference to an additional starting location.
bool tgui::Filesystem::Path::isEmpty | ( | ) | const |
Check if this object is empty.
bool tgui::Filesystem::Path::isRelative | ( | ) | const |
Checks whether the path is relative.
An absolute path is a path that unambiguously identifies the location of a file without reference to an additional starting location. A path is relative when it isn't an absolute path.
bool tgui::Filesystem::Path::operator!= | ( | const Path & | other | ) | const |
Checks whether the paths are not equal.
other | The path to compare with |
This function only checks whether the path strings are identical or not.
Returns a new path that consists of this object joined with another path.
path | The path to join to this one |
Returns a new path that consists of this object joined with another path.
path | The path to join to this one |
Joins this object with another path.
path | The path to join to this one |
Joins this object with another path.
path | The path to join to this one |
bool tgui::Filesystem::Path::operator== | ( | const Path & | other | ) | const |
Checks whether the paths are equal.
other | The path to compare with |
This function only checks whether the path strings are identical or not.