Commit 1623ef2a authored by Milo Yip's avatar Milo Yip

Update simplewriter example with Writer::Key()

parent a045314f
...@@ -9,23 +9,23 @@ int main() { ...@@ -9,23 +9,23 @@ int main() {
StringBuffer s; StringBuffer s;
Writer<StringBuffer> writer(s); Writer<StringBuffer> writer(s);
writer.StartObject(); // writer expects subsequent key/value pairs. writer.StartObject(); // Between StartObject()/EndObject(),
writer.String("hello"); // key writer.Key("hello"); // output a key,
writer.String("world"); // value writer.String("world"); // follow by a value.
writer.String("t"); // key writer.Key("t");
writer.Bool(true); // value writer.Bool(true);
writer.String("f"); // etc... writer.Key("f");
writer.Bool(false); writer.Bool(false);
writer.String("n"); writer.Key("n");
writer.Null(); writer.Null();
writer.String("i"); writer.Key("i");
writer.Uint(123); writer.Uint(123);
writer.String("pi"); writer.Key("pi");
writer.Double(3.1416); writer.Double(3.1416);
writer.String("a"); writer.Key("a");
writer.StartArray(); writer.StartArray(); // Between StartArray()/EndArray(),
for (unsigned i = 0; i < 4; i++) for (unsigned i = 0; i < 4; i++)
writer.Uint(i); writer.Uint(i); // all values are elements of the array.
writer.EndArray(); writer.EndArray();
writer.EndObject(); writer.EndObject();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment