diff options
Diffstat (limited to 'src/utility/stream.cpp')
-rw-r--r-- | src/utility/stream.cpp | 47 |
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 |