MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / escape_string

Function escape_string

include/jsoncons_ext/jsonpointer/jsonpointer.hpp:69–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67
68 template <typename CharT>
69 std::basic_string<CharT> escape_string(const std::basic_string<CharT>& s)
70 {
71 std::basic_string<CharT> result;
72 for (auto c : s)
73 {
74 switch (c)
75 {
76 case '~':
77 result.push_back('~');
78 result.push_back('0');
79 break;
80 case '/':
81 result.push_back('~');
82 result.push_back('1');
83 break;
84 default:
85 result.push_back(c);
86 break;
87 }
88 }
89 return result;
90 }
91
92 // basic_json_pointer
93

Callers 3

encode_stringFunction · 0.50
encode_keyFunction · 0.50
write_string_valueFunction · 0.50

Calls 1

push_backMethod · 0.45

Tested by

no test coverage detected