Fixed parameters not showing as child components + fixed parsing bounds in typeAdapter.

This commit is contained in:
Vincent Richard 2005-03-12 20:58:48 +00:00
parent 836c80565f
commit 825021442c
5 changed files with 28 additions and 2 deletions

View File

@ -184,9 +184,13 @@ void parameterizedHeaderField::parse(const string& buffer, const string::size_ty
if (attrStart != attrEnd && value.length()) if (attrStart != attrEnd && value.length())
{ {
// Append this parameter to the list // Append this parameter to the list
appendParameter(parameterFactory::getInstance()-> parameter* param = parameterFactory::getInstance()->
create(string(buffer.begin() + attrStart, create(string(buffer.begin() + attrStart,
buffer.begin() + attrEnd), value)); buffer.begin() + attrEnd), value);
param->setParsedBounds(attrStart, position + (p - pstart));
appendParameter(param);
} }
// Skip white-spaces after this parameter // Skip white-spaces after this parameter
@ -434,4 +438,19 @@ const std::vector <parameter*> parameterizedHeaderField::getParameterList()
} }
const std::vector <const component*> parameterizedHeaderField::getChildComponents() const
{
std::vector <const component*> list = headerField::getChildComponents();
for (std::vector <parameter*>::const_iterator it = m_params.begin() ;
it != m_params.end() ; ++it)
{
list.push_back(*it);
}
return (list);
}
} // vmime } // vmime

View File

@ -33,6 +33,8 @@ void typeAdapter <string>::parse(const string& buffer, const string::size_type p
{ {
m_value = string(buffer.begin() + position, buffer.begin() + end); m_value = string(buffer.begin() + position, buffer.begin() + end);
setParsedBounds(position, end);
if (newPosition) if (newPosition)
*newPosition = end; *newPosition = end;
} }

View File

@ -32,6 +32,7 @@ namespace vmime
class parameter : public component class parameter : public component
{ {
friend class parameterFactory; friend class parameterFactory;
friend class parameterizedHeaderField;
public: public:

View File

@ -172,6 +172,8 @@ public:
void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL); void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const; void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
const std::vector <const component*> getChildComponents() const;
}; };

View File

@ -91,6 +91,8 @@ public:
std::istringstream iss(string(buffer.begin() + position, buffer.begin() + end)); std::istringstream iss(string(buffer.begin() + position, buffer.begin() + end));
iss >> m_value; iss >> m_value;
setParsedBounds(position, end);
if (newPosition) if (newPosition)
*newPosition = end; *newPosition = end;
} }