first commit
This commit is contained in:
35
third_party/socket.io-client-cpp/lib/rapidjson/example/simplewriter/simplewriter.cpp
vendored
Normal file
35
third_party/socket.io-client-cpp/lib/rapidjson/example/simplewriter/simplewriter.cpp
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "rapidjson/writer.h"
|
||||
#include "rapidjson/stringbuffer.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace rapidjson;
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
StringBuffer s;
|
||||
Writer<StringBuffer> writer(s);
|
||||
|
||||
writer.StartObject();
|
||||
writer.String("hello");
|
||||
writer.String("world");
|
||||
writer.String("t");
|
||||
writer.Bool(true);
|
||||
writer.String("f");
|
||||
writer.Bool(false);
|
||||
writer.String("n");
|
||||
writer.Null();
|
||||
writer.String("i");
|
||||
writer.Uint(123);
|
||||
writer.String("pi");
|
||||
writer.Double(3.1416);
|
||||
writer.String("a");
|
||||
writer.StartArray();
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
writer.Uint(i);
|
||||
writer.EndArray();
|
||||
writer.EndObject();
|
||||
|
||||
cout << s.GetString() << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user