Model Railroad System  2.2.1
Public Member Functions | Private Attributes | List of all members
TTSupport::PathName Class Reference

A Class that portably represents a pathname. More...

#include <PathName.h>

Public Member Functions

 PathName ()
 Default constructor. More...
 
 PathName (const char *p)
 Constructor, given a plain C string. More...
 
 PathName (string p)
 Constructor, given a STL basic_string. More...
 
 PathName (const PathName &other)
 Copy constructor. More...
 
 ~PathName ()
 Destructor. More...
 
PathNameoperator= (PathName other)
 Assignment operator, from another pathname. More...
 
PathNameoperator= (string name)
 Assignment operator, from a string. More...
 
bool operator== (const PathName other) const
 Equality operator. More...
 
bool operator< (const PathName other) const
 Less than operator. More...
 
bool operator> (const PathName other) const
 Greater than operator. More...
 
bool operator<= (const PathName other) const
 Less than or equal operator. More...
 
bool operator>= (const PathName other) const
 Greater than or equal operator. More...
 
bool SameDirectory (const PathName other) const
 Are the two pathnames in the same directory? More...
 
string Tail () const
 Return the last pathname component. More...
 
string Dirname () const
 Return only the directory name. More...
 
string Extension () const
 Return only the extension. More...
 
string FullPath () const
 Return the full pathname. More...
 
stringVector Split () const
 Return a list of pathname components. More...
 
char PathSeparator () const
 Return the pathname separater character. More...
 
PathName operator+ (const PathName other)
 Concatenate pathnames. More...
 
PathName operator+ (string tail)
 Concatenate a string to the tail of a pathname. More...
 
PathNameoperator+= (const PathName other)
 Append a pathname. More...
 
PathNameoperator+= (string tail)
 Append a string. More...
 

Private Attributes

string pathname
 The pathname string. More...
 

Detailed Description

A Class that portably represents a pathname.

This class implements a pathname object in a portable, cross platform way.

Author
Robert Heller <heller@deepsoft.com>

Constructor & Destructor Documentation

◆ PathName() [1/4]

TTSupport::PathName::PathName ( )
inline

Default constructor.

References pathname.

◆ PathName() [2/4]

TTSupport::PathName::PathName ( const char *  p)
inline

Constructor, given a plain C string.

Parameters
pThe plain C string.

References pathname.

◆ PathName() [3/4]

TTSupport::PathName::PathName ( string  p)
inline

Constructor, given a STL basic_string.

Parameters
pThe STL basic_string.

References pathname.

◆ PathName() [4/4]

TTSupport::PathName::PathName ( const PathName other)
inline

Copy constructor.

Parameters
otherThe other instance.

References pathname.

◆ ~PathName()

TTSupport::PathName::~PathName ( )
inline

Destructor.

Member Function Documentation

◆ Dirname()

string TTSupport::PathName::Dirname ( ) const

Return only the directory name.

Referenced by SameDirectory().

◆ Extension()

string TTSupport::PathName::Extension ( ) const

Return only the extension.

Referenced by SameDirectory().

◆ FullPath()

string TTSupport::PathName::FullPath ( ) const
inline

Return the full pathname.

References operator+(), operator+=(), pathname, PathSeparator(), and Split().

◆ operator+() [1/2]

PathName TTSupport::PathName::operator+ ( const PathName  other)

Concatenate pathnames.

Parameters
otherThe other instance.

Referenced by FullPath().

◆ operator+() [2/2]

PathName TTSupport::PathName::operator+ ( string  tail)

Concatenate a string to the tail of a pathname.

Parameters
tailThe STL basic_string.

◆ operator+=() [1/2]

PathName& TTSupport::PathName::operator+= ( const PathName  other)

Append a pathname.

Parameters
otherThe other instance.

Referenced by FullPath().

◆ operator+=() [2/2]

PathName& TTSupport::PathName::operator+= ( string  tail)

Append a string.

Parameters
tailThe STL basic_string.

◆ operator<()

bool TTSupport::PathName::operator< ( const PathName  other) const
inline

Less than operator.

Parameters
otherThe other instance.

References pathname.

◆ operator<=()

bool TTSupport::PathName::operator<= ( const PathName  other) const
inline

Less than or equal operator.

Parameters
otherThe other instance.

References pathname.

◆ operator=() [1/2]

PathName& TTSupport::PathName::operator= ( PathName  other)
inline

Assignment operator, from another pathname.

Parameters
otherThe other instance.

References pathname.

◆ operator=() [2/2]

PathName& TTSupport::PathName::operator= ( string  name)
inline

Assignment operator, from a string.

Parameters
nameThe STL basic_string.

References pathname.

◆ operator==()

bool TTSupport::PathName::operator== ( const PathName  other) const
inline

Equality operator.

Parameters
otherThe other instance.

References pathname.

◆ operator>()

bool TTSupport::PathName::operator> ( const PathName  other) const
inline

Greater than operator.

Parameters
otherThe other instance.

References pathname.

◆ operator>=()

bool TTSupport::PathName::operator>= ( const PathName  other) const
inline

Greater than or equal operator.

Parameters
otherThe other instance.

References pathname.

◆ PathSeparator()

char TTSupport::PathName::PathSeparator ( ) const

Return the pathname separater character.

Referenced by FullPath().

◆ SameDirectory()

bool TTSupport::PathName::SameDirectory ( const PathName  other) const
inline

Are the two pathnames in the same directory?

Parameters
otherThe other instance.

References Dirname(), Extension(), and Tail().

◆ Split()

stringVector TTSupport::PathName::Split ( ) const

Return a list of pathname components.

Referenced by FullPath().

◆ Tail()

string TTSupport::PathName::Tail ( ) const

Return the last pathname component.

Referenced by SameDirectory().

Member Data Documentation

◆ pathname

string TTSupport::PathName::pathname
private