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/platforms/posix/posixFile.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/platforms/posix/posixFile.cpp') diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp index 744f01ff..1e4dd070 100644 --- a/src/platforms/posix/posixFile.cpp +++ b/src/platforms/posix/posixFile.cpp @@ -79,9 +79,9 @@ bool posixFileIterator::hasMoreElements() const } -ref posixFileIterator::nextElement() +shared_ptr posixFileIterator::nextElement() { - ref file = vmime::create + shared_ptr file = make_shared (m_path / vmime::utility::file::path::component(m_dirEntry->d_name)); getNextElement(); @@ -258,14 +258,14 @@ posixFileWriter::posixFileWriter(const vmime::utility::file::path& path, const v } -ref posixFileWriter::getOutputStream() +shared_ptr posixFileWriter::getOutputStream() { int fd = 0; if ((fd = ::open(m_nativePath.c_str(), O_WRONLY, 0660)) == -1) posixFileSystemFactory::reportError(m_path, errno); - return vmime::create (m_path, fd); + return make_shared (m_path, fd); } @@ -280,14 +280,14 @@ posixFileReader::posixFileReader(const vmime::utility::file::path& path, const v } -ref posixFileReader::getInputStream() +shared_ptr posixFileReader::getInputStream() { int fd = 0; if ((fd = ::open(m_nativePath.c_str(), O_RDONLY, 0640)) == -1) posixFileSystemFactory::reportError(m_path, errno); - return vmime::create (m_path, fd); + return make_shared (m_path, fd); } @@ -417,12 +417,12 @@ bool posixFile::exists() const } -ref posixFile::getParent() const +shared_ptr posixFile::getParent() const { if (m_path.isEmpty()) - return NULL; + return null; else - return vmime::create (m_path.getParent()); + return make_shared (m_path.getParent()); } @@ -465,24 +465,24 @@ void posixFile::remove() } -ref posixFile::getFileWriter() +shared_ptr posixFile::getFileWriter() { - return vmime::create (m_path, m_nativePath); + return make_shared (m_path, m_nativePath); } -ref posixFile::getFileReader() +shared_ptr posixFile::getFileReader() { - return vmime::create (m_path, m_nativePath); + return make_shared (m_path, m_nativePath); } -ref posixFile::getFiles() const +shared_ptr posixFile::getFiles() const { if (!isDirectory()) throw vmime::exceptions::not_a_directory(m_path); - return vmime::create (m_path, m_nativePath); + return make_shared (m_path, m_nativePath); } @@ -508,9 +508,9 @@ void posixFile::createDirectoryImpl(const vmime::utility::file::path& fullPath, // posixFileSystemFactory // -ref posixFileSystemFactory::create(const vmime::utility::file::path& path) const +shared_ptr posixFileSystemFactory::create(const vmime::utility::file::path& path) const { - return vmime::create (path); + return make_shared (path); } -- cgit v1.2.3