Skip to content

Commit

Permalink
Update simplewriter example with Writer::Key()
Browse files Browse the repository at this point in the history
  • Loading branch information
miloyip committed Mar 8, 2016
1 parent a045314 commit 1623ef2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions example/simplewriter/simplewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 1623ef2

Please sign in to comment.