Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

CdbPathName Class Reference

This class facilitates path name operations. More...

#include <CdbPathName.hh>

List of all members.

Public Member Functions

 CdbPathName (const char *theStr=0)
 The normal & default constructor.

 CdbPathName (const std::string &theStr)
 Construct an object from a string.

 CdbPathName (const CdbPathName &thePath)
 The copy constructor.

 ~CdbPathName ()
 The destructor.

CdbPathName & operator= (const CdbPathName &thePath)
 The assignment operator.

bool isValid () const
 Check if the path has the valid state.

bool isAbsolute () const
 Check if the path is an ABSOLUTE one.

bool isRoot () const
 Check if the path corresponds to the "root" path.

bool isComposite () const
 Check if the path is a COMPOSITE one.

CdbPathName first () const
 Get the first element in the path.

CdbPathName afterFirst () const
 Get the rest of the path after (excluding) the first element.

CdbPathName last () const
 Get the last element in the path.

CdbPathName beforeLast () const
 Get the beginning of the path before (excluding) the last element.

std::string toString () const
 The explicit conversion.

CdbPathName operator+ (const CdbPathName &thePath) const
 Add one path to the other one.

CdbPathName operator+ (const char *theStr) const
 Add a C-style string to a path.

CdbPathName operator+ (const std::string &theStr) const
 Add a C++ string to a path.

CdbIItr< CdbPathName > * iterator () const
 Return an iterator to iterate over the elements of a path.

void dump (std::ostream &theStream, const std::string &thePrefix="") const
 Dump the internal state of the object.


Static Public Member Functions

const char * separator ()
 The separator of path elements.

std::string separatorTerminated (const std::string &theName)
 Produce a name ending with the folder separator.


Friends

class CdbPathNameItr


Detailed Description

This class facilitates path name operations.

Details to come...

Definition at line 19 of file CdbPathName.hh.


Constructor & Destructor Documentation

CdbPathName::CdbPathName const char *    theStr = 0 [explicit]
 

The normal & default constructor.

Loads the path from specified string. This constructor expects a string pointer to be passed as value of the parameter. If this is a null pointer or if it points onto a non-translatable string then the new object will remain in the invalid state.

See also:
CdbPathName::isValid()

Definition at line 45 of file CdbPathName.cc.

Referenced by afterFirst(), beforeLast(), first(), last(), and operator+().

CdbPathName::CdbPathName const std::string &    theStr [explicit]
 

Construct an object from a string.

A non-empty string is expected. Otherwise the object will be put into a non-valid state.

See also:
CdbPathName::isValid()

Definition at line 56 of file CdbPathName.cc.

CdbPathName::CdbPathName const CdbPathName &    thePath
 

The copy constructor.

Definition at line 79 of file CdbPathName.cc.

CdbPathName::~CdbPathName  
 

The destructor.

Definition at line 88 of file CdbPathName.cc.


Member Function Documentation

CdbPathName CdbPathName::afterFirst   const
 

Get the rest of the path after (excluding) the first element.

More details...

Definition at line 137 of file CdbPathName.cc.

References CdbPathName().

Referenced by CdbMySQLView::create_folder(), CdbMySQLFolder::create_folder(), CdbRooRoViewR::createFolder(), CdbRooRoFolderR::createFolder(), CdbBdbSViewP::createFolder(), CdbMySQLView::exclude_condition(), CdbMySQLFolder::exclude_condition(), CdbMySQLView::find_condition(), CdbMySQLFolder::find_condition(), CdbMySQLView::find_folder(), CdbMySQLFolder::find_folder(), CdbRooRoFolderR::findCondition(), CdbBdbSFolderP::findCondition(), CdbRooRoViewR::findFolder(), CdbRooRoFolderR::findFolder(), CdbBdbSViewP::findFolder(), CdbBdbSFolderP::findFolder(), CdbMySQLView::include_condition(), CdbMySQLFolder::include_condition(), and main().

CdbPathName CdbPathName::beforeLast   const
 

Get the beginning of the path before (excluding) the last element.

More details...

Definition at line 159 of file CdbPathName.cc.

References CdbPathName().

Referenced by CdbSQLApiView::configIterator(), CdbRooRoViewR::findCondition(), CdbBdbSViewP::findCondition(), CdbSQLApiView::get(), CdbBdbWView::get(), CdbFolder::instance(), CdbCondition::instance(), main(), CdbRooRoViewR::removeCondition(), CdbBdbSViewP::removeCondition(), CdbRooRoViewR::removeFolder(), and CdbBdbSViewP::removeFolder().

void CdbPathName::dump std::ostream &    theStream,
const std::string &    thePrefix = ""
const
 

Dump the internal state of the object.

Definition at line 241 of file CdbPathName.cc.

CdbPathName CdbPathName::first   const
 

Get the first element in the path.

More details...

Definition at line 130 of file CdbPathName.cc.

References CdbPathName().

Referenced by CdbMySQLFolder::create_folder(), CdbRooRoFolderR::createFolder(), CdbMySQLFolder::exclude_condition(), CdbMySQLFolder::find_condition(), CdbMySQLFolder::find_folder(), CdbRooRoFolderR::findCondition(), CdbBdbSFolderP::findCondition(), CdbRooRoFolderR::findFolder(), CdbBdbSFolderP::findFolder(), CdbMySQLFolder::include_condition(), and main().

bool CdbPathName::isAbsolute   const
 

Check if the path is an ABSOLUTE one.

Every absolute path begins with the "root" path. The "root" path itself is just a case of an absolute path.

Definition at line 118 of file CdbPathName.cc.

Referenced by CdbSQLApiView::configIterator(), CdbRooRoView::configIterator(), CdbBdbSView::configIterator(), CdbMySQLView::create_folder(), CdbMySQLFolder::create_folder(), CdbRooRoViewR::createFolder(), CdbRooRoFolderR::createFolder(), CdbBdbSViewP::createFolder(), CdbMySQLView::exclude_condition(), CdbMySQLFolder::exclude_condition(), CdbMySQLView::find_condition(), CdbMySQLFolder::find_condition(), CdbMySQLView::find_folder(), CdbMySQLFolder::find_folder(), CdbSQLApiFolder::findCondition(), CdbRooRoViewR::findCondition(), CdbRooRoFolderR::findCondition(), CdbRooRoFolder::findCondition(), CdbBdbWFolder::findCondition(), CdbBdbSViewP::findCondition(), CdbBdbSFolderP::findCondition(), CdbBdbSFolder::findCondition(), CdbSQLApiFolder::findFolder(), CdbRooRoViewR::findFolder(), CdbRooRoFolderR::findFolder(), CdbRooRoFolder::findFolder(), CdbBdbSViewP::findFolder(), CdbBdbSFolderP::findFolder(), CdbBdbSFolder::findFolder(), CdbSQLApiView::get(), CdbRooRoView::get(), CdbBdbWView::get(), CdbBdbSView::get(), CdbMySQLView::include_condition(), CdbMySQLFolder::include_condition(), CdbRooRoFolderR::insert(), CdbFolder::instance(), CdbCondition::instance(), operator+(), CdbRooRoFolderR::removeCondition(), and CdbRooRoFolderR::removeFolder().

bool CdbPathName::isComposite   const
 

Check if the path is a COMPOSITE one.

A composite path is made from more than one simple token.

Definition at line 124 of file CdbPathName.cc.

Referenced by CdbSQLApiView::configIterator(), CdbRooRoView::configIterator(), CdbBdbSView::configIterator(), CdbMySQLView::create_folder(), CdbMySQLFolder::create_folder(), CdbRooRoViewR::createCondition(), CdbBdbSViewP::createCondition(), CdbRooRoViewR::createFolder(), CdbRooRoFolderR::createFolder(), CdbBdbSViewP::createFolder(), CdbMySQLView::exclude_condition(), CdbMySQLFolder::exclude_condition(), CdbMySQLView::find_condition(), CdbMySQLFolder::find_condition(), CdbMySQLFolder::find_folder(), CdbSQLApiFolder::findCondition(), CdbRooRoFolderR::findCondition(), CdbRooRoFolder::findCondition(), CdbBdbWFolder::findCondition(), CdbBdbSFolderP::findCondition(), CdbBdbSFolder::findCondition(), CdbSQLApiFolder::findFolder(), CdbRooRoFolderR::findFolder(), CdbRooRoFolder::findFolder(), CdbBdbSFolderP::findFolder(), CdbBdbSFolder::findFolder(), CdbSQLApiView::get(), CdbRooRoView::get(), CdbBdbWView::get(), CdbBdbSView::get(), CdbMySQLView::include_condition(), CdbMySQLFolder::include_condition(), CdbRooRoFolderR::insert(), CdbRooRoFolderR::removeCondition(), and CdbRooRoFolderR::removeFolder().

bool CdbPathName::isRoot   const
 

Check if the path corresponds to the "root" path.

More details...

Definition at line 112 of file CdbPathName.cc.

Referenced by CdbMySQLView::create_folder(), CdbRooRoViewR::createCondition(), CdbBdbSViewP::createCondition(), CdbRooRoViewR::createFolder(), CdbRooRoFolderR::createFolder(), CdbBdbSViewP::createFolder(), CdbMySQLView::exclude_condition(), CdbMySQLView::find_condition(), CdbMySQLView::find_folder(), CdbSQLApiFolder::findCondition(), CdbRooRoViewR::findCondition(), CdbRooRoFolder::findCondition(), CdbBdbSViewP::findCondition(), CdbBdbSFolder::findCondition(), CdbSQLApiFolder::findFolder(), CdbRooRoViewR::findFolder(), CdbRooRoFolder::findFolder(), CdbBdbSViewP::findFolder(), CdbBdbSFolder::findFolder(), CdbMySQLView::include_condition(), CdbFolder::instance(), CdbCondition::instance(), CdbRooRoViewR::removeCondition(), CdbBdbSViewP::removeCondition(), CdbRooRoViewR::removeFolder(), and CdbBdbSViewP::removeFolder().

bool CdbPathName::isValid   const
 

Check if the path has the valid state.

Any other operations with a path object can only make sense if this method will return true.

Definition at line 106 of file CdbPathName.cc.

Referenced by CdbSQLApiView::configIterator(), CdbRooRoView::configIterator(), CdbBdbSView::configIterator(), CdbMySQLView::create_folder(), CdbMySQLFolder::create_folder(), CdbRooRoViewR::createCondition(), CdbBdbSViewP::createCondition(), CdbRooRoViewR::createFolder(), CdbRooRoFolderR::createFolder(), CdbBdbSViewP::createFolder(), CdbMySQLView::exclude_condition(), CdbMySQLFolder::exclude_condition(), CdbMySQLView::find_condition(), CdbMySQLFolder::find_condition(), CdbMySQLView::find_folder(), CdbMySQLFolder::find_folder(), CdbSQLApiFolder::findCondition(), CdbRooRoViewR::findCondition(), CdbRooRoFolderR::findCondition(), CdbRooRoFolder::findCondition(), CdbBdbWFolder::findCondition(), CdbBdbSViewP::findCondition(), CdbBdbSFolderP::findCondition(), CdbBdbSFolder::findCondition(), CdbSQLApiFolder::findFolder(), CdbRooRoViewR::findFolder(), CdbRooRoFolderR::findFolder(), CdbRooRoFolder::findFolder(), CdbBdbSViewP::findFolder(), CdbBdbSFolderP::findFolder(), CdbBdbSFolder::findFolder(), CdbSQLApiView::get(), CdbRooRoView::get(), CdbBdbWView::get(), CdbBdbSView::get(), CdbMySQLView::include_condition(), CdbMySQLFolder::include_condition(), CdbRooRoFolderR::insert(), CdbFolder::instance(), CdbCondition::instance(), operator+(), CdbRooRoViewR::removeCondition(), CdbRooRoFolderR::removeCondition(), CdbBdbSViewP::removeCondition(), CdbRooRoViewR::removeFolder(), CdbRooRoFolderR::removeFolder(), and CdbBdbSViewP::removeFolder().

CdbIItr< CdbPathName > * CdbPathName::iterator   const
 

Return an iterator to iterate over the elements of a path.

The iterator will return elements of the path in a form of path objects.

Definition at line 235 of file CdbPathName.cc.

References CdbPathNameItr.

Referenced by main().

CdbPathName CdbPathName::last   const
 

Get the last element in the path.

More details...

Definition at line 152 of file CdbPathName.cc.

References CdbPathName().

Referenced by CdbSQLApiView::configIterator(), CdbRooRoViewR::findCondition(), CdbBdbSViewP::findCondition(), CdbSQLApiView::get(), CdbBdbWView::get(), CdbFolder::instance(), CdbCondition::instance(), main(), CdbRooRoViewR::removeCondition(), CdbBdbSViewP::removeCondition(), CdbRooRoViewR::removeFolder(), CdbBdbSViewP::removeFolder(), CdbRooProxyElement::shortName(), CdbProxyElement::shortName(), and CdbBdbProxyElement::shortName().

CdbPathName CdbPathName::operator+ const std::string &    theStr const
 

