15 outS.reserve(inS.size() * 2);
17 for (
unsigned int i = 0; i < inS.size(); i++) {
18 unsigned char ch =
static_cast<unsigned char>(inS[i]);
19 const char *escStr =
escapes[ch];
24 outS +=
static_cast<char>(ch);
32 unsigned int indentLevel)
const
37 unsigned int modIndent = indentLevel;
58 s += (
val ==
"1" ?
"true" :
"false");
65static void indentStr(
unsigned int prettyIndent,
unsigned int indentLevel, std::string&
s)
67 s.append(prettyIndent * indentLevel,
' ');
77 for (
unsigned int i = 0; i <
values.size(); i++) {
80 s +=
values[i].write(prettyIndent, indentLevel + 1);
81 if (i != (
values.size() - 1)) {
100 for (
unsigned int i = 0; i <
keys.size(); i++) {
106 s +=
values.at(i).write(prettyIndent, indentLevel + 1);
107 if (i != (
values.size() - 1))
void writeArray(unsigned int prettyIndent, unsigned int indentLevel, std::string &s) const
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
std::vector< UniValue > values
std::vector< std::string > keys
void writeObject(unsigned int prettyIndent, unsigned int indentLevel, std::string &s) const
static const char * escapes[256]
static std::string json_escape(const std::string &inS)
static void indentStr(unsigned int prettyIndent, unsigned int indentLevel, std::string &s)