limal::path::PathName Class Reference

PathName manipulation class. More...

#include <PathName.hpp>

List of all members.

Public Types

typedef BLOCXX_NAMESPACE::List
< BLOCXX_NAMESPACE::String > 
List

Public Member Functions

 PathName ()
 Create an empty PathName object.
 PathName (const PathName &path)
 Create a Copy of a PathName object.
 PathName (const PathName::List &list)
 Create a new PathName object from a PathName::List.
 PathName (const BLOCXX_NAMESPACE::String &name)
 Create a new PathName object from a blocxx::String.
 PathName (const char *name)
 Create a new PathName object from a c string.
virtual ~PathName ()
PathNameoperator= (const PathName &path)
 Assigns path to this PathName object and returns a reference to it.
PathNameoperator+= (const PathName &path)
 Appends path to this PathName object and a reference to it.
BLOCXX_NAMESPACE::String toString () const
 Returns the complete path this PathName object holds.
PathName::List toList () const
 Returns the path this PathName object holds, as a PathName::List. The first element of that list is either the prefix, or, if there is no drive prefix it's an empty string.
BLOCXX_NAMESPACE::String prefix () const
 Returns the path prefix if existent, otherwise "".
bool empty () const
 Returns true if this PathName object holds an empty path.
bool absolute () const
 Returns true if this PathName object holds an absolute Path.
bool relative () const
 Returns true if this PathName object holds an relative path.
PathName dirName () const
 Returns the directory part of the path string.
BLOCXX_NAMESPACE::String baseName () const
 Returns the base name part of the path string.
PathName absoluteName () const
 Returns the absolute name of the path string this object holds.
PathName relativeName () const
 Returns the relative name of the path string this object holds.
PathName cat (const PathName &add) const
 Create a new PathName object from the concatenation of this and add.
PathName extend (const BLOCXX_NAMESPACE::String &ext) const
 Create a new PathName object by extending this PathName object by ext.
bool equal (const PathName &rpath) const
 Test for equality of this and rpath.

Static Public Member Functions

static PathName dirName (const PathName &path)
 Returns the directory part of path
static BLOCXX_NAMESPACE::String baseName (const PathName &path)
 Returns the base name part of path
static PathName absoluteName (const PathName &path)
 Returns the absolute name of path.
static PathName relativeName (const PathName &path)
 Returns the relative name of path.
static PathName cat (const PathName &path, const PathName &add)
 Create a new PathName object by concatenating two existing ones.
static PathName extend (const PathName &path, const BLOCXX_NAMESPACE::String &ext)
 Create a new PathName object by extending path by ext.
static bool equal (const PathName &lpath, const PathName &rpath)
 Static function to test for equality of two PathName objects.

Protected Member Functions

void assign (const BLOCXX_NAMESPACE::String &path)
 Assigns path to this PathName objects m_name string.
void assign (const PathName::List &list)
 Assigns list to this PathName objects m_name string.

Private Attributes

size_t m_prefix
 holds index of first character in the path string after an (optional) drive letter.
BLOCXX_NAMESPACE::String m_name

Detailed Description

PathName manipulation class.

This class is intended for internal usage inside of LiMaL pluglibs and should never appear in the pluglib interface.


Member Typedef Documentation

typedef BLOCXX_NAMESPACE ::List< BLOCXX_NAMESPACE ::String> limal::path::PathName::List

Constructor & Destructor Documentation

limal::path::PathName::PathName (  ) 

Create an empty PathName object.

limal::path::PathName::PathName ( const PathName path  ) 

Create a Copy of a PathName object.

Parameters:
path The PathName object to be copied.
limal::path::PathName::PathName ( const PathName::List list  ) 

Create a new PathName object from a PathName::List.

Parameters:
list The PathName::List from which the new PathName object shall be created. The first element of this List has to be a prefix, or if there is no prefix an empty string.
Exceptions:
limal::ValueException 
limal::path::PathName::PathName ( const BLOCXX_NAMESPACE::String &  name  ) 

Create a new PathName object from a blocxx::String.

Parameters:
name The string from which the new PathName object shall be created.
Exceptions:
limal::ValueException 
limal::path::PathName::PathName ( const char *  name  ) 

Create a new PathName object from a c string.

Parameters:
name The character pointer to the c string from which the new PathName object shall be created.
Exceptions:
limal::ValueException 
virtual limal::path::PathName::~PathName (  )  [virtual]

Destructor


Member Function Documentation

bool limal::path::PathName::absolute (  )  const

Returns true if this PathName object holds an absolute Path.

Returns:
True if this PathName object holds an absolute path (like '/foo/bar').
static PathName limal::path::PathName::absoluteName ( const PathName path  )  [static]

Returns the absolute name of path.

 PathName p1("foo/bar/some_file");
 std::cout << absoluteName( p1 ); // == "/foo/bar/some_file"
Returns:
The absolute name form of path.
PathName limal::path::PathName::absoluteName (  )  const

Returns the absolute name of the path string this object holds.

 PathName p1("foo/bar/some_file");
 std::cout << p1.absoluteName(); // == "/foo/bar/some_file"
Returns:
The absolute name form of the path string.
void limal::path::PathName::assign ( const PathName::List list  )  [protected]

Assigns list to this PathName objects m_name string.

Takes the given path list, cleans it (i.e.: removing redundant parts from it like './foo/../bar/some_file" -> './bar/some_file') sets m_prefix and assigns the cleansed path string to m_path.

Parameters:
path path string that is to be assigned to this object.
Exceptions:
limal::ValueException 
void limal::path::PathName::assign ( const BLOCXX_NAMESPACE::String &  path  )  [protected]

Assigns path to this PathName objects m_name string.

Takes the given path string, cleans it (i.e.: removing redundant parts from it like './foo/../bar/some_file" -> './bar/some_file') sets m_prefix and assigns the cleansed path string to m_path.

Parameters:
path path string that is to be assigned to this object.
Exceptions:
limal::ValueException 
static BLOCXX_NAMESPACE ::String limal::path::PathName::baseName ( const PathName path  )  [static]

Returns the base name part of path

Returns the base name (i.e. the file name) of the path string. For example:

 PathName p1("/foo/bar/some_file");
 std::cout << PathName::baseName( p1 ); // == "some_file"
Parameters:
path The PathName object you want to inspect
Returns:
The file name part of the path string
BLOCXX_NAMESPACE ::String limal::path::PathName::baseName (  )  const

Returns the base name part of the path string.

Returns the base name (i.e. the file name) of the path string. For example:

 std::cout << PathName("/foo/bar/some_file").baseName(); // == "some_file"
Returns:
the file name part of the path string
static PathName limal::path::PathName::cat ( const PathName path,
const PathName add 
) [static]

Create a new PathName object by concatenating two existing ones.

Static function for concatenating two PathName objects. For example:

 PathName p1("/foo");
 PathName p2("bar/some_file");
 std::cout << PathName::cat( p1, p2 ); // == "/foo/bar/some_file"
Parameters:
path The front part of the resulting path.
add The part that is to be added.
Returns:
A PathName object that consists of the concatenation of the two arguments.
PathName limal::path::PathName::cat ( const PathName add  )  const

Create a new PathName object from the concatenation of this and add.

Creates a new PathName object consisting of the concatenation of this PathName object and add and returns it. For example:

 PathName p1("/foo");
 PathName p2("bar/some_file");
 std::cout <<  p1.cat( p2 ); // == "/foo/bar/some_file"
Parameters:
add Reference to the PathName object to be added to this object.
Returns:
A new PathName object consisting of the concatenation of this object and add.
static PathName limal::path::PathName::dirName ( const PathName path  )  [static]

Returns the directory part of path

Static function to aquire the directory part of a PathName object. For example:

 PathName p1("/foo/bar/some_file");
 std::cout << PathName::dirName(p1); // == "/foo/bar"
Parameters:
path The PathName object you want to inspect
Returns:
The substring of the path up to the file name (without prefix)
PathName limal::path::PathName::dirName (  )  const

Returns the directory part of the path string.

Returns the directory part of the path string this PathName object holds. For example:

 std::cout << PathName("/foo/bar/some_file").dirName(); // == "/foo/bar"
Returns:
The substring of the path up to the file name (without prefix)
bool limal::path::PathName::empty (  )  const

Returns true if this PathName object holds an empty path.

Returns:
True if this PathName object holds an empty path.
static bool limal::path::PathName::equal ( const PathName lpath,
const PathName rpath 
) [static]

Static function to test for equality of two PathName objects.

Parameters:
lpath Reference to PathName object one.
rpath Reference to PathName object two.
Returns:
True if lpath equals rpath.
bool limal::path::PathName::equal ( const PathName rpath  )  const

Test for equality of this and rpath.

Parameters:
rpath Reference to the PathName object that is to be compared to this object.
Returns:
True if path string of rpath equals the path string this object holds.
static PathName limal::path::PathName::extend ( const PathName path,
const BLOCXX_NAMESPACE::String &  ext 
) [static]

Create a new PathName object by extending path by ext.

Static function to create a new PathName object that consists of path extended by the string ext. Basically it just glues the two strings together and calls PathName( const blocxx::String ) For Example:

 PathName p1("/foo");
 blocxx::String strExt(".old");
 std::cout << PathName::extend(p1, strExt ); // == "/foo.old"
Parameters:
path Reference to a PathName object that is to be extended.
ext Reference to a blocxx::String containing the extension.
Returns:
A new PathName object that consists of path extended by ext.
PathName limal::path::PathName::extend ( const BLOCXX_NAMESPACE::String &  ext  )  const

Create a new PathName object by extending this PathName object by ext.

Use this function to create a new PathName object that consists of this PathName object extended by the string ext. Basically it just glues the two strings together and calls PathName( const blocxx::String ) For Example:

 PathName p1("/foo");
 blocxx::String strExt(".old");
 std::cout << p1.extend( strExt ); // == "/foo.old"
Parameters:
ext Reference to a blocxx::String containing the extension.
Returns:
A new PathName object that consists of path extended by ext.
PathName& limal::path::PathName::operator+= ( const PathName path  ) 

Appends path to this PathName object and a reference to it.

Parameters:
path The PathName object that is to be appended.
Returns:
A reference to this PathName object.
PathName& limal::path::PathName::operator= ( const PathName path  ) 

Assigns path to this PathName object and returns a reference to it.

Parameters:
path The PathName object to assign.
Returns:
A reference to this PathName object.
BLOCXX_NAMESPACE ::String limal::path::PathName::prefix (  )  const

Returns the path prefix if existent, otherwise "".

Returns the path prefix (i.e. drive letter), if the path this PathName object holds contains one (like in 'c:/foo/bar'), otherwise the empty string will be returned.

Returns:
prefix/drive letter or the empty string
bool limal::path::PathName::relative (  )  const

Returns true if this PathName object holds an relative path.

Returns:
True if this PathName object holds an relative path (like './foo/bar').
static PathName limal::path::PathName::relativeName ( const PathName path  )  [static]

Returns the relative name of path.

 PathName p1("/foo/bar/some_file");
 std::cout << relativeName( p1 ); // == "./foo/bar/some_file"
Returns:
The relative name form of path.
PathName limal::path::PathName::relativeName (  )  const

Returns the relative name of the path string this object holds.

 PathName p1("/foo/bar/some_file");
 std::cout << p1.relativeName(); // == "./foo/bar/some_file"
Returns:
The absolute name form of the path string.
PathName::List limal::path::PathName::toList (  )  const

Returns the path this PathName object holds, as a PathName::List. The first element of that list is either the prefix, or, if there is no drive prefix it's an empty string.

Returns:
The complete path this PathName object holds, as a PathName::List.
Exceptions:
limal::ValueException 
BLOCXX_NAMESPACE ::String limal::path::PathName::toString (  )  const

Returns the complete path this PathName object holds.

Returns:
The complete path this PathName object holds.

Member Data Documentation

BLOCXX_NAMESPACE ::String limal::path::PathName::m_name [private]

holds index of first character in the path string after an (optional) drive letter.


The documentation for this class was generated from the following file:
Generated on Mon Jul 5 22:01:31 2010 for limal by  doxygen 1.6.3