mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-26 18:51:04 +08:00
clarify comments
And throw instead of return null for invalid settings.
This commit is contained in:
parent
7796f20eab
commit
29501c4d9f
@ -299,10 +299,17 @@ public:
|
||||
These are case-sensitive.
|
||||
Available settings (case-sensitive):
|
||||
- "collectComments": false or true
|
||||
- "allowComments"
|
||||
- "strictRoot"
|
||||
- "allowDroppedNullPlaceholders"
|
||||
- "allowNumericKeys"
|
||||
- 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
|
||||
- true if comments are allowed.
|
||||
- "strictRoot": false or true
|
||||
- true if root must be either an array or an object value
|
||||
- "allowDroppedNullPlaceholders": false or true
|
||||
- true if dropped null placeholders are allowed. (See StreamWriterBuilder.)
|
||||
- "allowNumericKeys": false or true
|
||||
- true if numeric object keys are allowed.
|
||||
|
||||
You can examine 'settings_` yourself
|
||||
to see the defaults. You can also write and read them just like any
|
||||
|
@ -92,9 +92,9 @@ public:
|
||||
Available settings (case-sensitive):
|
||||
- "commentStyle": "None" or "All"
|
||||
- "indentation": "<anything>"
|
||||
- "enableYAMLCompatibility": False or True
|
||||
- "enableYAMLCompatibility": false or true
|
||||
- slightly change the whitespace around colons
|
||||
- "dropNullPlaceholders": False or True
|
||||
- "dropNullPlaceholders": false or true
|
||||
- Drop the "null" string from the writer's output for nullValues.
|
||||
Strictly speaking, this is not valid JSON. But when the output is being
|
||||
fed to a browser's Javascript, it makes for smaller output and the
|
||||
|
@ -981,7 +981,7 @@ StreamWriter* StreamWriterBuilder::newStreamWriter() const
|
||||
} else if (cs_str == "None") {
|
||||
cs = CommentStyle::None;
|
||||
} else {
|
||||
return NULL;
|
||||
throw std::runtime_error("commentStyle must be 'All' or 'None'");
|
||||
}
|
||||
std::string colonSymbol = " : ";
|
||||
if (eyc) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user