All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
rapidjson::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 rapidjson::GenericValue< Encoding, Allocator >:
rapidjson::GenericDocument< Encoding, Allocator, StackAllocator >

Classes

struct  Array
 
union  Data
 
union  Number
 
struct  Object
 
struct  ShortString
 
struct  String
 

Public Types

enum  {
  kBoolFlag = 0x100, kNumberFlag = 0x200, kIntFlag = 0x400, kUintFlag = 0x800,
  kInt64Flag = 0x1000, kUint64Flag = 0x2000, kDoubleFlag = 0x4000, kStringFlag = 0x100000,
  kCopyFlag = 0x200000, kInlineStrFlag = 0x400000, kNullFlag = kNullType, kTrueFlag = kTrueType | kBoolFlag,
  kFalseFlag = kFalseType | kBoolFlag, kNumberIntFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag, kNumberUintFlag = kNumberType | kNumberFlag | kUintFlag | kUint64Flag | kInt64Flag, kNumberInt64Flag = kNumberType | kNumberFlag | kInt64Flag,
  kNumberUint64Flag = kNumberType | kNumberFlag | kUint64Flag, kNumberDoubleFlag = kNumberType | kNumberFlag | kDoubleFlag, kNumberAnyFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag | kUintFlag | kUint64Flag | kDoubleFlag, kConstStringFlag = kStringType | kStringFlag,
  kCopyStringFlag = kStringType | kStringFlag | kCopyFlag, kShortStringFlag = kStringType | kStringFlag | kCopyFlag | kInlineStrFlag, kObjectFlag = kObjectType, kArrayFlag = kArrayType,
  kTypeMask = 0xFF
}
 
typedef GenericMember< Encoding, AllocatorMember
 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 T >
 RAPIDJSON_DISABLEIF_RETURN ((internal::IsPointer< T >),(GenericValue &)) operator
 Assignment with primitive types. More...
 
void SetArrayRaw (GenericValue *values, SizeType count, Allocator &allocator)
 
void SetObjectRaw (Member *members, SizeType count, Allocator &allocator)
 Initialize this value as object with initial data, without calling destructor. More...
 
void SetStringRaw (StringRefType s) RAPIDJSON_NOEXCEPT
 Initialize this value as constant string, without calling destructor. More...
 
void SetStringRaw (StringRefType s, Allocator &allocator)
 Initialize this value as copy string with initial data, without calling destructor. More...
 
void RawAssign (GenericValue &rhs) RAPIDJSON_NOEXCEPT
 Assignment without calling destructor. More...
 
template<typename SourceAllocator >
bool StringEqual (const GenericValue< Encoding, SourceAllocator > &rhs) const
 
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...
 

Public Attributes

Data data_
 
unsigned flags_
 

Static Public Attributes

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

Friends

template<typename , typename , typename >
class GenericDocument
 

Constructors and destructor.

 GenericValue () RAPIDJSON_NOEXCEPT
 Default constructor creates a null value. More...
 
 GenericValue (Type type) RAPIDJSON_NOEXCEPT
 Constructor with JSON value type. More...
 
template<typename SourceAllocator >
 GenericValue (const GenericValue< Encoding, SourceAllocator > &rhs, Allocator &allocator)
 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...
 
 GenericValue (const GenericValue &rhs)
 Copy constructor is not permitted. More...
 

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.

Definition at line 73 of file document.h.

Member Typedef Documentation

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

Allocator type from template parameter.

Definition at line 426 of file document.h.

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

Character type derived from Encoding.

Definition at line 427 of file document.h.

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

Constant member iterator for iterating in object.

Definition at line 430 of file document.h.

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

Constant value iterator for iterating in array.

Definition at line 432 of file document.h.

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

Encoding type from template parameter.

Definition at line 425 of file document.h.

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

Name-value pair in an object.

Definition at line 424 of file document.h.

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

Member iterator for iterating in object.

Definition at line 429 of file document.h.

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

Reference to a constant string.

Definition at line 428 of file document.h.

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

Value iterator for iterating in array.

Definition at line 431 of file document.h.

Member Enumeration Documentation

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

Definition at line 1437 of file document.h.

1437  {
1438  kBoolFlag = 0x100,
1439  kNumberFlag = 0x200,
1440  kIntFlag = 0x400,
1441  kUintFlag = 0x800,
1442  kInt64Flag = 0x1000,
1443  kUint64Flag = 0x2000,
1444  kDoubleFlag = 0x4000,
1445  kStringFlag = 0x100000,
1446  kCopyFlag = 0x200000,
1447  kInlineStrFlag = 0x400000,
1448 
1449  // Initial flags of different types.
1450  kNullFlag = kNullType,
1464 
1465  kTypeMask = 0xFF // bitwise-and with mask of 0xFF can be optimized by compiler
1466  };

Constructor & Destructor Documentation

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

Default constructor creates a null value.

Definition at line 438 of file document.h.

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)
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.

Definition at line 458 of file document.h.

template<typename Encoding, typename Allocator>
template<typename SourceAllocator >
rapidjson::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()

Definition at line 1895 of file document.h.

1896 {
1897  GenericDocument<Encoding,Allocator> d(&allocator);
1898  rhs.Accept(d);
1899  RawAssign(*d.stack_.template Pop<GenericValue>(1));
1900 }
void RawAssign(GenericValue &rhs) RAPIDJSON_NOEXCEPT
Assignment without calling destructor.
Definition: document.h:1581
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( 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.

Definition at line 485 of file document.h.

489  : data_(), flags_(b ? kTrueFlag : kFalseFlag) {
490  // safe-guard against failing SFINAE
492  }
#define RAPIDJSON_STATIC_ASSERT(x)
(Internal) macro to check for conditions at compile-time
Definition: rapidjson.h:301
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:1608
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( int  i)
inlineexplicit
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( unsigned  u)
inlineexplicit

Constructor for unsigned value.

Definition at line 502 of file document.h.

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

Constructor for int64_t value.

Definition at line 509 of file document.h.

510  data_.n.i64 = i64;
511  if (i64 >= 0) {
513  if (!(static_cast<uint64_t>(i64) & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x00000000)))
514  flags_ |= kUintFlag;
515  if (!(static_cast<uint64_t>(i64) & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x80000000)))
516  flags_ |= kIntFlag;
517  }
518  else if (i64 >= static_cast<int64_t>(RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x80000000)))
519  flags_ |= kIntFlag;
520  }
sqlite_int64 i64
Definition: tkeyvfs.cc:34
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.
Definition: rapidjson.h:186
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( uint64_t  u64)
inlineexplicit

Constructor for uint64_t value.

Definition at line 523 of file document.h.

524  data_.n.u64 = u64;
525  if (!(u64 & RAPIDJSON_UINT64_C2(0x80000000, 0x00000000)))
526  flags_ |= kInt64Flag;
527  if (!(u64 & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x00000000)))
528  flags_ |= kUintFlag;
529  if (!(u64 & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x80000000)))
530  flags_ |= kIntFlag;
531  }
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.
Definition: rapidjson.h:186
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( double  d)
inlineexplicit
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( const Ch s,
SizeType  length 
)
inline

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

Definition at line 537 of file document.h.

537 : data_(), flags_() { SetStringRaw(StringRef(s, length)); }
void SetStringRaw(StringRefType s) RAPIDJSON_NOEXCEPT
Initialize this value as constant string, without calling destructor.
Definition: document.h:1557
GenericStringRef< CharType > StringRef(const CharType *str)
Mark a character pointer as constant string.
Definition: document.h:348
static const double s
Definition: Units.h:99
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericValue< Encoding, Allocator >::GenericValue ( StringRefType  s)
inlineexplicit

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

Definition at line 540 of file document.h.

540 : data_(), flags_() { SetStringRaw(s); }
void SetStringRaw(StringRefType s) RAPIDJSON_NOEXCEPT
Initialize this value as constant string, without calling destructor.
Definition: document.h:1557
static const double s
Definition: Units.h:99
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)

Definition at line 543 of file document.h.

543 : data_(), flags_() { SetStringRaw(StringRef(s, length), allocator); }
void SetStringRaw(StringRefType s) RAPIDJSON_NOEXCEPT
Initialize this value as constant string, without calling destructor.
Definition: document.h:1557
GenericStringRef< CharType > StringRef(const CharType *str)
Mark a character pointer as constant string.
Definition: document.h:348
static const double s
Definition: Units.h:99
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)

Definition at line 546 of file document.h.

546 : data_(), flags_() { SetStringRaw(StringRef(s), allocator); }
void SetStringRaw(StringRefType s) RAPIDJSON_NOEXCEPT
Initialize this value as constant string, without calling destructor.
Definition: document.h:1557
GenericStringRef< CharType > StringRef(const CharType *str)
Mark a character pointer as constant string.
Definition: document.h:348
static const double s
Definition: Units.h:99
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.

Definition at line 558 of file document.h.

558  {
559  if (Allocator::kNeedFree) { // Shortcut by Allocator's trait
560  switch(flags_) {
561  case kArrayFlag:
562  for (GenericValue* v = data_.a.elements; v != data_.a.elements + data_.a.size; ++v)
563  v->~GenericValue();
564  Allocator::Free(data_.a.elements);
565  break;
566 
567  case kObjectFlag:
568  for (MemberIterator m = MemberBegin(); m != MemberEnd(); ++m)
569  m->~Member();
570  Allocator::Free(data_.o.members);
571  break;
572 
573  case kCopyStringFlag:
574  Allocator::Free(const_cast<Ch*>(data_.s.str));
575  break;
576 
577  default:
578  break; // Do nothing for other types.
579  }
580  }
581  }
static const double m
Definition: Units.h:79
GenericValue() RAPIDJSON_NOEXCEPT
Default constructor creates a null value.
Definition: document.h:438
GenericMemberIterator< false, Encoding, Allocator >::Iterator MemberIterator
Member iterator for iterating in object.
Definition: document.h:429

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.

Definition at line 591 of file document.h.

591  {
592  RAPIDJSON_ASSERT(this != &rhs);
593  this->~GenericValue();
594  RawAssign(rhs);
595  return *this;
596  }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:269
void RawAssign(GenericValue &rhs) RAPIDJSON_NOEXCEPT
Assignment without calling destructor.
Definition: document.h:1581
~GenericValue()
Destructor.
Definition: document.h:558
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
GenericValue& rapidjson::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)

Definition at line 610 of file document.h.

610  {
611  GenericValue s(str);
612  return *this = s;
613  }
GenericValue() RAPIDJSON_NOEXCEPT
Default constructor creates a null value.
Definition: document.h:438
static const double s
Definition: Units.h:99
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename T >
rapidjson::GenericValue< Encoding, Allocator >::RAPIDJSON_DISABLEIF_RETURN ( (internal::IsPointer< T >)  ,
(GenericValue< Encoding, Allocator > &)   
)

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.Set boolean value
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
void rapidjson::GenericValue< Encoding, Allocator >::RawAssign ( GenericValue< Encoding, Allocator > &  rhs)
inline

Assignment without calling destructor.

Definition at line 1581 of file document.h.

1581  {
1582  data_ = rhs.data_;
1583  flags_ = rhs.flags_;
1584  rhs.flags_ = kNullFlag;
1585  }
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
void rapidjson::GenericValue< Encoding, Allocator >::SetArrayRaw ( GenericValue< Encoding, Allocator > *  values,
SizeType  count,
Allocator allocator 
)
inline

Definition at line 1541 of file document.h.

