Electroneum
Loading...
Searching...
No Matches
simplepullreader.cpp File Reference
#include "rapidjson/reader.h"
#include <iostream>
#include <sstream>
Include dependency graph for simplepullreader.cpp:

Go to the source code of this file.

Classes

struct  MyHandler

Functions

template<typename T>
std::string stringify (T x)
int main ()

Function Documentation

◆ main()

int main ( )

Definition at line 40 of file simplepullreader.cpp.

40 {
41 const char json[] = " { \"hello\" : \"world\", \"t\" : true , \"f\" : false, \"n\": null, \"i\":123, \"pi\": 3.1416, \"a\":[1, 2, 3, 4] } ";
42
43 MyHandler handler;
44 Reader reader;
46 reader.IterativeParseInit();
47 while (!reader.IterativeParseComplete()) {
48 reader.IterativeParseNext<kParseDefaultFlags>(ss, handler);
49 cout << handler.type << handler.data << endl;
50 }
51
52 return 0;
53}
bool IterativeParseNext(InputStream &is, Handler &handler)
Parse one token from JSON text.
Definition reader.h:618
void IterativeParseInit()
Initialize JSON text token-by-token parsing.
Definition reader.h:605
RAPIDJSON_FORCEINLINE bool IterativeParseComplete() const
Check if token-by-token parsing JSON text is complete.
Definition reader.h:675
GenericStringStream< UTF8< char > > StringStream
Definition fwd.h:49
GenericReader< UTF8< char >, UTF8< char >, CrtAllocator > Reader
Definition fwd.h:90
@ kParseDefaultFlags
Default parse flags. Can be customized by defining RAPIDJSON_PARSE_DEFAULT_FLAGS.
Definition reader.h:156
std::string data
const char * type
rapidjson::Document json
Definition transport.cpp:49
Here is the call graph for this function:

◆ stringify()

template<typename T>
std::string stringify ( T x)

Definition at line 9 of file simplepullreader.cpp.

9 {
10 std::stringstream ss;
11 ss << x;
12 return ss.str();
13}
Here is the caller graph for this function: