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

Method write

src/univalue/lib/univalue_write.cpp:28–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 10

writeArrayMethod · 0.45
writeObjectMethod · 0.45
mainFunction · 0.45
runtestFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
ReadSettingsFunction · 0.45
WriteSettingsFunction · 0.45
ParseParametersMethod · 0.45
logArgsPrefixMethod · 0.45
LogArgsMethod · 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