--- /dev/null
+Changed: For ParameterHandler::OutputStyle::JSON or
+ParameterHandler::OutputStyle::ShortJSON, the function
+ParameterHandler::print_parameters() demangles now the
+parameters before printing the output. Users do not
+need to demangle the output themselves anymore.
+<br>
+(Magdalena Schreter, Peter Munch, 2022/05/25)
}
}
+ /**
+ * Demangle all parameters recursively and attach them to @p tree_out.
+ * @p parameter_node indicates, whether a given node @p tree_in
+ * is a parameter node (as opposed to being a subsection or alias
+ * node).
+ */
+ void
+ recursively_demangle(const boost::property_tree::ptree &tree_in,
+ boost::property_tree::ptree & tree_out,
+ const bool parameter_node = false)
+ {
+ for (const auto &p : tree_in)
+ {
+ if (parameter_node)
+ {
+ tree_out.put_child(p.first, p.second);
+ }
+ else
+ {
+ boost::property_tree::ptree temp;
+
+ if (const auto val = p.second.get_value_optional<std::string>())
+ temp.put_value<std::string>(*val);
+
+ recursively_demangle(p.second, temp, is_parameter_node(p.second));
+ tree_out.put_child(demangle(p.first), temp);
+ }
+ }
+ }
+
/**
* Assert validity of of given output @p style.
*/
if ((style & JSON) != 0)
{
- write_json(out, current_entries);
+ boost::property_tree::ptree current_entries_damangled;
+ recursively_demangle(current_entries, current_entries_damangled);
+ write_json(out, current_entries_damangled);
return out;
}
{
"Test":
{
- "A_20point":
+ "A point":
{
"value": "0, 0, 0",
"default_value": "0, 0, 0",
{
"Testing":
{
- "A_20bool":
+ "A bool":
{
"value": "true",
"default_value": "true",
"pattern_description": "[Bool]",
"actions": "1"
},
- "A_20double":
+ "A double":
{
"value": "1",
"default_value": "1",
"pattern_description": "[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]",
"actions": "0"
},
- "A_20string":
+ "A string":
{
"value": "Ciao",
"default_value": "Ciao",
DEAL::ShortJSON format:
DEAL::========================================
{
- "A_20double": "1",
- "Section_20two":
+ "A double": "1",
+ "Section two":
{
- "Another_20double": "2"
+ "Another double": "2"
}
}
"pattern_description": "[Integer range -2147483648...2147483647 (inclusive)]",
"actions": "1"
},
- "Testing_25testing":
+ "Testing%testing":
{
- "double_2bdouble":
+ "double+double":
{
"value": "7.1415926",
"default_value": "6.14159",
"pattern_description": "[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]",
"actions": "6"
},
- "int_2aint":
+ "int*int":
{
"value": "2",
"default_value": "2",
"pattern_description": "[Integer range -2147483648...2147483647 (inclusive)]",
"actions": "5"
},
- "string_26list":
+ "string&list":
{
"value": "< & > ; \/",
"default_value": "< & > ; \/",
},
"ss1":
{
- "double_201":
+ "double 1":
{
"value": "2.234",
"default_value": "1.234",
},
"ss2":
{
- "double_202":
+ "double 2":
{
"value": "5.321",
"default_value": "4.321",
"pattern": "1",
"pattern_description": "[Integer range -2147483648...2147483647 (inclusive)]"
},
- "Testing_25testing":
+ "Testing%testing":
{
- "double_2bdouble":
+ "double+double":
{
"value": "6.1415926",
"default_value": "6.1415926",
"pattern": "6",
"pattern_description": "[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]"
},
- "int_2aint":
+ "int*int":
{
"value": "2",
"default_value": "2",
"pattern": "5",
"pattern_description": "[Integer range -2147483648...2147483647 (inclusive)]"
},
- "string_26list":
+ "string&list":
{
"value": "< & > ; \/",
"default_value": "< & > ; \/",
},
"ss1":
{
- "double_201":
+ "double 1":
{
"value": "1.234",
"default_value": "1.234",
},
"ss2":
{
- "double_202":
+ "double 2":
{
"value": "4.321",
"default_value": "4.321",
{
"int1": "1",
"int2": "2",
- "Testing_25testing":
+ "Testing%testing":
{
- "double_2bdouble": "6.1415926",
- "int_2aint": "2",
- "string_26list": "< & > ; \/"
+ "double+double": "6.1415926",
+ "int*int": "2",
+ "string&list": "< & > ; \/"
},
"ss1":
{
- "double_201": "1.234",
+ "double 1": "1.234",
"ss2":
{
- "double_202": "4.321"
+ "double 2": "4.321"
}
}
}