13#ifndef ZYPP_PATHNAME_H
14#define ZYPP_PATHNAME_H
52 Pathname(
const std::string & name_r )
57 {
_assign( name_r ? name_r :
"" ); }
68 swap( lhs._name, rhs._name );
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;
110 const char *
c_str()
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; }
178 void _assign(
const std::string & name_r );
183 inline bool operator==(
const Pathname & l,
const Pathname & r )
184 {
return l.asString() == r.asString(); }
187 inline bool operator!=(
const Pathname & l,
const Pathname & r )
188 {
return l.asString() != r.asString(); }
191 inline Pathname operator/(
const Pathname & l,
const Pathname & r )
197 inline Pathname operator+(
const Pathname & l,
const Pathname & r )
201 inline bool operator<(
const Pathname & l,
const Pathname & r )
202 {
return l.asString() < r.asString(); }
207 inline std::ostream &
operator<<( std::ostream &
str,
const Pathname & obj )
208 {
return str << obj.asString(); }
215 using filesystem::Pathname;
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.
Pathname & operator/=(const Pathname &path_tv)
Concatenate and assign.
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.
Pathname dirname() const
Return all but the last component od this path.
bool emptyOrRoot() const
Test for "" or "/".
bool absolute() const
Test for an absolute path.
Pathname cat(const Pathname &r) const
Concatenation of pathnames.
Pathname()
Default ctor: an empty path.
const char * c_str() const
String representation.
const std::string & asString() const
String representation.
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.
void _assign(const std::string &name_r)
Pathname & operator=(Pathname rhs)
Assign.
Pathname realpath() const
Returns this path as the absolute canonical pathname.
Pathname absolutename() const
Return this path, adding a leading '/' if relative.
static std::string showRootIf(const Pathname &root_r, const Pathname &path_r)
String representation as "(root)/path", unless root is "/" or empty.
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.
std::ostream & operator<<(std::ostream &str, const Glob &obj)
Easy-to use interface to the ZYPP dependency resolver.
bool operator<(const StrMatcher &lhs, const StrMatcher &rhs)
bool operator==(const SetRelation::Enum &lhs, const SetCompare &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool operator!=(const SetRelation::Enum &lhs, const SetCompare &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr std::string_view Url("url")