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