Electroneum
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;
45  StringStream ss(json);
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 }
const char * type
Default parse flags. Can be customized by defining RAPIDJSON_PARSE_DEFAULT_FLAGS. ...
Definition: reader.h:156
Read-only string stream.
Definition: fwd.h:47
bool IterativeParseNext(InputStream &is, Handler &handler)
Parse one token from JSON text.
Definition: reader.h:618
std::string data
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
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: