aboutsummaryrefslogtreecommitdiffstats
path: root/src/utility/filteredStream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utility/filteredStream.cpp')
-rw-r--r--src/utility/filteredStream.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/utility/filteredStream.cpp b/src/utility/filteredStream.cpp
index c198c230..57e17634 100644
--- a/src/utility/filteredStream.cpp
+++ b/src/utility/filteredStream.cpp
@@ -228,6 +228,35 @@ void CRLFToLFFilteredOutputStream::write
}
+// stopSequenceFilteredInputStream <1>
+
+template <>
+const stream::size_type stopSequenceFilteredInputStream <1>::read
+ (value_type* const data, const size_type count)
+{
+ if (eof() || m_stream.eof())
+ {
+ m_eof = true;
+ return 0;
+ }
+
+ const size_type read = m_stream.read(data, count);
+ value_type* end = data + read;
+
+ value_type* pos = std::find(data, end, m_sequence[0]);
+
+ if (pos == end)
+ {
+ return (read);
+ }
+ else
+ {
+ m_found = 1;
+ return (pos - data);
+ }
+}
+
+
} // utility
} // vmime