aboutsummaryrefslogtreecommitdiffstats
path: root/src/utility/stream.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2004-12-16 09:49:55 +0000
committerVincent Richard <[email protected]>2004-12-16 09:49:55 +0000
commit0dbc72f835605aa17510ad8e9f9ecaa0d974fb06 (patch)
tree5caac322da63fd3a7fa7bf76141daef3a3d7d4be /src/utility/stream.cpp
parentWorking on 'maildir' implementation. (diff)
downloadvmime-0dbc72f835605aa17510ad8e9f9ecaa0d974fb06.tar.gz
vmime-0dbc72f835605aa17510ad8e9f9ecaa0d974fb06.zip
Added skip() method on inputStream.
Diffstat (limited to 'src/utility/stream.cpp')
-rw-r--r--src/utility/stream.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/utility/stream.cpp b/src/utility/stream.cpp
index 06d4ba27..15c2e8eb 100644
--- a/src/utility/stream.cpp
+++ b/src/utility/stream.cpp
@@ -127,6 +127,13 @@ const stream::size_type inputStreamAdapter::read
}
+const stream::size_type inputStreamAdapter::skip(const size_type count)
+{
+ m_stream.ignore(count);
+ return (m_stream.gcount());
+}
+
+
// inputStreamStringAdapter
@@ -175,6 +182,22 @@ const stream::size_type inputStreamStringAdapter::read
}
+const stream::size_type inputStreamStringAdapter::skip(const size_type count)
+{
+ if (m_pos + count >= m_end)
+ {
+ const size_type remaining = m_end - m_pos;
+ m_pos = m_end;
+ return (remaining);
+ }
+ else
+ {
+ m_pos += count;
+ return (count);
+ }
+}
+
+
// inputStreamStringProxyAdapter
@@ -216,6 +239,23 @@ const stream::size_type inputStreamStringProxyAdapter::read
}
+const stream::size_type inputStreamStringProxyAdapter::skip(const size_type count)
+{
+ const size_type remaining = m_buffer.length() - m_pos;
+
+ if (count > remaining)
+ {
+ m_pos = m_buffer.length();
+ return (remaining);
+ }
+ else
+ {
+ m_pos += count;
+ return (count);
+ }
+}
+
+
// inputStreamPointerAdapter
@@ -253,5 +293,12 @@ const stream::size_type inputStreamPointerAdapter::read
}
+const stream::size_type inputStreamPointerAdapter::skip(const size_type count)
+{
+ m_stream->ignore(count);
+ return (m_stream->gcount());
+}
+
+
} // utility
} // vmime