NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
nim_cpp_wrapper_util::Json::CharReaderBuilder类 参考

Build a CharReader implementation. 更多...

#include <reader.h>

类 nim_cpp_wrapper_util::Json::CharReaderBuilder 继承关系图:
nim_cpp_wrapper_util::Json::CharReader::Factory

Public 成员函数

 CharReaderBuilder ()
 
 ~CharReaderBuilder () override
 
CharReadernewCharReader () const override
 Allocate a CharReader via operator new().
 
bool validate (nim_cpp_wrapper_util::Json::Value *invalid) const
 
Valueoperator[] (const String &key)
 
- Public 成员函数 继承自 nim_cpp_wrapper_util::Json::CharReader::Factory
virtual ~Factory ()=default
 
virtual CharReadernewCharReader () const =0
 Allocate a CharReader via operator new().
 

静态 Public 成员函数

static void setDefaults (nim_cpp_wrapper_util::Json::Value *settings)
 
static void strictMode (nim_cpp_wrapper_util::Json::Value *settings)
 

Public 属性

nim_cpp_wrapper_util::Json::Value settings_
 

详细描述

Build a CharReader implementation.

Usage:

using namespace Json;
builder["collectComments"] = false;
Value value;
String errs;
bool ok = parseFromStream(builder, std::cin, &value, &errs);
Build a CharReader implementation.
Definition: reader.h:279
Represents a JSON value.
Definition: value.h:196
bool JSON_API parseFromStream(CharReader::Factory const &, IStream &, Value *root, String *errs)
Definition: json_reader.cpp:1905
std::basic_string< char, std::char_traits< char >, Allocator< char > > String
Definition: config.h:110

构造及析构函数说明

◆ CharReaderBuilder()

nim_cpp_wrapper_util::Json::CharReaderBuilder::CharReaderBuilder ( )

◆ ~CharReaderBuilder()

nim_cpp_wrapper_util::Json::CharReaderBuilder::~CharReaderBuilder ( )
overridedefault

成员函数说明

◆ newCharReader()

CharReader * nim_cpp_wrapper_util::Json::CharReaderBuilder::newCharReader ( ) const
overridevirtual

Allocate a CharReader via operator new().

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

实现了 nim_cpp_wrapper_util::Json::CharReader::Factory.

◆ operator[]()

Value & nim_cpp_wrapper_util::Json::CharReaderBuilder::operator[] ( const String key)

A simple way to update a specific setting.

◆ setDefaults()

void nim_cpp_wrapper_util::Json::CharReaderBuilder::setDefaults ( nim_cpp_wrapper_util::Json::Value settings)
static

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

前置条件
'settings' != NULL (but nim_cpp_wrapper_util::Json::null is fine)
备注
Defaults:

[CharReaderBuilderDefaults]

[CharReaderBuilderDefaults]

◆ strictMode()

void nim_cpp_wrapper_util::Json::CharReaderBuilder::strictMode ( nim_cpp_wrapper_util::Json::Value settings)
static

Same as old Features::strictMode().

前置条件
'settings' != NULL (but nim_cpp_wrapper_util::Json::null is fine)
备注
Defaults:

[CharReaderBuilderStrictMode]

[CharReaderBuilderStrictMode]

◆ validate()

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

类成员变量说明

◆ settings_

nim_cpp_wrapper_util::Json::Value nim_cpp_wrapper_util::Json::CharReaderBuilder::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.
  • "allowTrailingCommas": false or true
    • true if trailing commas in objects and arrays 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.

参见
setDefaults()

该类的文档由以下文件生成: