12 #ifndef ZYPP_PATHNAME_H
13 #define ZYPP_PATHNAME_H
56 {
_assign( name_r ? name_r :
"" ); }
69 #ifndef SWIG // Swig treats it as syntax error
77 {
swap( *
this, rhs );
return *
this; }
81 {
return( *
this =
cat( *
this, path_tv ) ); }
87 {
return( *
this =
cat( *
this, path_tv ) ); }
100 Url asUrl(
const std::string & scheme_r )
const;
110 {
return _name.c_str(); }
137 {
return name_r.
relative() ?
cat(
"/", name_r ) : name_r; }
142 {
return name_r.
absolute() ?
cat(
".", name_r ) : name_r; }
168 void _assign(
const std::string & name_r );
210 #endif // ZYPP_PATHNAME_H
Pathname absolutename() const
Return this path, adding a leading '/' if relative.
Pathname(const std::string &name_r)
Ctor from string.
std::string basename() const
Return the last component of this path.
Pathname relativename() const
Return this path, removing a leading '/' if absolute.
bool empty() const
Test for an empty path.
const std::string & asString() const
String representation.
static std::string showRootIf(const Pathname &root_r, const Pathname &path_r)
String representation as "(root)/path", unless root is "/" or empty.
Pathname dirname() const
Return all but the last component od this path.
bool relative() const
Test for a relative path.
friend void swap(Pathname &lhs, Pathname &rhs)
Swap.
Pathname & operator+=(const Pathname &path_tv)
Concatenate and assing.
Pathname operator/(const Pathname &l, const Pathname &r)
Pathname & operator=(Pathname rhs)
Assign.
Pathname(Pathname &&tmp)
Move Ctor.
bool operator<(const Pathname &l, const Pathname &r)
Pathname(const char *name_r)
Ctor from char*.
const char * c_str() const
String representation.
static Pathname assertprefix(const Pathname &root_r, const Pathname &path_r)
Return path_r prefixed with root_r, unless it is already prefixed.
Pathname()
Default ctor: an empty path.
bool operator!=(const Pathname &l, const Pathname &r)
std::string extension() const
Return all of the characters in name after and including the last dot in the last element of name...
static std::string showRoot(const Pathname &root_r, const Pathname &path_r)
String representation as "(root)/path".
Pathname(const Pathname &rhs)
Copy Ctor.
std::ostream & operator<<(std::ostream &str, const Pathname &obj)
Pathname operator+(const Pathname &l, const Pathname &r)
bool operator==(const Pathname &l, const Pathname &r)
Pathname cat(const Pathname &r) const
Concatenation of pathnames.
static Pathname relativename(const Pathname &name_r)
Pathname & operator/=(const Pathname &path_tv)
Concatenate and assing.
void _assign(const std::string &name_r)
static Pathname absolutename(const Pathname &name_r)
bool absolute() const
Test for an absolute path.
Pathname extend(const std::string &r) const
Append string r to the last component of the path.