GenericValue< Encoding, Allocator > Class Template Reference#
Represents a JSON value. Use Value for UTF8 encoding and default allocator. More...
#include <document.h>
Classes | |
struct | ArrayData |
union | Data |
struct | Flag |
union | Number |
struct | ObjectData |
struct | ShortString |
struct | String |
Public Types | |
typedef GenericMember< Encoding, Allocator > | Member |
Name-value pair in an object. More... | |
typedef Encoding | EncodingType |
Encoding type from template parameter. More... | |
typedef Allocator | AllocatorType |
Allocator type from template parameter. More... | |
typedef Encoding::Ch | Ch |
Character type derived from Encoding. More... | |
typedef GenericStringRef< Ch > | StringRefType |
Reference to a constant string. More... | |
typedef GenericMemberIterator< false, Encoding, Allocator >::Iterator | MemberIterator |
Member iterator for iterating in object. More... | |
typedef GenericMemberIterator< true, Encoding, Allocator >::Iterator | ConstMemberIterator |
Constant member iterator for iterating in object. More... | |
typedef GenericValue * | ValueIterator |
Value iterator for iterating in array. More... | |
typedef const GenericValue * | ConstValueIterator |
Constant value iterator for iterating in array. More... | |
typedef GenericValue< Encoding, Allocator > | ValueType |
Value type of itself. More... | |
typedef GenericArray< false, ValueType > | Array |
typedef GenericArray< true, ValueType > | ConstArray |
typedef GenericObject< false, ValueType > | Object |
typedef GenericObject< true, ValueType > | ConstObject |
Assignment operators | |
enum | { kBoolFlag = 0x0008 , kNumberFlag = 0x0010 , kIntFlag = 0x0020 , kUintFlag = 0x0040 , kInt64Flag = 0x0080 , kUint64Flag = 0x0100 , kDoubleFlag = 0x0200 , kStringFlag = 0x0400 , kCopyFlag = 0x0800 , kInlineStrFlag = 0x1000 , kNullFlag = kNullType , kTrueFlag = static_cast<int>(kTrueType) | static_cast<int>(kBoolFlag) , kFalseFlag = static_cast<int>(kFalseType) | static_cast<int>(kBoolFlag) , kNumberIntFlag = static_cast<int>(kNumberType) | static_cast<int>(kNumberFlag | kIntFlag | kInt64Flag) , kNumberUintFlag = static_cast<int>(kNumberType) | static_cast<int>(kNumberFlag | kUintFlag | kUint64Flag | kInt64Flag) , kNumberInt64Flag = static_cast<int>(kNumberType) | static_cast<int>(kNumberFlag | kInt64Flag) , kNumberUint64Flag = static_cast<int>(kNumberType) | static_cast<int>(kNumberFlag | kUint64Flag) , kNumberDoubleFlag = static_cast<int>(kNumberType) | static_cast<int>(kNumberFlag | kDoubleFlag) , kNumberAnyFlag = static_cast<int>(kNumberType) | static_cast<int>(kNumberFlag | kIntFlag | kInt64Flag | kUintFlag | kUint64Flag | kDoubleFlag) , kConstStringFlag = static_cast<int>(kStringType) | static_cast<int>(kStringFlag) , kCopyStringFlag = static_cast<int>(kStringType) | static_cast<int>(kStringFlag | kCopyFlag) , kShortStringFlag = static_cast<int>(kStringType) | static_cast<int>(kStringFlag | kCopyFlag | kInlineStrFlag) , kObjectFlag = kObjectType , kArrayFlag = kArrayType , kTypeMask = 0x07 } |
Assignment with move semantics. More... | |
template<typename , typename , typename > | |
class | GenericDocument |
Assignment with move semantics. More... | |
static const SizeType | kDefaultArrayCapacity = RAPIDJSON_VALUE_DEFAULT_ARRAY_CAPACITY |
Assignment with move semantics. More... | |
static const SizeType | kDefaultObjectCapacity = RAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY |
Assignment with move semantics. More... | |
Data | data_ |
Assignment with move semantics. More... | |
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 T > | |
RAPIDJSON_DISABLEIF_RETURN ((internal::IsPointer< T >),(GenericValue &)) operator | |
Assignment with primitive types. More... | |
RAPIDJSON_FORCEINLINE const Ch * | GetStringPointer () const |
Assignment with move semantics. More... | |
RAPIDJSON_FORCEINLINE const Ch * | SetStringPointer (const Ch *str) |
Assignment with move semantics. More... | |
RAPIDJSON_FORCEINLINE GenericValue * | GetElementsPointer () const |
Assignment with move semantics. More... | |
RAPIDJSON_FORCEINLINE GenericValue * | SetElementsPointer (GenericValue *elements) |
Assignment with move semantics. More... | |
RAPIDJSON_FORCEINLINE Member * | GetMembersPointer () const |
Assignment with move semantics. More... | |
RAPIDJSON_FORCEINLINE Member * | SetMembersPointer (Member *members) |
Assignment with move semantics. More... | |
RAPIDJSON_FORCEINLINE Member * | DoAllocMembers (SizeType capacity, Allocator &allocator) |
Assignment with move semantics. More... | |
void | DoReserveMembers (SizeType newCapacity, Allocator &allocator) |
Assignment with move semantics. More... | |
template<typename SourceAllocator > | |
MemberIterator | DoFindMember (const GenericValue< Encoding, SourceAllocator > &name) |
Assignment with move semantics. More... | |
void | DoClearMembers () |
Assignment with move semantics. More... | |
void | DoFreeMembers () |
Assignment with move semantics. More... | |
void | DoAddMember (GenericValue &name, GenericValue &value, Allocator &allocator) |
Assignment with move semantics. More... | |
MemberIterator | DoRemoveMember (MemberIterator m) |
Assignment with move semantics. More... | |
MemberIterator | DoEraseMembers (ConstMemberIterator first, ConstMemberIterator last) |
Assignment with move semantics. More... | |
template<typename SourceAllocator > | |
void | DoCopyMembers (const GenericValue< Encoding, SourceAllocator > &rhs, Allocator &allocator, bool copyConstStrings) |
Assignment with move semantics. More... | |
void | SetArrayRaw (GenericValue *values, SizeType count, Allocator &allocator) |
Assignment with move semantics. More... | |
void | SetObjectRaw (Member *members, SizeType count, Allocator &allocator) |
Initialize this value as object with initial data, without calling destructor. More... | |
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... | |
void | RawAssign (GenericValue &rhs) RAPIDJSON_NOEXCEPT |
Assignment without calling destructor. More... | |
template<typename SourceAllocator > | |
bool | StringEqual (const GenericValue< Encoding, SourceAllocator > &rhs) const |
Assignment with move semantics. More... | |
static RAPIDJSON_FORCEINLINE const Ch * | DataString (const Data &data) |
Assignment with move semantics. More... | |
static RAPIDJSON_FORCEINLINE SizeType | DataStringLength (const Data &data) |
Assignment with move semantics. More... | |
Constructors and destructor. | |
GenericValue () RAPIDJSON_NOEXCEPT | |
Default constructor creates a null value. More... | |
GenericValue (Type type) RAPIDJSON_NOEXCEPT | |
Constructor with JSON value type. More... | |
template<typename SourceAllocator > | |
GenericValue (const GenericValue< Encoding, SourceAllocator > &rhs, Allocator &allocator, bool copyConstStrings=false) | |
Explicit copy constructor (with allocator) More... | |
template<typename T > | |
GenericValue (T b, RAPIDJSON_ENABLEIF((internal::IsSame< bool, T >))) RAPIDJSON_NOEXCEPT | |
Constructor for boolean value. More... | |
GenericValue (int i) RAPIDJSON_NOEXCEPT | |
Constructor for int value. More... | |
GenericValue (unsigned u) RAPIDJSON_NOEXCEPT | |
Constructor for unsigned value. More... | |
GenericValue (int64_t i64) RAPIDJSON_NOEXCEPT | |
Constructor for int64_t value. More... | |
GenericValue (uint64_t u64) RAPIDJSON_NOEXCEPT | |
Constructor for uint64_t value. More... | |
GenericValue (double d) RAPIDJSON_NOEXCEPT | |
Constructor for double value. More... | |
GenericValue (float f) RAPIDJSON_NOEXCEPT | |
Constructor for float value. More... | |
GenericValue (const Ch *s, SizeType length) RAPIDJSON_NOEXCEPT | |
Constructor for constant string (i.e. do not make a copy of string) More... | |
GenericValue (StringRefType s) RAPIDJSON_NOEXCEPT | |
Constructor for constant string (i.e. do not make a copy of string) More... | |
GenericValue (const Ch *s, SizeType length, Allocator &allocator) | |
Constructor for copy-string (i.e. do make a copy of string) More... | |
GenericValue (const Ch *s, Allocator &allocator) | |
Constructor for copy-string (i.e. do make a copy of string) More... | |
GenericValue (Array a) RAPIDJSON_NOEXCEPT | |
Constructor for Array. More... | |
GenericValue (Object o) RAPIDJSON_NOEXCEPT | |
Constructor for Object. More... | |
~GenericValue () | |
Destructor. More... | |
Detailed Description
template<typename Encoding, typename Allocator = RAPIDJSON_DEFAULT_ALLOCATOR>
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.
Member Typedef Documentation
◆ AllocatorType
typedef Allocator GenericValue< Encoding, Allocator >::AllocatorType |
Allocator type from template parameter.
◆ Array
typedef GenericArray<false, ValueType> GenericValue< Encoding, Allocator >::Array |
◆ Ch
typedef Encoding::Ch GenericValue< Encoding, Allocator >::Ch |
Character type derived from Encoding.
◆ ConstArray
typedef GenericArray<true, ValueType> GenericValue< Encoding, Allocator >::ConstArray |
◆ ConstMemberIterator
typedef GenericMemberIterator<true,Encoding,Allocator>::Iterator GenericValue< Encoding, Allocator >::ConstMemberIterator |
Constant member iterator for iterating in object.
◆ ConstObject
typedef GenericObject<true, ValueType> GenericValue< Encoding, Allocator >::ConstObject |
◆ ConstValueIterator
typedef const GenericValue* GenericValue< Encoding, Allocator >::ConstValueIterator |
Constant value iterator for iterating in array.
◆ EncodingType
typedef Encoding GenericValue< Encoding, Allocator >::EncodingType |
Encoding type from template parameter.
◆ Member
typedef GenericMember<Encoding, Allocator> GenericValue< Encoding, Allocator >::Member |
Name-value pair in an object.
◆ MemberIterator
typedef GenericMemberIterator<false,Encoding,Allocator>::Iterator GenericValue< Encoding, Allocator >::MemberIterator |
Member iterator for iterating in object.
◆ Object
typedef GenericObject<false, ValueType> GenericValue< Encoding, Allocator >::Object |
◆ StringRefType
typedef GenericStringRef<Ch> GenericValue< Encoding, Allocator >::StringRefType |
Reference to a constant string.
◆ ValueIterator
typedef GenericValue* GenericValue< Encoding, Allocator >::ValueIterator |
Value iterator for iterating in array.
◆ ValueType
typedef GenericValue<Encoding, Allocator> GenericValue< Encoding, Allocator >::ValueType |
Value type of itself.
Member Enumeration Documentation
◆ anonymous enum
anonymous enum |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
Constructor & Destructor Documentation
◆ GenericValue() [1/16]
|
inline |
Default constructor creates a null value.
◆ GenericValue() [2/16]
|
inlineexplicit |
Constructor with JSON value type.
This creates a Value of specified type with default content.
- Parameters
-
type Type of the value.
- Note
- Default content for number is zero.
◆ GenericValue() [3/16]
|
inline |
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]
|
inlineexplicit |
Constructor for boolean value.
- Parameters
-
b Boolean value
- 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]
|
inlineexplicit |
Constructor for int value.
◆ GenericValue() [6/16]
|
inlineexplicit |
Constructor for unsigned value.
◆ GenericValue() [7/16]
|
inlineexplicit |
Constructor for int64_t value.
◆ GenericValue() [8/16]
|
inlineexplicit |
Constructor for uint64_t value.
◆ GenericValue() [9/16]
|
inlineexplicit |
Constructor for double value.
◆ GenericValue() [10/16]
|
inlineexplicit |
Constructor for float value.
◆ GenericValue() [11/16]
|
inline |
Constructor for constant string (i.e. do not make a copy of string)
◆ GenericValue() [12/16]
|
inlineexplicit |
Constructor for constant string (i.e. do not make a copy of string)
◆ GenericValue() [13/16]
|
inline |
Constructor for copy-string (i.e. do make a copy of string)
◆ GenericValue() [14/16]
|
inline |
Constructor for copy-string (i.e. do make a copy of string)
◆ GenericValue() [15/16]
|
inline |
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]
|
inline |
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()
|
inline |
Destructor.
Need to destruct elements of array, members of object, or copy-string.
Member Function Documentation
◆ DataString()
|
inlinestatic |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ DataStringLength()
|
inlinestatic |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ DoAddMember()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ DoAllocMembers()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ DoClearMembers()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ DoCopyMembers()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ DoEraseMembers()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ DoFindMember()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ DoFreeMembers()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ DoRemoveMember()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ DoReserveMembers()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ GetElementsPointer()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ GetMembersPointer()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ GetStringPointer()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ operator=() [1/2]
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ operator=() [2/2]
|
inline |
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()
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 tobool
, use SetBool() instead. Set boolean value
◆ RawAssign()
|
inline |
Assignment without calling destructor.
◆ SetArrayRaw()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ SetElementsPointer()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ SetMembersPointer()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ SetObjectRaw()
|
inline |
Initialize this value as object with initial data, without calling destructor.
◆ SetStringPointer()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ SetStringRaw() [1/2]
|
inline |
Initialize this value as constant string, without calling destructor.
◆ SetStringRaw() [2/2]
|
inline |
Initialize this value as copy string with initial data, without calling destructor.
◆ StringEqual()
|
inline |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
Friends And Related Function Documentation
◆ GenericDocument
|
friend |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
Member Data Documentation
◆ data_
Data GenericValue< Encoding, Allocator >::data_ |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ kDefaultArrayCapacity
|
static |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
◆ kDefaultObjectCapacity
|
static |
Assignment with move semantics.
- Parameters
-
rhs Source of the assignment. It will become a null value after assignment.
The documentation for this class was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/develop/include/rapidjson/document.h