MCPcopy Create free account
hub / github.com/ElementsProject/elements / json_escape

Function json_escape

src/univalue/lib/univalue_write.cpp:10–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include "univalue_escapes.h"
9
10static std::string json_escape(const std::string& inS)
11{
12 std::string outS;
13 outS.reserve(inS.size() * 2);
14
15 for (unsigned int i = 0; i < inS.size(); i++) {
16 unsigned char ch = static_cast<unsigned char>(inS[i]);
17 const char *escStr = escapes[ch];
18
19 if (escStr)
20 outS += escStr;
21 else
22 outS += static_cast<char>(ch);
23 }
24
25 return outS;
26}
27
28std::string UniValue::write(unsigned int prettyIndent,
29 unsigned int indentLevel) const

Callers 2

writeMethod · 0.85
writeObjectMethod · 0.85

Calls 2

reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected