7RAPIDJSON_DIAG_OFF(effc++)
149 const char* result =
v_.GetString();
183 int result =
v_.GetInt();
194 double result =
v_.GetDouble();
205 bool result =
v_.GetBool();
225 const char* result =
v_.GetString();
288 char json[] =
" { \"hello\" : \"world\", \"t\" : true , \"f\" : false, \"n\": null,"
289 "\"i\":123, \"pi\": 3.1416, \"a\":[-1, 2, 3, 4, \"array\", []], \"skipArrays\":[1, 2, [[[3]]]], "
290 "\"skipObject\":{ \"i\":0, \"t\":true, \"n\":null, \"d\":123.45 }, "
291 "\"skipNested\":[[[[{\"\":0}, {\"\":[-9.87]}]]], [], []], "
292 "\"skipString\":\"zzz\", \"reachedEnd\":null, \"t\":true }";
299 while (
const char* key =
r.NextObjectKey()) {
300 if (0 == strcmp(key,
"hello")) {
302 cout << key <<
":" <<
r.GetString() << endl;
304 else if (0 == strcmp(key,
"t") || 0 == strcmp(key,
"f")) {
306 cout << key <<
":" <<
r.GetBool() << endl;
309 else if (0 == strcmp(key,
"n")) {
315 else if (0 == strcmp(key,
"pi")) {
317 cout << key <<
":" <<
r.GetDouble() << endl;
320 else if (0 == strcmp(key,
"a")) {
325 cout << key <<
":[ ";
326 while (
r.NextArrayValue()) {
328 cout <<
r.GetDouble() <<
" ";
331 cout <<
r.GetString() <<
" ";
342 cout << key <<
":skipped" << endl;
bool IterativeParseNext(InputStream &is, Handler &handler)
Parse one token from JSON text.
void IterativeParseInit()
Initialize JSON text token-by-token parsing.
bool HasParseError() const
Whether a parse error has occurred in the last parsing.
bool RawNumber(const char *, SizeType, bool)
LookaheadParsingState st_
static const int parseFlags
bool Key(const char *str, SizeType length, bool)
bool String(const char *str, SizeType length, bool)
LookaheadParserHandler(char *str)
LookaheadParser(char *str)
const char * NextObjectKey()
#define RAPIDJSON_ASSERT(x)
Assertion.
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
@ kParseInsituFlag
In-situ(destructive) parsing.
@ kParseDefaultFlags
Default parse flags. Can be customized by defining RAPIDJSON_PARSE_DEFAULT_FLAGS.
unsigned __int64 uint64_t