Make indentation work in toString

This commit is contained in:
fbraem
2013-02-17 18:41:36 +01:00
parent b19401af37
commit 13380b5eb9
3 changed files with 46 additions and 12 deletions

View File

@@ -64,28 +64,32 @@ std::string Array::toString(int indent) const
{
if ( it != _elements.begin() )
{
if ( indent > 0 )
{
for(int i = 0; i < indent; ++i)
{
oss << ' ';
}
}
oss << ",";
if ( indent > 0 )
{
oss << std::endl;
}
}
for(int i = 0; i < indent; ++i)
{
oss << ' ';
}
oss << (*it)->toString();
}
oss << "]";
if ( indent > 0 )
if ( indent > 0 )
{
oss << std::endl;
indent -= 2;
for(int i = 0; i < indent; ++i)
{
oss << ' ';
}
}
oss << "]";
return oss.str();
}