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

Represents a JSON value. 更多...

#include <value.h>

class  Comments
 
class  CZString
 
union  ValueHolder
 

Public 类型

using Members = std::vector< String >
 
using iterator = ValueIterator
 
using const_iterator = ValueConstIterator
 
using UInt = nim_cpp_wrapper_util::Json::UInt
 
using Int = nim_cpp_wrapper_util::Json::Int
 
using UInt64 = nim_cpp_wrapper_util::Json::UInt64
 
using Int64 = nim_cpp_wrapper_util::Json::Int64
 
using LargestInt = nim_cpp_wrapper_util::Json::LargestInt
 
using LargestUInt = nim_cpp_wrapper_util::Json::LargestUInt
 
using ArrayIndex = nim_cpp_wrapper_util::Json::ArrayIndex
 
using value_type = std::string
 
typedef std::map< CZString, ValueObjectValues
 

Public 成员函数

 Value (ValueType type=nullValue)
 Create a default Value of the given type.
 
 Value (Int value)
 
 Value (UInt value)
 
 Value (Int64 value)
 
 Value (UInt64 value)
 
 Value (double value)
 
 Value (const char *value)
 Copy til first 0. (NULL causes to seg-fault.)
 
 Value (const char *begin, const char *end)
 Copy all, incl zeroes.
 
 Value (const StaticString &value)
 Constructs a value from a static string.
 
 Value (const String &value)
 
 Value (bool value)
 
 Value (std::nullptr_t ptr)=delete
 
 Value (const Value &other)
 
 Value (Value &&other)
 
 ~Value ()
 
Valueoperator= (const Value &other)
 
Valueoperator= (Value &&other)
 
void swap (Value &other)
 Swap everything.
 
void swapPayload (Value &other)
 Swap values but leave comments and source offsets in place.
 
void copy (const Value &other)
 copy everything.
 
void copyPayload (const Value &other)
 copy values but leave comments and source offsets in place.
 
ValueType type () const
 
bool operator< (const Value &other) const
 Compare payload only, not comments etc.
 
bool operator<= (const Value &other) const
 
bool operator>= (const Value &other) const
 
bool operator> (const Value &other) const
 
bool operator== (const Value &other) const
 
bool operator!= (const Value &other) const
 
int compare (const Value &other) const
 
const char * asCString () const
 Embedded zeroes could cause you trouble!
 
String asString () const
 Embedded zeroes are possible.
 
bool getString (char const **begin, char const **end) const
 
Int asInt () const
 
UInt asUInt () const
 
Int64 asInt64 () const
 
UInt64 asUInt64 () const
 
LargestInt asLargestInt () const
 
LargestUInt asLargestUInt () const
 
float asFloat () const
 
double asDouble () const
 
bool asBool () const
 
bool isNull () const
 
bool isBool () const
 
bool isInt () const
 
bool isInt64 () const
 
bool isUInt () const
 
bool isUInt64 () const
 
bool isIntegral () const
 
bool isDouble () const
 
bool isNumeric () const
 
bool isString () const
 
bool isArray () const
 
bool isObject () const
 
template<typename T >
as () const JSONCPP_TEMPLATE_DELETE
 The as<T> and is<T> member function templates and specializations.
 
template<typename T >
bool is () const JSONCPP_TEMPLATE_DELETE
 
bool isConvertibleTo (ValueType other) const
 
ArrayIndex size () const
 Number of values in array or object
 
bool empty () const
 Return true if empty array, empty object, or null; otherwise, false.
 
 operator bool () const
 Return !isNull()
 
void clear ()
 
void resize (ArrayIndex newSize)
 
Valueoperator[] (ArrayIndex index)
 
Valueoperator[] (int index)
 
const Valueoperator[] (ArrayIndex index) const
 
const Valueoperator[] (int index) const
 
Value get (ArrayIndex index, const Value &defaultValue) const
 
bool isValidIndex (ArrayIndex index) const
 Return true if index < size().
 
Valueappend (const Value &value)
 Append value to array at the end.
 
Valueappend (Value &&value)
 
bool insert (ArrayIndex index, const Value &newValue)
 Insert value in array at specific index
 
bool insert (ArrayIndex index, Value &&newValue)
 
Valueoperator[] (const char *key)
 
const Valueoperator[] (const char *key) const
 
Valueoperator[] (const String &key)
 
const Valueoperator[] (const String &key) const
 
Valueoperator[] (const StaticString &key)
 Access an object value by name, create a null member if it does not exist.
 
Value get (const char *key, const Value &defaultValue) const
 
Value get (const char *begin, const char *end, const Value &defaultValue) const
 
Value get (const String &key, const Value &defaultValue) const
 
Value const * find (char const *begin, char const *end) const
 
Valuedemand (char const *begin, char const *end)
 
void removeMember (const char *key)
 Remove and return the named member.
 
void removeMember (const String &key)
 
bool removeMember (const char *key, Value *removed)
 
bool removeMember (String const &key, Value *removed)
 Remove the named map member.
 
bool removeMember (const char *begin, const char *end, Value *removed)
 Same as removeMember(String const& key, Value* removed)
 
bool removeIndex (ArrayIndex index, Value *removed)
 Remove the indexed array element.
 
bool isMember (const char *key) const
 
bool isMember (const String &key) const
 
bool isMember (const char *begin, const char *end) const
 Same as isMember(String const& key)const
 
Members getMemberNames () const
 Return a list of the member names.
 
void setComment (const char *comment, CommentPlacement placement)
 
void setComment (const char *comment, size_t len, CommentPlacement placement)
 Comments must be //... or /* ... *‍/
 
void setComment (String comment, CommentPlacement placement)
 Comments must be //... or /* ... *‍/
 
bool hasComment (CommentPlacement placement) const
 
String getComment (CommentPlacement placement) const
 Include delimiters and embedded newlines.
 
String toStyledString () const
 
const_iterator begin () const
 
const_iterator end () const
 
iterator begin ()
 
iterator end ()
 
void setOffsetStart (ptrdiff_t start)
 
void setOffsetLimit (ptrdiff_t limit)
 
ptrdiff_t getOffsetStart () const
 
ptrdiff_t getOffsetLimit () const
 
template<>
bool as () const
 
template<>
bool is () const
 
template<>
Int as () const
 
template<>
bool is () const
 
template<>
UInt as () const
 
template<>
bool is () const
 
template<>
Int64 as () const
 
template<>
bool is () const
 
template<>
UInt64 as () const
 
template<>
bool is () const
 
template<>
double as () const
 
template<>
bool is () const
 
template<>
String as () const
 
template<>
bool is () const
 
template<>
float as () const
 
template<>
const char * as () const
 

静态 Public 成员函数

static Value const & nullSingleton ()
 

静态 Public 属性

static const Valuenull
 
static const ValuenullRef
 
static constexpr LargestInt minLargestInt = LargestInt(~(LargestUInt(-1) / 2))
 Minimum signed integer value that can be stored in a nim_cpp_wrapper_util::Json::Value.
 
static constexpr LargestInt maxLargestInt = LargestInt(LargestUInt(-1) / 2)
 Maximum signed integer value that can be stored in a nim_cpp_wrapper_util::Json::Value.
 
static constexpr LargestUInt maxLargestUInt = LargestUInt(-1)
 Maximum unsigned integer value that can be stored in a nim_cpp_wrapper_util::Json::Value.
 
static constexpr Int minInt = Int(~(UInt(-1) / 2))
 Minimum signed int value that can be stored in a nim_cpp_wrapper_util::Json::Value.
 
static constexpr Int maxInt = Int(UInt(-1) / 2)
 Maximum signed int value that can be stored in a nim_cpp_wrapper_util::Json::Value.
 
static constexpr UInt maxUInt = UInt(-1)
 Maximum unsigned int value that can be stored in a nim_cpp_wrapper_util::Json::Value.
 
static constexpr Int64 minInt64 = Int64(~(UInt64(-1) / 2))
 Minimum signed 64 bits int value that can be stored in a nim_cpp_wrapper_util::Json::Value.
 
static constexpr Int64 maxInt64 = Int64(UInt64(-1) / 2)
 Maximum signed 64 bits int value that can be stored in a nim_cpp_wrapper_util::Json::Value.
 
static constexpr UInt64 maxUInt64 = UInt64(-1)
 Maximum unsigned 64 bits int value that can be stored in a nim_cpp_wrapper_util::Json::Value.
 
