Hermes
|
Representation of a directory/file in the filesystem. More...
Public Member Functions | |
Path ()=default | |
Default constructor. | |
Path (const Str &path) | |
Constructor from hermes::Str More... | |
Path (const char *const &&path) | |
Constructor from c string. More... | |
Path (std::string path) | |
Constructor from std::string More... | |
Path (const Path &other) | |
Copy constructor. More... | |
Path (Path &&other) noexcept | |
Move constructor. | |
operator std::string () const | |
Casts to std::string More... | |
Path & | operator= (const Path &path) |
Copy assignment. More... | |
bool | operator== (const Path &b) const |
Full comparison. More... | |
Path | operator+ (const Str &b) const |
Generates copy concatenated with separator. More... | |
Path | operator/ (const Path &other) const |
Generates copy concatenated with separator. More... | |
Path & | operator/= (const Path &other) |
Joins with separator. More... | |
Path & | operator+= (const std::string &other) |
Joins with separator. More... | |
Path & | operator+= (const Path &other) |
Joins with separator. More... | |
Path & | join (const Path &path) |
Joins with separator. More... | |
Path & | cd (const std::string &path) |
Jump to path. More... | |
bool | exists () const |
Check if this path exists in filesystem. More... | |
bool | isDirectory () const |
Check if this path exists and represents a folder. More... | |
bool | isFile () const |
Check if this path exists and represents a file. More... | |
bool | hasExtension () const |
std::vector< std::string > | parts () const |
Splits this path into a list. More... | |
std::string | name () const |
Gets last folder/file name. More... | |
const std::string & | fullName () const |
Gets this full path string. More... | |
std::string | extension () const |
Gets file extension. More... | |
bool | match_r (const std::string ®ular_expression) const |
Checks if this path matches pattern. More... | |
Path | cwd () const |
Gets this path's folder location. More... | |
bool | mkdir () const |
Creates folder from this path. More... | |
bool | touch () const |
Creates empty file from this path. More... | |
u64 | writeTo (const std::string &content) const |
Writes content into this file. More... | |
u64 | appendTo (const std::string &content) const |
Appends to this file. More... | |
std::string | read () const |
Reads ascii content from this file. More... | |
Public Attributes | |
std::string | separator {"/"} |
OS path separator. | |
Representation of a directory/file in the filesystem.
hermes::Path::Path | ( | const Str & | path | ) |
Constructor from hermes::Str
path |
hermes::Path::Path | ( | const char *const && | path | ) |
Constructor from c string.
path |
hermes::Path::Path | ( | std::string | path | ) |
Constructor from std::string
path |
hermes::Path::Path | ( | const Path & | other | ) |
Copy constructor.
other |
u64 hermes::Path::appendTo | ( | const std::string & | content | ) | const |
Appends to this file.
content |
Path & hermes::Path::cd | ( | const std::string & | path | ) |
Jump to path.
path |
Path hermes::Path::cwd | ( | ) | const |
Gets this path's folder location.
bool hermes::Path::exists | ( | ) | const |
Check if this path exists in filesystem.
std::string hermes::Path::extension | ( | ) | const |
Gets file extension.
const std::string & hermes::Path::fullName | ( | ) | const |
Gets this full path string.
bool hermes::Path::hasExtension | ( | ) | const |
bool hermes::Path::isDirectory | ( | ) | const |
Check if this path exists and represents a folder.
bool hermes::Path::isFile | ( | ) | const |
Check if this path exists and represents a file.
bool hermes::Path::match_r | ( | const std::string & | regular_expression | ) | const |
Checks if this path matches pattern.
regular_expression |
bool hermes::Path::mkdir | ( | ) | const |
Creates folder from this path.
std::string hermes::Path::name | ( | ) | const |
Gets last folder/file name.
|
inlineexplicit |
Casts to std::string
Generates copy concatenated with separator.
b |
Joins with separator.
other |
Path & hermes::Path::operator+= | ( | const std::string & | other | ) |
Joins with separator.
other |
Generates copy concatenated with separator.
other |
Joins with separator.
other |
bool hermes::Path::operator== | ( | const Path & | b | ) | const |
Full comparison.
b |
std::vector< std::string > hermes::Path::parts | ( | ) | const |
Splits this path into a list.
std::string hermes::Path::read | ( | ) | const |
Reads ascii content from this file.
bool hermes::Path::touch | ( | ) | const |
Creates empty file from this path.
u64 hermes::Path::writeTo | ( | const std::string & | content | ) | const |
Writes content into this file.
content |