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

Function JsonEscape

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

Source from the content-addressed store, hash-verified

16{
17
18static std::string JsonEscape(const char* s)
19{
20 std::string out;
21 for (; *s; ++s)
22 {
23 switch (*s)
24 {
25 case '"':
26 out += "\\\"";
27 break;
28 case '\\':
29 out += "\\\\";
30 break;
31 case '\n':
32 out += "\\n";
33 break;
34 case '\r':
35 out += "\\r";
36 break;
37 case '\t':
38 out += "\\t";
39 break;
40 default:
41 out += *s;
42 }
43 }
44 return out;
45}
46
47static std::string Indent(int n)
48{

Callers 2

WriteArrayValueJsonMethod · 0.70
WriteEntryJsonMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected