From f879a9794c4908df8e7484250b56b13342a66038 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 12 Apr 2005 18:42:54 +0000 Subject: Added support for RFC-2231. --- src/parameter.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/parameter.cpp') diff --git a/src/parameter.cpp b/src/parameter.cpp index 1cc2e697..988755be 100644 --- a/src/parameter.cpp +++ b/src/parameter.cpp @@ -63,6 +63,23 @@ void parameter::parse(const string& buffer, const string::size_type position, getValue().parse(buffer, position, end, newPosition); setParsedBounds(position, end); + + if (newPosition) + *newPosition = end; +} + + +void parameter::parse(const std::vector & chunks) +{ + string value; + + for (std::vector ::const_iterator it = chunks.begin() ; + it != chunks.end() ; ++it) + { + value += (*it).data; + } + + getValue().parse(value, 0, value.length(), NULL); } @@ -87,10 +104,13 @@ void parameter::generate(utility::outputStream& os, const string::size_type maxL void parameter::generateValue(utility::outputStream& os, const string::size_type /* maxLineLength */, const string::size_type curLinePos, string::size_type* newLinePos) const { + // NOTE: This default implementation does not support parameter + // values that span on several lines ('defaultParameter' can do + // that, following rules specified in RFC-2231). + std::ostringstream valueStream; utility::outputStreamAdapter valueStreamV(valueStream); - // TODO: can we imagine having values that span on multiple lines? getValue().generate(valueStreamV, lineLengthLimits::infinite, 0, NULL); const string value(valueStream.str()); -- cgit v1.2.3