Add a C++ string to a path.

Definition at line 229 of file CdbPathName.cc.

References CdbPathName(), and operator+().

CdbPathName CdbPathName::operator+ const char *    theStr const
 

Add a C-style string to a path.

Definition at line 223 of file CdbPathName.cc.

References CdbPathName(), and operator+().

CdbPathName CdbPathName::operator+ const CdbPathName &    thePath const
 

Add one path to the other one.

Definition at line 180 of file CdbPathName.cc.

References _tokens, CdbPathName(), isAbsolute(), and isValid().

Referenced by operator+().

CdbPathName & CdbPathName::operator= const CdbPathName &    thePath
 

The assignment operator.

Definition at line 92 of file CdbPathName.cc.

References _isAbsolute, _isComposite, _isRoot, _isValid, _name, and _tokens.

const char * CdbPathName::separator   [static]
 

The separator of path elements.

This separator is also used as the name of the "root" path.

Definition at line 21 of file CdbPathName.cc.

Referenced by CdbMySQLView::create_folder(), CdbMySQLView::exclude_condition(), CdbMySQLView::find_condition(), CdbSQLApiView::findFolder(), CdbRooRoView::findFolder(), CdbBdbWView::findFolder(), CdbBdbSView::findFolder(), CdbSQLFolder::fullPathName(), CdbMySQLView::include_condition(), CdbRooRoFolderR::insert(), main(), CdbRooRoFolderRItr::next(), CdbRooRoConditionAtFolderRItr::next(), CdbBdbSFolderPItr::next(), CdbRooRoFolderR::removeCondition(), CdbRooRoFolderR::removeFolder(), separatorTerminated(), and CdbBdbWFolderItr::value().

std::string CdbPathName::separatorTerminated const std::string &    theName [static]
 

Produce a name ending with the folder separator.

The method would ensure that the output string produced out of the input one has a path name separator in its end.

EXAMPLE:

Input Output ------- ------ ** ERROR ** "" ** ERROR ** "/" "/" "abc" "abc/" "efg/" "efg/" "xyz//" "xyz//"

The method won't attempt to sqeeze multiple separators as in case of the "xyz//" example shown above into a single one.

Also, the input string should not be empty (non-initialized) and its length must be at least 1.

IMPORTANT NOTE:

If the input string is empty or it has zero characters then the method would crash the application. That's because the method doesn't have a clean way to tell a caller abouta wrong value of the parameter. In the end passing an empty string into this method is most likely a result of either a serious bug in an application's logic, or a sign of a memory corruption.

Definition at line 27 of file CdbPathName.cc.

References separator().

Referenced by main().

std::string CdbPathName::toString   const
 

The explicit conversion.

Definition at line 174 of file CdbPathName.cc.

Referenced by CdbSQLApiView::configIterator(), CdbMySQLView::create_folder(), CdbMySQLFolder::create_folder(), CdbRooRoViewR::createFolder(), CdbRooRoFolderR::createFolder(), CdbBdbSViewP::createFolder(), CdbMySQLView::exclude_condition(), CdbMySQLFolder::exclude_condition(), CdbMySQLView::find_condition(), CdbMySQLFolder::find_condition(), CdbMySQLView::find_folder(), CdbMySQLFolder::find_folder(), CdbRooRoViewR::findCondition(), CdbRooRoFolderR::findCondition(), CdbBdbWFolder::findCondition(), CdbBdbSViewP::findCondition(), CdbBdbSFolderP::findCondition(), CdbRooRoViewR::findFolder(), CdbRooRoFolderR::findFolder(), CdbBdbSFolderP::findFolder(), CdbCondition::fullPathName(), CdbSQLApiView::get(), CdbBdbWView::get(), CdbMySQLView::include_condition(), CdbMySQLFolder::include_condition(), CdbFolder::instance(), CdbCondition::instance(), main(), operator<<(), CdbRooRoViewR::removeCondition(), CdbBdbSViewP::removeCondition(), CdbRooRoViewR::removeFolder(), CdbBdbSViewP::removeFolder(), CdbRooProxyElement::shortName(), CdbProxyElement::shortName(), and CdbBdbProxyElement::shortName().


Friends And Related Function Documentation

friend class CdbPathNameItr [friend]
 

Definition at line 21 of file CdbPathName.hh.

Referenced by iterator().


The documentation for this class was generated from the following files:
Generated on Mon Dec 5 18:22:23 2005 for CDB by doxygen1.3-rc3