VMime
path Class Reference

#include <path.hpp>

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

◆ component

◆ list

typedef std::vector<component> list

Constructor & Destructor Documentation

◆ path() [1/4]

◆ path() [2/4]

path ( const component & c)

◆ path() [3/4]

path ( const path & p)

References object::object(), and path().

◆ path() [4/4]

path ( const string & s)
explicit

Member Function Documentation

◆ appendComponent()

void appendComponent ( const component & c)

Append a component to the path.

Parameters
ccomponent to add

Referenced by fromString().

◆ 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 appendComponent(), vmime::end(), and path().

◆ getComponentAt() [1/2]

path::component & getComponentAt ( const size_t pos)

Return the component at the specified position.

Parameters
posposition
Returns
component at position 'pos'

◆ getComponentAt() [2/2]

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

Return the component at the specified position.

Parameters
posposition
Returns
component at position 'pos'

◆ getLastComponent() [1/2]

path::component & getLastComponent ( )

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

Returns
last component

◆ getLastComponent() [2/2]

const path::component getLastComponent ( ) const

◆ getParent()

path getParent ( ) const

References isEmpty(), and path().

◆ getSize()

size_t getSize ( ) const

Return the number of components in this path.

Returns
number of components

Referenced by isDirectParentOf(), isParentOf(), courierMaildirFormat::listDirectories(), courierMaildirFormat::listFolders(), and renameParent().

◆ isDirectParentOf()

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 getSize(), and path().

◆ isEmpty()

bool isEmpty ( ) const

Test whether this path is empty (root).

Returns
true if the path is empty (no components = root)

Referenced by getParent(), kmailMaildirFormat::listFoldersImpl(), IMAPFolder::rename(), maildirFolder::rename(), and renameParent().

◆ isParentOf()

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 getSize(), and path().

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

◆ isRoot()

bool isRoot ( ) const

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

Returns
true if the path is the root

Referenced by courierMaildirFormat::listDirectories().

◆ operator!=()

bool operator!= ( const path & p) const

References path().

◆ operator/() [1/2]

path operator/ ( const component & c) const

References path().

◆ operator/() [2/2]

path operator/ ( const path & p) const

References path().

◆ operator/=() [1/2]

path & operator/= ( const component & c)

References path().

◆ operator/=() [2/2]

path & operator/= ( const path & p)

References path().

◆ operator=() [1/2]

path & operator= ( const component & c)

References path().

◆ operator=() [2/2]

path & operator= ( const path & p)

References path().

◆ operator==()

bool operator== ( const path & p) const

References path().

◆ operator[]() [1/2]

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

◆ operator[]() [2/2]

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

◆ renameParent()

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 getSize(), isEmpty(), and path().

Referenced by courierMaildirFormat::renameFolder().

◆ toString()

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: