MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / write

Method write

src/univalue/lib/univalue_write.cpp:31–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31string UniValue::write(unsigned int prettyIndent,
32 unsigned int indentLevel) const
33{
34 string s;
35 s.reserve(1024);
36
37 unsigned int modIndent = indentLevel;
38 if (modIndent == 0)
39 modIndent = 1;
40
41 switch (typ) {
42 case VNULL:
43 s += "null";
44 break;
45 case VOBJ:
46 writeObject(prettyIndent, modIndent, s);
47 break;
48 case VARR:
49 writeArray(prettyIndent, modIndent, s);
50 break;
51 case VSTR:
52 s += "\"" + json_escape(val) + "\"";
53 break;
54 case VNUM:
55 s += val;
56 break;
57 case VBOOL:
58 s += (val == "1" ? "true" : "false");
59 break;
60 }
61
62 return s;
63}
64
65static void indentStr(unsigned int prettyIndent, unsigned int indentLevel, string& s)
66{

Callers 5

writeArrayMethod · 0.45
writeObjectMethod · 0.45
mainFunction · 0.45
runtestFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45

Calls 2

json_escapeFunction · 0.85
reserveMethod · 0.45

Tested by 3

mainFunction · 0.36
runtestFunction · 0.36
BOOST_AUTO_TEST_CASEFunction · 0.36