Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Yip <miloyip@gmail.com>2016-03-08 09:35:10 +0300
committerMilo Yip <miloyip@gmail.com>2016-03-08 09:35:10 +0300
commit1623ef2a96be9f5b6bcd638ad8ac815428b22e57 (patch)
treed36efe87bd451303dafb06356725d5cd36f786da /example
parenta045314f0285841b351dc614fb67b12470e9a853 (diff)
Update simplewriter example with Writer::Key()
Diffstat (limited to 'example')
-rw-r--r--example/simplewriter/simplewriter.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/example/simplewriter/simplewriter.cpp b/example/simplewriter/simplewriter.cpp
index 70d18f40..8d1275c2 100644
--- a/example/simplewriter/simplewriter.cpp
+++ b/example/simplewriter/simplewriter.cpp
@@ -9,23 +9,23 @@ int main() {
StringBuffer s;
Writer<StringBuffer> writer(s);
- writer.StartObject(); // writer expects subsequent key/value pairs.
- writer.String("hello"); // key
- writer.String("world"); // value
- writer.String("t"); // key
- writer.Bool(true); // value
- writer.String("f"); // etc...
+ writer.StartObject(); // Between StartObject()/EndObject(),
+ writer.Key("hello"); // output a key,
+ writer.String("world"); // follow by a value.
+ writer.Key("t");
+ writer.Bool(true);
+ writer.Key("f");
writer.Bool(false);
- writer.String("n");
+ writer.Key("n");
writer.Null();
- writer.String("i");
+ writer.Key("i");
writer.Uint(123);
- writer.String("pi");
+ writer.Key("pi");
writer.Double(3.1416);
- writer.String("a");
- writer.StartArray();
+ writer.Key("a");
+ writer.StartArray(); // Between StartArray()/EndArray(),
for (unsigned i = 0; i < 4; i++)
- writer.Uint(i);
+ writer.Uint(i); // all values are elements of the array.
writer.EndArray();
writer.EndObject();