Represents a JSON value. Use Value for UTF8 encoding and default allocator.
More...
Inherited by GenericDocument< Encoding, Allocator, StackAllocator >, and GenericDocument< UTF8<> >.
|
enum | {
kBoolFlag = 0x0008,
kNumberFlag = 0x0010,
kIntFlag = 0x0020,
kUintFlag = 0x0040,
kInt64Flag = 0x0080,
kUint64Flag = 0x0100,
kDoubleFlag = 0x0200,
kStringFlag = 0x0400,
kCopyFlag = 0x0800,
kInlineStrFlag = 0x1000,
kNullFlag = kNullType,
kTrueFlag = kTrueType | kBoolFlag,
kFalseFlag = kFalseType | kBoolFlag,
kNumberIntFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag,
kNumberUintFlag = kNumberType | kNumberFlag | kUintFlag | kUint64Flag | kInt64Flag,
kNumberInt64Flag = kNumberType | kNumberFlag | kInt64Flag,
kNumberUint64Flag = kNumberType | kNumberFlag | kUint64Flag,
kNumberDoubleFlag = kNumberType | kNumberFlag | kDoubleFlag,
kNumberAnyFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag | kUintFlag | kUint64Flag | kDoubleFlag,
kConstStringFlag = kStringType | kStringFlag,
kCopyStringFlag = kStringType | kStringFlag | kCopyFlag,
kShortStringFlag = kStringType | kStringFlag | kCopyFlag | kInlineStrFlag,
kObjectFlag = kObjectType,
kArrayFlag = kArrayType,
kTypeMask = 0x07
} |
|
typedef Allocator | AllocatorType |
| Allocator type from template parameter. More...
|
|
typedef GenericArray< false, ValueType > | Array |
|
typedef Encoding::Ch | Ch |
| Character type derived from Encoding. More...
|
|
typedef GenericArray< true, ValueType > | ConstArray |
|
typedef GenericMemberIterator< true, Encoding, Allocator >::Iterator | ConstMemberIterator |
| Constant member iterator for iterating in object. More...
|
|
typedef GenericObject< true, ValueType > | ConstObject |
|
typedef const GenericValue * | ConstValueIterator |
| Constant value iterator for iterating in array. More...
|
|
typedef Encoding | EncodingType |
| Encoding type from template parameter. More...
|
|
typedef GenericMember< Encoding, Allocator > | Member |
| Name-value pair in an object. More...
|
|
typedef GenericMemberIterator< false, Encoding, Allocator >::Iterator | MemberIterator |
| Member iterator for iterating in object. More...
|
|
typedef GenericObject< false, ValueType > | Object |
|
typedef GenericStringRef< Ch > | StringRefType |
| Reference to a constant string. More...
|
|
typedef GenericValue * | ValueIterator |
| Value iterator for iterating in array. More...
|
|
typedef GenericValue< Encoding, Allocator > | ValueType |
| Value type of itself. More...
|
|
|
RAPIDJSON_FORCEINLINE GenericValue * | GetElementsPointer () const |
|
RAPIDJSON_FORCEINLINE Member * | GetMembersPointer () const |
|
RAPIDJSON_FORCEINLINE const Ch * | GetStringPointer () const |
|
template<typename T > |
| RAPIDJSON_DISABLEIF_RETURN ((internal::IsPointer< T >),(GenericValue &)) operator |
| Assignment with primitive types. More...
|
|
void | RawAssign (GenericValue &rhs) RAPIDJSON_NOEXCEPT |
| Assignment without calling destructor. More...
|
|
void | SetArrayRaw (GenericValue *values, SizeType count, Allocator &allocator) |
|
RAPIDJSON_FORCEINLINE GenericValue * | SetElementsPointer (GenericValue *elements) |
|
RAPIDJSON_FORCEINLINE Member * | SetMembersPointer (Member *members) |
|
void | SetObjectRaw (Member *members, SizeType count, Allocator &allocator) |
| Initialize this value as object with initial data, without calling destructor. More...
|
|
RAPIDJSON_FORCEINLINE const Ch * | SetStringPointer (const Ch *str) |
|
void | SetStringRaw (StringRefType s) RAPIDJSON_NOEXCEPT |
| Initialize this value as constant string, without calling destructor. More...
|
|
void | SetStringRaw (StringRefType s, Allocator &allocator) |
| Initialize this value as copy string with initial data, without calling destructor. More...
|
|
template<typename SourceAllocator > |
bool | StringEqual (const GenericValue< Encoding, SourceAllocator > &rhs) const |
|
|
GenericValue & | operator= (GenericValue &rhs) RAPIDJSON_NOEXCEPT |
| Assignment with move semantics. More...
|
|
GenericValue & | operator= (StringRefType str) RAPIDJSON_NOEXCEPT |
| Assignment of constant string reference (no copy) More...
|
|
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
class GenericValue< Encoding, Allocator >
Represents a JSON value. Use Value for UTF8 encoding and default allocator.
A JSON value can be one of 7 types. This class is a variant type supporting these types.
Use the Value if UTF8 and default allocator
- Template Parameters
-
Encoding | Encoding of the value. (Even non-string values need to have the same encoding in a document) |
Allocator | Allocator type for allocating memory of object, array and string. |
◆ AllocatorType
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Allocator type from template parameter.
◆ Array
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
◆ Ch
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Character type derived from Encoding.
◆ ConstArray
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
◆ ConstMemberIterator
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constant member iterator for iterating in object.
◆ ConstObject
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
◆ ConstValueIterator
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constant value iterator for iterating in array.
◆ EncodingType
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Encoding type from template parameter.
◆ Member
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Name-value pair in an object.
◆ MemberIterator
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Member iterator for iterating in object.
◆ Object
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
◆ StringRefType
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
◆ ValueIterator
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Value iterator for iterating in array.
◆ ValueType
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
◆ anonymous enum
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Enumerator |
---|
kBoolFlag | |
kNumberFlag | |
kIntFlag | |
kUintFlag | |
kInt64Flag | |
kUint64Flag | |
kDoubleFlag | |
kStringFlag | |
kCopyFlag | |
kInlineStrFlag | |
kNullFlag | |
kTrueFlag | |
kFalseFlag | |
kNumberIntFlag | |
kNumberUintFlag | |
kNumberInt64Flag | |
kNumberUint64Flag | |
kNumberDoubleFlag | |
kNumberAnyFlag | |
kConstStringFlag | |
kCopyStringFlag | |
kShortStringFlag | |
kObjectFlag | |
kArrayFlag | |
kTypeMask | |
◆ GenericValue() [1/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Default constructor creates a null value.
◆ GenericValue() [2/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor with JSON value type.
This creates a Value of specified type with default content.
- Parameters
-
- Note
- Default content for number is zero.
◆ GenericValue() [3/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename SourceAllocator >
Explicit copy constructor (with allocator)
Creates a copy of a Value by using the given Allocator
- Template Parameters
-
SourceAllocator | allocator of rhs |
- Parameters
-
rhs | Value to copy from (read-only) |
allocator | Allocator for allocating copied elements and buffers. Commonly use GenericDocument::GetAllocator(). |
copyConstStrings | Force copying of constant strings (e.g. referencing an in-situ buffer) |
- See also
- CopyFrom()
◆ GenericValue() [4/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
Constructor for boolean value.
- Parameters
-
- Note
- This constructor is limited to real boolean values and rejects implicitly converted types like arbitrary pointers. Use an explicit cast to
bool
, if you want to construct a boolean JSON value in such cases.
◆ GenericValue() [5/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor for int value.
◆ GenericValue() [6/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor for unsigned value.
◆ GenericValue() [7/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor for int64_t value.
◆ GenericValue() [8/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor for uint64_t value.
◆ GenericValue() [9/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor for double value.
◆ GenericValue() [10/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor for float value.
◆ GenericValue() [11/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor for constant string (i.e. do not make a copy of string)
◆ GenericValue() [12/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor for constant string (i.e. do not make a copy of string)
◆ GenericValue() [13/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor for copy-string (i.e. do make a copy of string)
◆ GenericValue() [14/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor for copy-string (i.e. do make a copy of string)
◆ GenericValue() [15/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor for Array.
- Parameters
-
a | An array obtained by GetArray() . |
- Note
Array
is always pass-by-value.
-
the source array is moved into this value and the sourec array becomes empty.
◆ GenericValue() [16/16]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Constructor for Object.
- Parameters
-
o | An object obtained by GetObject() . |
- Note
Object
is always pass-by-value.
-
the source object is moved into this value and the sourec object becomes empty.
◆ ~GenericValue()
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Destructor.
Need to destruct elements of array, members of object, or copy-string.
◆ GetElementsPointer()
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
◆ GetMembersPointer()
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
RAPIDJSON_FORCEINLINE Member* GenericValue< Encoding, Allocator >::GetMembersPointer |
( |
| ) |
const |
|
inline |
◆ GetStringPointer()
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
RAPIDJSON_FORCEINLINE const Ch* GenericValue< Encoding, Allocator >::GetStringPointer |
( |
| ) |
const |
|
inline |
◆ operator=() [1/2]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Assignment with move semantics.
- Parameters
-
rhs | Source of the assignment. It will become a null value after assignment. |
◆ operator=() [2/2]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Assignment of constant string reference (no copy)
- Parameters
-
str | Constant string reference to be assigned |
- Note
- This overload is needed to avoid clashes with the generic primitive type assignment overload below.
- See also
- GenericStringRef, operator=(T)
◆ RAPIDJSON_DISABLEIF_RETURN()
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue< Encoding, Allocator >::RAPIDJSON_DISABLEIF_RETURN |
( |
(internal::IsPointer< T >) |
, |
|
|
(GenericValue< Encoding, Allocator > &) |
|
|
) |
| |
Assignment with primitive types.
- Template Parameters
-
T | Either Type, int , unsigned , int64_t , uint64_t |
- Parameters
-
value | The value to be assigned. |
- Note
- The source type
T
explicitly disallows all pointer types, especially (const
) Ch*. This helps avoiding implicitly referencing character strings with insufficient lifetime, use SetString(const Ch*, Allocator&) (for copying) or StringRef() (to explicitly mark the pointer as constant) instead. All other pointer types would implicitly convert to bool
, use SetBool() instead.Set boolean value
◆ RawAssign()
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Assignment without calling destructor.
◆ SetArrayRaw()
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
◆ SetElementsPointer()
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
◆ SetMembersPointer()
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
◆ SetObjectRaw()
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Initialize this value as object with initial data, without calling destructor.
◆ SetStringPointer()
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
RAPIDJSON_FORCEINLINE const Ch* GenericValue< Encoding, Allocator >::SetStringPointer |
( |
const Ch * |
str | ) |
|
|
inline |
◆ SetStringRaw() [1/2]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Initialize this value as constant string, without calling destructor.
◆ SetStringRaw() [2/2]
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Initialize this value as copy string with initial data, without calling destructor.
◆ StringEqual()
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename SourceAllocator >
◆ GenericDocument
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename , typename , typename >
◆ data_
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
◆ kDefaultArrayCapacity
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
◆ kDefaultObjectCapacity
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
The documentation for this class was generated from the following file: