Skip to content

Commit f757c18

Browse files
committed
add all features
1 parent 3cf9175 commit f757c18

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

include/json/reader.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,16 @@ class JSON_API CharReaderBuilder : public CharReader::Factory {
298298
/** Configuration of this builder.
299299
These are case-sensitive.
300300
Available settings (case-sensitive):
301-
- "collectComments": false or true (default=true)
302-
- TODO: other features ...
301+
- "collectComments": false or true
302+
- "allowComments"
303+
- "strictRoot"
304+
- "allowDroppedNullPlaceholders"
305+
- "allowNumericKeys"
306+
303307
You can examine 'settings_` yourself
304308
to see the defaults. You can also write and read them just like any
305309
JSON Value.
306-
\sa setDefaults(Json::Value*)
310+
\sa setDefaults()
307311
*/
308312
Json::Value settings_;
309313

@@ -312,7 +316,7 @@ class JSON_API CharReaderBuilder : public CharReader::Factory {
312316

313317
virtual CharReader* newCharReader() const;
314318

315-
/** \return true if 'settings' are illegal and consistent;
319+
/** \return true if 'settings' are legal and consistent;
316320
* otherwise, indicate bad settings via 'invalid'.
317321
*/
318322
bool validate(Json::Value* invalid) const;

include/json/writer.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,13 @@ class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
9999
// without a major version bump.
100100
/** Configuration of this builder.
101101
Available settings (case-sensitive):
102-
- "commentStyle": "None", "Some", or "All" (default="All")
103-
- "indentation": (default="\t")
104-
But don't trust these docs. You can examine 'settings_` yourself
102+
- "commentStyle": "None", "Some", or "All"
103+
- "indentation": "<anything>"
104+
105+
You can examine 'settings_` yourself
105106
to see the defaults. You can also write and read them just like any
106107
JSON Value.
108+
\sa setDefaults()
107109
*/
108110
Json::Value settings_;
109111

@@ -115,7 +117,7 @@ class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
115117
*/
116118
virtual StreamWriter* newStreamWriter(std::ostream* sout) const;
117119

118-
/** \return true if 'settings' are illegal and consistent;
120+
/** \return true if 'settings' are legal and consistent;
119121
* otherwise, indicate bad settings via 'invalid'.
120122
*/
121123
bool validate(Json::Value* invalid) const;

src/lib_json/json_reader.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,13 +925,20 @@ CharReader* CharReaderBuilder::newCharReader() const
925925

926926
bool collectComments = settings_["collectComments"].asBool();
927927
Features features = Features::all();
928-
// TODO: Fill in features.
928+
features.allowComments_ = settings_["allowComments"].asBool();
929+
features.strictRoot_ = settings_["strictRoot"].asBool();
930+
features.allowDroppedNullPlaceholders_ = settings_["allowDroppedNullPlaceholders"].asBool();
931+
features.allowNumericKeys_ = settings_["allowNumericKeys"].asBool();
929932
return new OldReader(collectComments, features);
930933
}
931934
static void getValidReaderKeys(std::set<std::string>* valid_keys)
932935
{
933936
valid_keys->clear();
934937
valid_keys->insert("collectComments");
938+
valid_keys->insert("allowComments");
939+
valid_keys->insert("strictRoot");
940+
valid_keys->insert("allowDroppedNullPlaceholders");
941+
valid_keys->insert("allowNumericKeys");
935942
}
936943
bool CharReaderBuilder::validate(Json::Value* invalid) const
937944
{

0 commit comments

Comments
 (0)