13 #ifndef ZYPP_PATHNAME_H
14 #define ZYPP_PATHNAME_H
57 {
_assign( name_r ? name_r :
"" ); }
78 {
swap( *
this, rhs );
return *
this; }
82 {
return( *
this =
cat( *
this, path_tv ) ); }
88 {
return( *
this =
cat( *
this, path_tv ) ); }
101 Url asUrl(
const std::string & scheme_r )
const;
111 {
return _name.c_str(); }
141 {
return name_r.
relative() ?
cat(
"/", name_r ) : name_r; }
146 {
return name_r.
absolute() ?
cat(
".", name_r ) : name_r; }
175 void _assign(
const std::string & name_r );
Pathname relativename() const
Return this path, removing a leading '/' if absolute.
static std::string showRoot(const Pathname &root_r, const Pathname &path_r)
String representation as "(root)/path".
Pathname extend(const std::string &r) const
Append string r to the last component of the path.
static Pathname extend(const Pathname &l, const std::string &r)
Pathname(const Pathname &rhs)
Copy Ctor.
std::ostream & operator<<(std::ostream &str, const Pathname &obj)
Stream output.
friend void swap(Pathname &lhs, Pathname &rhs)
Swap.
static Pathname stripprefix(const Pathname &root_r, const Pathname &path_r)
Return path_r with any root_r dir prefix striped.
Pathname & operator+=(const Pathname &path_tv)
Concatenate and assign.
static Pathname absolutename(const Pathname &name_r)
Pathname & operator=(Pathname rhs)
Assign.
Pathname dirname() const
Return all but the last component od this path.
bool emptyOrRoot() const
Test for "" or "/".
Pathname & operator/=(const Pathname &path_tv)
Concatenate and assign.
bool absolute() const
Test for an absolute path.
Pathname operator+(const Pathname &l, const Pathname &r)
Concatenate two Pathname.
bool operator!=(const Pathname &l, const Pathname &r)
Pathname cat(const Pathname &r) const
Concatenation of pathnames.
Pathname()
Default ctor: an empty path.
const std::string & asString() const
String representation.
Pathname(const char *name_r)
Ctor from char*.
std::string basename() const
Return the last component of this path.
bool empty() const
Test for an empty path.
static Pathname assertprefix(const Pathname &root_r, const Pathname &path_r)
Return path_r prefixed with root_r, unless it is already prefixed.
Pathname(Pathname &&tmp)
Move Ctor.
bool operator==(const Pathname &l, const Pathname &r)
void _assign(const std::string &name_r)
Pathname absolutename() const
Return this path, adding a leading '/' if relative.
Pathname(const std::string &name_r)
Ctor from string.
static std::string showRootIf(const Pathname &root_r, const Pathname &path_r)
String representation as "(root)/path", unless root is "/" or empty.
const char * c_str() const
String representation.
bool operator<(const Pathname &l, const Pathname &r)
Pathname operator/(const Pathname &l, const Pathname &r)
Concatenate two Pathname.
static Pathname relativename(const Pathname &name_r)
std::string extension() const
Return all of the characters in name after and including the last dot in the last element of name.
bool relative() const
Test for a relative path.
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.