21 bool Null() { type =
"Null"; data.clear();
return true; }
22 bool Bool(
bool b) { type =
"Bool:"; data = b?
"true":
"false";
return true; }
23 bool Int(
int i) { type =
"Int:"; data =
stringify(i);
return true; }
24 bool Uint(
unsigned u) { type =
"Uint:"; data =
stringify(u);
return true; }
28 bool RawNumber(
const char* str,
SizeType length,
bool) { type =
"Number:"; data = std::string(str, length);
return true; }
29 bool String(
const char* str,
SizeType length,
bool) { type =
"String:"; data = std::string(str, length);
return true; }
30 bool StartObject() { type =
"StartObject"; data.clear();
return true; }
31 bool Key(
const char* str,
SizeType length,
bool) { type =
"Key:"; data = std::string(str, length);
return true; }
33 bool StartArray() { type =
"StartArray"; data.clear();
return true; }
41 const char json[] =
" { \"hello\" : \"world\", \"t\" : true , \"f\" : false, \"n\": null, \"i\":123, \"pi\": 3.1416, \"a\":[1, 2, 3, 4] } ";
49 cout << handler.
type << handler.
data << endl;
bool IterativeParseNext(InputStream &is, Handler &handler)
Parse one token from JSON text.
void IterativeParseInit()
Initialize JSON text token-by-token parsing.
RAPIDJSON_FORCEINLINE bool IterativeParseComplete() const
Check if token-by-token parsing JSON text is complete.
#define T(meth, val, expected)
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
@ kParseDefaultFlags
Default parse flags. Can be customized by defining RAPIDJSON_PARSE_DEFAULT_FLAGS.
std::string stringify(T x)
unsigned __int64 uint64_t
bool EndObject(SizeType memberCount)
bool RawNumber(const char *str, SizeType length, bool)
bool String(const char *str, SizeType length, bool)
bool EndArray(SizeType elementCount)
bool Key(const char *str, SizeType length, bool)