Path Class Reference

#include <Pt/System/Path.h>

Represents a path in the file-system.

Public Member Functions

 Path ()
 Default constructor.
 
 Path (const Path &p)
 Copy constructor.
 
 Path (const Pt::String &s)
 Construct from a path name.
 
 Path (const char *s)
 Construct from an UTF-8 encoded path name.
 
 Path (const char *s, std::size_t n)
 Construct from an UTF-8 encoded path name.
 
 ~Path ()
 Destructor.
 
Pathappend (const Path &p)
 Appends a path name. More...
 
Pathappend (const Pt::String &s)
 Appends a path name. More...
 
Pathappend (const char *s)
 Appends an UTF-8 encoded path name. More...
 
Pathappend (const char *s, std::size_t n)
 Appends an UTF-8 encoded path name. More...
 
Pathassign (const Path &p)
 Assigns a path name.
 
Pathassign (const Pt::String &s)
 Assigns a path name.
 
Pathassign (const char *s)
 Assigns an UTF-8 encoded path name.
 
Pathassign (const char *s, std::size_t n)
 Assigns an UTF-8 encoded path name.
 
Pt::String baseName () const
 Returns the file name without directory and extension.
 
void clear ()
 Clears the path.
 
int compare (const Path &p) const
 Compares two paths (with strcmp semantics).
 
Pathconcat (const Path &p)
 Concatenates a path name. More...
 
Pathconcat (const Pt::String &s)
 Concatenates a path name. More...
 
Pathconcat (const char *s)
 Concatenates a path name. More...
 
Pathconcat (const char *s, std::size_t n)
 Appends an UTF-8 encoded path name. More...
 
Pt::String dirName () const
 Returns the directory part.
 
bool empty () const
 Returns true if path is empty.
 
Pt::String extension () const
 Returns the file name extension.
 
Pt::String fileName () const
 Returns the file name without the directroy part.
 
Pathoperator+= (const Path &p)
 Concatenates a path name.
 
Pathoperator+= (const Pt::String &s)
 Concatenates a path name. More...
 
Pathoperator+= (const char *s)
 Concatenates a path name. More...
 
Pathoperator/= (const Path &p)
 Appends a path name. More...
 
Pathoperator/= (const Pt::String &s)
 Appends a path name. More...
 
Pathoperator/= (const char *s)
 Appends an UTF-8 encoded path name. More...
 
Pathoperator= (const Path &p)
 Assignment operator.
 
Pathoperator= (const Pt::String &s)
 Assigns a path name.
 
Pathoperator= (const char *s)
 Assigns an UTF-8 encoded path name.
 
std::string toLocal () const
 Returns the path name in local encoding.
 
Pt::String toString () const
 Returns the path name.
 

Static Public Member Functions

static Pt::String curdir ()
 Returns the current directory string.
 
static Pt::String dirsep ()
 Returns the directory separator string.
 
static Pt::String updir ()
 Returns the parent directory string.
 

Related Functions

bool operator!= (const Path &a, const Path &b)
 Compares two paths.
 
Path operator/ (const Path &a, const Path &b)
 Appends a paths to another.
 
Path operator/ (const Path &a, const Pt::String &b)
 Appends a paths to another.
 
Path operator/ (const Path &a, const char *b)
 Appends a paths to another.
 
bool operator< (const Path &a, const Path &b)
 Compares two paths.
 
bool operator== (const Path &a, const Path &b)
 Compares two paths.
 

Member Function Documentation

Path& append ( const Path p)

A directory separator is added if this path is not empty.

Path& append ( const Pt::String s)

A directory separator is added if this path is not empty.

Path& append ( const char *  s)

A directory separator is added if this path is not empty.

Path& append ( const char *  s,
std::size_t  n 
)

A directory separator is added if this path is not empty.

Path& operator/= ( const Path p)

A directory separator is added if this path is not empty.

Path& operator/= ( const Pt::String s)

A directory separator is added if this path is not empty.

Path& operator/= ( const char *  s)

A directory separator is added if this path is not empty.

Path& concat ( const Path p)

The two paths are directly joined and no separator is added.

Path& concat ( const Pt::String s)

The two paths are directly joined and no separator is added.

Path& concat ( const char *  s)

The two paths are directly joined and no separator is added.

Path& concat ( const char *  s,
std::size_t  n 
)

The two paths are directly joined and no separator is added.

Path& operator+= ( const Pt::String s)

The two paths are directly joined and no separator is added.

Path& operator+= ( const char *  s)

The two paths are directly joined and no separator is added.