13 #ifndef ZYPP_PATHNAME_H 14 #define ZYPP_PATHNAME_H 55 { _assign( name_r ); }
59 { _assign( name_r ? name_r :
"" ); }
70 swap( lhs._name, rhs._name );
75 : _name( std::move( tmp._name ) )
80 { swap( *
this, rhs );
return *
this; }
84 {
return( *
this = cat( *
this, path_tv ) ); }
90 {
return( *
this = cat( *
this, path_tv ) ); }
97 static std::string showRoot(
const Pathname & root_r,
const Pathname & path_r );
100 static std::string showRootIf(
const Pathname & root_r,
const Pathname & path_r );
103 Url asUrl(
const std::string & scheme_r )
const;
107 Url asDirUrl()
const;
109 Url asFileUrl()
const;
113 {
return _name.c_str(); }
116 bool empty()
const {
return _name.empty(); }
118 bool absolute()
const {
return *_name.c_str() ==
'/'; }
120 bool relative()
const {
return !( absolute() || empty() ); }
123 bool emptyOrRoot()
const {
return( _name.empty() || _name ==
"/" ); }
131 static std::string basename(
const Pathname & name_r );
138 static std::string extension(
const Pathname & name_r );
143 {
return name_r.
relative() ? cat(
"/", name_r ) : name_r; }
148 {
return name_r.
absolute() ? cat(
".", name_r ) : name_r; }
180 void _assign(
const std::string & name_r );
222 #endif // ZYPP_PATHNAME_H
Pathname(const std::string &name_r)
Ctor from string.
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.
Pathname operator/(const Pathname &l, const Pathname &r)
bool emptyOrRoot() const
Test for "" or "/".
bool empty() const
Test for an empty path.
Pathname & operator=(Pathname rhs)
Assign.
bool operator<(const Pathname &l, const Pathname &r)
const std::string & asString() const
String representation.
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
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.
bool absolute() const
Test for an absolute path.
bool operator!=(const Pathname &l, const Pathname &r)
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)
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.
Pathname & operator/=(const Pathname &path_tv)
Concatenate and assign.
static Pathname absolutename(const Pathname &name_r)
bool relative() const
Test for a relative path.
Easy-to use interface to the ZYPP dependency resolver.
Pathname cat(const Pathname &r) const
Concatenation of pathnames.
std::string extension() const
Return all of the characters in name after and including the last dot in the last element of name...