79 Path(
const std::string & path ) ;
82 Path(
const char * path ) ;
85 Path(
const Path & path ,
const std::string & tail ) ;
88 Path(
const Path & path ,
const std::string & tail_1 ,
const std::string & tail_2 ) ;
97 std::string
str()
const ;
198 std::ostream & operator<<( std::ostream & stream ,
const Path & path )
200 return stream << path.
str() ;
204 Path & operator+=( Path & p ,
const std::string & str )
211 Path operator+(
const Path & p ,
const std::string & str )
213 return Path( p , str ) ;
217 void swap( Path & p1 , Path & p2 )
std::string str() const
Returns the path string.
Path & operator=(const Path &other)
Assignment operator.
void swap(Path &other)
Swaps this with other.
A private implementation class used by G::Path providing a set of static methods. ...
Path()
Default constructor for a zero-length path.
Path withoutExtension() const
Returns a path without the basename extension, if any.
std::string basename() const
Returns the rightmost part of the path, ignoring "." parts.
bool operator!=(const Path &path) const
Comparison operator.
std::vector< std::string > StringArray
A std::vector of std::strings.
std::string extension() const
Returns the path's basename extension, ie.
bool simple() const
Returns true if the path has a single component (ignoring "." parts), ie.
bool isRelative() const
Returns true if the path is a relative path.
static Path difference(const Path &p1, const Path &p2)
Returns the relative path from p1 to p2.
static bool less(const Path &a, const Path &b)
Compares two paths, with simple eight-bit lexicographical comparisons of each path component...
bool isAbsolute() const
Returns !isRelative().
bool operator==(const Path &path) const
Comparison operator.
Path dirname() const
Returns the path without the rightmost part, ignoring "." parts.
StringArray split() const
Spits the path into a list of component parts (ignoring "." parts unless the whole path is "...
Path collapsed() const
Returns the path with "foo/.." and "." parts removed, so far as is possible without changing the mean...
void pathAppend(const std::string &tail)
Appends a filename or a relative path to this path.
static void setWindowsStyle()
Sets windows mode for testing purposes.
static void setPosixStyle()
Sets posix mode for testing purposes.
A Path object represents a file system path.
static Path join(const StringArray &parts)
Builds a path from a set of parts.
static Path nullDevice()
Returns the path of the "/dev/null" special file, or equivalent.
Path withExtension(const std::string &ext) const
Returns the path with the new basename extension.