Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Go to the documentation of this file. 15 return ((ch >=
'0') && (ch <=
'9'));
19 static const char *
hatoui(
const char *first,
const char *last,
22 unsigned int result = 0;
23 for (; first != last; ++first)
29 else if (*first >=
'a' && *first <=
'f')
30 digit = *first -
'a' + 10;
32 else if (*first >=
'A' && *first <=
'F')
33 digit = *first -
'A' + 10;
38 result = 16 * result + digit;
46 const char *raw,
const char *end)
51 const char *rawStart = raw;
63 consumed = (raw - rawStart);
67 consumed = (raw - rawStart);
71 consumed = (raw - rawStart);
75 consumed = (raw - rawStart);
80 consumed = (raw - rawStart);
84 consumed = (raw - rawStart);
90 if (!strncmp(raw,
"null", 4)) {
92 consumed = (raw - rawStart);
94 }
else if (!strncmp(raw,
"true", 4)) {
96 consumed = (raw - rawStart);
98 }
else if (!strncmp(raw,
"false", 5)) {
100 consumed = (raw - rawStart);
119 const char *first = raw;
121 const char *firstDigit = first;
124 if ((*firstDigit ==
'0') &&
json_isdigit(firstDigit[1]))
130 if ((*first ==
'-') && (raw < end) && (!
json_isdigit(*raw)))
139 if (raw < end && *raw ==
'.') {
152 if (raw < end && (*raw ==
'e' || *raw ==
'E')) {
156 if (raw < end && (*raw ==
'-' || *raw ==
'+')) {
170 consumed = (raw - rawStart);
181 if (raw >= end || (
unsigned char)*raw < 0x20)
184 else if (*raw ==
'\\') {
192 case '\\': writer.
push_back(
'\\');
break;
201 unsigned int codepoint;
202 if (raw + 1 + 4 >= end ||
203 hatoui(raw + 1, raw + 1 + 4, codepoint) !=
218 else if (*raw ==
'"') {
232 consumed = (raw - rawStart);
249 #define expect(bit) (expectMask & (EXP_##bit)) 250 #define setExpect(bit) (expectMask |= EXP_##bit) 251 #define clearExpect(bit) (expectMask &= ~EXP_##bit) 257 uint32_t expectMask = 0;
258 vector<UniValue*> stack;
261 unsigned int consumed;
264 const char* end = raw + size;
281 }
else if (
expect(ARR_VALUE)) {
288 }
else if (
expect(OBJ_NAME)) {
293 }
else if (
expect(COLON)) {
318 stack.push_back(
this);
322 top->
values.push_back(tmpVal);
337 if (!stack.size() || (last_tok ==
JTOK_COMMA))
399 top->
values.push_back(tmpVal);
413 top->
values.push_back(tmpVal);
422 top->
keys.push_back(tokenVal);
432 top->
values.push_back(tmpVal);
442 }
while (!stack.empty ());
static bool jsonTokenIsValue(enum jtokentype jtt)
bool read(const char *raw, size_t len)
enum VType getType() const
std::vector< UniValue > values
void push_back(unsigned char ch)
enum jtokentype getJsonToken(string &tokenVal, unsigned int &consumed, const char *raw, const char *end)
static bool json_isspace(int ch)
bool push_back(const UniValue &val)
std::vector< std::string > keys
static bool json_isdigit(int ch)
void push_back_u(unsigned int codepoint_)
static const char * hatoui(const char *first, const char *last, unsigned int &out)