comments/minor typos

This commit is contained in:
Christopher Dunn 2015-02-13 09:37:39 -06:00
parent da0fcfbaa2
commit aa13a8ba40
2 changed files with 18 additions and 12 deletions

View File

@ -56,20 +56,24 @@ std::cin >> root;
// You can also read into a particular sub-value.
std::cin >> root["subtree"];
// Get the value of the member of root named 'encoding', return 'UTF-8' if there is no
// such member.
// Get the value of the member of root named 'encoding',
// and return 'UTF-8' if there is no such member.
std::string encoding = root.get("encoding", "UTF-8" ).asString();
// Get the value of the member of root named 'encoding'; return a 'null' value if
// Get the value of the member of root named 'plug-ins'; return a 'null' value if
// there is no such member.
const Json::Value plugins = root["plug-ins"];
for ( int index = 0; index < plugins.size(); ++index ) // Iterates over the sequence elements.
// Iterate over the sequence elements.
for ( int index = 0; index < plugins.size(); ++index )
loadPlugIn( plugins[index].asString() );
// Try other datatypes. Some are auto-convertible to others.
foo::setIndentLength( root["indent"].get("length", 3).asInt() );
foo::setIndentUseSpace( root["indent"].get("use_space", true).asBool() );
// Since Json::Value has implicit constructor for all value types, it is not
// necessary to explicitly construct the Json::Value object:
// Since Json::Value has an implicit constructor for all value types, it is not
// necessary to explicitly construct the Json::Value object.
root["encoding"] = foo::getCurrentEncoding();
root["indent"]["length"] = foo::getCurrentIndentLength();
root["indent"]["use_space"] = foo::getCurrentIndentUseSpace();

View File

@ -298,19 +298,21 @@ public:
/** Configuration of this builder.
These are case-sensitive.
Available settings (case-sensitive):
- "collectComments": false or true
- `"collectComments": false or true`
- true to collect comment and allow writing them
back during serialization, false to discard comments.
This parameter is ignored if allowComments is false.
- "allowComments": false or true
- `"allowComments": false or true`
- true if comments are allowed.
- "strictRoot": false or true
- `"strictRoot": false or true`
- true if root must be either an array or an object value
- "allowDroppedNullPlaceholders": false or true
- `"allowDroppedNullPlaceholders": false or true`
- true if dropped null placeholders are allowed. (See StreamWriterBuilder.)
- "allowNumericKeys": false or true
- `"allowNumericKeys": false or true`
- true if numeric object keys are allowed.
- "stackLimit": integer
- `"stackLimit": integer`
- Exceeding stackLimit (recursive depth of `readValue()`) will
cause an exception.
- This is a security issue (seg-faults caused by deeply nested JSON),
so the default is low.