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 ++++++++++++------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/net/maildir/format/courierMaildirFormat.cpp') 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()) -- cgit v1.2.3