VMime
path Class Reference
Inheritance diagram for path:
Collaboration diagram for path:

Public Types

typedef vmime::word component
 
typedef std::vector< componentlist
 

Public Member Functions

 path ()
 
 path (const component &c)
 
 path (const path &p)
 
 path (const string &s)
 
path operator/ (const path &p) const
 
path operator/ (const component &c) const
 
pathoperator/= (const path &p)
 
pathoperator/= (const component &c)
 
path getParent () const
 
pathoperator= (const path &p)
 
pathoperator= (const component &c)
 
bool operator== (const path &p) const
 
bool operator!= (const path &p) const
 
void appendComponent (const component &c)
 
const componentgetComponentAt (const size_t pos) const
 
componentgetComponentAt (const size_t pos)
 
bool isEmpty () const
 
bool isRoot () const
 
const component getLastComponent () const
 
componentgetLastComponent ()
 
size_t getSize () const
 
const componentoperator[] (const size_t x) const
 
componentoperator[] (const size_t x)
 
bool isDirectParentOf (const path &p) const
 
bool isParentOf (const path &p) const
 
void renameParent (const path &oldPath, const path &newPath)
 
const string toString (const string &sep, const charset &cset) const
 

Static Public Member Functions

static path fromString (const string &str, const string &sep, const charset &cset)
 

Additional Inherited Members

- Protected Member Functions inherited from object
 object ()
 
 object (const object &)
 
objectoperator= (const object &)
 
virtual ~object ()
 

Detailed Description

Abstract representation of a path (filesystem, mailbox, etc).

Member Typedef Documentation

typedef std::vector<component> list

Constructor & Destructor Documentation

path ( const component c)
path ( const path p)
path ( const string s)
explicit

Member Function Documentation

void appendComponent ( const component c)

Append a component to the path.

Parameters
ccomponent to add

Referenced by path::fromString().

path fromString ( const string str,
const string sep,
const charset cset 
)
static

Construct a new path from a string.

Parameters
strstring representation of the path
sepseparator string (eg: "/")
csetcharset in which the path is encoded (use the value returned by vmime::charset::getLocalCharset() to use the default charset of your system)
Returns
a new path corresponding to the specified string

References path::appendComponent(), vmime::end(), and vmime::npos.

const path::component & getComponentAt ( const size_t  pos) const

Return the component at the specified position.

Parameters
posposition
Returns
component at position 'pos'
path::component & getComponentAt ( const size_t  pos)

Return the component at the specified position.

Parameters
posposition
Returns
component at position 'pos'
path::component & getLastComponent ( )

Return the last component of this path (non-const version).

Returns
last component
bool isDirectParentOf ( const path p) const

Test whether this path is a direct parent of another one.

Parameters
pother path
Returns
true if the specified path is a child of this path, false otherwise

References path::getSize().

Referenced by IMAPFolder::getFolders().

bool isParentOf ( const path p) const

Test whether this path is a parent of another one.

Parameters
pother path
Returns
true if the specified path is a child (direct or indirect) of this path, false otherwise

References path::getSize().

Referenced by maildirFolder::rename(), and IMAPFolder::rename().

bool isRoot ( ) const

Test whether this path is the root (alias for isEmpty()).

Returns
true if the path is the root

Referenced by courierMaildirFormat::folderExists(), courierMaildirFormat::folderPathToFileSystemPath(), and courierMaildirFormat::listDirectories().

bool operator!= ( const path p) const
path operator/ ( const path p) const
path operator/ ( const component c) const
path & operator/= ( const path p)
path & operator/= ( const component c)
path & operator= ( const path p)
path & operator= ( const component c)
bool operator== ( const path p) const
const path::component & operator[] ( const size_t  x) const

Return the specified component of the path (const version).

Parameters
xindex of the component
Returns
component at the specified index
path::component & operator[] ( const size_t  x)

Return the specified component of the path (non-const version).

Parameters
xindex of the component
Returns
component at the specified index
void renameParent ( const path oldPath,
const path newPath 
)

Rename a parent component in the path.

Example: path("a/b/c/d").renameParent("a/b", "x/y/z") will return path("x/y/z/c/d").

Parameters
oldPathold parent path
newPathnew parent path

References path::getSize(), and path::isEmpty().

Referenced by courierMaildirFormat::renameFolder().

const string toString ( const string sep,
const charset cset 
) const

Returns a string representation of this path.

Parameters
sepseparator string (eg: "/")
csetcharset in which to encode the components (use the value returned by vmime::charset::getLocalCharset() to use the default charset of your system)
Returns
a string representing this path

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