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 | |
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, kNumberInt64Flag = kNumberType | kNumberFlag | kInt64Flag, kNumberUint64Flag = kNumberType | kNumberFlag | kUint64Flag, kNumberDoubleFlag = kNumberType | kNumberFlag | kDoubleFlag, kNumberAnyFlag, 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 |
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... | |
Public Member Functions | |
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) |
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) |
template<typename SourceAllocator > | |
bool | StringEqual (const GenericValue< Encoding, SourceAllocator > &rhs) const |
Assignment operators | |
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... | |
Public Attributes | |
Data | data_ |
Static Public Attributes | |
static const SizeType | kDefaultArrayCapacity = 16 |
static const SizeType | kDefaultObjectCapacity = 16 |
Friends | |
template<typename , typename , typename > | |
class | GenericDocument |
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... | |
GenericValue (const GenericValue &rhs) | |
Copy constructor is not permitted. More... | |
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
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. |
Definition at line 59 of file document.h.
typedef Allocator GenericValue< Encoding, Allocator >::AllocatorType |
Allocator type from template parameter.
Definition at line 716 of file document.h.
typedef GenericArray<false, ValueType> GenericValue< Encoding, Allocator >::Array |
Definition at line 731 of file document.h.
typedef Encoding::Ch GenericValue< Encoding, Allocator >::Ch |
Character type derived from Encoding.
Definition at line 717 of file document.h.
typedef GenericArray<true, ValueType> GenericValue< Encoding, Allocator >::ConstArray |
Definition at line 732 of file document.h.
typedef GenericMemberIterator<true, Encoding, Allocator>::Iterator GenericValue< Encoding, Allocator >::ConstMemberIterator |
Constant member iterator for iterating in object.
Definition at line 723 of file document.h.
typedef GenericObject<true, ValueType> GenericValue< Encoding, Allocator >::ConstObject |
Definition at line 734 of file document.h.
typedef const GenericValue* GenericValue< Encoding, Allocator >::ConstValueIterator |
Constant value iterator for iterating in array.
Definition at line 728 of file document.h.
typedef Encoding GenericValue< Encoding, Allocator >::EncodingType |
Encoding type from template parameter.
Definition at line 715 of file document.h.
typedef GenericMember<Encoding, Allocator> GenericValue< Encoding, Allocator >::Member |
Name-value pair in an object.
Definition at line 714 of file document.h.
typedef GenericMemberIterator<false, Encoding, Allocator>::Iterator GenericValue< Encoding, Allocator >::MemberIterator |
Member iterator for iterating in object.
Definition at line 721 of file document.h.
typedef GenericObject<false, ValueType> GenericValue< Encoding, Allocator >::Object |
Definition at line 733 of file document.h.
typedef GenericStringRef<Ch> GenericValue< Encoding, Allocator >::StringRefType |
Reference to a constant string.
Definition at line 719 of file document.h.
typedef GenericValue* GenericValue< Encoding, Allocator >::ValueIterator |
Value iterator for iterating in array.
Definition at line 726 of file document.h.
typedef GenericValue<Encoding, Allocator> GenericValue< Encoding, Allocator >::ValueType |
Value type of itself.
Definition at line 730 of file document.h.
anonymous enum |
Definition at line 2339 of file document.h.
|
inline |
Default constructor creates a null value.
Definition at line 740 of file document.h.
|
private |
Copy constructor is not permitted.
|
inlineexplicit |
Constructor with JSON value type.
This creates a Value of specified type with default content.
type | Type of the value. |
Definition at line 770 of file document.h.
|
inline |
Explicit copy constructor (with allocator)
Creates a copy of a Value by using the given Allocator
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) |
Definition at line 791 of file document.h.
|
inlineexplicit |
Constructor for boolean value.
b | Boolean value |
bool
, if you want to construct a boolean JSON value in such cases. Definition at line 846 of file document.h.
|
inlineexplicit |
Constructor for int value.
Definition at line 858 of file document.h.
|
inlineexplicit |
Constructor for unsigned value.
Definition at line 865 of file document.h.
|
inlineexplicit |
Constructor for int64_t value.
Definition at line 873 of file document.h.
|
inlineexplicit |
Constructor for uint64_t value.
Definition at line 890 of file document.h.
|
inlineexplicit |
Constructor for double value.
Definition at line 902 of file document.h.
|
inlineexplicit |
Constructor for float value.
Definition at line 908 of file document.h.
|
inline |
Constructor for constant string (i.e. do not make a copy of string)
Definition at line 914 of file document.h.
|
inlineexplicit |
Constructor for constant string (i.e. do not make a copy of string)
Definition at line 919 of file document.h.
|
inline |
Constructor for copy-string (i.e. do make a copy of string)
Definition at line 924 of file document.h.
|
inline |
Constructor for copy-string (i.e. do make a copy of string)
Definition at line 929 of file document.h.
|
inline |
Constructor for Array.
a | An array obtained by GetArray() . |
Array
is always pass-by-value. Definition at line 951 of file document.h.
|
inline |
Constructor for Object.
o | An object obtained by GetObject() . |
Object
is always pass-by-value. Definition at line 963 of file document.h.
|
inline |
Destructor.
Need to destruct elements of array, members of object, or copy-string.
Definition at line 971 of file document.h.
|
inline |
Definition at line 2477 of file document.h.
|
inline |
Definition at line 2484 of file document.h.
|
inline |
Definition at line 2471 of file document.h.
|
inline |
Assignment with move semantics.
rhs | Source of the assignment. It will become a null value after assignment. |
Definition at line 1006 of file document.h.
|
inline |
Assignment of constant string reference (no copy)
str | Constant string reference to be assigned |
Definition at line 1026 of file document.h.
GenericValue< Encoding, Allocator >::RAPIDJSON_DISABLEIF_RETURN | ( | (internal::IsPointer< T >) | , |
(GenericValue< Encoding, Allocator > &) | |||
) |
Assignment with primitive types.
T | Either Type, int , unsigned , int64_t , uint64_t |
value | The value to be assigned. |
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
|
inline |
Assignment without calling destructor.
Definition at line 2545 of file document.h.
|
inline |
Definition at line 2493 of file document.h.
|
inline |
Definition at line 2480 of file document.h.
|
inline |
Definition at line 2487 of file document.h.
|
inline |
Initialize this value as object with initial data, without calling destructor.
Definition at line 2507 of file document.h.
|
inline |
Definition at line 2474 of file document.h.
|
inline |
Initialize this value as constant string, without calling destructor.
Definition at line 2520 of file document.h.
|
inline |
Initialize this value as copy string with initial data, without calling destructor.
Definition at line 2528 of file document.h.
|
inline |
Definition at line 2552 of file document.h.
|
friend |
Definition at line 2337 of file document.h.
Data GenericValue< Encoding, Allocator >::data_ |
Definition at line 2571 of file document.h.
|
static |
Definition at line 2372 of file document.h.
|
static |
Definition at line 2373 of file document.h.