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

Method writeObject

src/univalue/lib/univalue_write.cpp:89–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void UniValue::writeObject(unsigned int prettyIndent, unsigned int indentLevel, std::string& s) const
90{
91 s += "{";
92 if (prettyIndent)
93 s += "\n";
94
95 for (unsigned int i = 0; i < keys.size(); i++) {
96 if (prettyIndent)
97 indentStr(prettyIndent, indentLevel, s);
98 s += "\"" + json_escape(keys[i]) + "\":";
99 if (prettyIndent)
100 s += " ";
101 s += values.at(i).write(prettyIndent, indentLevel + 1);
102 if (i != (values.size() - 1))
103 s += ",";
104 if (prettyIndent)
105 s += "\n";
106 }
107
108 if (prettyIndent)
109 indentStr(prettyIndent, indentLevel - 1, s);
110 s += "}";
111}
112

Callers

nothing calls this directly

Calls 4

indentStrFunction · 0.85
json_escapeFunction · 0.85
sizeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected