![]() |
Disk ARchive 2.7.16
Full featured and portable backup and archiving tool
|
the class path is here to manipulate paths in the Unix notation: using'/' More...
#include <path.hpp>
Public Member Functions | |
path (const std::string &s, bool x_undisclosed=false) | |
constructor from a string | |
path (const path &ref) | |
copy constructor | |
path (path &&ref) noexcept=default | |
move constructor | |
path & | operator= (const path &ref) |
assignment operator | |
path & | operator= (path &&ref) noexcept=default |
move operator | |
~path ()=default | |
destructor | |
bool | operator== (const path &ref) const |
comparison operator | |
bool | operator!= (const path &ref) const |
std::string | basename () const |
get the basename of a path | |
void | reset_read () const |
reset the read_subdir operation | |
bool | read_subdir (std::string &r) const |
sequentially read the elements that compose the path | |
bool | is_relative () const |
whether the path is relative or absolute (= start with a /) | |
bool | is_absolute () const |
whether the path is absolute or relative | |
bool | is_undisclosed () const |
whether the path has an undisclosed part at the beginning | |
bool | pop (std::string &arg) |
remove and gives in argument the basename of the path | |
bool | pop_front (std::string &arg) |
remove and gives in argument the outer most member of the path | |
path | operator+ (const path &arg) const |
add a path to the current path. The added path must be a relative path | |
path | append (const std::string &sub) const |
add a single sub-directory to the path | |
path & | operator+= (const path &arg) |
add a path to the current path. The added path must be a relative path | |
path & | operator+= (const std::string &sub) |
add a single sub-directory to the current path object | |
bool | is_subdir_of (const path &p, bool case_sensit) const |
test whether the current object is a subdir of the method's argument | |
std::string | display () const |
convert back a path to a string | |
std::string | display_without_root () const |
display the path as a string but without the first member of the path | |
U_I | degre () const |
returns the number of member in the path | |
void | explode_undisclosed () const |
if the current object is an undisclosed path, tries to convert it back to normal path | |
Private Member Functions | |
void | reduce () |
void | init (const std::string &chem, bool x_undisclosed) |
Private Attributes | |
std::list< std::string >::const_iterator | reading |
std::list< std::string > | dirs |
bool | relative |
bool | undisclosed |
the class path is here to manipulate paths in the Unix notation: using'/'
several operations are provided as well as convertion functions, but for the API user, it can be used as if it was a std::string object. However if the argument is not a valid path, an exception may be thrown by libdar
libdar::path::path | ( | const std::string & | s, |
bool | x_undisclosed = false ) |
constructor from a string
This realizes the string to path convertion function
[in] | s | the string to convert to path |
[in] | x_undisclosed | do not split the given string, consider it as a single directory name, even if some '/' are found in it |
|
inline |
std::string libdar::path::basename | ( | ) | const |
get the basename of a path
this function returns the basename that's it the right most member of a path
|
inline |
std::string libdar::path::display | ( | ) | const |
convert back a path to a string
the returned string is the representation of the current object in Unix notation
Referenced by libdar::entrepot_local::get_url(), and libdar::mask::is_covered().
std::string libdar::path::display_without_root | ( | ) | const |
display the path as a string but without the first member of the path
|
inline |
whether the path is absolute or relative
Definition at line 104 of file path.hpp.
Referenced by libdar::catalogue::has_in_place().
|
inline |
bool libdar::path::is_subdir_of | ( | const path & | p, |
bool | case_sensit ) const |
test whether the current object is a subdir of the method's argument
[in] | p | the path to test with |
[in] | case_sensit | whether the test must be in case sensitive manner or not |
Referenced by libdar::exclude_dir_mask::is_covered().
|
inline |
|
inline |
add a path to the current path. The added path must be a relative path
[in] | arg | the relative path to add |
add a path to the current path. The added path must be a relative path
[in] | arg | the relative path to add |
bool libdar::path::pop | ( | std::string & | arg | ) |
remove and gives in argument the basename of the path
[out] | arg | the basename of the path |
bool libdar::path::pop_front | ( | std::string & | arg | ) |
remove and gives in argument the outer most member of the path
[out] | arg | the value of the outer element of the path |
bool libdar::path::read_subdir | ( | std::string & | r | ) | const |
sequentially read the elements that compose the path
[out] | r | the next element of the path |
|
inline |
|
mutableprivate |