mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-30 13:47:10 +01:00
Make indentation work in toString
This commit is contained in:
@@ -155,10 +155,40 @@ std::string Document::toString(int indent) const
|
||||
{
|
||||
if ( it != _elements.begin() )
|
||||
{
|
||||
oss << ", ";
|
||||
oss << ",";
|
||||
if ( indent > 0 )
|
||||
{
|
||||
oss << std::endl;
|
||||
}
|
||||
}
|
||||
if ( indent > 0 )
|
||||
{
|
||||
for(int i = 0; i < indent; ++i)
|
||||
{
|
||||
oss << ' ';
|
||||
}
|
||||
}
|
||||
oss << '"' << (*it)->name() << '"' << " : ";
|
||||
if ( indent > 0 )
|
||||
{
|
||||
oss << (*it)->toString(indent + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << (*it)->toString();
|
||||
}
|
||||
oss << '"' << (*it)->name() << '"' << " : " << (*it)->toString();
|
||||
}
|
||||
|
||||
if ( indent > 0 )
|
||||
{
|
||||
oss << std::endl;
|
||||
indent -= 2;
|
||||
for(int i = 0; i < indent; ++i)
|
||||
{
|
||||
oss << ' ';
|
||||
}
|
||||
}
|
||||
|
||||
oss << "}" << std::endl;
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user