13 #ifndef ZYPP_PATHNAME_H 14 #define ZYPP_PATHNAME_H 56 { _assign( name_r ); }
60 { _assign( name_r ? name_r :
"" ); }
71 swap( lhs._name, rhs._name );
76 : _name( std::move( tmp._name ) )
81 { swap( *
this, rhs );
return *
this; }
85 {
return( *
this = cat( *
this, path_tv ) ); }
91 {
return( *
this = cat( *
this, path_tv ) ); }
98 static std::string showRoot(
const Pathname & root_r,
const Pathname & path_r );
101 static std::string showRootIf(
const Pathname & root_r,
const Pathname & path_r );
104 Url asUrl(
const std::string & scheme_r )
const;
108 Url asDirUrl()
const;
110 Url asFileUrl()
const;
114 {
return _name.c_str(); }
117 bool empty()
const {
return _name.empty(); }
119 bool absolute()
const {
return *_name.c_str() ==
'/'; }
121 bool relative()
const {
return !( absolute() || empty() ); }
124 bool relativeDotDot()
const {
return strncmp( _name.c_str() ,
"./..", 4 ) == 0 && ( _name.size() == 4 || _name.c_str()[4] ==
'/' ); }
127 bool emptyOrRoot()
const {
return( _name.empty() || _name ==
"/" ); }
138 static std::string basename(
const Pathname & name_r );
145 static std::string extension(
const Pathname & name_r );
150 {
return name_r.
relative() ? cat(
"/", name_r ) : name_r; }
155 {
return name_r.
absolute() ? cat(
".", name_r ) : name_r; }
187 void _assign(
const std::string & name_r );
224 using filesystem::Pathname;
229 #endif // ZYPP_PATHNAME_H
bool absoluteNotRoot() const
Test for a not empty absolute Path (!= "/")
Pathname(const std::string &name_r)
Ctor from string.
bool operator==(const Pathname &l, const Pathname &r)
relates: Pathname
Pathname extend(const std::string &r) const
Append string r to the last component of the path.
const char * c_str() const
String representation.
String related utilities and Regular expression matching.
std::string basename() const
Return the last component of this path.
Pathname & operator+=(const Pathname &path_tv)
Concatenate and assign.
Pathname(Pathname &&tmp) noexcept
Move Ctor.
std::ostream & operator<<(std::ostream &str, const Glob &obj)
relates: Glob Stream output
bool emptyOrRoot() const
Test for "" or "/".
bool empty() const
Test for an empty path.
Pathname & operator=(Pathname rhs)
Assign.
const std::string & asString() const
String representation.
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
Pathname(const char *name_r)
Ctor from char*.
Pathname dirname() const
Return all but the last component od this path.
Pathname relativename() const
Return this path, removing a leading '/' if absolute.
Pathname()
Default ctor: an empty path.
Provides API related macros.
bool absolute() const
Test for an absolute path.
Pathname(const Pathname &rhs)
Copy Ctor.
bool operator!=(const Pathname &l, const Pathname &r)
relates: Pathname
static Pathname relativename(const Pathname &name_r)
Pathname absolutename() const
Return this path, adding a leading '/' if relative.
friend void swap(Pathname &lhs, Pathname &rhs) noexcept
Swap.
bool operator<(const Pathname &l, const Pathname &r)
relates: Pathname
Pathname & operator/=(const Pathname &path_tv)
Concatenate and assign.
static Pathname absolutename(const Pathname &name_r)
bool relative() const
Test for a relative path.
Pathname operator+(const Pathname &l, const Pathname &r)
relates: Pathname Concatenate two Pathname.
bool relativeDotDot() const
Test for a relative path referring to ../.
Easy-to use interface to the ZYPP dependency resolver.
Pathname cat(const Pathname &r) const
Concatenation of pathnames.
Pathname operator/(const Pathname &l, const Pathname &r)
relates: Pathname Concatenate two Pathname.
std::string extension() const
Return all of the characters in name after and including the last dot in the last element of name...