From f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Thu, 21 Nov 2013 22:16:57 +0100 Subject: Boost/C++11 shared pointers. --- src/net/maildir/format/courierMaildirFormat.cpp | 50 ++++++++++++------------- src/net/maildir/format/kmailMaildirFormat.cpp | 46 +++++++++++------------ 2 files changed, 48 insertions(+), 48 deletions(-) (limited to 'src/net/maildir/format') 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 ctx) +courierMaildirFormat::courierMaildirFormat(shared_ptr ctx) : maildirFormat(ctx) { } @@ -55,19 +55,19 @@ const string courierMaildirFormat::getName() const void courierMaildirFormat::createFolder(const folder::path& path) { - ref fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr fsf = platform::getHandler()->getFileSystemFactory(); if (!fsf->isValidPath(folderPathToFileSystemPath(path, ROOT_DIRECTORY))) throw exceptions::invalid_folder_name(); - ref rootDir = fsf->create + shared_ptr rootDir = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY)); - ref newDir = fsf->create + shared_ptr newDir = fsf->create (folderPathToFileSystemPath(path, NEW_DIRECTORY)); - ref tmpDir = fsf->create + shared_ptr tmpDir = fsf->create (folderPathToFileSystemPath(path, TMP_DIRECTORY)); - ref curDir = fsf->create + shared_ptr 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 maildirFile = fsf->create + shared_ptr 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 fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr fsf = platform::getHandler()->getFileSystemFactory(); // Recursively delete directories of subfolders const std::vector folders = listFolders(path, true); @@ -125,7 +125,7 @@ void courierMaildirFormat::renameFolder void courierMaildirFormat::renameFolderImpl (const folder::path& oldPath, const folder::path& newPath) { - ref fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr 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 rootDir = fsf->create(oldFSPath); + shared_ptr rootDir = fsf->create(oldFSPath); rootDir->rename(newFSPath); } bool courierMaildirFormat::folderExists(const folder::path& path) const { - ref fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr fsf = platform::getHandler()->getFileSystemFactory(); - ref rootDir = fsf->create + shared_ptr rootDir = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY)); - ref newDir = fsf->create + shared_ptr newDir = fsf->create (folderPathToFileSystemPath(path, NEW_DIRECTORY)); - ref tmpDir = fsf->create + shared_ptr tmpDir = fsf->create (folderPathToFileSystemPath(path, TMP_DIRECTORY)); - ref curDir = fsf->create + shared_ptr curDir = fsf->create (folderPathToFileSystemPath(path, CUR_DIRECTORY)); - ref maildirFile = fsf->create + shared_ptr maildirFile = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY) / utility::file::path::component("maildirfolder")); @@ -260,9 +260,9 @@ const std::vector courierMaildirFormat::listFolders bool courierMaildirFormat::listDirectories(const folder::path& root, std::vector & dirs, const bool onlyTestForExistence) const { - ref fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr fsf = platform::getHandler()->getFileSystemFactory(); - ref rootDir = fsf->create + shared_ptr rootDir = fsf->create (getContext()->getStore()->getFileSystemPath()); if (rootDir->exists()) @@ -278,11 +278,11 @@ bool courierMaildirFormat::listDirectories(const folder::path& root, } // Enumerate directories - ref it = rootDir->getFiles(); + shared_ptr it = rootDir->getFiles(); while (it->hasMoreElements()) { - ref file = it->nextElement(); + shared_ptr file = it->nextElement(); if (isSubfolderDirectory(*file)) { @@ -502,24 +502,24 @@ const folder::path::component courierMaildirFormat::fromModifiedUTF7(const strin bool courierMaildirFormat::supports() const { - ref fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr fsf = platform::getHandler()->getFileSystemFactory(); - ref rootDir = fsf->create + shared_ptr 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 it = rootDir->getFiles(); + shared_ptr it = rootDir->getFiles(); while (it->hasMoreElements()) { - ref file = it->nextElement(); + shared_ptr file = it->nextElement(); if (isSubfolderDirectory(*file)) { - ref folderFile = fsf->create + shared_ptr 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 ctx) +kmailMaildirFormat::kmailMaildirFormat(shared_ptr ctx) : maildirFormat(ctx) { } @@ -55,19 +55,19 @@ const string kmailMaildirFormat::getName() const void kmailMaildirFormat::createFolder(const folder::path& path) { - ref fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr fsf = platform::getHandler()->getFileSystemFactory(); if (!fsf->isValidPath(folderPathToFileSystemPath(path, ROOT_DIRECTORY))) throw exceptions::invalid_folder_name(); - ref rootDir = fsf->create + shared_ptr rootDir = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY)); - ref newDir = fsf->create + shared_ptr newDir = fsf->create (folderPathToFileSystemPath(path, NEW_DIRECTORY)); - ref tmpDir = fsf->create + shared_ptr tmpDir = fsf->create (folderPathToFileSystemPath(path, TMP_DIRECTORY)); - ref curDir = fsf->create + shared_ptr 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 fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr 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 fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr fsf = platform::getHandler()->getFileSystemFactory(); - ref rootDir = fsf->create + shared_ptr rootDir = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY)); - ref newDir = fsf->create + shared_ptr newDir = fsf->create (folderPathToFileSystemPath(path, NEW_DIRECTORY)); - ref tmpDir = fsf->create + shared_ptr tmpDir = fsf->create (folderPathToFileSystemPath(path, TMP_DIRECTORY)); - ref curDir = fsf->create + shared_ptr curDir = fsf->create (folderPathToFileSystemPath(path, CUR_DIRECTORY)); return rootDir->exists() && rootDir->isDirectory() && @@ -183,18 +183,18 @@ const std::vector kmailMaildirFormat::listFolders void kmailMaildirFormat::listFoldersImpl (std::vector & list, const folder::path& root, const bool recursive) const { - ref fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr fsf = platform::getHandler()->getFileSystemFactory(); - ref rootDir = fsf->create(folderPathToFileSystemPath(root, + shared_ptr rootDir = fsf->create(folderPathToFileSystemPath(root, root.isEmpty() ? ROOT_DIRECTORY : CONTAINER_DIRECTORY)); if (rootDir->exists()) { - ref it = rootDir->getFiles(); + shared_ptr it = rootDir->getFiles(); while (it->hasMoreElements()) { - ref file = it->nextElement(); + shared_ptr 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 fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr fsf = platform::getHandler()->getFileSystemFactory(); - ref rootDir = fsf->create + shared_ptr rootDir = fsf->create (folderPathToFileSystemPath(oldPath, ROOT_DIRECTORY)); - ref contDir = fsf->create + shared_ptr 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 fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr fsf = platform::getHandler()->getFileSystemFactory(); - ref rootDir = fsf->create + shared_ptr rootDir = fsf->create (folderPathToFileSystemPath(path, CONTAINER_DIRECTORY)); - ref it = rootDir->getFiles(); + shared_ptr it = rootDir->getFiles(); while (it->hasMoreElements()) { - ref file = it->nextElement(); + shared_ptr file = it->nextElement(); if (isSubfolderDirectory(*file)) return true; -- cgit