aboutsummaryrefslogtreecommitdiffstats
path: root/src/platforms/windows/windowsFile.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2012-04-16 20:32:33 +0000
committerVincent Richard <[email protected]>2012-04-16 20:32:33 +0000
commit4f33877820edee1b47d1b6f4fc800eaad273adaa (patch)
tree10d5d339f17f2561ef46993de308c2e7d8a9fd79 /src/platforms/windows/windowsFile.cpp
parentSplit stream.hpp/.cpp into multiple source files. (diff)
downloadvmime-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/windows/windowsFile.cpp')
-rw-r--r--src/platforms/windows/windowsFile.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/platforms/windows/windowsFile.cpp b/src/platforms/windows/windowsFile.cpp
index 624612af..5da786e5 100644
--- a/src/platforms/windows/windowsFile.cpp
+++ b/src/platforms/windows/windowsFile.cpp
@@ -479,6 +479,24 @@ vmime::utility::stream::size_type windowsFileReaderInputStream::skip(const size_
return (dwNewPos - dwCurPos);
}
+vmime::utility::stream::size_type windowsFileReaderInputStream::getPosition() const
+{
+ DWORD dwCurPos = SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT);
+
+ if (dwCurPos == INVALID_SET_FILE_POINTER)
+ windowsFileSystemFactory::reportError(m_path, GetLastError());
+
+ return static_cast <size_type>(dwCurPos);
+}
+
+void windowsFileReaderInputStream::seek(const size_type pos)
+{
+ DWORD dwNewPos = SetFilePointer(m_hFile, (LONG)pos, NULL, FILE_BEGIN);
+
+ if (dwNewPos == INVALID_SET_FILE_POINTER)
+ windowsFileSystemFactory::reportError(m_path, GetLastError());
+}
+
windowsFileWriter::windowsFileWriter(const vmime::utility::file::path& path, const vmime::string& nativePath)
: m_path(path), m_nativePath(nativePath)
{