Electroneum
serialize.cpp File Reference
#include "rapidjson/prettywriter.h"
#include <cstdio>
#include <string>
#include <vector>
Include dependency graph for serialize.cpp:

Go to the source code of this file.

Classes

class  Person
 
class  Education
 
class  Dependent
 
class  Employee
 

Functions

int main (int, char *[])
 

Function Documentation

◆ main()

int main ( int  ,
char *  [] 
)

Definition at line 153 of file serialize.cpp.

153  {
154  std::vector<Employee> employees;
155 
156  employees.push_back(Employee("Milo YIP", 34, true));
157  employees.back().AddDependent(Dependent("Lua YIP", 3, new Education("Happy Kindergarten", 3.5)));
158  employees.back().AddDependent(Dependent("Mio YIP", 1));
159 
160  employees.push_back(Employee("Percy TSE", 30, false));
161 
162  StringBuffer sb;
163  PrettyWriter<StringBuffer> writer(sb);
164 
165  writer.StartArray();
166  for (std::vector<Employee>::const_iterator employeeItr = employees.begin(); employeeItr != employees.end(); ++employeeItr)
167  employeeItr->Serialize(writer);
168  writer.EndArray();
169 
170  puts(sb.GetString());
171 
172  return 0;
173 }
Writer with indentation and spacing.
Definition: fwd.h:100
const Ch * GetString() const
Definition: stringbuffer.h:73
Here is the call graph for this function: