![]() |
Disk ARchive
2.5.7
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>
Inherits libdar::on_pool.
Public Member Functions | |
path (const std::string &s, bool x_undisclosed=false) | |
constructor from a string More... | |
path (const char *s, bool x_undisclosed=false) | |
constructor from a char * More... | |
path (const path &ref) | |
copy constructor | |
const path & | operator= (const path &ref) |
assignment operator | |
bool | operator== (const path &ref) const |
comparison operator | |
bool | operator!= (const path &ref) const |
std::string | basename () const |
get the basename of a path More... | |
void | reset_read () |
reset the read_subdir operation More... | |
bool | read_subdir (std::string &r) |
sequentially read the elements that compose the path More... | |
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 More... | |
bool | pop_front (std::string &arg) |
remove and gives in argument the outer most member of the path More... | |
path | operator+ (const path &arg) const |
add a path to the current path. The added path must be a relative path More... | |
path & | operator+= (const path &arg) |
add a path to the current path. The added path must be a relative path More... | |
bool | is_subdir_of (const path &p, bool case_sensit) const |
test whether the current object is a subdir of the method's argument More... | |
std::string | display () const |
convert back a path to a string More... | |
unsigned int | degre () const |
returns the number of member in the path More... | |
void | explode_undisclosed () const |
if the current object is an undisclosed path, tries to convert it back to normal path | |
![]() | |
void * | operator new (size_t n_byte) |
void * | operator new (size_t n_byte, const std::nothrow_t ¬hrow_value) |
void * | operator new[] (size_t n_byte) |
void * | operator new[] (size_t n_byte, const std::nothrow_t ¬hrow_value) |
void * | operator new (size_t n_byte, memory_pool *p) |
void * | operator new[] (size_t n_byte, memory_pool *p) |
void | operator delete (void *ptr, memory_pool *p) |
this operator is called by the compiler if an exception is throw from the constructor of the allocated object | |
void | operator delete[] (void *ptr, memory_pool *p) |
this operator is called by the compiler if an exception is throw from the constructor of the allocated objects | |
void | operator delete (void *ptr) |
this is the usual delete operator, modified to handle allocated objects allocated on a memory pool or not | |
void | operator delete[] (void *ptr) |
this is the usual delete[] operator, modified to handle allocated objects allocated on a memory pool or not | |
Additional Inherited Members | |
![]() | |
memory_pool * | get_pool () const |
template<class T > | |
void | meta_new (T *&ptr, size_t num) |
template<class T > | |
void | meta_delete (T *ptr) |
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 |
Referenced by path().
|
inline |
constructor from a char *
this realizes the char * to path convertion function
Definition at line 68 of file path.hpp.
References basename(), operator=(), operator==(), and path().
Referenced by path().
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
Referenced by path().
|
inline |
returns the number of member in the path
Definition at line 152 of file path.hpp.
References explode_undisclosed().
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::mask::is_covered(), operator+(), and libdar::entrepot::set_root().
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(), and operator+().
add a path to the current path. The added path must be a relative path
[in] | arg | the relative path to add |
Definition at line 129 of file path.hpp.
References display(), is_subdir_of(), and operator+=().
add a path to the current path. The added path must be a relative path
[in] | arg | the relative path to add |
Referenced by operator+().
bool libdar::path::pop | ( | std::string & | arg | ) |
remove and gives in argument the basename of the path
[out] | arg | the basename of the path |
Referenced by is_undisclosed().
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 |
Referenced by is_undisclosed().
bool libdar::path::read_subdir | ( | std::string & | r | ) |
sequentially read the elements that compose the path
[out] | r | the next element of the path |
Referenced by reset_read().
|
inline |
reset the read_subdir operation
reset for read_subdir. next call to read_subdir is the most global
Definition at line 88 of file path.hpp.
References read_subdir().