MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / EscapeJSONString

Function EscapeJSONString

include/util/string_util.hpp:39–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39inline void EscapeJSONString(const std::string &input, std::string &output)
40{
41 for (const char letter : input)
42 {
43 switch (letter)
44 {
45 case '\\':
46 output += "\\\\";
47 break;
48 case '"':
49 output += "\\\"";
50 break;
51 case '/':
52 output += "\\/";
53 break;
54 case '\b':
55 output += "\\b";
56 break;
57 case '\f':
58 output += "\\f";
59 break;
60 case '\n':
61 output += "\\n";
62 break;
63 case '\r':
64 output += "\\r";
65 break;
66 case '\t':
67 output += "\\t";
68 break;
69 default:
70 output.append(1, letter);
71 break;
72 }
73 }
74}
75
76inline std::size_t URIDecode(const std::string &input, std::string &output)
77{

Callers 3

BOOST_AUTO_TEST_CASEFunction · 0.85
operator()Method · 0.85
LLVMFuzzerTestOneInputFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected