diff options
| author | Vincent Richard <[email protected]> | 2004-12-26 21:23:29 +0100 |
|---|---|---|
| committer | Vincent Richard <[email protected]> | 2004-12-26 21:23:29 +0100 |
| commit | 4ce991d3b1bd97fbb896d17fb8f36f6650429a22 (patch) | |
| tree | 2db6e072b862dd809d4acd8c571a1b859fdcb484 /src/platforms/posix | |
| parent | Allow creating a service from an URL. (diff) | |
| download | vmime-4ce991d3b1bd97fbb896d17fb8f36f6650429a22.tar.gz vmime-4ce991d3b1bd97fbb896d17fb8f36f6650429a22.zip | |
Moved all header files to 'vmime/' directory.
Diffstat (limited to 'src/platforms/posix')
| -rw-r--r-- | src/platforms/posix/file.cpp | 4 | ||||
| -rw-r--r-- | src/platforms/posix/file.hpp | 205 | ||||
| -rw-r--r-- | src/platforms/posix/handler.cpp | 2 | ||||
| -rw-r--r-- | src/platforms/posix/handler.hpp | 87 | ||||
| -rw-r--r-- | src/platforms/posix/socket.cpp | 4 | ||||
| -rw-r--r-- | src/platforms/posix/socket.hpp | 75 |
6 files changed, 5 insertions, 372 deletions
diff --git a/src/platforms/posix/file.cpp b/src/platforms/posix/file.cpp index 463d4ca0..2854f54d 100644 --- a/src/platforms/posix/file.cpp +++ b/src/platforms/posix/file.cpp @@ -17,7 +17,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include "platforms/posix/file.hpp" +#include "vmime/platforms/posix/file.hpp" #include <unistd.h> #include <fcntl.h> @@ -30,7 +30,7 @@ #include <string.h> -#include "exception.hpp" +#include "vmime/exception.hpp" #if VMIME_HAVE_FILESYSTEM_FEATURES diff --git a/src/platforms/posix/file.hpp b/src/platforms/posix/file.hpp deleted file mode 100644 index 7405d238..00000000 --- a/src/platforms/posix/file.hpp +++ /dev/null @@ -1,205 +0,0 @@ -// -// VMime library (http://vmime.sourceforge.net) -// Copyright (C) 2002-2004 Vincent Richard <[email protected]> -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// - -#ifndef VMIME_PLATFORMS_POSIX_FILE_HPP_INCLUDED -#define VMIME_PLATFORMS_POSIX_FILE_HPP_INCLUDED - - -#include "utility/file.hpp" - - -#if VMIME_HAVE_FILESYSTEM_FEATURES - - -#include <dirent.h> - - -namespace vmime { -namespace platforms { -namespace posix { - - -class posixFileWriterOutputStream : public vmime::utility::outputStream -{ -public: - - posixFileWriterOutputStream(const vmime::utility::file::path& path, const int fd); - ~posixFileWriterOutputStream(); - - void write(const value_type* const data, const size_type count); - -private: - - const vmime::utility::file::path m_path; - const int m_fd; -}; - - - -class posixFileReaderInputStream : public vmime::utility::inputStream -{ -public: - - posixFileReaderInputStream(const vmime::utility::file::path& path, const int fd); - ~posixFileReaderInputStream(); - - const bool eof() const; - - void reset(); - - const size_type read(value_type* const data, const size_type count); - - const size_type skip(const size_type count); - -private: - - const vmime::utility::file::path m_path; - const int m_fd; - - bool m_eof; -}; - - - -class posixFileWriter : public vmime::utility::fileWriter -{ -public: - - posixFileWriter(const vmime::utility::file::path& path, const vmime::string& nativePath); - - vmime::utility::outputStream* getOutputStream(); - -private: - - vmime::utility::file::path m_path; - vmime::string m_nativePath; -}; - - - -class posixFileReader : public vmime::utility::fileReader -{ -public: - - posixFileReader(const vmime::utility::file::path& path, const vmime::string& nativePath); - - vmime::utility::inputStream* getInputStream(); - -private: - - vmime::utility::file::path m_path; - vmime::string m_nativePath; -}; - - - -class posixFileIterator : public vmime::utility::fileIterator -{ -public: - - posixFileIterator(const vmime::utility::file::path& path, const vmime::string& nativePath); - ~posixFileIterator(); - - const bool hasMoreElements() const; - vmime::utility::file* nextElement(); - -private: - - void getNextElement(); - - vmime::utility::file::path m_path; - vmime::string m_nativePath; - - DIR* m_dir; - struct dirent* m_dirEntry; -}; - - - -class posixFile : public vmime::utility::file -{ -public: - - posixFile(const vmime::utility::file::path& path); - - void createFile(); - void createDirectory(const bool createAll = false); - - const bool isFile() const; - const bool isDirectory() const; - - const bool canRead() const; - const bool canWrite() const; - - const length_type getLength(); - - const path& getFullPath() const; - - const bool exists() const; - - const vmime::utility::file* getParent() const; - - void rename(const path& newName); - - void remove(); - - vmime::utility::fileWriter* getFileWriter(); - vmime::utility::fileReader* getFileReader(); - - vmime::utility::fileIterator* getFiles() const; - -private: - - static void createDirectoryImpl(const vmime::utility::file::path& fullPath, const vmime::utility::file::path& path, const bool recursive = false); - -private: - - vmime::utility::file::path m_path; - vmime::string m_nativePath; -}; - - - -class posixFileSystemFactory : public vmime::utility::fileSystemFactory -{ -public: - - vmime::utility::file* create(const vmime::utility::file::path& path) const; - - const vmime::utility::file::path stringToPath(const vmime::string& str) const; - const vmime::string pathToString(const vmime::utility::file::path& path) const; - - static const vmime::utility::file::path stringToPathImpl(const vmime::string& str); - static const vmime::string pathToStringImpl(const vmime::utility::file::path& path); - - const bool isValidPathComponent(const vmime::utility::file::path::component& comp) const; - const bool isValidPath(const vmime::utility::file::path& path) const; - - static void reportError(const vmime::utility::path& path, const int err); -}; - - -} // posix -} // platforms -} // vmime - - -#endif // VMIME_HAVE_FILESYSTEM_FEATURES - -#endif // VMIME_PLATFORMS_POSIX_FILE_HPP_INCLUDED diff --git a/src/platforms/posix/handler.cpp b/src/platforms/posix/handler.cpp index ddb1c421..1084d59e 100644 --- a/src/platforms/posix/handler.cpp +++ b/src/platforms/posix/handler.cpp @@ -17,7 +17,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include "platforms/posix/handler.hpp" +#include "vmime/platforms/posix/handler.hpp" #include <time.h> diff --git a/src/platforms/posix/handler.hpp b/src/platforms/posix/handler.hpp deleted file mode 100644 index a284e5ab..00000000 --- a/src/platforms/posix/handler.hpp +++ /dev/null @@ -1,87 +0,0 @@ -// -// VMime library (http://vmime.sourceforge.net) -// Copyright (C) 2002-2004 Vincent Richard <[email protected]> -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// - -#ifndef VMIME_PLATFORMS_POSIX_HANDLER_HPP_INCLUDED -#define VMIME_PLATFORMS_POSIX_HANDLER_HPP_INCLUDED - - -#include "config.hpp" -#include "platformDependant.hpp" - -#if VMIME_HAVE_MESSAGING_FEATURES - #include "platforms/posix/socket.hpp" -#endif - -#if VMIME_HAVE_FILESYSTEM_FEATURES - #include "platforms/posix/file.hpp" -#endif - - -namespace vmime { -namespace platforms { -namespace posix { - - -class posixHandler : public vmime::platformDependant::handler -{ -public: - - posixHandler(); - ~posixHandler(); - - const unsigned int getUnixTime() const; - - const vmime::datetime getCurrentLocalTime() const; - - const vmime::charset getLocaleCharset() const; - - const vmime::string getHostName() const; - - const unsigned int getProcessId() const; - -#if VMIME_HAVE_MESSAGING_FEATURES - vmime::messaging::socketFactory* getSocketFactory(const vmime::string& name) const; - - vmime::messaging::timeoutHandlerFactory* getTimeoutHandlerFactory(const vmime::string& name) const; -#endif - -#if VMIME_HAVE_FILESYSTEM_FEATURES - vmime::utility::fileSystemFactory* getFileSystemFactory() const; -#endif - - void wait() const; - -private: - -#if VMIME_HAVE_MESSAGING_FEATURES - posixSocketFactory* m_socketFactory; -#endif - -#if VMIME_HAVE_FILESYSTEM_FEATURES - posixFileSystemFactory* m_fileSysFactory; -#endif -}; - - -} // posix -} // platforms -} // vmime - - -#endif // VMIME_PLATFORMS_POSIX_HANDLER_HPP_INCLUDED diff --git a/src/platforms/posix/socket.cpp b/src/platforms/posix/socket.cpp index e5a07f36..fe3150bf 100644 --- a/src/platforms/posix/socket.cpp +++ b/src/platforms/posix/socket.cpp @@ -17,7 +17,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include "platforms/posix/socket.hpp" +#include "vmime/platforms/posix/socket.hpp" #include <unistd.h> #include <sys/socket.h> @@ -27,7 +27,7 @@ #include <netdb.h> #include <fcntl.h> -#include "exception.hpp" +#include "vmime/exception.hpp" #if VMIME_HAVE_MESSAGING_FEATURES diff --git a/src/platforms/posix/socket.hpp b/src/platforms/posix/socket.hpp deleted file mode 100644 index 83291bbf..00000000 --- a/src/platforms/posix/socket.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// -// VMime library (http://vmime.sourceforge.net) -// Copyright (C) 2002-2004 Vincent Richard <[email protected]> -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// - -#ifndef VMIME_PLATFORMS_POSIX_SOCKET_HPP_INCLUDED -#define VMIME_PLATFORMS_POSIX_SOCKET_HPP_INCLUDED - - -#include "messaging/socket.hpp" - - -#if VMIME_HAVE_MESSAGING_FEATURES - - -namespace vmime { -namespace platforms { -namespace posix { - - -class posixSocket : public vmime::messaging::socket -{ -public: - - posixSocket(); - ~posixSocket(); - - void connect(const vmime::string& address, const vmime::port_t port); - const bool isConnected() const; - void disconnect(); - - void receive(vmime::string& buffer); - const int receiveRaw(char* buffer, const int count); - - void send(const vmime::string& buffer); - void sendRaw(const char* buffer, const int count); - -private: - - char m_buffer[65536]; - int m_desc; -}; - - - -class posixSocketFactory : public vmime::messaging::socketFactory -{ -public: - - vmime::messaging::socket* create(); -}; - - -} // posix -} // platforms -} // vmime - - -#endif // VMIME_HAVE_MESSAGING_FEATURES - -#endif // VMIME_PLATFORMS_POSIX_SOCKET_HPP_INCLUDED |
