VR-Vantage API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends
rapidjson::GenericValue< Encoding, Allocator > Class Template Reference

Represents a JSON value. Use Value for UTF8 encoding and default allocator. More...

Inheritance diagram for rapidjson::GenericValue< Encoding, Allocator >:
Inheritance graph
[legend]

Classes

struct  Array
union  Data
struct  Member
 Name-value pair in an object. More...
union  Number
struct  Object
struct  String

Public Types

typedef Encoding EncodingType
 Encoding type from template parameter.
typedef Allocator AllocatorType
 Allocator type from template parameter.
typedef Encoding::Ch Ch
 Character type derived from Encoding.
typedef MemberMemberIterator
 Member iterator for iterating in object.
typedef const MemberConstMemberIterator
 Constant member iterator for iterating in object.
typedef GenericValueValueIterator
 Value iterator for iterating in array.
typedef const GenericValueConstValueIterator
 Constant value iterator for iterating in array.

Public Member Functions

template<typename Handler >
const GenericValueAccept (Handler &handler) const
 Generate events of this value to a Handler.
Assignment operators
GenericValueoperator= (GenericValue &rhs)
 Assignment with move semantics.
template<typename T >
GenericValueoperator= (T value)
 Assignment with primitive types.
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
GenericValueSetNull ()
Bool
bool GetBool () const
GenericValueSetBool (bool b)
Object
GenericValueSetObject ()
 Set this value as an empty object.
GenericValueoperator[] (const Ch *name)
 Get the value associated with the object's name.
const GenericValueoperator[] (const Ch *name) const
 Set this value as an empty object.
ConstMemberIterator MemberBegin () const
 Member iterators.
ConstMemberIterator MemberEnd () const
 Set this value as an empty object.
MemberIterator MemberBegin ()
 Set this value as an empty object.
MemberIterator MemberEnd ()
 Set this value as an empty object.
bool HasMember (const Ch *name) const
 Check whether a member exists in the object.
GenericValueAddMember (GenericValue &name, GenericValue &value, Allocator &allocator)
 Add a member (name-value pair) to the object.
GenericValueAddMember (const Ch *name, Allocator &nameAllocator, GenericValue &value, Allocator &allocator)
 Set this value as an empty object.
GenericValueAddMember (const Ch *name, GenericValue &value, Allocator &allocator)
 Set this value as an empty object.
template<typename T >
GenericValueAddMember (const Ch *name, T value, Allocator &allocator)
 Set this value as an empty object.
bool RemoveMember (const Ch *name)
 Remove a member in object by its name.
Array
GenericValueSetArray ()
 Set this value as an empty array.
SizeType Size () const
 Get the number of elements in array.
SizeType Capacity () const
 Get the capacity of array.
bool Empty () const
 Check whether the array is empty.
void Clear ()
 Remove all elements in the array.
GenericValueoperator[] (SizeType index)
 Get an element from array by index.
const GenericValueoperator[] (SizeType index) const
 Set this value as an empty array.
ValueIterator Begin ()
 Element iterator.
ValueIterator End ()
 Set this value as an empty array.
ConstValueIterator Begin () const
 Set this value as an empty array.
ConstValueIterator End () const
 Set this value as an empty array.
GenericValueReserve (SizeType newCapacity, Allocator &allocator)
 Request the array to have enough capacity to store elements.
GenericValuePushBack (GenericValue &value, Allocator &allocator)
 Append a value at the end of the array.
template<typename T >
GenericValuePushBack (T value, Allocator &allocator)
 Set this value as an empty array.
GenericValuePopBack ()
 Remove the last element in the array.
Number
int GetInt () const
unsigned GetUint () const
int64_t GetInt64 () const
uint64_t GetUint64 () const
double GetDouble () const
GenericValueSetInt (int i)
GenericValueSetUint (unsigned u)
GenericValueSetInt64 (int64_t i64)
GenericValueSetUint64 (uint64_t u64)
GenericValueSetDouble (double d)
String
const ChGetString () const
 Get the length of string.
SizeType GetStringLength () const
 Get the length of string.
GenericValueSetString (const Ch *s, SizeType length)
 Set this value as a string without copying source string.
GenericValueSetString (const Ch *s)
 Set this value as a string without copying source string.
GenericValueSetString (const Ch *s, SizeType length, Allocator &allocator)
 Set this value as a string by copying from source string.
GenericValueSetString (const Ch *s, Allocator &allocator)
 Set this value as a string by copying from source string.

Private Types

enum  {
  kBoolFlag = 0x100, kNumberFlag = 0x200, kIntFlag = 0x400, kUintFlag = 0x800,
  kInt64Flag = 0x1000, kUint64Flag = 0x2000, kDoubleFlag = 0x4000, kStringFlag = 0x100000,
  kCopyFlag = 0x200000, 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, kConstStringFlag = kStringType | kStringFlag, kCopyStringFlag = kStringType | kStringFlag | kCopyFlag, kObjectFlag = kObjectType,
  kArrayFlag = kArrayType, kTypeMask = 0xFF
}

Private Member Functions

MemberFindMember (const Ch *name)
 Find member by name.
const MemberFindMember (const Ch *name) const
void SetArrayRaw (GenericValue *values, SizeType count, Allocator &alloctaor)
void SetObjectRaw (Member *members, SizeType count, Allocator &alloctaor)
 Initialize this value as object with initial data, without calling destructor.
void SetStringRaw (const Ch *s, SizeType length)
 Initialize this value as constant string, without calling destructor.
void SetStringRaw (const Ch *s, SizeType length, Allocator &allocator)
 Initialize this value as copy string with initial data, without calling destructor.
void RawAssign (GenericValue &rhs)
 Assignment without calling destructor.

Private Attributes

Data data_
unsigned flags_

Static Private Attributes

static const SizeType kDefaultArrayCapacity = 16
static const SizeType kDefaultObjectCapacity = 16

Friends

class GenericDocument

Constructors and destructor.

 GenericValue ()
 Default constructor creates a null value.
 GenericValue (Type type)
 Constructor with JSON value type.
 GenericValue (bool b)
 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 (const Ch *s, SizeType length)
 Constructor for constant string (i.e. do not make a copy of string)
 GenericValue (const Ch *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 ()
 Destructor.
 GenericValue (const GenericValue &rhs)
 Copy constructor is not permitted.

Detailed Description

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
class rapidjson::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
EncodingEncoding of the value. (Even non-string values need to have the same encoding in a document)
AllocatorAllocator type for allocating memory of object, array and string.

Member Typedef Documentation

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
typedef Encoding rapidjson::GenericValue< Encoding, Allocator >::EncodingType

Encoding type from template parameter.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
typedef Allocator rapidjson::GenericValue< Encoding, Allocator >::AllocatorType

Allocator type from template parameter.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
typedef Encoding::Ch rapidjson::GenericValue< Encoding, Allocator >::Ch

Character type derived from Encoding.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
typedef Member* rapidjson::GenericValue< Encoding, Allocator >::MemberIterator

Member iterator for iterating in object.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
typedef const Member* rapidjson::GenericValue< Encoding, Allocator >::ConstMemberIterator

Constant member iterator for iterating in object.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
typedef GenericValue* rapidjson::GenericValue< Encoding, Allocator >::ValueIterator

Value iterator for iterating in array.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
typedef const GenericValue* rapidjson::GenericValue< Encoding, Allocator >::ConstValueIterator

Constant value iterator for iterating in array.

Member Enumeration Documentation

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
anonymous enum
private
Enumerator:
kBoolFlag 
kNumberFlag 
kIntFlag 
kUintFlag 
kInt64Flag 
kUint64Flag 
kDoubleFlag 
kStringFlag 
kCopyFlag 
kNullFlag 
kTrueFlag 
kFalseFlag 
kNumberIntFlag 
kNumberUintFlag 
kNumberInt64Flag 
kNumberUint64Flag 
kNumberDoubleFlag 
kConstStringFlag 
kCopyStringFlag 
kObjectFlag 
kArrayFlag 
kTypeMask 

Constructor & Destructor Documentation

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( )
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( const GenericValue< Encoding, Allocator > &  rhs)
private

Copy constructor is not permitted.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( Type  type)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( bool  b)
inline

Constructor for boolean value.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( int  i)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( unsigned  u)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( int64_t  i64)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( uint64_t  u64)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( double  d)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( const Ch s,
SizeType  length 
)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( const Ch s)
inline

Constructor for constant string (i.e. do not make a copy of string)

References rapidjson::GenericValue< Encoding, Allocator >::SetStringRaw(), and rapidjson::internal::StrLen().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( const Ch s,
SizeType  length,
Allocator allocator 
)
inline

Constructor for copy-string (i.e. do make a copy of string)

References rapidjson::GenericValue< Encoding, Allocator >::SetStringRaw().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( const Ch s,
Allocator allocator 
)
inline

Constructor for copy-string (i.e. do make a copy of string)

References rapidjson::GenericValue< Encoding, Allocator >::SetStringRaw(), and rapidjson::internal::StrLen().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::~GenericValue ( )
inline

Destructor.

Need to destruct elements of array, members of object, or copy-string.

References rapidjson::GenericValue< Encoding, Allocator >::Data::a, rapidjson::GenericValue< Encoding, Allocator >::data_, rapidjson::GenericValue< Encoding, Allocator >::Array::elements, rapidjson::GenericValue< Encoding, Allocator >::flags_, rapidjson::GenericValue< Encoding, Allocator >::kArrayFlag, rapidjson::GenericValue< Encoding, Allocator >::kCopyStringFlag, rapidjson::GenericValue< Encoding, Allocator >::kObjectFlag, rapidjson::GenericValue< Encoding, Allocator >::Object::members, rapidjson::GenericValue< Encoding, Allocator >::Data::o, rapidjson::GenericValue< Encoding, Allocator >::Data::s, rapidjson::GenericValue< Encoding, Allocator >::Object::size, rapidjson::GenericValue< Encoding, Allocator >::Array::size, and rapidjson::GenericValue< Encoding, Allocator >::String::str.

Referenced by rapidjson::GenericValue< Encoding, Allocator >::operator=(), rapidjson::GenericValue< Encoding, Allocator >::SetArray(), rapidjson::GenericValue< Encoding, Allocator >::SetBool(), rapidjson::GenericValue< Encoding, Allocator >::SetDouble(), rapidjson::GenericValue< Encoding, Allocator >::SetInt(), rapidjson::GenericValue< Encoding, Allocator >::SetInt64(), rapidjson::GenericValue< Encoding, Allocator >::SetNull(), rapidjson::GenericValue< Encoding, Allocator >::SetObject(), rapidjson::GenericValue< Encoding, Allocator >::SetString(), rapidjson::GenericValue< Encoding, Allocator >::SetUint(), and rapidjson::GenericValue< Encoding, Allocator >::SetUint64().

Member Function Documentation

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::operator= ( GenericValue< Encoding, Allocator > &  rhs)
inline

Assignment with move semantics.

Parameters
rhsSource of the assignment. It will become a null value after assignment.

References rapidjson::GenericValue< Encoding, Allocator >::flags_, rapidjson::GenericValue< Encoding, Allocator >::kNullFlag, RAPIDJSON_ASSERT, and rapidjson::GenericValue< Encoding, Allocator >::~GenericValue().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::operator= ( T  value)
inline

Assignment with primitive types.

Template Parameters
TEither Type, int, unsigned, int64_t, uint64_t, const Ch*
Parameters
valueThe value to be assigned.

References rapidjson::GenericValue< Encoding, Allocator >::GenericValue(), and rapidjson::GenericValue< Encoding, Allocator >::~GenericValue().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
Type rapidjson::GenericValue< Encoding, Allocator >::GetType ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsNull ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsFalse ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsTrue ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsBool ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsObject ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsArray ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsNumber ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsInt ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsUint ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsInt64 ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsUint64 ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsDouble ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::IsString ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetNull ( )
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::GetBool ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetBool ( bool  b)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetObject ( )
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::operator[] ( const Ch name)
inline

Get the value associated with the object's name.

References rapidjson::GenericValue< Encoding, Allocator >::FindMember().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
const GenericValue& rapidjson::GenericValue< Encoding, Allocator >::operator[] ( const Ch name) const
inline

Set this value as an empty object.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
ConstMemberIterator rapidjson::GenericValue< Encoding, Allocator >::MemberBegin ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
ConstMemberIterator rapidjson::GenericValue< Encoding, Allocator >::MemberEnd ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
MemberIterator rapidjson::GenericValue< Encoding, Allocator >::MemberBegin ( )
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
MemberIterator rapidjson::GenericValue< Encoding, Allocator >::MemberEnd ( )
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::HasMember ( const Ch name) const
inline

Check whether a member exists in the object.

References rapidjson::GenericValue< Encoding, Allocator >::FindMember().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::AddMember ( GenericValue< Encoding, Allocator > &  name,
GenericValue< Encoding, Allocator > &  value,
Allocator allocator 
)
inline

Add a member (name-value pair) to the object.

Parameters
nameA string value as name of member.
valueValue of any type.
allocatorAllocator for reallocating memory.
Returns
The value itself for fluent API.
Note
The ownership of name and value will be transfered to this object if success.

References rapidjson::GenericValue< Encoding, Allocator >::Object::capacity, rapidjson::GenericValue< Encoding, Allocator >::data_, rapidjson::GenericValue< Encoding, Allocator >::IsObject(), rapidjson::GenericValue< Encoding, Allocator >::IsString(), rapidjson::GenericValue< Encoding, Allocator >::kDefaultObjectCapacity, rapidjson::GenericValue< Encoding, Allocator >::Data::o, and RAPIDJSON_ASSERT.

Referenced by rapidjson::GenericValue< Encoding, Allocator >::AddMember().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::AddMember ( const Ch name,
Allocator nameAllocator,
GenericValue< Encoding, Allocator > &  value,
Allocator allocator 
)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::AddMember ( const Ch name,
GenericValue< Encoding, Allocator > &  value,
Allocator allocator 
)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::AddMember ( const Ch name,
T  value,
Allocator allocator 
)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::RemoveMember ( const Ch name)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetArray ( )
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
SizeType rapidjson::GenericValue< Encoding, Allocator >::Size ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
SizeType rapidjson::GenericValue< Encoding, Allocator >::Capacity ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
bool rapidjson::GenericValue< Encoding, Allocator >::Empty ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
void rapidjson::GenericValue< Encoding, Allocator >::Clear ( )
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::operator[] ( SizeType  index)
inline

Get an element from array by index.

Parameters
indexZero-based index of element.
Note
a.PushBack(123);
int x = a[0].GetInt(); // Error: operator[ is ambiguous, as 0 also mean a null pointer of const char* type.
int y = a[SizeType(0)].GetInt(); // Cast to SizeType will work.
int z = a[0u].GetInt(); // This works too.

References rapidjson::GenericValue< Encoding, Allocator >::Data::a, rapidjson::GenericValue< Encoding, Allocator >::data_, rapidjson::GenericValue< Encoding, Allocator >::Array::elements, rapidjson::GenericValue< Encoding, Allocator >::IsArray(), RAPIDJSON_ASSERT, and rapidjson::GenericValue< Encoding, Allocator >::Array::size.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
const GenericValue& rapidjson::GenericValue< Encoding, Allocator >::operator[] ( SizeType  index) const
inline

Set this value as an empty array.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
ValueIterator rapidjson::GenericValue< Encoding, Allocator >::Begin ( )
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
ValueIterator rapidjson::GenericValue< Encoding, Allocator >::End ( )
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
ConstValueIterator rapidjson::GenericValue< Encoding, Allocator >::Begin ( ) const
inline

Set this value as an empty array.

References rapidjson::GenericValue< Encoding, Allocator >::Begin().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
ConstValueIterator rapidjson::GenericValue< Encoding, Allocator >::End ( ) const
inline

Set this value as an empty array.

References rapidjson::GenericValue< Encoding, Allocator >::End().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::Reserve ( SizeType  newCapacity,
Allocator allocator 
)
inline

Request the array to have enough capacity to store elements.

Parameters
newCapacityThe capacity that the array at least need to have.
allocatorThe allocator for allocating memory. It must be the same one use previously.
Returns
The value itself for fluent API.

References rapidjson::GenericValue< Encoding, Allocator >::Data::a, rapidjson::GenericValue< Encoding, Allocator >::Array::capacity, rapidjson::GenericValue< Encoding, Allocator >::data_, rapidjson::GenericValue< Encoding, Allocator >::Array::elements, rapidjson::GenericValue< Encoding, Allocator >::IsArray(), and RAPIDJSON_ASSERT.

Referenced by rapidjson::GenericValue< Encoding, Allocator >::PushBack().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::PushBack ( GenericValue< Encoding, Allocator > &  value,
Allocator allocator 
)
inline

Append a value at the end of the array.

Parameters
valueThe value to be appended.
allocatorThe allocator for allocating memory. It must be the same one use previously.
Returns
The value itself for fluent API.
Note
The ownership of the value will be transfered to this object if success.
If the number of elements to be appended is known, calls Reserve() once first may be more efficient.

References rapidjson::GenericValue< Encoding, Allocator >::Data::a, rapidjson::GenericValue< Encoding, Allocator >::Array::capacity, rapidjson::GenericValue< Encoding, Allocator >::data_, rapidjson::GenericValue< Encoding, Allocator >::Array::elements, rapidjson::GenericValue< Encoding, Allocator >::IsArray(), rapidjson::GenericValue< Encoding, Allocator >::kDefaultArrayCapacity, RAPIDJSON_ASSERT, rapidjson::GenericValue< Encoding, Allocator >::Reserve(), and rapidjson::GenericValue< Encoding, Allocator >::Array::size.

Referenced by rapidjson::GenericValue< Encoding, Allocator >::PushBack().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::PushBack ( T  value,
Allocator allocator 
)
inline

Set this value as an empty array.

References rapidjson::GenericValue< Encoding, Allocator >::PushBack().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::PopBack ( )
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
int rapidjson::GenericValue< Encoding, Allocator >::GetInt ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
unsigned rapidjson::GenericValue< Encoding, Allocator >::GetUint ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
int64_t rapidjson::GenericValue< Encoding, Allocator >::GetInt64 ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
uint64_t rapidjson::GenericValue< Encoding, Allocator >::GetUint64 ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
double rapidjson::GenericValue< Encoding, Allocator >::GetDouble ( ) const
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetInt ( int  i)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetUint ( unsigned  u)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetInt64 ( int64_t  i64)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetUint64 ( uint64_t  u64)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetDouble ( double  d)
inline
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
const Ch* rapidjson::GenericValue< Encoding, Allocator >::GetString ( ) const
inline

Get the length of string.

Since rapidjson permits "\u0000" in the json string, strlen(v.GetString()) may not equal to v.GetStringLength().

References rapidjson::GenericValue< Encoding, Allocator >::data_, rapidjson::GenericValue< Encoding, Allocator >::IsString(), RAPIDJSON_ASSERT, rapidjson::GenericValue< Encoding, Allocator >::Data::s, and rapidjson::GenericValue< Encoding, Allocator >::String::str.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
SizeType rapidjson::GenericValue< Encoding, Allocator >::GetStringLength ( ) const
inline

Get the length of string.

Since rapidjson permits "\u0000" in the json string, strlen(v.GetString()) may not equal to v.GetStringLength().

References rapidjson::GenericValue< Encoding, Allocator >::data_, rapidjson::GenericValue< Encoding, Allocator >::IsString(), rapidjson::GenericValue< Encoding, Allocator >::String::length, RAPIDJSON_ASSERT, and rapidjson::GenericValue< Encoding, Allocator >::Data::s.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetString ( const Ch s,
SizeType  length 
)
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.

Parameters
ssource string pointer.
lengthThe length of source string, excluding the trailing null terminator.
Returns
The value itself for fluent API.

References rapidjson::GenericValue< Encoding, Allocator >::SetStringRaw(), and rapidjson::GenericValue< Encoding, Allocator >::~GenericValue().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetString ( const Ch s)
inline

Set this value as a string without copying source string.

Parameters
ssource string pointer.
Returns
The value itself for fluent API.

References rapidjson::GenericValue< Encoding, Allocator >::SetString(), and rapidjson::internal::StrLen().

Referenced by rapidjson::GenericValue< Encoding, Allocator >::SetString().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetString ( const Ch s,
SizeType  length,
Allocator allocator 
)
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.

Parameters
ssource string.
lengthThe length of source string, excluding the trailing null terminator.
allocatorAllocator for allocating copied buffer. Commonly use document.GetAllocator().
Returns
The value itself for fluent API.

References rapidjson::GenericValue< Encoding, Allocator >::SetStringRaw(), and rapidjson::GenericValue< Encoding, Allocator >::~GenericValue().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::GenericValue< Encoding, Allocator >::SetString ( const Ch s,
Allocator allocator 
)
inline

Set this value as a string by copying from source string.

Parameters
ssource string.
allocatorAllocator for allocating copied buffer. Commonly use document.GetAllocator().
Returns
The value itself for fluent API.

References rapidjson::GenericValue< Encoding, Allocator >::SetString(), and rapidjson::internal::StrLen().

Referenced by rapidjson::GenericValue< Encoding, Allocator >::SetString().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
template<typename Handler >
const GenericValue& rapidjson::GenericValue< Encoding, Allocator >::Accept ( Handler handler) const
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.

Template Parameters
Handlertype of handler.
Parameters
handlerAn object implementing concept Handler.

References rapidjson::GenericValue< Encoding, Allocator >::Data::a, rapidjson::GenericValue< Encoding, Allocator >::Number::d, rapidjson::GenericValue< Encoding, Allocator >::data_, rapidjson::GenericValue< Encoding, Allocator >::Array::elements, rapidjson::GenericValue< Encoding, Allocator >::GetType(), rapidjson::GenericValue< Encoding, Allocator >::Number::I::i, rapidjson::GenericValue< Encoding, Allocator >::Number::i, rapidjson::GenericValue< Encoding, Allocator >::Number::i64, rapidjson::GenericValue< Encoding, Allocator >::IsInt(), rapidjson::GenericValue< Encoding, Allocator >::IsInt64(), rapidjson::GenericValue< Encoding, Allocator >::IsUint(), rapidjson::GenericValue< Encoding, Allocator >::IsUint64(), rapidjson::kArrayType, rapidjson::kFalseType, rapidjson::kNullType, rapidjson::kNumberType, rapidjson::kObjectType, rapidjson::kStringType, rapidjson::kTrueType, rapidjson::GenericValue< Encoding, Allocator >::String::length, rapidjson::GenericValue< Encoding, Allocator >::Object::members, rapidjson::GenericValue< Encoding, Allocator >::Data::n, rapidjson::GenericValue< Encoding, Allocator >::Data::o, rapidjson::GenericValue< Encoding, Allocator >::Data::s, rapidjson::GenericValue< Encoding, Allocator >::Object::size, rapidjson::GenericValue< Encoding, Allocator >::Array::size, rapidjson::GenericValue< Encoding, Allocator >::String::str, rapidjson::GenericValue< Encoding, Allocator >::Number::U::u, rapidjson::GenericValue< Encoding, Allocator >::Number::u, and rapidjson::GenericValue< Encoding, Allocator >::Number::u64.

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
Member* rapidjson::GenericValue< Encoding, Allocator >::FindMember ( const Ch name)
inlineprivate
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
const Member* rapidjson::GenericValue< Encoding, Allocator >::FindMember ( const Ch name) const
inlineprivate
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
void rapidjson::GenericValue< Encoding, Allocator >::SetArrayRaw ( GenericValue< Encoding, Allocator > *  values,
SizeType  count,
Allocator alloctaor 
)
inlineprivate
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
void rapidjson::GenericValue< Encoding, Allocator >::SetObjectRaw ( Member members,
SizeType  count,
Allocator alloctaor 
)
inlineprivate
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
void rapidjson::GenericValue< Encoding, Allocator >::SetStringRaw ( const Ch s,
SizeType  length 
)
inlineprivate
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
void rapidjson::GenericValue< Encoding, Allocator >::SetStringRaw ( const Ch s,
SizeType  length,
Allocator allocator 
)
inlineprivate
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
void rapidjson::GenericValue< Encoding, Allocator >::RawAssign ( GenericValue< Encoding, Allocator > &  rhs)
inlineprivate

Friends And Related Function Documentation

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
friend class GenericDocument
friend

Member Data Documentation

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
const SizeType rapidjson::GenericValue< Encoding, Allocator >::kDefaultArrayCapacity = 16
staticprivate
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
const SizeType rapidjson::GenericValue< Encoding, Allocator >::kDefaultObjectCapacity = 16
staticprivate
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
Data rapidjson::GenericValue< Encoding, Allocator >::data_
private

Referenced by rapidjson::GenericValue< Encoding, Allocator >::Accept(), rapidjson::GenericValue< Encoding, Allocator >::AddMember(), rapidjson::GenericValue< Encoding, Allocator >::Begin(), rapidjson::GenericValue< Encoding, Allocator >::Capacity(), rapidjson::GenericValue< Encoding, Allocator >::Clear(), rapidjson::GenericValue< Encoding, Allocator >::Empty(), rapidjson::GenericValue< Encoding, Allocator >::End(), rapidjson::GenericValue< Encoding, Allocator >::FindMember(), rapidjson::GenericValue< Encoding, Allocator >::GenericValue(), rapidjson::GenericValue< Encoding, Allocator >::GetDouble(), rapidjson::GenericValue< Encoding, Allocator >::GetInt(), rapidjson::GenericValue< Encoding, Allocator >::GetInt64(), rapidjson::GenericValue< Encoding, Allocator >::GetString(), rapidjson::GenericValue< Encoding, Allocator >::GetStringLength(), rapidjson::GenericValue< Encoding, Allocator >::GetUint(), rapidjson::GenericValue< Encoding, Allocator >::GetUint64(), rapidjson::GenericValue< Encoding, Allocator >::MemberBegin(), rapidjson::GenericValue< Encoding, Allocator >::MemberEnd(), rapidjson::GenericValue< Encoding, Allocator >::operator[](), rapidjson::GenericValue< Encoding, Allocator >::PopBack(), rapidjson::GenericValue< Encoding, Allocator >::PushBack(), rapidjson::GenericValue< Encoding, Allocator >::RemoveMember(), rapidjson::GenericValue< Encoding, Allocator >::Reserve(), rapidjson::GenericValue< Encoding, Allocator >::SetArrayRaw(), rapidjson::GenericValue< Encoding, Allocator >::SetObjectRaw(), rapidjson::GenericValue< Encoding, Allocator >::SetStringRaw(), rapidjson::GenericValue< Encoding, Allocator >::Size(), and rapidjson::GenericValue< Encoding, Allocator >::~GenericValue().

template<typename Encoding , typename Allocator = MemoryPoolAllocator<>>
unsigned rapidjson::GenericValue< Encoding, Allocator >::flags_
private

Referenced by rapidjson::GenericValue< Encoding, Allocator >::GenericValue(), rapidjson::GenericValue< Encoding, Allocator >::GetBool(), rapidjson::GenericValue< Encoding, Allocator >::GetDouble(), rapidjson::GenericValue< Encoding, Allocator >::GetInt(), rapidjson::GenericValue< Encoding, Allocator >::GetInt64(), rapidjson::GenericValue< Encoding, Allocator >::GetType(), rapidjson::GenericValue< Encoding, Allocator >::GetUint(), rapidjson::GenericValue< Encoding, Allocator >::GetUint64(), rapidjson::GenericValue< Encoding, Allocator >::IsArray(), rapidjson::GenericValue< Encoding, Allocator >::IsBool(), rapidjson::GenericValue< Encoding, Allocator >::IsDouble(), rapidjson::GenericValue< Encoding, Allocator >::IsFalse(), rapidjson::GenericValue< Encoding, Allocator >::IsInt(), rapidjson::GenericValue< Encoding, Allocator >::IsInt64(), rapidjson::GenericValue< Encoding, Allocator >::IsNull(), rapidjson::GenericValue< Encoding, Allocator >::IsNumber(), rapidjson::GenericValue< Encoding, Allocator >::IsObject(), rapidjson::GenericValue< Encoding, Allocator >::IsString(), rapidjson::GenericValue< Encoding, Allocator >::IsTrue(), rapidjson::GenericValue< Encoding, Allocator >::IsUint(), rapidjson::GenericValue< Encoding, Allocator >::IsUint64(), rapidjson::GenericValue< Encoding, Allocator >::operator=(), rapidjson::GenericValue< Encoding, Allocator >::RawAssign(), rapidjson::GenericValue< Encoding, Allocator >::SetArrayRaw(), rapidjson::GenericValue< Encoding, Allocator >::SetObjectRaw(), rapidjson::GenericValue< Encoding, Allocator >::SetStringRaw(), and rapidjson::GenericValue< Encoding, Allocator >::~GenericValue().


The documentation for this class was generated from the following file:


Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)