13#ifndef ZYPP_PATHNAME_H
14#define ZYPP_PATHNAME_H
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(); }
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 );
Pathname relativename() const
Return this path, removing a leading '/' if absolute.
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.
Pathname & operator/=(const Pathname &path_tv)
Concatenate and assign.
friend void swap(Pathname &lhs, Pathname &rhs) noexcept
Swap.
Pathname(Pathname &&tmp) noexcept
Move Ctor.
static Pathname absolutename(const Pathname &name_r)
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 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 char * c_str() const
String representation.
Pathname(const char *name_r)
Ctor from char*.
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.
bool operator==(const Pathname &l, const Pathname &r)
void _assign(const std::string &name_r)
Pathname & operator=(Pathname rhs)
Assign.
Pathname absolutename() const
Return this path, adding a leading '/' if relative.
Pathname(const std::string &name_r)
Ctor from string.
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.
Types and functions for filesystem operations.
Easy-to use interface to the ZYPP dependency resolver.
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API