Logo Search packages:      
Sourcecode: poco version File versions

Poco::Path Class Reference

#include <Path.h>

List of all members.


Detailed Description

This class represents filesystem paths in a platform-independent manner. Unix, Windows and OpenVMS all use a different syntax for filesystem paths. This class can work with all three formats. A path is made up of an optional node name (only Windows and OpenVMS), an optional device name (also only Windows and OpenVMS), a list of directory names and an optional filename.

Definition at line 50 of file Path.h.


Public Types

typedef std::vector< std::string > StringVec
enum  Style {
  PATH_UNIX, PATH_WINDOWS, PATH_VMS, PATH_NATIVE,
  PATH_GUESS
}

Public Member Functions

Path absolute (const Path &base) const
Path absolute () const
Pathappend (const Path &path)
Pathassign (const char *path)
 Assigns the given path.
Pathassign (const Path &path)
 Assigns a string containing a path.
Pathassign (const std::string &path, Style style)
 Assigns a string containing a path in native format.
Pathassign (const std::string &path)
 Swaps the path with another one.
void clear ()
 Returns the file version. VMS only.
int depth () const
 Returns the device name.
const std::string & directory (int n) const
 Returns the number of directories in the directory list.
std::string getBaseName () const
const std::string & getDevice () const
std::string getExtension () const
 Sets the filename extension.
const std::string & getFileName () const
 Sets the filename.
const std::string & getNode () const
bool isAbsolute () const
bool isDirectory () const
 Returns true iff the path is relative.
bool isFile () const
bool isRelative () const
 Returns true iff the path is absolute.
PathmakeAbsolute (const Path &base)
PathmakeAbsolute ()
 Makes the path refer to its parent.
PathmakeDirectory ()
PathmakeFile ()
PathmakeParent ()
Pathoperator= (const char *path)
 Assigns a string containing a path in native format.
Pathoperator= (const std::string &path)
 Assignment operator.
Pathoperator= (const Path &path)
 Destroys the Path.
const std::string & operator[] (int n) const
Path parent () const
 Clears all components.
Pathparse (const std::string &path, Style style)
 Same as assign().
Pathparse (const std::string &path)
 Returns a string containing the path in the given format.
PathparseDirectory (const std::string &path, Style style)
PathparseDirectory (const std::string &path)
 Path (const Path &parent, const Path &relative)
 Path (const Path &parent, const char *fileName)
 Path (const Path &parent, const std::string &fileName)
 Copy constructor.
 Path (const Path &path)
 Creates a path from a string.
 Path (const std::string &path, Style style)
 Creates a path from a string.
 Path (const std::string &path)
 Creates a path from a string.
 Path (const char *path, Style style)
 Creates a path from a string.
 Path (const char *path)
 Creates an empty absolute or relative path.
 Path (bool absolute)
 Creates an empty relative path.
void popDirectory ()
 Adds a directory to the directory list.
void pushDirectory (const std::string &dir)
Pathresolve (const Path &path)
 Appends the given path.
void setBaseName (const std::string &name)
 Returns the filename.
void setDevice (const std::string &device)
 Returns the node name.
void setExtension (const std::string &extension)
void setFileName (const std::string &name)
 Removes the last directory from the directory list.
void setNode (const std::string &node)
void swap (Path &path)
 Assigns a string containing a path in native format.
std::string toString (Style style) const
 Returns a string containing the path in native format.
std::string toString () const
 Assigns a string containing a path.
bool tryParse (const std::string &path, Style style)
bool tryParse (const std::string &path)
 Assigns a string containing a path.
const std::string & version () const
 Returns the filename extension.
 ~Path ()

Static Public Member Functions

static std::string current ()
static std::string expand (const std::string &path)
 Returns the name of the null device.
static bool find (const std::string &pathList, const std::string &name, Path &path)
static bool find (StringVec::const_iterator it, StringVec::const_iterator end, const std::string &name, Path &path)
static Path forDirectory (const std::string &path, Style style)
 Creates a path referring to a directory.
static Path forDirectory (const std::string &path)
static std::string home ()
 Returns the current working directory.
static void listRoots (std::vector< std::string > &roots)
static std::string null ()
 Returns the temporary directory.
static char pathSeparator ()
static char separator ()
 Creates a path referring to a directory.
static std::string temp ()
 Returns the user's home directory.
static std::string transcode (const std::string &path)

Protected Member Functions

std::string buildUnix () const
std::string buildVMS () const
std::string buildWindows () const
void parseGuess (const std::string &path)
void parseUnix (const std::string &path)
void parseVMS (const std::string &path)
void parseWindows (const std::string &path)

Private Attributes

bool _absolute
std::string _device
StringVec _dirs
std::string _name
std::string _node
std::string _version

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index