A file/directory path. More...
#include "Path.hpp"
Inheritance diagram for Path:Public Types | |
| using | size_type = String::size_type |
Public Member Functions | |
| Path (const char *) | |
| Path (const String &) | |
| Path (String &&) | |
| Path (const Path &) | |
| Path (Path &&) | |
| void | clear () |
| postcondition: this->empty() is true. | |
| Path & | make_absolute () |
| postcondition: For the returned path, is_absolute() is true. | |
| Path & | make_preferred () |
| Convert the contained pathname to the native format. | |
| Path & | remove_filename () |
| if has_parent_path() then remove the last filename from the stored path. | |
| Path & | replace_extension (const String &new_extension=String()) |
| postcondition: extension() == new_extension (where a leading dot has been removed from replacement, if present) | |
| void | swap (Path &) |
| swaps the contents of the two paths. | |
| String | string () const |
| returns the stored path, formatted according to the operating system rules for regular file pathnames | |
| Path | root_name () const |
| returns the root name (e.g. d:/path/filename.ext -> d:) | |
| Path | root_directory () const |
| returns the root directory (e.g. d:/path/filename.ext -> /) | |
| Path | root_path () const |
| returns root_name() + root_directory() | |
| Path | relative_path () const |
| returns the stored path without root_path() (e.g. d:/path/file.ext -> path/file.ext) | |
| Path | parent_path () const |
| returns the parent directory, if any (e.g. d:/path/filename.ext -> d:/path/) | |
| Path | filename () const |
| returns the filename (i.e. /path/filename.ext -> filename.ext) | |
| String | stem () const |
| returns the filename without extension (i.e. /path/filename.ext -> filename) | |
| String | extension () const |
| returns the filename extension (i.e. /path/filename.ext -> .ext) | |
| bool | empty () const |
| returns string().empty() | |
| bool | has_root_name () const |
| returns !root_name().empty() | |
| bool | has_root_directory () const |
| returns !root_directory().empty() | |
| bool | has_root_path () const |
| returns !root_path().empty() | |
| bool | has_relative_path () const |
| returns !relative_path().empty() | |
| bool | has_parent_path () const |
| returns !parent_path().empty() | |
| bool | has_filename () const |
| returns !filename().empty() | |
| bool | has_stem () const |
| returns !stem().empty() | |
| bool | has_extension () const |
| returns !extension().empty() | |
| bool | is_absolute () const |
| returns true if the elements of root_path() uniquely identify a directory, else false | |
| bool | is_relative () const |
| returns !is_absolute() | |
| Path & | normalize () |
| Replace symlinks, replace '/' with '\', replace "foo/../bar" with "bar", etc. | |
| String | compressed (size_type length) const |
| shorten path to length, e.g. d:/foo_long_directory_name/bar.txt -> d:/foo.../bar.txt | |
assignment operators | |
| Path & | operator= (const char *) |
| Path & | operator= (const String &) |
| Path & | operator= (String &&) |
| Path & | operator= (const Path &) |
| Path & | operator= (Path &&) |
append a file / directory name | |
introducing a '/' between the stored path and the directory/filename to append | |
| Path & | operator/= (const char *) |
| Path & | operator/= (const String &) |
| Path & | operator/= (const Path &) |
add a string | |
return a path where a string has been appended to the stored path (not introducing a '/' in between) | |
| Path | operator+ (const char *) const |
| Path | operator+ (const String &) const |
| Path | operator+ (const Path &) const |
append a string | |
append a string to the stored path (not introducing a '/' in between) | |
| Path & | operator+= (const char *) |
| Path & | operator+= (const String &) |
| Path & | operator+= (const Path &) |
Related Functions | |
(Note that these are not member functions.) | |
| void | swap (Path &, Path &) |
| Path | operator/ (const Path &lhs, const Path &rhs) |
| Path | operator/ (const Path &lhs, const char *rhs) |
| Path | operator/ (const char *lhs, const Path &rhs) |
| Path | operator/ (const Path &lhs, const String &rhs) |
| Path | operator/ (const String &lhs, const Path &rhs) |
| bool | operator< (const Path &, const Path &) |
| bool | operator<= (const Path &, const Path &) |
| bool | operator> (const Path &, const Path &) |
| bool | operator>= (const Path &, const Path &) |
| bool | operator== (const Path &, const Path &) |
| bool | operator== (const Path &, const String &) |
| bool | operator== (const String &, const Path &) |
| bool | operator== (const Path &, const char *) |
| bool | operator== (const char *, const Path &) |
| bool | operator!= (const Path &, const Path &) |
| bool | operator!= (const Path &, const String &) |
| bool | operator!= (const String &, const Path &) |
| bool | operator!= (const Path &, const char *) |
| bool | operator!= (const char *, const Path &) |
| std::size_t | hash_value (const Path &p) |
A file/directory path.
Internally, all '\' are replaced by '/'