ADTF  3.18.2
CharReaderBuilder

Build a CharReader implementation. More...

Inheritance diagram for CharReaderBuilder:
[legend]

Public Member Functions

CharReadernewCharReader () const JSONCPP_OVERRIDE
 Allocate a CharReader via operator new(). More...
 
bool validate (Json::Value *invalid) const
 
Valueoperator[] (JSONCPP_STRING key)
 A simple way to update a specific setting.
 

Static Public Member Functions

static void setDefaults (Json::Value *settings)
 Called by ctor, but you can use this to reset settings_. More...
 
static void strictMode (Json::Value *settings)
 Same as old Features::strictMode(). More...
 

Public Attributes

Json::Value settings_
 Configuration of this builder. More...
 

Detailed Description

Build a CharReader implementation.

Usage:

using namespace Json;
CharReaderBuilder builder;
builder["collectComments"] = false;
Value value;
JSONCPP_STRING errs;
bool ok = parseFromStream(builder, std::cin, &value, &errs);
JSON (JavaScript Object Notation).
Definition: allocator.h:14
bool JSON_API parseFromStream(CharReader::Factory const &, JSONCPP_ISTREAM &, Value *root, std::string *errs)
Consume entire stream and use its begin/end.

Definition at line 298 of file workspace/conan/dev_essential/1.3.3/dw/stable/package/37682420cd166e229516a41c8d6a139a0b13e1e1/include/json/reader.h.

Member Function Documentation

◆ newCharReader()

CharReader* newCharReader ( ) const
virtual

Allocate a CharReader via operator new().

Exceptions
std::exceptionif something goes wrong (e.g. invalid settings)

Implements CharReader::Factory.

◆ setDefaults()

static void setDefaults ( Json::Value settings)
static

Called by ctor, but you can use this to reset settings_.

Precondition
'settings' != NULL (but Json::null is fine)
Remarks
Defaults:

◆ strictMode()

static void strictMode ( Json::Value settings)
static

Same as old Features::strictMode().

Precondition
'settings' != NULL (but Json::null is fine)
Remarks
Defaults:

◆ validate()

bool validate ( Json::Value invalid) const
Returns
true if 'settings' are legal and consistent; otherwise, indicate bad settings via 'invalid'.

Member Data Documentation

◆ settings_

Json::Value settings_

Configuration of this builder.

These are case-sensitive. Available settings (case-sensitive):

  • "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
    • 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
  • "allowNumericKeys": false or true
    • true if numeric object keys are allowed.
  • "allowSingleQuotes": false or true
    • true if '' are allowed for strings (both keys and values)
  • "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.
  • "failIfExtra": false or true
    • If true, parse() returns false when extra non-whitespace trails the JSON value in the input string.
  • "rejectDupKeys": false or true
    • If true, parse() returns false when a key is duplicated within an object.
  • "allowSpecialFloats": false or true
    • If true, special float values (NaNs and infinities) are allowed and their values are lossfree restorable.

You can examine 'settings_` yourself to see the defaults. You can also write and read them just like any JSON Value.

See also
setDefaults()

Definition at line 338 of file workspace/conan/dev_essential/1.3.3/dw/stable/package/37682420cd166e229516a41c8d6a139a0b13e1e1/include/json/reader.h.