VMime
courierMaildirFormat Class Reference

#include <courierMaildirFormat.hpp>

Inheritance diagram for courierMaildirFormat:
Collaboration diagram for courierMaildirFormat:

Public Member Functions

 courierMaildirFormat (shared_ptr< context > ctx)
const string getName () const
void createFolder (const folder::path &path)
void destroyFolder (const folder::path &path)
void renameFolder (const folder::path &oldPath, const folder::path &newPath)
bool folderExists (const folder::path &path) const
bool folderHasSubfolders (const folder::path &path) const
const utility::file::path folderPathToFileSystemPath (const folder::path &path, const DirectoryType type) const
const std::vector< folder::pathlistFolders (const folder::path &root, const bool recursive) const

Protected Member Functions

bool supports () const
void renameFolderImpl (const folder::path &oldPath, const folder::path &newPath)
bool listDirectories (const folder::path &root, std::vector< string > &dirs, const bool onlyTestForExistence) const
Protected Member Functions inherited from maildirFormat
 maildirFormat (shared_ptr< context > ctx)
shared_ptr< contextgetContext ()
shared_ptr< const contextgetContext () const
Protected Member Functions inherited from object
 object ()
 object (const object &)
objectoperator= (const object &)
virtual ~object ()

Static Protected Member Functions

static const string toModifiedUTF7 (const folder::path::component &text)
static const folder::path::component fromModifiedUTF7 (const string &text)
static bool isSubfolderDirectory (const utility::file &file)

Additional Inherited Members

Public Types inherited from maildirFormat
enum  DirectoryType {
  ROOT_DIRECTORY , NEW_DIRECTORY , CUR_DIRECTORY , TMP_DIRECTORY ,
  CONTAINER_DIRECTORY
}
Static Public Member Functions inherited from maildirFormat
static shared_ptr< maildirFormatdetect (shared_ptr< maildirStore > store)
Static Protected Attributes inherited from maildirFormat
static const utility::file::path::component TMP_DIR
static const utility::file::path::component CUR_DIR
static const utility::file::path::component NEW_DIR

Detailed Description

Reads Courier/QMail Maildir format.

Constructor & Destructor Documentation

◆ courierMaildirFormat()

courierMaildirFormat ( shared_ptr< context > ctx)

Member Function Documentation

◆ createFolder()

void createFolder ( const folder::path & path)
virtual

Create the specified folder.

Parameters
pathvirtual path of the folder
Exceptions
exceptions::filesystem_exception,invalid_folder_name

Implements maildirFormat.

References maildirFormat::CUR_DIRECTORY, folderPathToFileSystemPath(), platform::getHandler(), maildirFormat::NEW_DIRECTORY, maildirFormat::ROOT_DIRECTORY, and maildirFormat::TMP_DIRECTORY.

◆ destroyFolder()

void destroyFolder ( const folder::path & path)
virtual

Destroy the specified folder.

Parameters
pathvirtual path of the folder
Exceptions
exceptions::filesystem_exception

Implements maildirFormat.

References folderPathToFileSystemPath(), platform::getHandler(), listFolders(), and maildirFormat::ROOT_DIRECTORY.

◆ folderExists()

bool folderExists ( const folder::path & path) const
virtual

Test whether the specified folder exists.

Parameters
pathvirtual path of the folder
Returns
true if the folder exists, false otherwise

Implements maildirFormat.

References maildirFormat::CUR_DIRECTORY, folderPathToFileSystemPath(), platform::getHandler(), maildirFormat::NEW_DIRECTORY, maildirFormat::ROOT_DIRECTORY, and maildirFormat::TMP_DIRECTORY.

◆ folderHasSubfolders()

bool folderHasSubfolders ( const folder::path & path) const
virtual

Test whether the specified folder has subfolders.

Parameters
pathvirtual path of the folder
Returns
true if the folder has at least one subfolder, false otherwise

Implements maildirFormat.

References listDirectories().

◆ folderPathToFileSystemPath()

const utility::file::path folderPathToFileSystemPath ( const folder::path & path,
const DirectoryType type ) const
virtual

Returns the directory which represents the specified folder on the file system.

Parameters
pathvirtual path of the folder
typetype of directory to return
Returns
corresponding directory on the file system

Implements maildirFormat.

References maildirFormat::CONTAINER_DIRECTORY, maildirFormat::CUR_DIR, maildirFormat::CUR_DIRECTORY, maildirFormat::getContext(), maildirFormat::NEW_DIR, maildirFormat::NEW_DIRECTORY, maildirFormat::ROOT_DIRECTORY, maildirFormat::TMP_DIR, maildirFormat::TMP_DIRECTORY, and toModifiedUTF7().

Referenced by createFolder(), destroyFolder(), folderExists(), and renameFolderImpl().

◆ fromModifiedUTF7()

const folder::path::component fromModifiedUTF7 ( const string & text)
staticprotected

◆ getName()

const string getName ( ) const
virtual

Return the name of this Maildir format.

Returns
format name

Implements maildirFormat.

◆ isSubfolderDirectory()

bool isSubfolderDirectory ( const utility::file & file)
staticprotected

Test whether the specified file system directory corresponds to a maildir subfolder.

The name of the directory should start with a '.' to be listed as a subfolder.

Parameters
filereference to a file system directory
Returns
true if the specified directory is a maildir subfolder, false otherwise

References word::getBuffer(), file::getFullPath(), path::getLastComponent(), and file::isDirectory().

Referenced by listDirectories(), and supports().

◆ listDirectories()

bool listDirectories ( const folder::path & root,
std::vector< string > & dirs,
const bool onlyTestForExistence ) const
protected

List directories corresponding to folders which are (direct or indirect) children of specified folder.

Parameters
rootroot folder
dirslist in which found directories will be added
onlyTestForExistenceif true, the function returns as soon as the first directory is found
Returns
true if at least one directory has been found, false otherwise

References maildirFormat::getContext(), platform::getHandler(), path::getSize(), path::isRoot(), isSubfolderDirectory(), and toModifiedUTF7().

Referenced by folderHasSubfolders(), and listFolders().

◆ listFolders()

const std::vector< folder::path > listFolders ( const folder::path & root,
const bool recursive ) const
virtual

List subfolders in the specified folder.

Parameters
rootroot folder in which to start the search
recursiveif set to true, all the descendant are returned; if set to false, only direct children are returned.
Returns
list of subfolders

Implements maildirFormat.

References fromModifiedUTF7(), path::getSize(), and listDirectories().

Referenced by destroyFolder(), and renameFolder().

◆ renameFolder()

void renameFolder ( const folder::path & oldPath,
const folder::path & newPath )
virtual

Rename the specified folder.

Parameters
oldPathold virtual path of the folder
newPathnew virtual path of the folder
Exceptions
exceptions::filesystem_exception

Implements maildirFormat.

References listFolders(), renameFolderImpl(), and path::renameParent().

◆ renameFolderImpl()

void renameFolderImpl ( const folder::path & oldPath,
const folder::path & newPath )
protected

◆ supports()

bool supports ( ) const
protectedvirtual

Quick checks whether this implementation can read the Maildir format in the specified directory.

Returns
true if the implementation supports the specified Maildir, or false otherwise

Implements maildirFormat.

References maildirFormat::getContext(), platform::getHandler(), and isSubfolderDirectory().

◆ toModifiedUTF7()

const string toModifiedUTF7 ( const folder::path::component & text)
staticprotected

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