31 #include "../my_config.h"
62 path(
const std::string & s,
bool x_undisclosed =
false);
81 bool operator != (
const path & ref)
const {
return !(*
this == ref); };
116 bool pop(std::string & arg);
135 path append(
const std::string & sub)
const {
path tmp = *
this;
if(sub.find_first_of(
"/") != std::string::npos)
throw SRC_BUG; tmp += sub;
return tmp; };
166 U_I
degre()
const {
return dirs.size() + (relative ? 0 : 1); };
172 mutable std::list<std::string>::const_iterator reading;
173 std::list<std::string> dirs;
178 void init(
const std::string & chem,
bool x_undisclosed);
the class path is here to manipulate paths in the Unix notation: using'/'
void explode_undisclosed() const
if the current object is an undisclosed path, tries to convert it back to normal path
bool read_subdir(std::string &r) const
sequentially read the elements that compose the path
bool pop(std::string &arg)
remove and gives in argument the basename of the path
bool is_subdir_of(const path &p, bool case_sensit) const
test whether the current object is a subdir of the method's argument
~path()=default
destructor
path(path &&ref) noexcept=default
move constructor
path & operator+=(const path &arg)
add a path to the current path. The added path must be a relative path
void reset_read() const
reset the read_subdir operation
bool operator==(const path &ref) const
comparison operator
U_I degre() const
returns the number of member in the path
bool is_absolute() const
whether the path is absolute or relative
path(const std::string &s, bool x_undisclosed=false)
constructor from a string
bool pop_front(std::string &arg)
remove and gives in argument the outer most member of the path
std::string display() const
convert back a path to a string
path & operator=(const path &ref)
assignment operator
std::string display_without_root() const
display the path as a string but without the first 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
bool is_undisclosed() const
whether the path has an undisclosed part at the beginning
path(const path &ref)
copy constructor
bool is_relative() const
whether the path is relative or absolute (= start with a /)
std::string basename() const
get the basename of a path
contains all the excetion class thrown by libdar
const std::string PSEUDO_ROOT
root name to use when archive operation does not use filesystem (archive testing for example)
const path FAKE_ROOT
root path object based on PSEUDO_ROOT
are defined here basic integer types that tend to be portable
libdar namespace encapsulate all libdar symbols