Refactor JSON::writeClose

This commit is contained in:
m-holger 2023-01-28 11:09:46 +00:00 committed by Jay Berkenbilt
parent cb4debe75f
commit dfa7d414f5
1 changed files with 6 additions and 4 deletions

View File

@ -32,11 +32,13 @@ JSON::JSON(std::shared_ptr<JSON_value> value) :
void
JSON::writeClose(Pipeline* p, bool first, size_t depth, char const* delimiter)
{
if (!first) {
*p << "\n";
writeIndent(p, depth);
if (first) {
*p << delimiter;
} else {
std::string s{"\n"};
s.append(2 * depth, ' ');
*p << s + delimiter;
}
*p << delimiter;
}
void