GenericValue
Engine/source/persistence/rapidjson/document.h
Represents a JSON value. Use Value for UTF8 encoding and default allocator.
Classes:
Assignment operators
_Anonymous_ { 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 }
operator=(GenericValue & rhs)
Assignment with move semantics.
operator=(StringRefType str)
Assignment of constant string reference (no copy)
RAPIDJSON_DISABLEIF_RETURN((internal::IsPointer< T >) , (GenericValue &) )
Assignment with primitive types.
SetStringPointer(const Ch * str)
RAPIDJSON_FORCEINLINE GenericValue *
RAPIDJSON_FORCEINLINE GenericValue *
SetElementsPointer(GenericValue * elements)
RAPIDJSON_FORCEINLINE Member *
RAPIDJSON_FORCEINLINE Member *
SetMembersPointer(Member * members)
SetArrayRaw(GenericValue * values, SizeType count, Allocator & allocator)
SetObjectRaw(Member * members, SizeType count, Allocator & allocator)
Initialize this value as object with initial data, without calling destructor.
Initialize this value as constant string, without calling destructor.
SetStringRaw(StringRefType s, Allocator & allocator)
Initialize this value as copy string with initial data, without calling destructor.
RawAssign(GenericValue & rhs)
Assignment without calling destructor.
bool
StringEqual(const GenericValue< Encoding, SourceAllocator > & rhs)
class
Constructors and destructor.
Default constructor creates a null value.
GenericValue(Type type)
Constructor with JSON value type.
GenericValue(const GenericValue< Encoding, SourceAllocator > & rhs, Allocator & allocator, bool copyConstStrings)
Explicit copy constructor (with allocator)
GenericValue(T b, RAPIDJSON_ENABLEIF((internal::IsSame< bool, T >)) )
Constructor for boolean value.
GenericValue(int i)
Constructor for int value.
GenericValue(unsigned u)
Constructor for unsigned value.
GenericValue(int64_t i64)
Constructor for int64_t value.
GenericValue(uint64_t u64)
Constructor for uint64_t value.
GenericValue(double d)
Constructor for double value.
GenericValue(float f)
Constructor for float value.
GenericValue(const Ch * s, SizeType length)
Constructor for constant string (i.e. do not make a copy of string)
Constructor for constant string (i.e. do not make a copy of string)
GenericValue(const Ch * s, SizeType length, Allocator & allocator)
Constructor for copy-string (i.e. do make a copy of string)
GenericValue(const Ch * s, Allocator & allocator)
Constructor for copy-string (i.e. do make a copy of string)
Constructor for Array.
Constructor for Object.
Destructor.
GenericValue(const GenericValue & rhs)
Copy constructor is not permitted.
Public Types
AllocatorType
Allocator type from template parameter.
GenericArray< false, ValueType >
Array
Encoding::Ch
Ch
Character type derived from Encoding.
GenericArray< true, ValueType >
ConstArray
GenericMemberIterator< true, Encoding, Allocator >::Iterator
ConstMemberIterator
Constant member iterator for iterating in object.
GenericObject< true, ValueType >
ConstObject
ConstValueIterator
Constant value iterator for iterating in array.
EncodingType
Encoding type from template parameter.
Member
Name-value pair in an object.
GenericMemberIterator< false, Encoding, Allocator >::Iterator
MemberIterator
Member iterator for iterating in object.
GenericObject< false, ValueType >
Object
StringRefType
Reference to a constant string.
ValueIterator
Value iterator for iterating in array.
ValueType
Value type of itself.
Detailed Description
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
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. |
Assignment operators
@121
Enumerator
- 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
operator=(GenericValue & rhs)
Assignment with move semantics.
Parameters:
rhs | Source of the assignment. It will become a null value after assignment. |
operator=(StringRefType str)
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.
GenericStringRef, operator=(T)
RAPIDJSON_DISABLEIF_RETURN((internal::IsPointer< T >) , (GenericValue &) )
Assignment with primitive types.
Parameters:
T | Either Type, int, unsigned, int64_t, uint64_t |
value | The value to be assigned. |
note:The source type
Texplicitly 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
GetStringPointer()
SetStringPointer(const Ch * str)
GetElementsPointer()
SetElementsPointer(GenericValue * elements)
GetMembersPointer()
SetMembersPointer(Member * members)
SetArrayRaw(GenericValue * values, SizeType count, Allocator & allocator)
SetObjectRaw(Member * members, SizeType count, Allocator & allocator)
Initialize this value as object with initial data, without calling destructor.
SetStringRaw(StringRefType s)
Initialize this value as constant string, without calling destructor.
SetStringRaw(StringRefType s, Allocator & allocator)
Initialize this value as copy string with initial data, without calling destructor.
RawAssign(GenericValue & rhs)
Assignment without calling destructor.
StringEqual(const GenericValue< Encoding, SourceAllocator > & rhs)
const SizeType kDefaultArrayCapacity
const SizeType kDefaultObjectCapacity
Data data_
Constructors and destructor.
GenericValue()
Default constructor creates a null value.
GenericValue(Type type)
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(const GenericValue< Encoding, SourceAllocator > & rhs, Allocator & allocator, bool copyConstStrings)
Explicit copy constructor (with allocator)
Creates a copy of a Value by using the given Allocator Parameters:
SourceAllocator | allocator of rhs |
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) |
CopyFrom()
GenericValue(T b, RAPIDJSON_ENABLEIF((internal::IsSame< bool, T >)) )
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(int i)
Constructor for int value.
GenericValue(unsigned u)
Constructor for unsigned value.
GenericValue(int64_t i64)
Constructor for int64_t value.
GenericValue(uint64_t u64)
Constructor for uint64_t value.
GenericValue(double d)
Constructor for double value.
GenericValue(float f)
Constructor for float value.
GenericValue(const Ch * s, SizeType length)
Constructor for constant string (i.e. do not make a copy of string)
GenericValue(StringRefType s)
Constructor for constant string (i.e. do not make a copy of string)
GenericValue(const Ch * s, SizeType length, Allocator & allocator)
Constructor for copy-string (i.e. do make a copy of string)
GenericValue(const Ch * s, Allocator & allocator)
Constructor for copy-string (i.e. do make a copy of string)
GenericValue(Array a)
Constructor for Array.
Parameters:
a | An array obtained by GetArray(). |
note:Arrayis always pass-by-value.
note:the source array is moved into this value and the sourec array becomes empty.
GenericValue(Object o)
Constructor for Object.
Parameters:
o | An object obtained by GetObject(). |
note:Objectis always pass-by-value.
note:the source object is moved into this value and the sourec object becomes empty.
~GenericValue()
Destructor.
Need to destruct elements of array, members of object, or copy-string.
GenericValue(const GenericValue & rhs)
Copy constructor is not permitted.
Public Types
typedef Allocator AllocatorType
Allocator type from template parameter.
typedef GenericArray< false, ValueType > Array
typedef Encoding::Ch Ch
Character type derived from Encoding.
typedef GenericArray< true, ValueType > ConstArray
typedef GenericMemberIterator< true, Encoding, Allocator >::Iterator ConstMemberIterator
Constant member iterator for iterating in object.
typedef GenericObject< true, ValueType > ConstObject
typedef const GenericValue * ConstValueIterator
Constant value iterator for iterating in array.
typedef Encoding EncodingType
Encoding type from template parameter.
typedef GenericMember< Encoding, Allocator > Member
Name-value pair in an object.
typedef GenericMemberIterator< false, Encoding, Allocator >::Iterator MemberIterator
Member iterator for iterating in object.
typedef GenericObject< false, ValueType > Object
typedef GenericStringRef< Ch > StringRefType
Reference to a constant string.
typedef GenericValue * ValueIterator
Value iterator for iterating in array.
typedef GenericValue< Encoding, Allocator > ValueType
Value type of itself.