Represents a JSON value. Use Value for UTF8 encoding and default allocator. More...
#include <document.h>
Classes | |
| struct | Member |
| Name-value pair in an object. More... | |
Public Types | |
| 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 Member * | MemberIterator |
| Member iterator for iterating in object. More... | |
| typedef const Member * | 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... | |
Public Member Functions | |
| template<typename Handler > | |
| const GenericValue & | Accept (Handler &handler) const |
| Generate events of this value to a Handler. More... | |
Assignment operators | |
| GenericValue & | operator= (GenericValue &rhs) |
| Assignment with move semantics. More... | |
| local | operator= ( local rhs) |
| Assignment with move semantics. More... | |
| template<typename T > | |
| GenericValue & | operator= (T value) |
| Assignment with primitive types. More... | |
| template<typename T > | |
| local | operator= ( local value) |
| Assignment with primitive types. More... | |
Type | |
| Type | GetType () const |
| bool | IsNull () const |
| bool | IsFalse () const |
| bool | IsTrue () const |
| bool | IsBool () const |
| bool | IsObject () const |
| bool | IsArray () const |
| bool | IsNumber () const |
| bool | IsInt () const |
| bool | IsUint () const |
| bool | IsInt64 () const |
| bool | IsUint64 () const |
| bool | IsDouble () const |
| bool | IsString () const |
Null | |
| GenericValue & | SetNull () |
| var | SetNull () |
| local | SetNull () |
Bool | |
| bool | GetBool () const |
| GenericValue & | SetBool (bool b) |
| local | SetBool ( local b) |
Object | |
| GenericValue & | SetObject () |
| Set this value as an empty object. More... | |
| GenericValue & | operator[] (const Ch *name) |
| Get the value associated with the object's name. More... | |
| var | operator[] ( var name) |
| Get the value associated with the object's name. More... | |
| local | operator[] ( local name) |
| Get the value associated with the object's name. More... | |
| const GenericValue & | operator[] (const Ch *name) const |
| ConstMemberIterator | MemberonBegin () const |
| Member iterators. More... | |
| ConstMemberIterator | MemberonEnd () const |
| local | MemberonEnd () |
| MemberIterator | MemberonBegin () |
| MemberIterator | MemberonEnd () |
| bool | HasMember (const Ch *name) const |
| Check whether a member exists in the object. More... | |
| GenericValue & | AddMember (GenericValue &name, GenericValue &value, Allocator &allocator) |
| Add a member (name-value pair) to the object. More... | |
| local | AddMember ( local name, local value, local allocator) |
| Add a member (name-value pair) to the object. More... | |
| GenericValue & | AddMember (const Ch *name, Allocator &nameAllocator, GenericValue &value, Allocator &allocator) |
| local | AddMember ( local name, local nameAllocator, local value, local allocator) |
| GenericValue & | AddMember (const Ch *name, GenericValue &value, Allocator &allocator) |
| template<typename T > | |
| GenericValue & | AddMember (const Ch *name, T value, Allocator &allocator) |
| template<typename T > | |
| local | AddMember ( local name, local value, local allocator) |
| bool | RemoveMember (const Ch *name) |
| Remove a member in object by its name. More... | |
Array | |
| GenericValue & | SetArray () |
| Set this value as an empty array. More... | |
| SizeType | Size () const |
| Get the number of elements in array. More... | |
| SizeType | Capacity () const |
| Get the capacity of array. More... | |
| bool | Empty () const |
| Check whether the array is empty. More... | |
| void | Clear () |
| Remove all elements in the array. More... | |
| GenericValue & | operator[] (SizeType index) |
| Get an element from array by index. More... | |
| local | operator[] ( local index) |
| Get an element from array by index. More... | |
| const GenericValue & | operator[] (SizeType index) const |
| ValueIterator | onBegin () |
| Element iterator. More... | |
| ValueIterator | onEnd () |
| ConstValueIterator | onBegin () const |
| var | onBegin () |
| local | onBegin () |
| ConstValueIterator | onEnd () const |
| GenericValue & | Reserve (SizeType newCapacity, Allocator &allocator) |
| Request the array to have enough capacity to store elements. More... | |
| local | Reserve ( local newCapacity, local allocator) |
| Request the array to have enough capacity to store elements. More... | |
| GenericValue & | PushBack (GenericValue &value, Allocator &allocator) |
| Append a value at the end of the array. More... | |
| local | PushBack ( local value, local allocator) |
| Append a value at the end of the array. More... | |
| template<typename T > | |
| GenericValue & | PushBack (T value, Allocator &allocator) |
| template<typename T > | |
| var | PushBack ( var value, var allocator) |
| template<typename T > | |
| local | PushBack ( local value, local allocator) |
| GenericValue & | PopBack () |
| Remove the last element in the array. More... | |
Number | |
| int | GetInt () const |
| unsigned | GetUint () const |
| int64_t | GetInt64 () const |
| uint64_t | GetUint64 () const |
| double | GetDouble () const |
| GenericValue & | SetInt (int i) |
| GenericValue & | SetUint (unsigned u) |
| GenericValue & | SetInt64 (int64_t i64) |
| var | SetInt64 ( var i64) |
| local | SetInt64 ( local i64) |
| GenericValue & | SetUint64 (uint64_t u64) |
| GenericValue & | SetDouble (double d) |
String | |
| const Ch * | GetString () const |
| SizeType | GetStringLength () const |
| Get the length of string. More... | |
| GenericValue & | SetString (const Ch *s, SizeType length) |
| Set this value as a string without copying source string. More... | |
| GenericValue & | SetString (const Ch *s) |
| Set this value as a string without copying source string. More... | |
| GenericValue & | SetString (const Ch *s, SizeType length, Allocator &allocator) |
| Set this value as a string by copying from source string. More... | |
| var | SetString ( var s, var length, var allocator) |
| Set this value as a string by copying from source string. More... | |
| local | SetString ( local s, local length, local allocator) |
| Set this value as a string by copying from source string. More... | |
| GenericValue & | SetString (const Ch *s, Allocator &allocator) |
| Set this value as a string by copying from source string. More... | |
Friends | |
| template<typename , typename > | |
| class | GenericDocument |
Constructors and destructor. | |
| GenericValue () | |
| Default constructor creates a null value. More... | |
| GenericValue (Type type) | |
| Constructor with JSON value type. More... | |
| GenericValue (bool b) | |
| Constructor for boolean value. More... | |
| GenericValue (int i) | |
| Constructor for int value. More... | |
| GenericValue (unsigned u) | |
| Constructor for unsigned value. More... | |
| GenericValue (int64_t i64) | |
| Constructor for int64_t value. More... | |
| GenericValue (uint64_t u64) | |
| Constructor for uint64_t value. More... | |
| GenericValue (double d) | |
| Constructor for double value. More... | |
| GenericValue (const Ch *s, SizeType length) | |
| Constructor for constant string (i.e. do not make a copy of string) More... | |
| GenericValue (const Ch *s) | |
| 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 ( local s, local length, local 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 () | |
| Destructor. 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
| typedef Allocator AllocatorType |
Allocator type from template parameter.
| var AllocatorType |
Allocator type from template parameter.
| local AllocatorType |
Allocator type from template parameter.
| typedef const Member* ConstMemberIterator |
Constant member iterator for iterating in object.
Constant member iterator for iterating in object.
| local ConstMemberIterator |
Constant member iterator for iterating in object.
| typedef const GenericValue* ConstValueIterator |
Constant value iterator for iterating in array.
Constant value iterator for iterating in array.
| local ConstValueIterator |
Constant value iterator for iterating in array.
| typedef Encoding EncodingType |
Encoding type from template parameter.
| var EncodingType |
Encoding type from template parameter.
| local EncodingType |
Encoding type from template parameter.
| typedef Member* MemberIterator |
Member iterator for iterating in object.
| var MemberIterator |
Member iterator for iterating in object.
| local MemberIterator |
Member iterator for iterating in object.
| typedef GenericValue* ValueIterator |
Value iterator for iterating in array.
| var ValueIterator |
Value iterator for iterating in array.
| local ValueIterator |
Value iterator for iterating in array.
|
inline |
Default constructor creates a null value.
|
inline |
Default constructor creates a null value.
|
inline |
Default constructor creates a null value.
|
inline |
Constructor with JSON value type.
This creates a Value of specified type with default content.
| type | Type of the value. |
|
inline |
Constructor with JSON value type.
This creates a Value of specified type with default content.
| type | Type of the value. |
|
inline |
Constructor with JSON value type.
This creates a Value of specified type with default content.
| type | Type of the value. |
|
inline |
Constructor for boolean value.
|
inline |
Constructor for boolean value.
|
inline |
Constructor for boolean value.
|
inline |
Constructor for int value.
|
inline |
Constructor for int value.
|
inline |
Constructor for int value.
|
inline |
Constructor for unsigned value.
|
inline |
Constructor for unsigned value.
|
inline |
Constructor for unsigned value.
|
inline |
Constructor for int64_t value.
|
inline |
Constructor for int64_t value.
|
inline |
Constructor for int64_t value.
|
inline |
Constructor for uint64_t value.
|
inline |
Constructor for uint64_t value.
|
inline |
Constructor for uint64_t value.
|
inline |
Constructor for double value.
|
inline |
Constructor for double value.
|
inline |
Constructor for double value.
|
inline |
Constructor for constant string (i.e. do not make a copy of string)
|
inline |
Constructor for constant string (i.e. do not make a copy of string)
|
inline |
Constructor for constant string (i.e. do not make a copy of string)
|
inline |
Constructor for constant string (i.e. do not make a copy of string)
|
inline |
Constructor for constant string (i.e. do not make a copy of string)
|
inline |
Constructor for constant string (i.e. do not make a copy of string)
|
inline |
Constructor for copy-string (i.e. do make a copy of string)
|
inline |
Constructor for copy-string (i.e. do make a copy of string)
|
inline |
Constructor for copy-string (i.e. do make a copy of string)
|
inline |
Constructor for copy-string (i.e. do make a copy of string)
|
inline |
Constructor for copy-string (i.e. do make a copy of string)
|
inline |
Constructor for copy-string (i.e. do make a copy of string)
|
inline |
Destructor.
Need to destruct elements of array, members of object, or copy-string.
|
inline |
Destructor.
Need to destruct elements of array, members of object, or copy-string.
|
inline |
Destructor.
Need to destruct elements of array, members of object, or copy-string.
|
inline |
Generate events of this value to a Handler.
This function adopts the GoF visitor pattern. Typical usage is to output this JSON value as JSON text via Writer, which is a Handler. It can also be used to deep clone this value via GenericDocument, which is also a Handler.
| Handler | type of handler. |
| handler | An object implementing concept Handler. |
|
inline |
Generate events of this value to a Handler.
This function adopts the GoF visitor pattern. Typical usage is to output this JSON value as JSON text via Writer, which is a Handler. It can also be used to deep clone this value via GenericDocument, which is also a Handler.
| Handler | type of handler. |
| handler | An object implementing concept Handler. |
|
inline |
Generate events of this value to a Handler.
This function adopts the GoF visitor pattern. Typical usage is to output this JSON value as JSON text via Writer, which is a Handler. It can also be used to deep clone this value via GenericDocument, which is also a Handler.
| Handler | type of handler. |
| handler | An object implementing concept Handler. |
|
inline |
Add a member (name-value pair) to the object.
| name | A string value as name of member. |
| value | Value of any type. |
| allocator | Allocator for reallocating memory. |
|
inline |
Add a member (name-value pair) to the object.
| name | A string value as name of member. |
| value | Value of any type. |
| allocator | Allocator for reallocating memory. |
|
inline |
Add a member (name-value pair) to the object.
| name | A string value as name of member. |
| value | Value of any type. |
| allocator | Allocator for reallocating memory. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the capacity of array.
|
inline |
Get the capacity of array.
|
inline |
Get the capacity of array.
|
inline |
Remove all elements in the array.
This function do not deallocate memory in the array, i.e. the capacity is unchanged.
|
inline |
Remove all elements in the array.
This function do not deallocate memory in the array, i.e. the capacity is unchanged.
|
inline |
Remove all elements in the array.
This function do not deallocate memory in the array, i.e. the capacity is unchanged.
|
inline |
Check whether the array is empty.
|
inline |
Check whether the array is empty.
|
inline |
Check whether the array is empty.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the length of string.
Since rapidjson permits "\u0000" in the json string, strlen(v.GetString()) may not equal to v.GetStringLength().
|
inline |
Get the length of string.
Since rapidjson permits "\u0000" in the json string, strlen(v.GetString()) may not equal to v.GetStringLength().
|
inline |
Get the length of string.
Since rapidjson permits "\u0000" in the json string, strlen(v.GetString()) may not equal to v.GetStringLength().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Check whether a member exists in the object.
|
inline |
Check whether a member exists in the object.
|
inline |
Check whether a member exists in the object.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Member iterators.
|
inline |
Member iterators.
|
inline |
Member iterators.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Element iterator.
|
inline |
Element iterator.
|
inline |
Element iterator.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Assignment with move semantics.
| rhs | Source of the assignment. It will become a null value after assignment. |
|
inline |
Assignment with move semantics.
| rhs | Source of the assignment. It will become a null value after assignment. |
|
inline |
Assignment with move semantics.
| rhs | Source of the assignment. It will become a null value after assignment. |
|
inline |
Assignment with primitive types.
| T | Either Type, int, unsigned, int64_t, uint64_t, const Ch* |
| value | The value to be assigned. |
|
inline |
Assignment with primitive types.
| T | Either Type, int, unsigned, int64_t, uint64_t, const Ch* |
| value | The value to be assigned. |
|
inline |
Assignment with primitive types.
| T | Either Type, int, unsigned, int64_t, uint64_t, const Ch* |
| value | The value to be assigned. |
|
inline |
Get the value associated with the object's name.
|
inline |
Get the value associated with the object's name.
|
inline |
Get the value associated with the object's name.
|
inline |
|
inline |
|
inline |
|
inline |
Get an element from array by index.
| index | Zero-based index of element. |
|
inline |
Get an element from array by index.
| index | Zero-based index of element. |
|
inline |
Get an element from array by index.
| index | Zero-based index of element. |
|
inline |
|
inline |
|
inline |
|
inline |
Remove the last element in the array.
|
inline |
Remove the last element in the array.
|
inline |
Remove the last element in the array.
|
inline |
Append a value at the end of the array.
| value | The value to be appended. |
| allocator | The allocator for allocating memory. It must be the same one use previously. |
|
inline |
Append a value at the end of the array.
| value | The value to be appended. |
| allocator | The allocator for allocating memory. It must be the same one use previously. |
|
inline |
Append a value at the end of the array.
| value | The value to be appended. |
| allocator | The allocator for allocating memory. It must be the same one use previously. |
|
inline |
|
inline |
|
inline |
|
inline |
Remove a member in object by its name.
| name | Name of member to be removed. |
|
inline |
Remove a member in object by its name.
| name | Name of member to be removed. |
|
inline |
Remove a member in object by its name.
| name | Name of member to be removed. |
|
inline |
Request the array to have enough capacity to store elements.
| newCapacity | The capacity that the array at least need to have. |
| allocator | The allocator for allocating memory. It must be the same one use previously. |
|
inline |
Request the array to have enough capacity to store elements.
| newCapacity | The capacity that the array at least need to have. |
| allocator | The allocator for allocating memory. It must be the same one use previously. |
|
inline |
Request the array to have enough capacity to store elements.
| newCapacity | The capacity that the array at least need to have. |
| allocator | The allocator for allocating memory. It must be the same one use previously. |
|
inline |
Set this value as an empty array.
|
inline |
Set this value as an empty array.
|
inline |
Set this value as an empty array.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set this value as an empty object.
|
inline |
Set this value as an empty object.
|
inline |
Set this value as an empty object.
|
inline |
Set this value as a string without copying source string.
This version has better performance with supplied length, and also support string containing null character.
| s | source string pointer. |
| length | The length of source string, excluding the trailing null terminator. |
|
inline |
Set this value as a string without copying source string.
This version has better performance with supplied length, and also support string containing null character.
| s | source string pointer. |
| length | The length of source string, excluding the trailing null terminator. |
|
inline |
Set this value as a string without copying source string.
This version has better performance with supplied length, and also support string containing null character.
| s | source string pointer. |
| length | The length of source string, excluding the trailing null terminator. |
|
inline |
Set this value as a string without copying source string.
| s | source string pointer. |
|
inline |
Set this value as a string without copying source string.
| s | source string pointer. |
|
inline |
Set this value as a string without copying source string.
| s | source string pointer. |
|
inline |
Set this value as a string by copying from source string.
This version has better performance with supplied length, and also support string containing null character.
| s | source string. |
| length | The length of source string, excluding the trailing null terminator. |
| allocator | Allocator for allocating copied buffer. Commonly use document.GetAllocator(). |
|
inline |
Set this value as a string by copying from source string.
This version has better performance with supplied length, and also support string containing null character.
| s | source string. |
| length | The length of source string, excluding the trailing null terminator. |
| allocator | Allocator for allocating copied buffer. Commonly use document.GetAllocator(). |
|
inline |
Set this value as a string by copying from source string.
This version has better performance with supplied length, and also support string containing null character.
| s | source string. |
| length | The length of source string, excluding the trailing null terminator. |
| allocator | Allocator for allocating copied buffer. Commonly use document.GetAllocator(). |
|
inline |
Set this value as a string by copying from source string.
| s | source string. |
| allocator | Allocator for allocating copied buffer. Commonly use document.GetAllocator(). |
|
inline |
Set this value as a string by copying from source string.
| s | source string. |
| allocator | Allocator for allocating copied buffer. Commonly use document.GetAllocator(). |
|
inline |
Set this value as a string by copying from source string.
| s | source string. |
| allocator | Allocator for allocating copied buffer. Commonly use document.GetAllocator(). |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the number of elements in array.
|
inline |
Get the number of elements in array.
|
inline |
Get the number of elements in array.
|
friend |
|
friend |
|
friend |