diff options
| author | Vincent Richard <[email protected]> | 2012-04-16 20:32:33 +0000 |
|---|---|---|
| committer | Vincent Richard <[email protected]> | 2012-04-16 20:32:33 +0000 |
| commit | 4f33877820edee1b47d1b6f4fc800eaad273adaa (patch) | |
| tree | 10d5d339f17f2561ef46993de308c2e7d8a9fd79 /src/platforms/posix/posixFile.cpp | |
| parent | Split stream.hpp/.cpp into multiple source files. (diff) | |
| download | vmime-4f33877820edee1b47d1b6f4fc800eaad273adaa.tar.gz vmime-4f33877820edee1b47d1b6f4fc800eaad273adaa.zip | |
Added ability to parse directly from an input stream (eg. file). This allows very big messages to be parsed without loading the whole message data into memory.
Diffstat (limited to 'src/platforms/posix/posixFile.cpp')
| -rw-r--r-- | src/platforms/posix/posixFile.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp index ec529eb6..4087a21f 100644 --- a/src/platforms/posix/posixFile.cpp +++ b/src/platforms/posix/posixFile.cpp @@ -224,6 +224,26 @@ vmime::utility::stream::size_type posixFileReaderInputStream::skip(const size_ty } +vmime::utility::stream::size_type posixFileReaderInputStream::getPosition() const +{ + const off_t curPos = ::lseek(m_fd, 0, SEEK_CUR); + + if (curPos == off_t(-1)) + posixFileSystemFactory::reportError(m_path, errno); + + return static_cast <size_type>(curPos); +} + + +void posixFileReaderInputStream::seek(const size_type pos) +{ + const off_t newPos = ::lseek(m_fd, pos, SEEK_SET); + + if (newPos == off_t(-1)) + posixFileSystemFactory::reportError(m_path, errno); +} + + // // posixFileWriter |
