15#ifndef RAPIDJSON_POINTER_H_
16#define RAPIDJSON_POINTER_H_
19#include "internal/itoa.h"
23RAPIDJSON_DIAG_OFF(
switch-
enum)
24#elif defined(_MSC_VER)
26RAPIDJSON_DIAG_OFF(4512)
78template <
typename ValueType,
typename Allocator = CrtAllocator>
82 typedef typename ValueType::Ch
Ch;
115 Parse(source, internal::StrLen(source));
118#if RAPIDJSON_HAS_STDSTRING
126 Parse(source.c_str(), source.size());
138 Parse(source, length);
212 internal::Swap(
tokens_, other.tokens_);
247 Ch *p = r.CopyFromRaw(*
this, 1, token.length + 1);
248 std::memcpy(p, token.name, (token.length + 1) *
sizeof(
Ch));
263 Token token = { name, length, kPointerInvalidIndex };
264 return Append(token, allocator);
273 template <
typename T>
276 return Append(name, internal::StrLen(name), allocator);
279#if RAPIDJSON_HAS_STDSTRING
287 return Append(name.c_str(),
static_cast<SizeType>(name.size()), allocator);
299 char* end =
sizeof(
SizeType) == 4 ? internal::u32toa(index, buffer) : internal::u64toa(index, buffer);
301 buffer[length] =
'\0';
303 if (
sizeof(
Ch) == 1) {
304 Token token = {
reinterpret_cast<Ch*
>(buffer), length, index };
305 return Append(token, allocator);
309 for (
size_t i = 0; i <= length; i++)
310 name[i] =
static_cast<Ch>(buffer[i]);
311 Token token = { name, length, index };
312 return Append(token, allocator);
323 if (token.IsString())
324 return Append(token.GetString(), token.GetStringLength(), allocator);
328 return Append(
static_cast<SizeType>(token.GetUint64()), allocator);
347 Allocator& GetAllocator() {
return *
allocator_; }
356 size_t GetTokenCount()
const {
return tokenCount_; }
387 bool operator!=(
const GenericPointer& rhs)
const {
return !(*
this == rhs); }
426 template<
typename OutputStream>
427 bool Stringify(OutputStream& os)
const {
428 return Stringify<false, OutputStream>(os);
436 template<
typename OutputStream>
437 bool StringifyUriFragment(OutputStream& os)
const {
438 return Stringify<true, OutputStream>(os);
461 ValueType& Create(ValueType& root,
typename ValueType::AllocatorType& allocator,
bool* alreadyExist = 0)
const {
463 ValueType* v = &root;
466 if (v->IsArray() && t->name[0] ==
'-' && t->length == 1) {
467 v->PushBack(ValueType().Move(), allocator);
468 v = &((*v)[v->Size() - 1]);
472 if (t->index == kPointerInvalidIndex) {
477 if (!v->IsArray() && !v->IsObject())
482 if (t->index >= v->Size()) {
483 v->Reserve(t->index + 1, allocator);
484 while (t->index >= v->Size())
485 v->PushBack(ValueType().Move(), allocator);
488 v = &((*v)[t->index]);
491 typename ValueType::MemberIterator m = v->FindMember(GenericValue<EncodingType>(GenericStringRef<Ch>(t->name, t->length)));
492 if (m == v->MemberEnd()) {
493 v->AddMember(ValueType(t->name, t->length, allocator).Move(), ValueType().Move(), allocator);
505 *alreadyExist = exist;
516 template <
typename stackAllocator>
517 ValueType& Create(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document,
bool* alreadyExist = 0)
const {
518 return Create(document, document.
GetAllocator(), alreadyExist);
540 ValueType* Get(ValueType& root,
size_t* unresolvedTokenIndex = 0)
const {
542 ValueType* v = &root;
544 switch (v->GetType()) {
547 typename ValueType::MemberIterator m = v->FindMember(GenericValue<EncodingType>(GenericStringRef<Ch>(t->name, t->length)));
548 if (m == v->MemberEnd())
554 if (t->index == kPointerInvalidIndex || t->index >= v->Size())
556 v = &((*v)[t->index]);
563 if (unresolvedTokenIndex)
564 *unresolvedTokenIndex =
static_cast<size_t>(t -
tokens_);
575 const ValueType* Get(
const ValueType& root,
size_t* unresolvedTokenIndex = 0)
const {
576 return Get(
const_cast<ValueType&
>(root), unresolvedTokenIndex);
594 ValueType& GetWithDefault(ValueType& root,
const ValueType& defaultValue,
typename ValueType::AllocatorType& allocator)
const {
596 ValueType& v = Create(root, allocator, &alreadyExist);
597 return alreadyExist ? v : v.CopyFrom(defaultValue, allocator);
601 ValueType& GetWithDefault(ValueType& root,
const Ch* defaultValue,
typename ValueType::AllocatorType& allocator)
const {
603 ValueType& v = Create(root, allocator, &alreadyExist);
604 return alreadyExist ? v : v.SetString(defaultValue, allocator);
607#if RAPIDJSON_HAS_STDSTRING
609 ValueType& GetWithDefault(ValueType& root,
const std::basic_string<Ch>& defaultValue,
typename ValueType::AllocatorType& allocator)
const {
611 ValueType& v = Create(root, allocator, &alreadyExist);
612 return alreadyExist ? v : v.SetString(defaultValue, allocator);
620 template <
typename T>
622 GetWithDefault(ValueType& root, T defaultValue,
typename ValueType::AllocatorType& allocator)
const {
623 return GetWithDefault(root, ValueType(defaultValue).Move(), allocator);
627 template <
typename stackAllocator>
628 ValueType& GetWithDefault(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document,
const ValueType& defaultValue)
const {
629 return GetWithDefault(document, defaultValue, document.
GetAllocator());
633 template <
typename stackAllocator>
634 ValueType& GetWithDefault(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document,
const Ch* defaultValue)
const {
635 return GetWithDefault(document, defaultValue, document.
GetAllocator());
638#if RAPIDJSON_HAS_STDSTRING
640 template <
typename stackAllocator>
641 ValueType& GetWithDefault(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document,
const std::basic_string<Ch>& defaultValue)
const {
642 return GetWithDefault(document, defaultValue, document.
GetAllocator());
650 template <
typename T,
typename stackAllocator>
652 GetWithDefault(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document, T defaultValue)
const {
653 return GetWithDefault(document, defaultValue, document.
GetAllocator());
671 ValueType& Set(ValueType& root, ValueType& value,
typename ValueType::AllocatorType& allocator)
const {
672 return Create(root, allocator) = value;
676 ValueType& Set(ValueType& root,
const ValueType& value,
typename ValueType::AllocatorType& allocator)
const {
677 return Create(root, allocator).CopyFrom(value, allocator);
681 ValueType& Set(ValueType& root,
const Ch* value,
typename ValueType::AllocatorType& allocator)
const {
682 return Create(root, allocator) = ValueType(value, allocator).Move();
685#if RAPIDJSON_HAS_STDSTRING
687 ValueType& Set(ValueType& root,
const std::basic_string<Ch>& value,
typename ValueType::AllocatorType& allocator)
const {
688 return Create(root, allocator) = ValueType(value, allocator).Move();
696 template <
typename T>
698 Set(ValueType& root, T value,
typename ValueType::AllocatorType& allocator)
const {
699 return Create(root, allocator) = ValueType(value).Move();
703 template <
typename stackAllocator>
704 ValueType& Set(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document, ValueType& value)
const {
705 return Create(document) = value;
709 template <
typename stackAllocator>
710 ValueType& Set(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document,
const ValueType& value)
const {
711 return Create(document).CopyFrom(value, document.
GetAllocator());
715 template <
typename stackAllocator>
716 ValueType& Set(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document,
const Ch* value)
const {
717 return Create(document) = ValueType(value, document.
GetAllocator()).Move();
720#if RAPIDJSON_HAS_STDSTRING
722 template <
typename stackAllocator>
723 ValueType& Set(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document,
const std::basic_string<Ch>& value)
const {
724 return Create(document) = ValueType(value, document.
GetAllocator()).Move();
732 template <
typename T,
typename stackAllocator>
734 Set(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document, T value)
const {
735 return Create(document) = value;
753 ValueType&
Swap(ValueType& root, ValueType& value,
typename ValueType::AllocatorType& allocator)
const {
754 return Create(root, allocator).
Swap(value);
758 template <
typename stackAllocator>
759 ValueType&
Swap(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document, ValueType& value)
const {
760 return Create(document).
Swap(value);
772 bool Erase(ValueType& root)
const {
777 ValueType* v = &root;
780 switch (v->GetType()) {
783 typename ValueType::MemberIterator m = v->FindMember(GenericValue<EncodingType>(GenericStringRef<Ch>(t->name, t->length)));
784 if (m == v->MemberEnd())
790 if (t->index == kPointerInvalidIndex || t->index >= v->Size())
792 v = &((*v)[t->index]);
799 switch (v->GetType()) {
801 return v->EraseMember(GenericStringRef<Ch>(last->name, last->length));
803 if (last->index == kPointerInvalidIndex || last->index >= v->Size())
805 v->Erase(v->Begin() + last->index);
820 Ch* CopyFromRaw(
const GenericPointer& rhs,
size_t extraToken = 0,
size_t extraNameBufferSize = 0) {
826 nameBufferSize += t->length;
834 if (nameBufferSize > 0) {
851 bool NeedPercentEncode(
Ch c)
const {
852 return !((c >=
'0' && c <=
'9') || (c >=
'A' && c <=
'Z') || (c >=
'a' && c <=
'z') || c ==
'-' || c ==
'.' || c ==
'_' || c ==
'~');
863 void Parse(
const Ch* source,
size_t length) {
874 for (
const Ch* s = source; s != source + length; s++)
883 bool uriFragment =
false;
884 if (source[i] ==
'#') {
889 if (i != length && source[i] !=
'/') {
899 bool isNumber =
true;
901 while (i < length && source[i] !=
'/') {
906 PercentDecodeStream is(&source[i], source + length);
907 GenericInsituStringStream<EncodingType> os(name);
908 Ch* begin = os.PutBegin();
909 if (!Transcoder<UTF8<>,
EncodingType>().Validate(is, os) || !is.IsValid()) {
913 size_t len = os.PutEnd(begin);
924 else if (NeedPercentEncode(c)) {
936 if (c ==
'0') c =
'~';
937 else if (c ==
'1') c =
'/';
951 if (c <
'0' || c >
'9')
956 token->length =
static_cast<SizeType>(name - token->name);
957 if (token->length == 0)
962 if (isNumber && token->length > 1 && token->name[0] ==
'0')
968 for (
size_t j = 0; j < token->length; j++) {
978 token->index = isNumber ? n : kPointerInvalidIndex;
1001 template<
bool uriFragment,
typename OutputStream>
1002 bool Stringify(OutputStream& os)
const {
1010 for (
size_t j = 0; j < t->length; j++) {
1016 else if (c ==
'/') {
1020 else if (uriFragment && NeedPercentEncode(c)) {
1022 GenericStringStream<typename ValueType::EncodingType> source(&t->name[j]);
1024 if (!Transcoder<
EncodingType, UTF8<> >().Validate(source, target))
1026 j += source.Tell() - 1;
1041 class PercentDecodeStream {
1043 typedef typename ValueType::Ch Ch;
1050 PercentDecodeStream(
const Ch* source,
const Ch* end) : src_(source), head_(source), end_(end), valid_(true) {}
1053 if (*src_ !=
'%' || src_ + 3 > end_) {
1059 for (
int j = 0; j < 2; j++) {
1060 c =
static_cast<Ch
>(c << 4);
1062 if (h >=
'0' && h <=
'9') c =
static_cast<Ch
>(c + h -
'0');
1063 else if (h >=
'A' && h <=
'F') c =
static_cast<Ch
>(c + h -
'A' + 10);
1064 else if (h >=
'a' && h <=
'f') c =
static_cast<Ch
>(c + h -
'a' + 10);
1074 size_t Tell()
const {
return static_cast<size_t>(src_ - head_); }
1075 bool IsValid()
const {
return valid_; }
1085 template <
typename OutputStream>
1086 class PercentEncodeStream {
1088 PercentEncodeStream(OutputStream& os) : os_(os) {}
1090 unsigned char u =
static_cast<unsigned char>(c);
1091 static const char hexDigits[16] = {
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'A',
'B',
'C',
'D',
'E',
'F' };
1093 os_.Put(
static_cast<typename OutputStream::Ch
>(hexDigits[u >> 4]));
1094 os_.Put(
static_cast<typename OutputStream::Ch
>(hexDigits[u & 15]));
1117template <
typename T>
1119 return pointer.Create(root, a);
1122template <
typename T,
typename CharType,
size_t N>
1123typename T::ValueType& CreateValueByPointer(T& root,
const CharType(&source)[N],
typename T::AllocatorType& a) {
1129template <
typename DocumentType>
1131 return pointer.Create(document);
1134template <
typename DocumentType,
typename CharType,
size_t N>
1135typename DocumentType::ValueType& CreateValueByPointer(DocumentType& document,
const CharType(&source)[N]) {
1141template <
typename T>
1143 return pointer.Get(root, unresolvedTokenIndex);
1146template <
typename T>
1148 return pointer.Get(root, unresolvedTokenIndex);
1151template <
typename T,
typename CharType,
size_t N>
1152typename T::ValueType* GetValueByPointer(T& root,
const CharType (&source)[N],
size_t* unresolvedTokenIndex = 0) {
1156template <
typename T,
typename CharType,
size_t N>
1157const typename T::ValueType* GetValueByPointer(
const T& root,
const CharType(&source)[N],
size_t* unresolvedTokenIndex = 0) {
1163template <
typename T>
1164typename T::ValueType& GetValueByPointerWithDefault(T& root,
const GenericPointer<typename T::ValueType>& pointer,
const typename T::ValueType& defaultValue,
typename T::AllocatorType& a) {
1165 return pointer.GetWithDefault(root, defaultValue, a);
1168template <
typename T>
1169typename T::ValueType& GetValueByPointerWithDefault(T& root,
const GenericPointer<typename T::ValueType>& pointer,
const typename T::Ch* defaultValue,
typename T::AllocatorType& a) {
1170 return pointer.GetWithDefault(root, defaultValue, a);
1173#if RAPIDJSON_HAS_STDSTRING
1174template <
typename T>
1175typename T::ValueType& GetValueByPointerWithDefault(T& root,
const GenericPointer<typename T::ValueType>& pointer,
const std::basic_string<typename T::Ch>& defaultValue,
typename T::AllocatorType& a) {
1176 return pointer.GetWithDefault(root, defaultValue, a);
1180template <
typename T,
typename T2>
1183 return pointer.GetWithDefault(root, defaultValue, a);
1186template <
typename T,
typename CharType,
size_t N>
1187typename T::ValueType& GetValueByPointerWithDefault(T& root,
const CharType(&source)[N],
const typename T::ValueType& defaultValue,
typename T::AllocatorType& a) {
1191template <
typename T,
typename CharType,
size_t N>
1192typename T::ValueType& GetValueByPointerWithDefault(T& root,
const CharType(&source)[N],
const typename T::Ch* defaultValue,
typename T::AllocatorType& a) {
1196#if RAPIDJSON_HAS_STDSTRING
1197template <
typename T,
typename CharType,
size_t N>
1198typename T::ValueType& GetValueByPointerWithDefault(T& root,
const CharType(&source)[N],
const std::basic_string<typename T::Ch>& defaultValue,
typename T::AllocatorType& a) {
1203template <
typename T,
typename CharType,
size_t N,
typename T2>
1205GetValueByPointerWithDefault(T& root,
const CharType(&source)[N], T2 defaultValue,
typename T::AllocatorType& a) {
1211template <
typename DocumentType>
1213 return pointer.GetWithDefault(document, defaultValue);
1216template <
typename DocumentType>
1218 return pointer.GetWithDefault(document, defaultValue);
1221#if RAPIDJSON_HAS_STDSTRING
1222template <
typename DocumentType>
1224 return pointer.GetWithDefault(document, defaultValue);
1228template <
typename DocumentType,
typename T2>
1229RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T2>,
internal::IsGenericValue<T2> >), (
typename DocumentType::ValueType&))
1231 return pointer.GetWithDefault(document, defaultValue);
1234template <
typename DocumentType,
typename CharType,
size_t N>
1235typename DocumentType::ValueType& GetValueByPointerWithDefault(DocumentType& document,
const CharType(&source)[N],
const typename DocumentType::ValueType& defaultValue) {
1239template <
typename DocumentType,
typename CharType,
size_t N>
1240typename DocumentType::ValueType& GetValueByPointerWithDefault(DocumentType& document,
const CharType(&source)[N],
const typename DocumentType::Ch* defaultValue) {
1244#if RAPIDJSON_HAS_STDSTRING
1245template <
typename DocumentType,
typename CharType,
size_t N>
1246typename DocumentType::ValueType& GetValueByPointerWithDefault(DocumentType& document,
const CharType(&source)[N],
const std::basic_string<typename DocumentType::Ch>& defaultValue) {
1251template <
typename DocumentType,
typename CharType,
size_t N,
typename T2>
1252RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T2>,
internal::IsGenericValue<T2> >), (
typename DocumentType::ValueType&))
1253GetValueByPointerWithDefault(DocumentType& document,
const CharType(&source)[N], T2 defaultValue) {
1259template <
typename T>
1261 return pointer.Set(root, value, a);
1264template <
typename T>
1266 return pointer.Set(root, value, a);
1269template <
typename T>
1271 return pointer.Set(root, value, a);
1274#if RAPIDJSON_HAS_STDSTRING
1275template <
typename T>
1276typename T::ValueType& SetValueByPointer(T& root,
const GenericPointer<typename T::ValueType>& pointer,
const std::basic_string<typename T::Ch>& value,
typename T::AllocatorType& a) {
1277 return pointer.Set(root, value, a);
1281template <
typename T,
typename T2>
1284 return pointer.Set(root, value, a);
1287template <
typename T,
typename CharType,
size_t N>
1288typename T::ValueType& SetValueByPointer(T& root,
const CharType(&source)[N],
typename T::ValueType& value,
typename T::AllocatorType& a) {
1292template <
typename T,
typename CharType,
size_t N>
1293typename T::ValueType& SetValueByPointer(T& root,
const CharType(&source)[N],
const typename T::ValueType& value,
typename T::AllocatorType& a) {
1297template <
typename T,
typename CharType,
size_t N>
1298typename T::ValueType& SetValueByPointer(T& root,
const CharType(&source)[N],
const typename T::Ch* value,
typename T::AllocatorType& a) {
1302#if RAPIDJSON_HAS_STDSTRING
1303template <
typename T,
typename CharType,
size_t N>
1304typename T::ValueType& SetValueByPointer(T& root,
const CharType(&source)[N],
const std::basic_string<typename T::Ch>& value,
typename T::AllocatorType& a) {
1309template <
typename T,
typename CharType,
size_t N,
typename T2>
1311SetValueByPointer(T& root,
const CharType(&source)[N], T2 value,
typename T::AllocatorType& a) {
1317template <
typename DocumentType>
1319 return pointer.Set(document, value);
1322template <
typename DocumentType>
1324 return pointer.Set(document, value);
1327template <
typename DocumentType>
1329 return pointer.Set(document, value);
1332#if RAPIDJSON_HAS_STDSTRING
1333template <
typename DocumentType>
1335 return pointer.Set(document, value);
1339template <
typename DocumentType,
typename T2>
1340RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T2>,
internal::IsGenericValue<T2> >), (
typename DocumentType::ValueType&))
1342 return pointer.Set(document, value);
1345template <
typename DocumentType,
typename CharType,
size_t N>
1346typename DocumentType::ValueType& SetValueByPointer(DocumentType& document,
const CharType(&source)[N],
typename DocumentType::ValueType& value) {
1350template <
typename DocumentType,
typename CharType,
size_t N>
1351typename DocumentType::ValueType& SetValueByPointer(DocumentType& document,
const CharType(&source)[N],
const typename DocumentType::ValueType& value) {
1355template <
typename DocumentType,
typename CharType,
size_t N>
1356typename DocumentType::ValueType& SetValueByPointer(DocumentType& document,
const CharType(&source)[N],
const typename DocumentType::Ch* value) {
1360#if RAPIDJSON_HAS_STDSTRING
1361template <
typename DocumentType,
typename CharType,
size_t N>
1362typename DocumentType::ValueType& SetValueByPointer(DocumentType& document,
const CharType(&source)[N],
const std::basic_string<typename DocumentType::Ch>& value) {
1367template <
typename DocumentType,
typename CharType,
size_t N,
typename T2>
1368RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T2>,
internal::IsGenericValue<T2> >), (
typename DocumentType::ValueType&))
1369SetValueByPointer(DocumentType& document,
const CharType(&source)[N], T2 value) {
1375template <
typename T>
1377 return pointer.
Swap(root, value, a);
1380template <
typename T,
typename CharType,
size_t N>
1381typename T::ValueType& SwapValueByPointer(T& root,
const CharType(&source)[N],
typename T::ValueType& value,
typename T::AllocatorType& a) {
1385template <
typename DocumentType>
1387 return pointer.
Swap(document, value);
1390template <
typename DocumentType,
typename CharType,
size_t N>
1391typename DocumentType::ValueType& SwapValueByPointer(DocumentType& document,
const CharType(&source)[N],
typename DocumentType::ValueType& value) {
1397template <
typename T>
1399 return pointer.Erase(root);
1402template <
typename T,
typename CharType,
size_t N>
1403bool EraseValueByPointer(T& root,
const CharType(&source)[N]) {
1411#if defined(__clang__) || defined(_MSC_VER)
Allocator & GetAllocator()
Get the allocator of this document.
A helper stream to encode character (UTF-8 code unit) into percent-encoded sequence.
Represents a JSON Pointer. Use Pointer for UTF8 encoding and default allocator.
friend void swap(GenericPointer &a, GenericPointer &b) RAPIDJSON_NOEXCEPT
free-standing swap function helper
CrtAllocator * allocator_
GenericPointer(const GenericPointer &rhs, Allocator *allocator)
Copy constructor.
GenericPointer(const Ch *source, Allocator *allocator=0)
Constructor that parses a string or URI fragment representation.
Value::EncodingType EncodingType
GenericPointer(const Token *tokens, size_t tokenCount)
Constructor with user-supplied tokens.
GenericPointer(Allocator *allocator=0)
Default constructor.
GenericPointer(const GenericPointer &rhs)
Copy constructor.
PointerParseErrorCode parseErrorCode_
CrtAllocator * ownAllocator_
GenericPointer(const Ch *source, size_t length, Allocator *allocator=0)
Constructor that parses a string or URI fragment representation, with length of the source string.
GenericPointer Append(const Ch *name, SizeType length, Allocator *allocator=0) const
Append a name token with length, and return a new Pointer.
GenericPointer Append(const Token &token, Allocator *allocator=0) const
Append a token and return a new Pointer.
RAPIDJSON_DISABLEIF_RETURN((internal::NotExpr< internal::IsSame< typename internal::RemoveConst< T >::Type, Ch > >),(GenericPointer)) Append(T *name
Append a name token without length, and return a new Pointer.
~GenericPointer()
Destructor.
GenericPointer & operator=(const GenericPointer &rhs)
Assignment operator.
GenericPointer & Swap(GenericPointer &other) RAPIDJSON_NOEXCEPT
Swap the content of this pointer with an other.
Concept for allocating, resizing and freeing memory block.
#define RAPIDJSON_ASSERT(x)
Assertion.
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
PointerParseErrorCode
Error code of parsing.
@ kPointerParseErrorInvalidEscape
Invalid escape.
@ kPointerParseErrorTokenMustBeginWithSolidus
A token must begin with a '/'.
@ kPointerParseErrorNone
The parse is successful.
@ kPointerParseErrorCharacterMustPercentEncode
A character must percent encoded in URI fragment.
@ kPointerParseErrorInvalidPercentEncoding
Invalid percent encoding in URI fragment.
#define RAPIDJSON_DELETE(x)
! customization point for global delete
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
#define RAPIDJSON_NEW(TypeName)
! customization point for global new
A token is the basic units of internal representation.
SizeType index
A valid array index, if it is not equal to kPointerInvalidIndex.
SizeType length
Length of the name.
const Ch * name
Name of the token. It has null character at the end but it can contain null character.