add dumpconfigto option, JSON formatting

This commit is contained in:
John
2022-02-26 08:54:01 +01:00
parent bb965173b4
commit 7e7eb28898
3 changed files with 35 additions and 9 deletions
+3 -5
View File
@@ -2833,21 +2833,19 @@ void MessageMap::dump(bool withConditions, OutputFormat outputFormat, ostream* o
if (!message) {
continue;
}
bool wasFirst = first;
if (first) {
first = false;
} else if (isJson) {
*output << ",\n";
} else {
*output << endl;
}
if (isJson) {
if (!wasFirst) {
*output << ",\n";
}
ostringstream str;
message->decodeJson(false, false, false, false, outputFormat, &str);
string add = str.str();
size_t pos = add.find('{');
*output << "\n {\"circuit\": \"" << message->getCircuit() << "\", " << add.substr(pos+1);
*output << " {\n \"circuit\": \"" << message->getCircuit() << "\", " << add.substr(pos+1);
} else {
message->dump(nullptr, withConditions, outputFormat, output);
}