@@ -56,20 +56,24 @@ std::cin >> root;
5656// You can also read into a particular sub-value.
5757std::cin >> root["subtree"];
5858
59- // Get the value of the member of root named 'encoding', return 'UTF-8' if there is no
60- // such member.
59+ // Get the value of the member of root named 'encoding',
60+ // and return 'UTF-8' if there is no such member.
6161std::string encoding = root.get("encoding", "UTF-8" ).asString();
62- // Get the value of the member of root named 'encoding'; return a 'null' value if
62+
63+ // Get the value of the member of root named 'plug-ins'; return a 'null' value if
6364// there is no such member.
6465const Json::Value plugins = root["plug-ins"];
65- for ( int index = 0; index < plugins.size(); ++index ) // Iterates over the sequence elements.
66+
67+ // Iterate over the sequence elements.
68+ for ( int index = 0; index < plugins.size(); ++index )
6669 loadPlugIn( plugins[index].asString() );
6770
71+ // Try other datatypes. Some are auto-convertible to others.
6872foo::setIndentLength( root["indent"].get("length", 3).asInt() );
6973foo::setIndentUseSpace( root["indent"].get("use_space", true).asBool() );
7074
71- // Since Json::Value has implicit constructor for all value types, it is not
72- // necessary to explicitly construct the Json::Value object:
75+ // Since Json::Value has an implicit constructor for all value types, it is not
76+ // necessary to explicitly construct the Json::Value object.
7377root["encoding"] = foo::getCurrentEncoding();
7478root["indent"]["length"] = foo::getCurrentIndentLength();
7579root["indent"]["use_space"] = foo::getCurrentIndentUseSpace();
0 commit comments