24 return ((
ch >=
'0') && (
ch <=
'9'));
28static const char *
hatoui(
const char *first,
const char *last,
30 unsigned int result = 0;
31 for (; first != last; ++first) {
35 }
else if (*first >=
'a' && *first <=
'f') {
36 digit = *first -
'a' + 10;
37 }
else if (*first >=
'A' && *first <=
'F') {
38 digit = *first -
'A' + 10;
43 result = 16 * result +
digit;
51 const char *raw,
const char *end) {
100 }
else if (!
strncmp(raw,
"true", 4)) {
104 }
else if (!
strncmp(raw,
"false", 5)) {
126 const char *first = raw;
140 if ((*first ==
'-') && (raw < end) && (!
json_isdigit(*raw))) {
151 if (raw < end && *raw ==
'.') {
167 if (raw < end && (*raw ==
'e' || *raw ==
'E')) {
171 if (raw < end && (*raw ==
'-' || *raw ==
'+')) {
199 if (raw >= end || (
uint8_t)*raw < 0x20) {
201 }
else if (*raw ==
'\\') {
235 unsigned int codepoint;
236 if (raw + 1 + 4 >= end ||
237 hatoui(raw + 1, raw + 1 + 4, codepoint) !=
241 writer.push_back_u(codepoint);
251 }
else if (*raw ==
'"') {
283#define expect(bit) (expectMask & (EXP_##bit))
284#define setExpect(bit) (expectMask |= EXP_##bit)
285#define clearExpect(bit) (expectMask &= ~EXP_##bit)
291 std::vector<UniValue *> stack;
297 const char *raw{
str_in.data()};
298 const char *end{raw +
str_in.size()};
354 stack.push_back(
this);
491 }
while (!stack.empty());
Filter that generates and validates UTF-8, as well as collates UTF-16 surrogate pairs as specified in...
void push_back(UniValue val)
std::vector< UniValue > values
std::vector< std::string > keys
bool read(std::string_view raw)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
enum jtokentype getJsonToken(std::string &tokenVal, unsigned int &consumed, const char *raw, const char *end)
static bool jsonTokenIsValue(enum jtokentype jtt)
static bool json_isspace(int ch)
static bool json_isdigit(int ch)
static constexpr size_t MAX_JSON_DEPTH
enum jtokentype getJsonToken(std::string &tokenVal, unsigned int &consumed, const char *raw, const char *end)
static const char * hatoui(const char *first, const char *last, unsigned int &out)