static constexpr UInt defaultRealPrecision = 17
 Default precision for real value for string representation.
 
static constexpr double maxUInt64AsDouble = 18446744073709551615.0
 

Private 成员函数

void setType (ValueType v)
 
bool isAllocated () const
 
void setIsAllocated (bool v)
 
void initBasic (ValueType type, bool allocated=false)
 
void dupPayload (const Value &other)
 
void releasePayload ()
 
void dupMeta (const Value &other)
 
ValueresolveReference (const char *key)
 
ValueresolveReference (const char *key, const char *end)
 

Private 属性

union nim_cpp_wrapper_util::Json::Value::ValueHolder value_
 
struct {
   unsigned int   value_type_: 8
 
   unsigned int   allocated_: 1
 
bits_
 
Comments comments_
 
ptrdiff_t start_
 
ptrdiff_t limit_
 

友元

class ValueIteratorBase
 

详细描述

Represents a JSON value.

This class is a discriminated union wrapper that can represents a:

The type of the held value is represented by a ValueType and can be obtained using type().

Values of an objectValue or arrayValue can be accessed using operator[]() methods. Non-const methods will automatically create the a nullValue element if it does not exist. The sequence of an arrayValue will be automatically resized and initialized with nullValue. resize() can be used to enlarge or truncate an arrayValue.

The get() methods can be used to obtain default value in the case the required element does not exist.

It is possible to iterate over the list of member keys of an object using the getMemberNames() method.

注解
Value string-length fit in size_t, but keys must be < 2^30. (The reason is an implementation detail.) A #CharReader will raise an exception if a bound is exceeded to avoid security holes in your app, but the Value API does not check bounds. That is the responsibility of the caller.

成员类型定义说明

◆ ArrayIndex

◆ const_iterator

◆ Int

◆ Int64

◆ iterator

◆ LargestInt

◆ LargestUInt

◆ Members

◆ ObjectValues

◆ UInt

◆ UInt64

◆ value_type

构造及析构函数说明

◆ Value() [1/14]

nim_cpp_wrapper_util::Json::Value::Value ( ValueType  type = nullValue)

Create a default Value of the given type.

This is a very useful constructor. To create an empty array, pass arrayValue. To create an empty object, pass objectValue. Another Value can then be set to this one by assignment. This is useful since clear() and resize() will not alter types.

Examples:

Represents a JSON value.
Definition: value.h:196
@ objectValue
object value (collection of name/value pairs).
Definition: value.h:116
@ arrayValue
array value (ordered list)
Definition: value.h:115

◆ Value() [2/14]

nim_cpp_wrapper_util::Json::Value::Value ( Int  value)

◆ Value() [3/14]

nim_cpp_wrapper_util::Json::Value::Value ( UInt  value)

◆ Value() [4/14]

nim_cpp_wrapper_util::Json::Value::Value ( Int64  value)

◆ Value() [5/14]

nim_cpp_wrapper_util::Json::Value::Value ( UInt64  value)

◆ Value() [6/14]

nim_cpp_wrapper_util::Json::Value::Value ( double  value)

◆ Value() [7/14]

nim_cpp_wrapper_util::Json::Value::Value ( const char *  value)

Copy til first 0. (NULL causes to seg-fault.)

◆ Value() [8/14]

nim_cpp_wrapper_util::Json::Value::Value ( const char *  begin,
const char *  end 
)

Copy all, incl zeroes.

◆ Value() [9/14]

nim_cpp_wrapper_util::Json::Value::Value ( const StaticString value)

Constructs a value from a static string.

Like other value string constructor but do not duplicate the string for internal storage. The given string must remain alive after the call to this constructor.

注解
This works only for null-terminated strings. (We cannot change the size of this class, so we have nowhere to store the length, which might be computed later for various operations.)

Example of usage:

static StaticString foo("some text");
Lightweight wrapper to tag static string.
Definition: value.h:149

◆ Value() [10/14]

nim_cpp_wrapper_util::Json::Value::Value ( const String value)

◆ Value() [11/14]

nim_cpp_wrapper_util::Json::Value::Value ( bool  value)

◆ Value() [12/14]

nim_cpp_wrapper_util::Json::Value::Value ( std::nullptr_t  ptr)
delete

◆ Value() [13/14]

nim_cpp_wrapper_util::Json::Value::Value ( const Value other)

◆ Value() [14/14]

nim_cpp_wrapper_util::Json::Value::Value ( Value &&  other)

◆ ~Value()

nim_cpp_wrapper_util::Json::Value::~Value ( )

成员函数说明

◆ append() [1/2]

Value & nim_cpp_wrapper_util::Json::Value::append ( const Value value)

Append value to array at the end.

Equivalent to jsonvalue[jsonvalue.size()] = value;

◆ append() [2/2]

Value & nim_cpp_wrapper_util::Json::Value::append ( Value &&  value)

◆ as() [1/10]

template<>
bool nim_cpp_wrapper_util::Json::Value::as ( ) const
inline

◆ as() [2/10]

template<>
Int nim_cpp_wrapper_util::Json::Value::as ( ) const
inline

◆ as() [3/10]

template<>
UInt nim_cpp_wrapper_util::Json::Value::as ( ) const
inline

◆ as() [4/10]

template<>
Int64 nim_cpp_wrapper_util::Json::Value::as ( ) const
inline

◆ as() [5/10]

template<>
UInt64 nim_cpp_wrapper_util::Json::Value::as ( ) const
inline

◆ as() [6/10]

template<>
double nim_cpp_wrapper_util::Json::Value::as ( ) const
inline

◆ as() [7/10]

template<>
String nim_cpp_wrapper_util::Json::Value::as ( ) const
inline

◆ as() [8/10]

template<>
float nim_cpp_wrapper_util::Json::Value::as ( ) const
inline

These as specializations are type conversions, and do not have a corresponding is.

◆ as() [9/10]

template<>
const char * nim_cpp_wrapper_util::Json::Value::as ( ) const
inline

◆ as() [10/10]

template<typename T >
T nim_cpp_wrapper_util::Json::Value::as ( ) const

The as<T> and is<T> member function templates and specializations.

◆ asBool()

bool nim_cpp_wrapper_util::Json::Value::asBool ( ) const

◆ asCString()

const char * nim_cpp_wrapper_util::Json::Value::asCString ( ) const

Embedded zeroes could cause you trouble!

◆ asDouble()

double nim_cpp_wrapper_util::Json::Value::asDouble ( ) const

◆ asFloat()

float nim_cpp_wrapper_util::Json::Value::asFloat ( ) const

◆ asInt()

Value::Int nim_cpp_wrapper_util::Json::Value::asInt ( ) const

◆ asInt64()

Int64 nim_cpp_wrapper_util::Json::Value::asInt64 ( ) const

◆ asLargestInt()

LargestInt nim_cpp_wrapper_util::Json::Value::asLargestInt ( ) const

◆ asLargestUInt()

LargestUInt nim_cpp_wrapper_util::Json::Value::asLargestUInt ( ) const

◆ asString()

String nim_cpp_wrapper_util::Json::Value::asString ( ) const

Embedded zeroes are possible.

◆ asUInt()

Value::UInt nim_cpp_wrapper_util::Json::Value::asUInt ( ) const

◆ asUInt64()

UInt64 nim_cpp_wrapper_util::Json::Value::asUInt64 ( ) const

◆ begin() [1/2]

Value::iterator nim_cpp_wrapper_util::Json::Value::begin ( )

◆ begin() [2/2]

Value::const_iterator nim_cpp_wrapper_util::Json::Value::begin ( ) const

◆ clear()

void nim_cpp_wrapper_util::Json::Value::clear ( )

Remove all object members and array elements.

前置条件
type() is arrayValue, objectValue, or nullValue
后置条件
type() is unchanged

◆ compare()

int nim_cpp_wrapper_util::Json::Value::compare ( const Value other) const

◆ copy()

void nim_cpp_wrapper_util::Json::Value::copy ( const Value other)

copy everything.

◆ copyPayload()

void nim_cpp_wrapper_util::Json::Value::copyPayload ( const Value other)

copy values but leave comments and source offsets in place.

◆ demand()

Value * nim_cpp_wrapper_util::Json::Value::demand ( char const *  begin,
char const *  end 
)

Most general and efficient version of object-mutators.

注解
As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
返回
non-zero, but JSON_ASSERT if this is neither object nor nullValue.

◆ dupMeta()

void nim_cpp_wrapper_util::Json::Value::dupMeta ( const Value other)
private

◆ dupPayload()

void nim_cpp_wrapper_util::Json::Value::dupPayload ( const Value other)
private

◆ empty()

bool nim_cpp_wrapper_util::Json::Value::empty ( ) const

Return true if empty array, empty object, or null; otherwise, false.

◆ end() [1/2]

Value::iterator nim_cpp_wrapper_util::Json::Value::end ( )

◆ end() [2/2]

Value::const_iterator nim_cpp_wrapper_util::Json::Value::end ( ) const

◆ find()

Value const * nim_cpp_wrapper_util::Json::Value::find ( char const *  begin,
char const *  end 
) const

Most general and efficient version of isMember()const, get()const, and operator[]const

注解
As stated elsewhere, behavior is undefined if (end-begin) >= 2^30

◆ get() [1/4]

Value nim_cpp_wrapper_util::Json::Value::get ( ArrayIndex  index,
const Value defaultValue 
) const

If the array contains at least index+1 elements, returns the element value, otherwise returns defaultValue.

◆ get() [2/4]

Value nim_cpp_wrapper_util::Json::Value::get ( const char *  begin,
const char *  end,
const Value defaultValue 
) const

Return the member named key if it exist, defaultValue otherwise.

注解
deep copy
key may contain embedded nulls.

◆ get() [3/4]

Value nim_cpp_wrapper_util::Json::Value::get ( const char *  key,
const Value defaultValue 
) const

Return the member named key if it exist, defaultValue otherwise.

注解
deep copy

◆ get() [4/4]

Value nim_cpp_wrapper_util::Json::Value::get ( const String key,
const Value defaultValue 
) const

Return the member named key if it exist, defaultValue otherwise.

注解
deep copy
参数
keymay contain embedded nulls.

◆ getComment()

String nim_cpp_wrapper_util::Json::Value::getComment ( CommentPlacement  placement) const

Include delimiters and embedded newlines.

◆ getMemberNames()

Value::Members nim_cpp_wrapper_util::Json::Value::getMemberNames ( ) const

Return a list of the member names.

If null, return an empty list.

前置条件
type() is objectValue or nullValue
后置条件
if type() was nullValue, it remains nullValue

◆ getOffsetLimit()

ptrdiff_t nim_cpp_wrapper_util::Json::Value::getOffsetLimit ( ) const

◆ getOffsetStart()

ptrdiff_t nim_cpp_wrapper_util::Json::Value::getOffsetStart ( ) const

◆ getString()

bool nim_cpp_wrapper_util::Json::Value::getString ( char const **  begin,
char const **  end 
) const

Get raw char* of string-value.

返回
false if !string. (Seg-fault if str or end are NULL.)

◆ hasComment()

bool nim_cpp_wrapper_util::Json::Value::hasComment ( CommentPlacement  placement) const

◆ initBasic()

void nim_cpp_wrapper_util::Json::Value::initBasic ( ValueType  type,
bool  allocated = false 
)
private

◆ insert() [1/2]

bool nim_cpp_wrapper_util::Json::Value::insert ( ArrayIndex  index,
const Value newValue 
)

Insert value in array at specific index

◆ insert() [2/2]

bool nim_cpp_wrapper_util::Json::Value::insert ( ArrayIndex  index,
Value &&  newValue 
)

◆ is() [1/8]

template<>
bool nim_cpp_wrapper_util::Json::Value::is ( ) const
inline

◆ is() [2/8]

template<>
bool nim_cpp_wrapper_util::Json::Value::is ( ) const
inline

◆ is() [3/8]

template<>
bool nim_cpp_wrapper_util::Json::Value::is ( ) const
inline

◆ is() [4/8]

template<>
bool nim_cpp_wrapper_util::Json::Value::is ( ) const
inline

◆ is() [5/8]

template<>
bool nim_cpp_wrapper_util::Json::Value::is ( ) const
inline

◆ is() [6/8]

template<>
bool nim_cpp_wrapper_util::Json::Value::is ( ) const
inline

◆ is() [7/8]

template<>
bool nim_cpp_wrapper_util::Json::Value::is ( ) const
inline

◆ is() [8/8]

template<typename T >
bool nim_cpp_wrapper_util::Json::Value::is ( ) const

◆ isAllocated()

bool nim_cpp_wrapper_util::Json::Value::isAllocated ( ) const
inlineprivate

◆ isArray()

bool nim_cpp_wrapper_util::Json::Value::isArray ( ) const

◆ isBool()

bool nim_cpp_wrapper_util::Json::Value::isBool ( ) const

◆ isConvertibleTo()

bool nim_cpp_wrapper_util::Json::Value::isConvertibleTo ( ValueType  other) const

◆ isDouble()

bool nim_cpp_wrapper_util::Json::Value::isDouble ( ) const

◆ isInt()

bool nim_cpp_wrapper_util::Json::Value::isInt ( ) const

◆ isInt64()

bool nim_cpp_wrapper_util::Json::Value::isInt64 ( ) const

◆ isIntegral()

bool nim_cpp_wrapper_util::Json::Value::isIntegral ( ) const

◆ isMember() [1/3]

bool nim_cpp_wrapper_util::Json::Value::isMember ( const char *  begin,
const char *  end 
) const

◆ isMember() [2/3]

bool nim_cpp_wrapper_util::Json::Value::isMember ( const char *  key) const

Return true if the object has a member named key.

注解
'key' must be null-terminated.

◆ isMember() [3/3]

bool nim_cpp_wrapper_util::Json::Value::isMember ( const String key) const

Return true if the object has a member named key.

参数
keymay contain embedded nulls.

◆ isNull()

bool nim_cpp_wrapper_util::Json::Value::isNull ( ) const

◆ isNumeric()

bool nim_cpp_wrapper_util::Json::Value::isNumeric ( ) const

◆ isObject()

bool nim_cpp_wrapper_util::Json::Value::isObject ( ) const

◆ isString()

bool nim_cpp_wrapper_util::Json::Value::isString ( ) const

◆ isUInt()

bool nim_cpp_wrapper_util::Json::Value::isUInt ( ) const

◆ isUInt64()

bool nim_cpp_wrapper_util::Json::Value::isUInt64 ( ) const

◆ isValidIndex()

bool nim_cpp_wrapper_util::Json::Value::isValidIndex ( ArrayIndex  index) const

Return true if index < size().

◆ nullSingleton()

Value const & nim_cpp_wrapper_util::Json::Value::nullSingleton ( )
static

◆ operator bool()

nim_cpp_wrapper_util::Json::Value::operator bool ( ) const
explicit

Return !isNull()

◆ operator!=()

bool nim_cpp_wrapper_util::Json::Value::operator!= ( const Value other) const

◆ operator<()

bool nim_cpp_wrapper_util::Json::Value::operator< ( const Value other) const

Compare payload only, not comments etc.

◆ operator<=()

bool nim_cpp_wrapper_util::Json::Value::operator<= ( const Value other) const

◆ operator=() [1/2]

Value & nim_cpp_wrapper_util::Json::Value::operator= ( const Value other)
注解
Overwrite existing comments. To preserve comments, use swapPayload().

◆ operator=() [2/2]

Value & nim_cpp_wrapper_util::Json::Value::operator= ( Value &&  other)

◆ operator==()

bool nim_cpp_wrapper_util::Json::Value::operator== ( const Value other) const

◆ operator>()

bool nim_cpp_wrapper_util::Json::Value::operator> ( const Value other) const

◆ operator>=()

bool nim_cpp_wrapper_util::Json::Value::operator>= ( const Value other) const

◆ operator[]() [1/9]

Value & nim_cpp_wrapper_util::Json::Value::operator[] ( ArrayIndex  index)

Access an array element (zero based index). If the array contains less than index element, then null value are inserted in the array so that its size is index+1. (You may need to say 'value[0u]' to get your compiler to distinguish this from the operator[] which takes a string.)

◆ operator[]() [2/9]

const Value & nim_cpp_wrapper_util::Json::Value::operator[] ( ArrayIndex  index) const

Access an array element (zero based index). (You may need to say 'value[0u]' to get your compiler to distinguish this from the operator[] which takes a string.)

◆ operator[]() [3/9]

Value & nim_cpp_wrapper_util::Json::Value::operator[] ( const char *  key)

Access an object value by name, create a null member if it does not exist.

注解
Because of our implementation, keys are limited to 2^30 -1 chars. Exceeding that will cause an exception.

◆ operator[]() [4/9]

const Value & nim_cpp_wrapper_util::Json::Value::operator[] ( const char *  key) const

Access an object value by name, returns null if there is no member with that name.

◆ operator[]() [5/9]

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

Access an object value by name, create a null member if it does not exist.

If the object has no entry for that name, then the member name used to store the new entry is not duplicated. Example of use:

static const StaticString code("code");
object[code] = 1234;

◆ operator[]() [6/9]

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

Access an object value by name, create a null member if it does not exist.

参数
keymay contain embedded nulls.

◆ operator[]() [7/9]

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

Access an object value by name, returns null if there is no member with that name.

参数
keymay contain embedded nulls.

◆ operator[]() [8/9]

Value & nim_cpp_wrapper_util::Json::Value::operator[] ( int  index)

◆ operator[]() [9/9]

const Value & nim_cpp_wrapper_util::Json::Value::operator[] ( int  index) const

◆ releasePayload()

void nim_cpp_wrapper_util::Json::Value::releasePayload ( )
private

◆ removeIndex()

bool nim_cpp_wrapper_util::Json::Value::removeIndex ( ArrayIndex  index,
Value removed 
)

Remove the indexed array element.

O(n) expensive operations. Update 'removed' iff removed.

返回
true if removed (no exceptions)

◆ removeMember() [1/5]

bool nim_cpp_wrapper_util::Json::Value::removeMember ( const char *  begin,
const char *  end,
Value removed 
)

◆ removeMember() [2/5]

void nim_cpp_wrapper_util::Json::Value::removeMember ( const char *  key)

Remove and return the named member.

Do nothing if it did not exist.

前置条件
type() is objectValue or nullValue
后置条件
type() is unchanged

◆ removeMember() [3/5]

bool nim_cpp_wrapper_util::Json::Value::removeMember ( const char *  key,
Value removed 
)

◆ removeMember() [4/5]

void nim_cpp_wrapper_util::Json::Value::removeMember ( const String key)

Same as removeMember(const char*)

参数
keymay contain embedded nulls.

◆ removeMember() [5/5]

bool nim_cpp_wrapper_util::Json::Value::removeMember ( String const &  key,
Value removed 
)

Remove the named map member.

Update 'removed' iff removed.

参数
keymay contain embedded nulls.
返回
true iff removed (no exceptions)

◆ resize()

void nim_cpp_wrapper_util::Json::Value::resize ( ArrayIndex  newSize)

Resize the array to newSize elements. New elements are initialized to null. May only be called on nullValue or arrayValue.

前置条件
type() is arrayValue or nullValue
后置条件
type() is arrayValue

◆ resolveReference() [1/2]

Value & nim_cpp_wrapper_util::Json::Value::resolveReference ( const char *  key)
private

◆ resolveReference() [2/2]

Value & nim_cpp_wrapper_util::Json::Value::resolveReference ( const char *  key,
const char *  end 
)
private

◆ setComment() [1/3]

void nim_cpp_wrapper_util::Json::Value::setComment ( const char *  comment,
CommentPlacement  placement 
)
inline
弃用:
Always pass len.

◆ setComment() [2/3]

void nim_cpp_wrapper_util::Json::Value::setComment ( const char *  comment,
size_t  len,
CommentPlacement  placement 
)
inline

Comments must be //... or /* ... *‍/

◆ setComment() [3/3]

void nim_cpp_wrapper_util::Json::Value::setComment ( String  comment,
CommentPlacement  placement 
)

Comments must be //... or /* ... *‍/

◆ setIsAllocated()

void nim_cpp_wrapper_util::Json::Value::setIsAllocated ( bool  v)
inlineprivate

◆ setOffsetLimit()

void nim_cpp_wrapper_util::Json::Value::setOffsetLimit ( ptrdiff_t  limit)

◆ setOffsetStart()

void nim_cpp_wrapper_util::Json::Value::setOffsetStart ( ptrdiff_t  start)

◆ setType()

void nim_cpp_wrapper_util::Json::Value::setType ( ValueType  v)
inlineprivate

◆ size()

ArrayIndex nim_cpp_wrapper_util::Json::Value::size ( ) const

Number of values in array or object

◆ swap()

void nim_cpp_wrapper_util::Json::Value::swap ( Value other)

Swap everything.

◆ swapPayload()

void nim_cpp_wrapper_util::Json::Value::swapPayload ( Value other)

Swap values but leave comments and source offsets in place.

◆ toStyledString()

String nim_cpp_wrapper_util::Json::Value::toStyledString ( ) const

◆ type()

ValueType nim_cpp_wrapper_util::Json::Value::type ( ) const

友元及相关函数文档

◆ ValueIteratorBase

friend class ValueIteratorBase
friend

类成员变量说明

◆ allocated_

unsigned int nim_cpp_wrapper_util::Json::Value::allocated_

◆ 

struct { ... } nim_cpp_wrapper_util::Json::Value::bits_

◆ comments_

Comments nim_cpp_wrapper_util::Json::Value::comments_
private

◆ defaultRealPrecision

constexpr UInt nim_cpp_wrapper_util::Json::Value::defaultRealPrecision = 17
staticconstexpr

Default precision for real value for string representation.

◆ limit_

ptrdiff_t nim_cpp_wrapper_util::Json::Value::limit_
private

◆ maxInt

constexpr Int nim_cpp_wrapper_util::Json::Value::maxInt = Int(UInt(-1) / 2)
staticconstexpr

Maximum signed int value that can be stored in a nim_cpp_wrapper_util::Json::Value.

◆ maxInt64

constexpr Int64 nim_cpp_wrapper_util::Json::Value::maxInt64 = Int64(UInt64(-1) / 2)
staticconstexpr

Maximum signed 64 bits int value that can be stored in a nim_cpp_wrapper_util::Json::Value.

◆ maxLargestInt

constexpr LargestInt nim_cpp_wrapper_util::Json::Value::maxLargestInt = LargestInt(LargestUInt(-1) / 2)
staticconstexpr

Maximum signed integer value that can be stored in a nim_cpp_wrapper_util::Json::Value.

◆ maxLargestUInt

constexpr LargestUInt nim_cpp_wrapper_util::Json::Value::maxLargestUInt = LargestUInt(-1)
staticconstexpr

Maximum unsigned integer value that can be stored in a nim_cpp_wrapper_util::Json::Value.

◆ maxUInt

constexpr UInt nim_cpp_wrapper_util::Json::Value::maxUInt = UInt(-1)
staticconstexpr

Maximum unsigned int value that can be stored in a nim_cpp_wrapper_util::Json::Value.

◆ maxUInt64

constexpr UInt64 nim_cpp_wrapper_util::Json::Value::maxUInt64 = UInt64(-1)
staticconstexpr

Maximum unsigned 64 bits int value that can be stored in a nim_cpp_wrapper_util::Json::Value.

◆ maxUInt64AsDouble

constexpr double nim_cpp_wrapper_util::Json::Value::maxUInt64AsDouble = 18446744073709551615.0
staticconstexpr

◆ minInt

constexpr Int nim_cpp_wrapper_util::Json::Value::minInt = Int(~(UInt(-1) / 2))
staticconstexpr

Minimum signed int value that can be stored in a nim_cpp_wrapper_util::Json::Value.

◆ minInt64

constexpr Int64 nim_cpp_wrapper_util::Json::Value::minInt64 = Int64(~(UInt64(-1) / 2))
staticconstexpr

Minimum signed 64 bits int value that can be stored in a nim_cpp_wrapper_util::Json::Value.

◆ minLargestInt

constexpr LargestInt nim_cpp_wrapper_util::Json::Value::minLargestInt = LargestInt(~(LargestUInt(-1) / 2))
staticconstexpr

Minimum signed integer value that can be stored in a nim_cpp_wrapper_util::Json::Value.

◆ null

const Value& nim_cpp_wrapper_util::Json::Value::null
static

◆ nullRef

const Value& nim_cpp_wrapper_util::Json::Value::nullRef
static

◆ start_

ptrdiff_t nim_cpp_wrapper_util::Json::Value::start_
private

◆ value_

union nim_cpp_wrapper_util::Json::Value::ValueHolder nim_cpp_wrapper_util::Json::Value::value_
private

◆ value_type_

unsigned int nim_cpp_wrapper_util::Json::Value::value_type_

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