1541  {
1542  flags_ = kArrayFlag;
1543  data_.a.elements = (GenericValue*)allocator.Malloc(count * sizeof(GenericValue));
1544  std::memcpy(data_.a.elements, values, count * sizeof(GenericValue));
1545  data_.a.size = data_.a.capacity = count;
1546  }
GenericValue() RAPIDJSON_NOEXCEPT
Default constructor creates a null value.
Definition: document.h:438
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
void rapidjson::GenericValue< Encoding, Allocator >::SetObjectRaw ( Member members,
SizeType  count,
Allocator allocator 
)
inline

Initialize this value as object with initial data, without calling destructor.

Definition at line 1549 of file document.h.

1549  {
1550  flags_ = kObjectFlag;
1551  data_.o.members = (Member*)allocator.Malloc(count * sizeof(Member));
1552  std::memcpy(data_.o.members, members, count * sizeof(Member));
1553  data_.o.size = data_.o.capacity = count;
1554  }
GenericMember< Encoding, Allocator > Member
Name-value pair in an object.
Definition: document.h:424
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
void rapidjson::GenericValue< Encoding, Allocator >::SetStringRaw ( StringRefType  s)
inline

Initialize this value as constant string, without calling destructor.

Definition at line 1557 of file document.h.

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
void rapidjson::GenericValue< Encoding, Allocator >::SetStringRaw ( StringRefType  s,
Allocator allocator 
)
inline

Initialize this value as copy string with initial data, without calling destructor.

Definition at line 1564 of file document.h.

1564  {
1565  Ch* str = nullptr;
1566  if(ShortString::Usable(s.length)) {
1568  data_.ss.SetLength(s.length);
1569  str = data_.ss.str;
1570  } else {
1572  data_.s.length = s.length;
1573  str = (Ch *)allocator.Malloc((s.length + 1) * sizeof(Ch));
1574  data_.s.str = str;
1575  }
1576  std::memcpy(str, s, s.length * sizeof(Ch));
1577  str[s.length] = '\0';
1578  }
static bool Usable(SizeType len)
Definition: document.h:1489
Encoding::Ch Ch
Character type derived from Encoding.
Definition: document.h:427
static const double s
Definition: Units.h:99
template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
template<typename SourceAllocator >
bool rapidjson::GenericValue< Encoding, Allocator >::StringEqual ( const GenericValue< Encoding, SourceAllocator > &  rhs) const
inline

Definition at line 1588 of file document.h.

1588  {
1589  RAPIDJSON_ASSERT(IsString());
1590  RAPIDJSON_ASSERT(rhs.IsString());
1591 
1592  const SizeType len1 = GetStringLength();
1593  const SizeType len2 = rhs.GetStringLength();
1594  if(len1 != len2) { return false; }
1595 
1596  const Ch* const str1 = GetString();
1597  const Ch* const str2 = rhs.GetString();
1598  if(str1 == str2) { return true; } // fast path for constant string
1599 
1600  return (std::memcmp(str1, str2, sizeof(Ch) * len1) == 0);
1601  }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:269
unsigned SizeType
Size type (for string lengths, array sizes, etc.)
Definition: rapidjson.h:247
Encoding::Ch Ch
Character type derived from Encoding.
Definition: document.h:427
string GetString(xmlDocPtr xml_doc, string node_path)

Friends And Related Function Documentation

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

Definition at line 1435 of file document.h.

Member Data Documentation

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
Data rapidjson::GenericValue< Encoding, Allocator >::data_

Definition at line 1603 of file document.h.

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

Definition at line 1604 of file document.h.

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
const SizeType rapidjson::GenericValue< Encoding, Allocator >::kDefaultArrayCapacity = 16
static

Definition at line 1468 of file document.h.

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
const SizeType rapidjson::GenericValue< Encoding, Allocator >::kDefaultObjectCapacity = 16
static

Definition at line 1469 of file document.h.


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