webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Classes | Public Types | Public Member Functions | Friends | List of all members
GenericValue< Encoding, Allocator > Class Template Reference

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

#include <document.h>

Inheritance diagram for GenericValue< Encoding, Allocator >:
GenericDocument< Encoding, Allocator, StackAllocator >

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< ChStringRefType
 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 GenericValueValueIterator
 Value iterator for iterating in array. More...
 
typedef const GenericValueConstValueIterator
 Constant value iterator for iterating in array. More...
 

Public Member Functions

template<typename Handler >
bool Accept (Handler &handler) const
 Generate events of this value to a Handler. More...
 
Assignment operators
GenericValueoperator= (GenericValue &rhs) RAPIDJSON_NOEXCEPT
 Assignment with move semantics. More...
 
GenericValueoperator= (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...
 
template<typename SourceAllocator >
GenericValueCopyFrom (const GenericValue< Encoding, SourceAllocator > &rhs, Allocator &allocator)
 Deep-copy assignment from Value. More...
 
GenericValueSwap (GenericValue &other) RAPIDJSON_NOEXCEPT
 Exchange the contents of this value with those of other. More...
 
GenericValueMove () RAPIDJSON_NOEXCEPT
 Prepare Value for move semantics. More...
 
Equal-to and not-equal-to operators
template<typename SourceAllocator >
bool operator== (const GenericValue< Encoding, SourceAllocator > &rhs) const
 Equal-to operator. More...
 
bool operator== (const Ch *rhs) const
 Equal-to operator with const C-string pointer. More...
 
template<typename T >
 RAPIDJSON_DISABLEIF_RETURN ((internal::OrExpr< internal::IsPointer< T >, internal::IsGenericValue< T > >),(bool)) operator
 Equal-to operator with primitive types. More...
 
template<typename SourceAllocator >
bool operator!= (const GenericValue< Encoding, SourceAllocator > &rhs) const
 Not-equal-to operator. More...
 
bool operator!= (const Ch *rhs) const
 Not-equal-to operator with const C-string pointer. More...
 
template<typename T >
 RAPIDJSON_DISABLEIF_RETURN ((internal::IsGenericValue< T >),(bool)) operator!
 Not-equal-to operator with arbitrary types. More...
 
template<typename T >
friend RAPIDJSON_DISABLEIF_RETURN ((internal::IsGenericValue< T >),(bool)) operator
 Equal-to operator with arbitrary types (symmetric version) More...
 
template<typename T >
friend RAPIDJSON_DISABLEIF_RETURN ((internal::IsGenericValue< T >),(bool)) operator!
 Not-Equal-to operator with arbitrary types (symmetric version) 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
GenericValueSetNull ()
 
Bool
bool GetBool () const
 Set boolean value. More...
 
GenericValueSetBool (bool b)
 
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
 
SizeType GetStringLength () const
 Get the length of string. More...
 
GenericValueSetString (const Ch *s, SizeType length)
 Set this value as a string without copying source string. More...
 
GenericValueSetString (StringRefType s)
 Set this value as a string without copying source string. More...
 
GenericValueSetString (const Ch *s, SizeType length, Allocator &allocator)
 Set this value as a string by copying from source string. More...
 
GenericValueSetString (const Ch *s, Allocator &allocator)
 Set this value as a string by copying from source string. More...
 

Friends

template<typename , typename >
class GenericValue
 
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)
 Explicit copy constructor (with allocator) More...
 
template<typename T >
 GenericValue (T b, RAPIDJSON_ENABLEIF((internal::IsSame< T, bool >))) 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 (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 ()
 Destructor. More...
 

Object

T value
 
T Allocator & allocator
 
GenericValueSetObject ()
 Set this value as an empty object. More...
 
SizeType MemberCount () const
 Get the number of members in the object. More...
 
bool ObjectEmpty () const
 Check whether the object is empty. More...
 
template<typename T >
 RAPIDJSON_DISABLEIF_RETURN ((internal::NotExpr< internal::IsSame< typename internal::RemoveConst< T >::Type, Ch > >),(GenericValue &)) operator[](T *name)
 Get a value from an object associated with the name. More...
 
template<typename T >
 RAPIDJSON_DISABLEIF_RETURN ((internal::NotExpr< internal::IsSame< typename internal::RemoveConst< T >::Type, Ch > >),(const GenericValue &)) operator[](T *name) const
 
template<typename SourceAllocator >
GenericValueoperator[] (const GenericValue< Encoding, SourceAllocator > &name)
 Get a value from an object associated with the name. More...
 
template<typename SourceAllocator >
const GenericValueoperator[] (const GenericValue< Encoding, SourceAllocator > &name) const
 
ConstMemberIterator MemberBegin () const
 Const member iterator. More...
 
ConstMemberIterator MemberEnd () const
 Const past-the-end member iterator. More...
 
MemberIterator MemberBegin ()
 Member iterator. More...
 
MemberIterator MemberEnd ()
 Past-the-end member iterator More...
 
bool HasMember (const Ch *name) const
 Check whether a member exists in the object. More...
 
template<typename SourceAllocator >
bool HasMember (const GenericValue< Encoding, SourceAllocator > &name) const
 Check whether a member exists in the object with GenericValue name. More...
 
MemberIterator FindMember (const Ch *name)
 Find member by name. More...
 
ConstMemberIterator FindMember (const Ch *name) const
 
template<typename SourceAllocator >
MemberIterator FindMember (const GenericValue< Encoding, SourceAllocator > &name)
 Find member by name. More...
 
template<typename SourceAllocator >
ConstMemberIterator FindMember (const GenericValue< Encoding, SourceAllocator > &name) const
 
GenericValueAddMember (GenericValue &name, GenericValue &value, Allocator &allocator)
 Add a member (name-value pair) to the object. More...
 
GenericValueAddMember (StringRefType name, GenericValue &value, Allocator &allocator)
 Add a member (name-value pair) to the object. More...
 
GenericValueAddMember (StringRefType name, StringRefType value, Allocator &allocator)
 Add a constant string value as member (name-value pair) to the object. More...
 
template<typename T >
 RAPIDJSON_DISABLEIF_RETURN ((internal::OrExpr< internal::IsPointer< T >, internal::IsGenericValue< T > >),(GenericValue &)) AddMember(StringRefType name
 Add any primitive value as member (name-value pair) to the object. More...
 
GenericValue v (value)
 
return AddMember (n, v, allocator)
 
void RemoveAllMembers ()
 Remove all members in the object. More...
 
bool RemoveMember (const Ch *name)
 Remove a member in object by its name. More...
 
template<typename SourceAllocator >
bool RemoveMember (const GenericValue< Encoding, SourceAllocator > &name)
 
MemberIterator RemoveMember (MemberIterator m)
 Remove a member in object by iterator. More...
 
MemberIterator EraseMember (ConstMemberIterator pos)
 Remove a member from an object by iterator. More...
 
MemberIterator EraseMember (ConstMemberIterator first, ConstMemberIterator last)
 Remove members in the range [first, last) from an object. More...
 

Array

Allocator & allocator
 
GenericValueSetArray ()
 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...
 
GenericValueoperator[] (SizeType index)
 Get an element from array by index. More...
 
const GenericValueoperator[] (SizeType index) const
 
ValueIterator Begin ()
 Element iterator. More...
 
ValueIterator End ()
 Past-the-end element iterator More...
 
ConstValueIterator Begin () const
 Constant element iterator. More...
 
ConstValueIterator End () const
 Constant past-the-end element iterator. More...
 
GenericValueReserve (SizeType newCapacity, Allocator &allocator)
 Request the array to have enough capacity to store elements. More...
 
GenericValuePushBack (GenericValue &value, Allocator &allocator)
 Append a GenericValue at the end of the array. More...
 
GenericValuePushBack (StringRefType value, Allocator &allocator)
 Append a constant string reference at the end of the array. More...
 
template<typename T >
 RAPIDJSON_DISABLEIF_RETURN ((internal::OrExpr< internal::IsPointer< T >, internal::IsGenericValue< T > >),(GenericValue &)) PushBack(T value
 Append a primitive value at the end of the array. More...
 
return PushBack (v, allocator)
 
GenericValuePopBack ()
 Remove the last element in the array. More...
 
ValueIterator Erase (ConstValueIterator pos)
 Remove an element of array by iterator. More...
 
ValueIterator Erase (ConstValueIterator first, ConstValueIterator last)
 Remove elements in the range [first, last) of the array. More...
 

Detailed Description

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
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
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

◆ AllocatorType

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

Allocator type from template parameter.

◆ Ch

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

Character type derived from Encoding.

◆ ConstMemberIterator

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
typedef GenericMemberIterator<true,Encoding,Allocator>::Iterator GenericValue< Encoding, Allocator >::ConstMemberIterator

Constant member iterator for iterating in object.

◆ ConstValueIterator

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

Constant value iterator for iterating in array.

◆ EncodingType

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

Encoding type from template parameter.

◆ Member

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
typedef GenericMember<Encoding, Allocator> GenericValue< Encoding, Allocator >::Member

Name-value pair in an object.

◆ MemberIterator

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
typedef GenericMemberIterator<false,Encoding,Allocator>::Iterator GenericValue< Encoding, Allocator >::MemberIterator

Member iterator for iterating in object.

◆ StringRefType

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

Reference to a constant string.

◆ ValueIterator

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

Value iterator for iterating in array.

Constructor & Destructor Documentation

◆ GenericValue() [1/13]

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

Default constructor creates a null value.

◆ GenericValue() [2/13]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue< Encoding, Allocator >::GenericValue ( Type  type)
inlineexplicit

Constructor with JSON value type.

This creates a Value of specified type with default content.

Parameters
typeType of the value.
Note
Default content for number is zero.

◆ GenericValue() [3/13]

template<typename Encoding, typename Allocator>
template<typename SourceAllocator >
GenericValue< Encoding, Allocator >::GenericValue ( const GenericValue< Encoding, SourceAllocator > &  rhs,
Allocator &  allocator 
)
inline

Explicit copy constructor (with allocator)

Creates a copy of a Value by using the given Allocator

Template Parameters
SourceAllocatorallocator of rhs
Parameters
rhsValue to copy from (read-only)
allocatorAllocator for allocating copied elements and buffers. Commonly use GenericDocument::GetAllocator().
See also
CopyFrom()

◆ GenericValue() [4/13]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue< Encoding, Allocator >::GenericValue ( T  b,
RAPIDJSON_ENABLEIF((internal::IsSame< T, bool >))   
)
inlineexplicit

Constructor for boolean value.

Parameters
bBoolean 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/13]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue< Encoding, Allocator >::GenericValue ( int  i)
inlineexplicit

Constructor for int value.

◆ GenericValue() [6/13]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue< Encoding, Allocator >::GenericValue ( unsigned  u)
inlineexplicit

Constructor for unsigned value.

◆ GenericValue() [7/13]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue< Encoding, Allocator >::GenericValue ( int64_t  i64)
inlineexplicit

Constructor for int64_t value.

◆ GenericValue() [8/13]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue< Encoding, Allocator >::GenericValue ( uint64_t  u64)
inlineexplicit

Constructor for uint64_t value.

◆ GenericValue() [9/13]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue< Encoding, Allocator >::GenericValue ( double  d)
inlineexplicit

Constructor for double value.

◆ GenericValue() [10/13]

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

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

◆ GenericValue() [11/13]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue< Encoding, Allocator >::GenericValue ( StringRefType  s)
inlineexplicit

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

◆ GenericValue() [12/13]

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

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

◆ GenericValue() [13/13]

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

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

◆ ~GenericValue()

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

Destructor.

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

Member Function Documentation

◆ Accept()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename Handler >
bool 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.

◆ AddMember() [1/4]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& 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. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
Returns
The value itself for fluent API.
Note
The ownership of name and value will be transferred to this object on success.
Precondition
IsObject() && name.IsString()
Postcondition
name.IsNull() && value.IsNull()
Note
Amortized Constant time complexity.

◆ AddMember() [2/4]

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

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

Parameters
nameA constant string reference as name of member.
valueValue of any type.
allocatorAllocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
Returns
The value itself for fluent API.
Note
The ownership of value will be transferred to this object on success.
Precondition
IsObject()
Postcondition
value.IsNull()
Note
Amortized Constant time complexity.

◆ AddMember() [3/4]

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

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

Parameters
nameA constant string reference as name of member.
valueconstant string reference as value of member.
allocatorAllocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
Returns
The value itself for fluent API.
Precondition
IsObject()
Note
This overload is needed to avoid clashes with the generic primitive type AddMember(StringRefType,T,Allocator&) overload below.
Amortized Constant time complexity.

◆ AddMember() [4/4]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
return GenericValue< Encoding, Allocator >::AddMember ( n  ,
v  ,
allocator   
)

◆ Begin() [1/2]

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

Element iterator.

Precondition
IsArray() == true

◆ Begin() [2/2]

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

Constant element iterator.

Precondition
IsArray() == true

◆ Capacity()

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

Get the capacity of array.

◆ Clear()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
void GenericValue< Encoding, Allocator >::Clear ( )
inline

Remove all elements in the array.

This function do not deallocate memory in the array, i.e. the capacity is unchanged.

Note
Linear time complexity.

◆ CopyFrom()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename SourceAllocator >
GenericValue& GenericValue< Encoding, Allocator >::CopyFrom ( const GenericValue< Encoding, SourceAllocator > &  rhs,
Allocator &  allocator 
)
inline

Deep-copy assignment from Value.

Assigns a copy of the Value to the current Value object

Template Parameters
SourceAllocatorAllocator type of rhs
Parameters
rhsValue to copy from (read-only)
allocatorAllocator to use for copying

◆ Empty()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::Empty ( ) const
inline

Check whether the array is empty.

◆ End() [1/2]

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

Past-the-end element iterator

Precondition
IsArray() == true

◆ End() [2/2]

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

Constant past-the-end element iterator.

Precondition
IsArray() == true

◆ Erase() [1/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
ValueIterator GenericValue< Encoding, Allocator >::Erase ( ConstValueIterator  pos)
inline

Remove an element of array by iterator.

Parameters
positerator to the element to remove
Precondition
IsArray() == true && Begin() <= pos < End()
Returns
Iterator following the removed element. If the iterator pos refers to the last element, the End() iterator is returned.
Note
Linear time complexity.

◆ Erase() [2/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
ValueIterator GenericValue< Encoding, Allocator >::Erase ( ConstValueIterator  first,
ConstValueIterator  last 
)
inline

Remove elements in the range [first, last) of the array.

Parameters
firstiterator to the first element to remove
lastiterator following the last element to remove
Precondition
IsArray() == true && Begin() <= first <= last <= End()
Returns
Iterator following the last removed element.
Note
Linear time complexity.

◆ EraseMember() [1/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
MemberIterator GenericValue< Encoding, Allocator >::EraseMember ( ConstMemberIterator  pos)
inline

Remove a member from an object by iterator.

Parameters
positerator to the member to remove
Precondition
IsObject() == true && MemberBegin() <= pos < MemberEnd()
Returns
Iterator following the removed element. If the iterator pos refers to the last element, the MemberEnd() iterator is returned.
Note
This function preserves the relative order of the remaining object members. If you do not need this, use the more efficient RemoveMember(MemberIterator).
Linear time complexity.

◆ EraseMember() [2/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
MemberIterator GenericValue< Encoding, Allocator >::EraseMember ( ConstMemberIterator  first,
ConstMemberIterator  last 
)
inline

Remove members in the range [first, last) from an object.

Parameters
firstiterator to the first member to remove
lastiterator following the last member to remove
Precondition
IsObject() == true && MemberBegin() <= first <= last <= MemberEnd()
Returns
Iterator following the last removed element.
Note
This function preserves the relative order of the remaining object members.
Linear time complexity.

◆ FindMember() [1/4]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
MemberIterator GenericValue< Encoding, Allocator >::FindMember ( const Ch name)
inline

Find member by name.

Parameters
nameMember name to be searched.
Precondition
IsObject() == true
Returns
Iterator to member, if it exists. Otherwise returns MemberEnd().
Note
Earlier versions of Rapidjson returned a NULL pointer, in case the requested member doesn't exist. For consistency with e.g. std::map, this has been changed to MemberEnd() now.
Linear time complexity.

◆ FindMember() [2/4]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
ConstMemberIterator GenericValue< Encoding, Allocator >::FindMember ( const Ch name) const
inline

◆ FindMember() [3/4]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename SourceAllocator >
MemberIterator GenericValue< Encoding, Allocator >::FindMember ( const GenericValue< Encoding, SourceAllocator > &  name)
inline

Find member by name.

This version is faster because it does not need a StrLen(). It can also handle string with null character.

Parameters
nameMember name to be searched.
Precondition
IsObject() == true
Returns
Iterator to member, if it exists. Otherwise returns MemberEnd().
Note
Earlier versions of Rapidjson returned a NULL pointer, in case the requested member doesn't exist. For consistency with e.g. std::map, this has been changed to MemberEnd() now.
Linear time complexity.

◆ FindMember() [4/4]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename SourceAllocator >
ConstMemberIterator GenericValue< Encoding, Allocator >::FindMember ( const GenericValue< Encoding, SourceAllocator > &  name) const
inline

◆ GetBool()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::GetBool ( ) const
inline

Set boolean value.

◆ GetDouble()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
double GenericValue< Encoding, Allocator >::GetDouble ( ) const
inline

◆ GetInt()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
int GenericValue< Encoding, Allocator >::GetInt ( ) const
inline

◆ GetInt64()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
int64_t GenericValue< Encoding, Allocator >::GetInt64 ( ) const
inline

◆ GetString()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
const Ch* GenericValue< Encoding, Allocator >::GetString ( ) const
inline

◆ GetStringLength()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
SizeType 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().

◆ GetType()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Type GenericValue< Encoding, Allocator >::GetType ( ) const
inline

◆ GetUint()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
unsigned GenericValue< Encoding, Allocator >::GetUint ( ) const
inline

◆ GetUint64()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
uint64_t GenericValue< Encoding, Allocator >::GetUint64 ( ) const
inline

◆ HasMember() [1/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::HasMember ( const Ch name) const
inline

Check whether a member exists in the object.

Parameters
nameMember name to be searched.
Precondition
IsObject() == true
Returns
Whether a member with that name exists.
Note
It is better to use FindMember() directly if you need the obtain the value as well.
Linear time complexity.

◆ HasMember() [2/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename SourceAllocator >
bool GenericValue< Encoding, Allocator >::HasMember ( const GenericValue< Encoding, SourceAllocator > &  name) const
inline

Check whether a member exists in the object with GenericValue name.

This version is faster because it does not need a StrLen(). It can also handle string with null character.

Parameters
nameMember name to be searched.
Precondition
IsObject() == true
Returns
Whether a member with that name exists.
Note
It is better to use FindMember() directly if you need the obtain the value as well.
Linear time complexity.

◆ IsArray()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsArray ( ) const
inline

◆ IsBool()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsBool ( ) const
inline

◆ IsDouble()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsDouble ( ) const
inline

◆ IsFalse()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsFalse ( ) const
inline

◆ IsInt()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsInt ( ) const
inline

◆ IsInt64()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsInt64 ( ) const
inline

◆ IsNull()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsNull ( ) const
inline

◆ IsNumber()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsNumber ( ) const
inline

◆ IsObject()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsObject ( ) const
inline

◆ IsString()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsString ( ) const
inline

◆ IsTrue()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsTrue ( ) const
inline

◆ IsUint()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsUint ( ) const
inline

◆ IsUint64()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::IsUint64 ( ) const
inline

◆ MemberBegin() [1/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
ConstMemberIterator GenericValue< Encoding, Allocator >::MemberBegin ( ) const
inline

Const member iterator.

Precondition
IsObject() == true

◆ MemberBegin() [2/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
MemberIterator GenericValue< Encoding, Allocator >::MemberBegin ( )
inline

Member iterator.

Precondition
IsObject() == true

◆ MemberCount()

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

Get the number of members in the object.

◆ MemberEnd() [1/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
ConstMemberIterator GenericValue< Encoding, Allocator >::MemberEnd ( ) const
inline

Const past-the-end member iterator.

Precondition
IsObject() == true

◆ MemberEnd() [2/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
MemberIterator GenericValue< Encoding, Allocator >::MemberEnd ( )
inline

Past-the-end member iterator

Precondition
IsObject() == true

◆ Move()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& GenericValue< Encoding, Allocator >::Move ( )
inline

Prepare Value for move semantics.

Returns
*this

◆ ObjectEmpty()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::ObjectEmpty ( ) const
inline

Check whether the object is empty.

◆ operator!=() [1/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename SourceAllocator >
bool GenericValue< Encoding, Allocator >::operator!= ( const GenericValue< Encoding, SourceAllocator > &  rhs) const
inline

Not-equal-to operator.

Returns
!(*this == rhs)

◆ operator!=() [2/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::operator!= ( const Ch rhs) const
inline

Not-equal-to operator with const C-string pointer.

◆ operator=() [1/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& 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.

◆ operator=() [2/2]

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

Assignment of constant string reference (no copy)

Parameters
strConstant 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)

◆ operator==() [1/2]

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

Equal-to operator.

Note
If an object contains duplicated named member, comparing equality with any object is always false.
Linear time complexity (number of all values in the subtree and total lengths of all strings).

◆ operator==() [2/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::operator== ( const Ch rhs) const
inline

Equal-to operator with const C-string pointer.

◆ operator[]() [1/4]

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

Get a value from an object associated with the name.

Precondition
IsObject() == true
Template Parameters
SourceAllocatorAllocator of the name value
Note
Compared to operator[](T*), this version is faster because it does not need a StrLen(). And it can also handle strings with embedded null characters.
Linear time complexity.

◆ operator[]() [2/4]

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

◆ operator[]() [3/4]

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

Get an element from array by index.

Precondition
IsArray() == true
Parameters
indexZero-based index of element.
See also
operator[](T*)

◆ operator[]() [4/4]

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

◆ PopBack()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& GenericValue< Encoding, Allocator >::PopBack ( )
inline

Remove the last element in the array.

Note
Constant time complexity.

◆ PushBack() [1/3]

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

Append a GenericValue at the end of the array.

Parameters
valueValue to be appended.
allocatorAllocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
Precondition
IsArray() == true
Postcondition
value.IsNull() == true
Returns
The value itself for fluent API.
Note
The ownership of value will be transferred to this array on success.
If the number of elements to be appended is known, calls Reserve() once first may be more efficient.
Amortized constant time complexity.

◆ PushBack() [2/3]

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

Append a constant string reference at the end of the array.

Parameters
valueConstant string reference to be appended.
allocatorAllocator for reallocating memory. It must be the same one used previously. Commonly use GenericDocument::GetAllocator().
Precondition
IsArray() == true
Returns
The value itself for fluent API.
Note
If the number of elements to be appended is known, calls Reserve() once first may be more efficient.
Amortized constant time complexity.
See also
GenericStringRef

◆ PushBack() [3/3]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
return GenericValue< Encoding, Allocator >::PushBack ( v  ,
allocator   
)

◆ RAPIDJSON_DISABLEIF_RETURN() [1/9]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue< Encoding, Allocator >::RAPIDJSON_DISABLEIF_RETURN ( (internal::IsPointer< T >)  ,
(GenericValue< Encoding, Allocator > &)   
)
inline

Assignment with primitive types.

Template Parameters
TEither Type, int, unsigned, int64_t, uint64_t
Parameters
valueThe 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 to bool, use SetBool() instead.

◆ RAPIDJSON_DISABLEIF_RETURN() [2/9]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue< Encoding, Allocator >::RAPIDJSON_DISABLEIF_RETURN ( (internal::OrExpr< internal::IsPointer< T >, internal::IsGenericValue< T > >)  ,
(bool)   
)
inline

Equal-to operator with primitive types.

Template Parameters
TEither Type, int, unsigned, int64_t, uint64_t, double, true, false

◆ RAPIDJSON_DISABLEIF_RETURN() [3/9]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue< Encoding, Allocator >::RAPIDJSON_DISABLEIF_RETURN ( (internal::IsGenericValue< T >)  ,
(bool)   
)
inline

Not-equal-to operator with arbitrary types.

Returns
!(*this == rhs)

◆ RAPIDJSON_DISABLEIF_RETURN() [4/9]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue< Encoding, Allocator >::RAPIDJSON_DISABLEIF_RETURN ( (internal::IsGenericValue< T >)  ,
(bool)   
)
inline

Equal-to operator with arbitrary types (symmetric version)

Returns
(rhs == lhs)

◆ RAPIDJSON_DISABLEIF_RETURN() [5/9]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue< Encoding, Allocator >::RAPIDJSON_DISABLEIF_RETURN ( (internal::IsGenericValue< T >)  ,
(bool)   
)
inline

Not-Equal-to operator with arbitrary types (symmetric version)

Returns
!(rhs == lhs)

◆ RAPIDJSON_DISABLEIF_RETURN() [6/9]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue< Encoding, Allocator >::RAPIDJSON_DISABLEIF_RETURN ( (internal::NotExpr< internal::IsSame< typename internal::RemoveConst< T >::Type, Ch > >)  ,
(GenericValue< Encoding, Allocator > &)   
)
inline

Get a value from an object associated with the name.

Precondition
IsObject() == true
Template Parameters
TEither Ch or const Ch (template used for disambiguation with operator[](SizeType))
Note
In version 0.1x, if the member is not found, this function returns a null value. This makes issue 7. Since 0.2, if the name is not correct, it will assert. If user is unsure whether a member exists, user should use HasMember() first. A better approach is to use FindMember().
Linear time complexity.

◆ RAPIDJSON_DISABLEIF_RETURN() [7/9]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue< Encoding, Allocator >::RAPIDJSON_DISABLEIF_RETURN ( (internal::NotExpr< internal::IsSame< typename internal::RemoveConst< T >::Type, Ch > >)  ,
(const GenericValue< Encoding, Allocator > &)   
) const
inline

◆ RAPIDJSON_DISABLEIF_RETURN() [8/9]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue< Encoding, Allocator >::RAPIDJSON_DISABLEIF_RETURN ( (internal::OrExpr< internal::IsPointer< T >, internal::IsGenericValue< T > >)  ,
(GenericValue< Encoding, Allocator > &)   
)

Add any primitive value as member (name-value pair) to the object.

Template Parameters
TEither Type, int, unsigned, int64_t, uint64_t
Parameters
nameA constant string reference as name of member.
valueValue of primitive type T as value of member
allocatorAllocator for reallocating memory. Commonly use GenericDocument::GetAllocator().
Returns
The value itself for fluent API.
Precondition
IsObject()
Note
The source type T explicitly disallows all pointer types, especially (const) Ch*. This helps avoiding implicitly referencing character strings with insufficient lifetime, use AddMember(StringRefType, GenericValue&, Allocator&) or AddMember(StringRefType, StringRefType, Allocator&). All other pointer types would implicitly convert to bool, use an explicit cast instead, if needed.
Amortized Constant time complexity.

◆ RAPIDJSON_DISABLEIF_RETURN() [9/9]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
GenericValue< Encoding, Allocator >::RAPIDJSON_DISABLEIF_RETURN ( (internal::OrExpr< internal::IsPointer< T >, internal::IsGenericValue< T > >)  ,
(GenericValue< Encoding, Allocator > &)   
)

Append a primitive value at the end of the array.

Template Parameters
TEither Type, int, unsigned, int64_t, uint64_t
Parameters
valueValue of primitive type T to be appended.
allocatorAllocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
Precondition
IsArray() == true
Returns
The value itself for fluent API.
Note
If the number of elements to be appended is known, calls Reserve() once first may be more efficient.
The source type T explicitly disallows all pointer types, especially (const) Ch*. This helps avoiding implicitly referencing character strings with insufficient lifetime, use PushBack(GenericValue&, Allocator&) or PushBack(StringRefType, Allocator&). All other pointer types would implicitly convert to bool, use an explicit cast instead, if needed.
Amortized constant time complexity.

◆ RemoveAllMembers()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
void GenericValue< Encoding, Allocator >::RemoveAllMembers ( )
inline

Remove all members in the object.

This function do not deallocate memory in the object, i.e. the capacity is unchanged.

Note
Linear time complexity.

◆ RemoveMember() [1/3]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
bool GenericValue< Encoding, Allocator >::RemoveMember ( const Ch name)
inline

Remove a member in object by its name.

Parameters
nameName of member to be removed.
Returns
Whether the member existed.
Note
This function may reorder the object members. Use EraseMember(ConstMemberIterator) if you need to preserve the relative order of the remaining members.
Linear time complexity.

◆ RemoveMember() [2/3]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename SourceAllocator >
bool GenericValue< Encoding, Allocator >::RemoveMember ( const GenericValue< Encoding, SourceAllocator > &  name)
inline

◆ RemoveMember() [3/3]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
MemberIterator GenericValue< Encoding, Allocator >::RemoveMember ( MemberIterator  m)
inline

Remove a member in object by iterator.

Parameters
mmember iterator (obtained by FindMember() or MemberBegin()).
Returns
the new iterator after removal.
Note
This function may reorder the object members. Use EraseMember(ConstMemberIterator) if you need to preserve the relative order of the remaining members.
Constant time complexity.

◆ Reserve()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& 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.
allocatorAllocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
Returns
The value itself for fluent API.
Note
Linear time complexity.

◆ SetArray()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& GenericValue< Encoding, Allocator >::SetArray ( )
inline

Set this value as an empty array.

Postcondition
IsArray == true

◆ SetBool()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& GenericValue< Encoding, Allocator >::SetBool ( bool  b)
inline
Postcondition
IsBool() == true

◆ SetDouble()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& GenericValue< Encoding, Allocator >::SetDouble ( double  d)
inline

◆ SetInt()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& GenericValue< Encoding, Allocator >::SetInt ( int  i)
inline

◆ SetInt64()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& GenericValue< Encoding, Allocator >::SetInt64 ( int64_t  i64)
inline

◆ SetNull()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& GenericValue< Encoding, Allocator >::SetNull ( )
inline

◆ SetObject()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& GenericValue< Encoding, Allocator >::SetObject ( )
inline

Set this value as an empty object.

Postcondition
IsObject() == true

◆ SetString() [1/4]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& 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.
Postcondition
IsString() == true && GetString() == s && GetStringLength() == length
See also
SetString(StringRefType)

◆ SetString() [2/4]

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

Set this value as a string without copying source string.

Parameters
ssource string reference
Returns
The value itself for fluent API.
Postcondition
IsString() == true && GetString() == s && GetStringLength() == s.length

◆ SetString() [3/4]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& 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 GenericDocument::GetAllocator().
Returns
The value itself for fluent API.
Postcondition
IsString() == true && GetString() != s && strcmp(GetString(),s) == 0 && GetStringLength() == length

◆ SetString() [4/4]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& 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 GenericDocument::GetAllocator().
Returns
The value itself for fluent API.
Postcondition
IsString() == true && GetString() != s && strcmp(GetString(),s) == 0 && GetStringLength() == length

◆ SetUint()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& GenericValue< Encoding, Allocator >::SetUint ( unsigned  u)
inline

◆ SetUint64()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& GenericValue< Encoding, Allocator >::SetUint64 ( uint64_t  u64)
inline

◆ Size()

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

Get the number of elements in array.

◆ Swap()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& GenericValue< Encoding, Allocator >::Swap ( GenericValue< Encoding, Allocator > &  other)
inline

Exchange the contents of this value with those of other.

Parameters
otherAnother value.
Note
Constant complexity.

◆ v()

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue GenericValue< Encoding, Allocator >::v ( value  )

Friends And Related Function Documentation

◆ GenericDocument

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

◆ GenericValue

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

Member Data Documentation

◆ allocator [1/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
T Allocator& GenericValue< Encoding, Allocator >::allocator
Initial value:

◆ allocator [2/2]

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Allocator& GenericValue< Encoding, Allocator >::allocator
Initial value:

◆ value

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
T GenericValue< Encoding, Allocator >::value

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