diff options
author | Vincent Richard <[email protected]> | 2013-11-21 21:16:57 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2013-11-21 21:16:57 +0000 |
commit | f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8 (patch) | |
tree | 2bdc90e361a8f6e0a81164cf67afec9f78f9b959 /src/net/maildir/format | |
parent | Per-protocol include files. (diff) | |
download | vmime-f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8.tar.gz vmime-f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8.zip |
Boost/C++11 shared pointers.
Diffstat (limited to 'src/net/maildir/format')
-rw-r--r-- | src/net/maildir/format/courierMaildirFormat.cpp | 50 | ||||
-rw-r--r-- | src/net/maildir/format/kmailMaildirFormat.cpp | 46 |
2 files changed, 48 insertions, 48 deletions
diff --git a/src/net/maildir/format/courierMaildirFormat.cpp b/src/net/maildir/format/courierMaildirFormat.cpp index 346b9c67..a948de3e 100644 --- a/src/net/maildir/format/courierMaildirFormat.cpp +++ b/src/net/maildir/format/courierMaildirFormat.cpp @@ -41,7 +41,7 @@ namespace maildir { namespace format { -courierMaildirFormat::courierMaildirFormat(ref <context> ctx) +courierMaildirFormat::courierMaildirFormat(shared_ptr <context> ctx) : maildirFormat(ctx) { } @@ -55,19 +55,19 @@ const string courierMaildirFormat::getName() const void courierMaildirFormat::createFolder(const folder::path& path) { - ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); if (!fsf->isValidPath(folderPathToFileSystemPath(path, ROOT_DIRECTORY))) throw exceptions::invalid_folder_name(); - ref <utility::file> rootDir = fsf->create + shared_ptr <utility::file> rootDir = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY)); - ref <utility::file> newDir = fsf->create + shared_ptr <utility::file> newDir = fsf->create (folderPathToFileSystemPath(path, NEW_DIRECTORY)); - ref <utility::file> tmpDir = fsf->create + shared_ptr <utility::file> tmpDir = fsf->create (folderPathToFileSystemPath(path, TMP_DIRECTORY)); - ref <utility::file> curDir = fsf->create + shared_ptr <utility::file> curDir = fsf->create (folderPathToFileSystemPath(path, CUR_DIRECTORY)); rootDir->createDirectory(true); @@ -76,7 +76,7 @@ void courierMaildirFormat::createFolder(const folder::path& path) tmpDir->createDirectory(false); curDir->createDirectory(false); - ref <utility::file> maildirFile = fsf->create + shared_ptr <utility::file> maildirFile = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY) / utility::file::path::component("maildirfolder")); @@ -86,7 +86,7 @@ void courierMaildirFormat::createFolder(const folder::path& path) void courierMaildirFormat::destroyFolder(const folder::path& path) { - ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); // Recursively delete directories of subfolders const std::vector <folder::path> folders = listFolders(path, true); @@ -125,7 +125,7 @@ void courierMaildirFormat::renameFolder void courierMaildirFormat::renameFolderImpl (const folder::path& oldPath, const folder::path& newPath) { - ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); const utility::file::path oldFSPath = folderPathToFileSystemPath(oldPath, ROOT_DIRECTORY); @@ -133,26 +133,26 @@ void courierMaildirFormat::renameFolderImpl const utility::file::path newFSPath = folderPathToFileSystemPath(newPath, ROOT_DIRECTORY); - ref <utility::file> rootDir = fsf->create(oldFSPath); + shared_ptr <utility::file> rootDir = fsf->create(oldFSPath); rootDir->rename(newFSPath); } bool courierMaildirFormat::folderExists(const folder::path& path) const { - ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); - ref <utility::file> rootDir = fsf->create + shared_ptr <utility::file> rootDir = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY)); - ref <utility::file> newDir = fsf->create + shared_ptr <utility::file> newDir = fsf->create (folderPathToFileSystemPath(path, NEW_DIRECTORY)); - ref <utility::file> tmpDir = fsf->create + shared_ptr <utility::file> tmpDir = fsf->create (folderPathToFileSystemPath(path, TMP_DIRECTORY)); - ref <utility::file> curDir = fsf->create + shared_ptr <utility::file> curDir = fsf->create (folderPathToFileSystemPath(path, CUR_DIRECTORY)); - ref <utility::file> maildirFile = fsf->create + shared_ptr <utility::file> maildirFile = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY) / utility::file::path::component("maildirfolder")); @@ -260,9 +260,9 @@ const std::vector <folder::path> courierMaildirFormat::listFolders bool courierMaildirFormat::listDirectories(const folder::path& root, std::vector <string>& dirs, const bool onlyTestForExistence) const { - ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); - ref <utility::file> rootDir = fsf->create + shared_ptr <utility::file> rootDir = fsf->create (getContext()->getStore()->getFileSystemPath()); if (rootDir->exists()) @@ -278,11 +278,11 @@ bool courierMaildirFormat::listDirectories(const folder::path& root, } // Enumerate directories - ref <utility::fileIterator> it = rootDir->getFiles(); + shared_ptr <utility::fileIterator> it = rootDir->getFiles(); while (it->hasMoreElements()) { - ref <utility::file> file = it->nextElement(); + shared_ptr <utility::file> file = it->nextElement(); if (isSubfolderDirectory(*file)) { @@ -502,24 +502,24 @@ const folder::path::component courierMaildirFormat::fromModifiedUTF7(const strin bool courierMaildirFormat::supports() const { - ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); - ref <utility::file> rootDir = fsf->create + shared_ptr <utility::file> rootDir = fsf->create (getContext()->getStore()->getFileSystemPath()); if (rootDir->exists()) { // Try to find a file named "maildirfolder", which indicates // the Maildir is in Courier format - ref <utility::fileIterator> it = rootDir->getFiles(); + shared_ptr <utility::fileIterator> it = rootDir->getFiles(); while (it->hasMoreElements()) { - ref <utility::file> file = it->nextElement(); + shared_ptr <utility::file> file = it->nextElement(); if (isSubfolderDirectory(*file)) { - ref <utility::file> folderFile = fsf->create + shared_ptr <utility::file> folderFile = fsf->create (file->getFullPath() / utility::file::path::component("maildirfolder")); if (folderFile->exists() && folderFile->isFile()) diff --git a/src/net/maildir/format/kmailMaildirFormat.cpp b/src/net/maildir/format/kmailMaildirFormat.cpp index 0f81b10a..70c9b909 100644 --- a/src/net/maildir/format/kmailMaildirFormat.cpp +++ b/src/net/maildir/format/kmailMaildirFormat.cpp @@ -41,7 +41,7 @@ namespace maildir { namespace format { -kmailMaildirFormat::kmailMaildirFormat(ref <context> ctx) +kmailMaildirFormat::kmailMaildirFormat(shared_ptr <context> ctx) : maildirFormat(ctx) { } @@ -55,19 +55,19 @@ const string kmailMaildirFormat::getName() const void kmailMaildirFormat::createFolder(const folder::path& path) { - ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); if (!fsf->isValidPath(folderPathToFileSystemPath(path, ROOT_DIRECTORY))) throw exceptions::invalid_folder_name(); - ref <utility::file> rootDir = fsf->create + shared_ptr <utility::file> rootDir = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY)); - ref <utility::file> newDir = fsf->create + shared_ptr <utility::file> newDir = fsf->create (folderPathToFileSystemPath(path, NEW_DIRECTORY)); - ref <utility::file> tmpDir = fsf->create + shared_ptr <utility::file> tmpDir = fsf->create (folderPathToFileSystemPath(path, TMP_DIRECTORY)); - ref <utility::file> curDir = fsf->create + shared_ptr <utility::file> curDir = fsf->create (folderPathToFileSystemPath(path, CUR_DIRECTORY)); rootDir->createDirectory(true); @@ -81,7 +81,7 @@ void kmailMaildirFormat::createFolder(const folder::path& path) void kmailMaildirFormat::destroyFolder(const folder::path& path) { // Delete 'folder' and '.folder.directory' directories - ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); maildirUtils::recursiveFSDelete(fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY))); // root @@ -93,16 +93,16 @@ void kmailMaildirFormat::destroyFolder(const folder::path& path) bool kmailMaildirFormat::folderExists(const folder::path& path) const { - ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); - ref <utility::file> rootDir = fsf->create + shared_ptr <utility::file> rootDir = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY)); - ref <utility::file> newDir = fsf->create + shared_ptr <utility::file> newDir = fsf->create (folderPathToFileSystemPath(path, NEW_DIRECTORY)); - ref <utility::file> tmpDir = fsf->create + shared_ptr <utility::file> tmpDir = fsf->create (folderPathToFileSystemPath(path, TMP_DIRECTORY)); - ref <utility::file> curDir = fsf->create + shared_ptr <utility::file> curDir = fsf->create (folderPathToFileSystemPath(path, CUR_DIRECTORY)); return rootDir->exists() && rootDir->isDirectory() && @@ -183,18 +183,18 @@ const std::vector <folder::path> kmailMaildirFormat::listFolders void kmailMaildirFormat::listFoldersImpl (std::vector <folder::path>& list, const folder::path& root, const bool recursive) const { - ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); - ref <utility::file> rootDir = fsf->create(folderPathToFileSystemPath(root, + shared_ptr <utility::file> rootDir = fsf->create(folderPathToFileSystemPath(root, root.isEmpty() ? ROOT_DIRECTORY : CONTAINER_DIRECTORY)); if (rootDir->exists()) { - ref <utility::fileIterator> it = rootDir->getFiles(); + shared_ptr <utility::fileIterator> it = rootDir->getFiles(); while (it->hasMoreElements()) { - ref <utility::file> file = it->nextElement(); + shared_ptr <utility::file> file = it->nextElement(); if (isSubfolderDirectory(*file)) { @@ -232,11 +232,11 @@ bool kmailMaildirFormat::isSubfolderDirectory(const utility::file& file) void kmailMaildirFormat::renameFolder(const folder::path& oldPath, const folder::path& newPath) { - ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); - ref <utility::file> rootDir = fsf->create + shared_ptr <utility::file> rootDir = fsf->create (folderPathToFileSystemPath(oldPath, ROOT_DIRECTORY)); - ref <utility::file> contDir = fsf->create + shared_ptr <utility::file> contDir = fsf->create (folderPathToFileSystemPath(oldPath, CONTAINER_DIRECTORY)); try @@ -283,16 +283,16 @@ void kmailMaildirFormat::renameFolder(const folder::path& oldPath, const folder: bool kmailMaildirFormat::folderHasSubfolders(const folder::path& path) const { - ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); - ref <utility::file> rootDir = fsf->create + shared_ptr <utility::file> rootDir = fsf->create (folderPathToFileSystemPath(path, CONTAINER_DIRECTORY)); - ref <utility::fileIterator> it = rootDir->getFiles(); + shared_ptr <utility::fileIterator> it = rootDir->getFiles(); while (it->hasMoreElements()) { - ref <utility::file> file = it->nextElement(); + shared_ptr <utility::file> file = it->nextElement(); if (isSubfolderDirectory(*file)) return true; |