MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / WriteEntryJson

Method WriteEntryJson

apps/tools/Tools/commands/ConfigCommand.cpp:96–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96void ConfigCommand::WriteEntryJson(std::ostream& out, const ParamEntry& entry, int indent)
97{
98 if (entry.IsClass())
99 {
100 const ParamClass* cls = entry.GetClassInterface();
101 out << Indent(indent) << "\"" << JsonEscape(entry.GetName().Data()) << "\": ";
102 WriteClassJson(out, *cls, indent);
103 }
104 else if (entry.IsArray())
105 {
106 out << Indent(indent) << "\"" << JsonEscape(entry.GetName().Data()) << "\": ";
107 WriteArrayJson(out, entry);
108 }
109 else if (entry.IsFloatValue())
110 out << Indent(indent) << "\"" << JsonEscape(entry.GetName().Data()) << "\": " << (float)entry;
111 else if (entry.IsIntValue())
112 out << Indent(indent) << "\"" << JsonEscape(entry.GetName().Data()) << "\": " << (int)entry;
113 else
114 out << Indent(indent) << "\"" << JsonEscape(entry.GetName().Data()) << "\": \""
115 << JsonEscape(entry.GetValue().Data()) << "\"";
116}
117
118void ConfigCommand::WriteClassJson(std::ostream& out, const ParamClass& cls, int indent)
119{

Callers

nothing calls this directly

Calls 10

GetClassInterfaceMethod · 0.80
IndentFunction · 0.70
JsonEscapeFunction · 0.70
IsClassMethod · 0.45
DataMethod · 0.45
GetNameMethod · 0.45
IsArrayMethod · 0.45
IsFloatValueMethod · 0.45
IsIntValueMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected