NewNet::Path Class Reference

Helper class for file-path manipulation. More...

#include <nnpath.h>

List of all members.

Public Member Functions

 Path ()
 Constructor.
 Path (const std::string &path)
 Constructor.
 Path (const std::vector< std::string > &path)
 Constructor.
const std::string & path () const
 Return the current path as a string.
bool isAbsolute () const
 Check if path is absolute.
std::vector< std::string > split () const
 Split the path.
Path simplified () const
 Return a simplified version of the path.
Path absolute (const std::string &base=std::string()) const
 Return an absolute version of the current path.

Static Public Member Functions

static char seperator ()
 Return the platform's directory seperator.
static Path currentDir ()
 Return the current working directory.


Detailed Description

This class provides helper functions for dealing with file-path manipulation

Definition at line 32 of file nnpath.h.


Constructor & Destructor Documentation

NewNet::Path::Path (  )  [inline]

Default constructor leaves the path empty

Definition at line 37 of file nnpath.h.

Referenced by absolute(), currentDir(), and simplified().

NewNet::Path::Path ( const std::string &  path  )  [inline]

Point at a specific path.

Definition at line 43 of file nnpath.h.

NewNet::Path::Path ( const std::vector< std::string > &  path  ) 

Constructs the path from a vector of path pieces.

Definition at line 24 of file nnpath.cpp.

References seperator().


Member Function Documentation

static char NewNet::Path::seperator (  )  [inline, static]

Return the platform's directory seperator.

Definition at line 59 of file nnpath.h.

Referenced by absolute(), Path(), and split().

bool NewNet::Path::isAbsolute (  )  const

Checks if the current path is absolute.

Definition at line 39 of file nnpath.cpp.

Referenced by absolute(), and simplified().

std::vector< std::string > NewNet::Path::split (  )  const

Split the path at the directory separator.

Definition at line 49 of file nnpath.cpp.

References path(), and seperator().

Referenced by simplified().

NewNet::Path NewNet::Path::simplified (  )  const

This removes any unnecessary and resolvable '..', '.' and empty elements from the path.

Definition at line 68 of file nnpath.cpp.

References isAbsolute(), Path(), and split().

NewNet::Path NewNet::Path::absolute ( const std::string &  base = std::string()  )  const

Return an absolute version of the current path. If the path isn't absolute already, base will be used as a base path. If base is an empty string, the current working directory will be used

Definition at line 91 of file nnpath.cpp.

References absolute(), currentDir(), isAbsolute(), Path(), path(), and seperator().

Referenced by absolute().

NewNet::Path NewNet::Path::currentDir (  )  [static]

This returns the current working directory

Definition at line 109 of file nnpath.cpp.

References Path(), and path().

Referenced by absolute().


The documentation for this class was generated from the following files:
Generated on Sun Jan 7 14:00:01 2007 for NewNet by  doxygen 1.5.1