Electroneum
messagereader.cpp File Reference
#include "rapidjson/reader.h"
#include "rapidjson/error/en.h"
#include <iostream>
#include <string>
#include <map>
Include dependency graph for messagereader.cpp:

Go to the source code of this file.

Classes

struct  MessageHandler
 

Typedefs

typedef map< string, string > MessageMap
 

Functions

int main ()
 

Typedef Documentation

◆ MessageMap

typedef map<string, string> MessageMap

Definition at line 13 of file messagereader.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 89 of file messagereader.cpp.

89  {
90  MessageMap messages;
91 
92  const char* json1 = "{ \"greeting\" : \"Hello!\", \"farewell\" : \"bye-bye!\" }";
93  cout << json1 << endl;
94  ParseMessages(json1, messages);
95 
96  for (MessageMap::const_iterator itr = messages.begin(); itr != messages.end(); ++itr)
97  cout << itr->first << ": " << itr->second << endl;
98 
99  cout << endl << "Parse a JSON with invalid schema." << endl;
100  const char* json2 = "{ \"greeting\" : \"Hello!\", \"farewell\" : \"bye-bye!\", \"foo\" : {} }";
101  cout << json2 << endl;
102  ParseMessages(json2, messages);
103 
104  return 0;
105 }
map< string, string > MessageMap