From 4f33877820edee1b47d1b6f4fc800eaad273adaa Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Mon, 16 Apr 2012 22:32:33 +0200 Subject: 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. --- src/bodyPart.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/bodyPart.cpp') diff --git a/src/bodyPart.cpp b/src/bodyPart.cpp index 7d60461e..522cbb23 100644 --- a/src/bodyPart.cpp +++ b/src/bodyPart.cpp @@ -46,15 +46,18 @@ bodyPart::bodyPart(weak_ref parentPart) } -void bodyPart::parse(const string& buffer, const string::size_type position, - const string::size_type end, string::size_type* newPosition) +void bodyPart::parseImpl + (ref parser, + const utility::stream::size_type position, + const utility::stream::size_type end, + utility::stream::size_type* newPosition) { // Parse the headers string::size_type pos = position; - m_header->parse(buffer, pos, end, &pos); + m_header->parse(parser, pos, end, &pos); // Parse the body contents - m_body->parse(buffer, pos, end, NULL); + m_body->parse(parser, pos, end, NULL); setParsedBounds(position, end); @@ -63,7 +66,7 @@ void bodyPart::parse(const string& buffer, const string::size_type position, } -void bodyPart::generate(utility::outputStream& os, const string::size_type maxLineLength, +void bodyPart::generateImpl(utility::outputStream& os, const string::size_type maxLineLength, const string::size_type /* curLinePos */, string::size_type* newLinePos) const { m_header->generate(os, maxLineLength); @@ -142,9 +145,9 @@ ref bodyPart::getParentPart() const } -const std::vector > bodyPart::getChildComponents() const +const std::vector > bodyPart::getChildComponents() { - std::vector > list; + std::vector > list; list.push_back(m_header); list.push_back(m_body); -- cgit v1.2.3