15 #ifndef RAPIDJSON_POINTER_H_
16 #define RAPIDJSON_POINTER_H_
23 RAPIDJSON_DIAG_OFF(
switch-
enum)
28 RAPIDJSON_DIAG_OFF(4512)
80 template <
typename ValueType,
typename Allocator = CrtAllocator>
84 typedef typename ValueType::Ch
Ch;
120 #if RAPIDJSON_HAS_STDSTRING
165 GenericPointer(
const Token* tokens,
size_t tokenCount) : allocator_(), ownAllocator_(), nameBuffer_(), tokens_(const_cast<Token*>(tokens)), tokenCount_(tokenCount), parseErrorOffset_(), parseErrorCode_(
kPointerParseErrorNone) {}
213 r.allocator_ = allocator;
214 Ch *p =
r.CopyFromRaw(*
this, 1, token.length + 1);
215 std::memcpy(p, token.name, (token.length + 1) *
sizeof(
Ch));
216 r.tokens_[tokenCount_].name = p;
217 r.tokens_[tokenCount_].length = token.length;
218 r.tokens_[tokenCount_].index = token.index;
231 return Append(token, allocator);
240 template <
typename T>
243 return Append(name,
StrLen(name), allocator);
246 #if RAPIDJSON_HAS_STDSTRING
254 return Append(name.c_str(),
static_cast<SizeType>(name.size()), allocator);
270 if (
sizeof(Ch) == 1) {
271 Token token = {
reinterpret_cast<Ch*
>(
buffer), length, index };
272 return Append(token, allocator);
276 for (
size_t i = 0;
i <= length;
i++)
277 name[
i] =
static_cast<Ch
>(
buffer[
i]);
278 Token token = { name, length, index };
279 return Append(token, allocator);
289 GenericPointer Append(
const ValueType& token,
Allocator* allocator = 0)
const {
290 if (token.IsString())
291 return Append(token.GetString(), token.GetStringLength(), allocator);
295 return Append(
static_cast<SizeType>(token.GetUint64()), allocator);
306 size_t GetParseErrorOffset()
const {
return parseErrorOffset_; }
314 Allocator& GetAllocator() {
return *allocator_; }
320 const Token* GetTokens()
const {
return tokens_; }
323 size_t GetTokenCount()
const {
return tokenCount_; }
334 bool operator==(
const GenericPointer& rhs)
const {
335 if (!
IsValid() || !rhs.IsValid() || tokenCount_ != rhs.tokenCount_)
338 for (
size_t i = 0;
i < tokenCount_;
i++) {
339 if (tokens_[
i].index != rhs.tokens_[
i].index ||
340 tokens_[
i].length != rhs.tokens_[
i].length ||
341 (tokens_[
i].length != 0 && std::memcmp(tokens_[
i].name, rhs.tokens_[
i].name,
sizeof(Ch)* tokens_[
i].length) != 0))
354 bool operator!=(
const GenericPointer& rhs)
const {
return !(*
this == rhs); }
366 template<
typename OutputStream>
367 bool Stringify(OutputStream& os)
const {
368 return Stringify<false, OutputStream>(os);
376 template<
typename OutputStream>
377 bool StringifyUriFragment(OutputStream& os)
const {
378 return Stringify<true, OutputStream>(os);
401 ValueType& Create(ValueType& root,
typename ValueType::AllocatorType& allocator,
bool* alreadyExist = 0)
const {
403 ValueType* v = &root;
405 for (
const Token *
t = tokens_;
t != tokens_ + tokenCount_; ++
t) {
406 if (v->IsArray() &&
t->name[0] ==
'-' &&
t->length == 1) {
408 v->PushBack(ValueType().SetValueAllocator(&allocator).Move(), allocator);
409 v = &((*v)[v->Size() - 1]);
418 if (!v->IsArray() && !v->IsObject())
423 if (
t->index >= v->Size()) {
424 v->Reserve(
t->index + 1, allocator);
426 while (
t->index >= v->Size())
427 v->PushBack(ValueType().SetValueAllocator(&allocator).Move(), allocator);
430 v = &((*v)[
t->index]);
433 typename ValueType::MemberIterator m = v->FindMember(GenericStringRef<Ch>(
t->name,
t->length));
434 if (m == v->MemberEnd()) {
436 v->AddMember(ValueType(
t->name,
t->length, allocator).SetValueAllocator(&allocator).Move(), ValueType().SetValueAllocator(&allocator).Move(), allocator);
449 *alreadyExist = exist;
460 template <
typename stackAllocator>
461 ValueType& Create(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document,
bool* alreadyExist = 0)
const {
462 return Create(document, document.GetAllocator(), alreadyExist);
484 ValueType*
Get(ValueType& root,
size_t* unresolvedTokenIndex = 0)
const {
486 ValueType* v = &root;
487 for (
const Token *
t = tokens_;
t != tokens_ + tokenCount_; ++
t) {
488 switch (v->GetType()) {
491 typename ValueType::MemberIterator m = v->FindMember(GenericStringRef<Ch>(
t->name,
t->length));
492 if (m == v->MemberEnd())
500 v = &((*v)[
t->index]);
507 if (unresolvedTokenIndex)
508 *unresolvedTokenIndex =
static_cast<size_t>(
t - tokens_);
519 const ValueType*
Get(
const ValueType& root,
size_t* unresolvedTokenIndex = 0)
const {
520 return Get(
const_cast<ValueType&
>(root), unresolvedTokenIndex);
538 ValueType& GetWithDefault(ValueType& root,
const ValueType&
defaultValue,
typename ValueType::AllocatorType& allocator)
const {
540 Value& v = Create(root, allocator, &alreadyExist);
541 return alreadyExist ? v : v.CopyFrom(
defaultValue, allocator);
545 ValueType& GetWithDefault(ValueType& root,
const Ch*
defaultValue,
typename ValueType::AllocatorType& allocator)
const {
547 Value& v = Create(root, allocator, &alreadyExist);
548 return alreadyExist ? v : v.SetString(
defaultValue, allocator);
551 #if RAPIDJSON_HAS_STDSTRING
553 ValueType& GetWithDefault(ValueType& root,
const std::basic_string<Ch>&
defaultValue,
typename ValueType::AllocatorType& allocator)
const {
555 Value& v = Create(root, allocator, &alreadyExist);
556 return alreadyExist ? v : v.SetString(
defaultValue, allocator);
564 template <
typename T>
566 GetWithDefault(ValueType& root,
T defaultValue,
typename ValueType::AllocatorType& allocator)
const {
567 return GetWithDefault(root, ValueType(
defaultValue).Move(), allocator);
571 template <
typename stackAllocator>
572 ValueType& GetWithDefault(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document,
const ValueType&
defaultValue)
const {
573 return GetWithDefault(document,
defaultValue, document.GetAllocator());
577 template <
typename stackAllocator>
578 ValueType& GetWithDefault(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document,
const Ch*
defaultValue)
const {
579 return GetWithDefault(document,
defaultValue, document.GetAllocator());
582 #if RAPIDJSON_HAS_STDSTRING
584 template <
typename stackAllocator>
585 ValueType& GetWithDefault(GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator>& document,
const std::basic_string<Ch>&
defaultValue)
const {
586 return GetWithDefault(document,
defaultValue, document.GetAllocator());
594 template <
typename T,
typename stackAllocator>
597 return GetWithDefault(document,
defaultValue, document.GetAllocator());
615 ValueType&
Set(ValueType& root, ValueType&
value,
typename ValueType::AllocatorType& allocator)
const {
616 return Create(root, allocator) =
value;
620 ValueType&
Set(ValueType& root,
const ValueType&
value,
typename ValueType::AllocatorType& allocator)
const {
621 return Create(root, allocator).CopyFrom(
value, allocator);
625 ValueType&
Set(ValueType& root,
const Ch*
value,
typename ValueType::AllocatorType& allocator)
const {
626 return Create(root, allocator) = ValueType(
value, allocator).Move();
629 #if RAPIDJSON_HAS_STDSTRING
631 ValueType& Set(ValueType& root,
const std::basic_string<Ch>&
value,
typename ValueType::AllocatorType& allocator)
const {
632 return Create(root, allocator) = ValueType(
value, allocator).Move();
640 template <
typename T>
642 Set(ValueType& root,
T value, typename ValueType::AllocatorType& allocator)
const {
643 return Create(root, allocator) = ValueType(
value).Move();
647 template <
typename stackAllocator>
649 return Create(document) =
value;
653 template <
typename stackAllocator>
659 template <
typename stackAllocator>
664 #if RAPIDJSON_HAS_STDSTRING
666 template <
typename stackAllocator>
676 template <
typename T,
typename stackAllocator>
679 return Create(document) =
value;
697 ValueType&
Swap(ValueType& root, ValueType&
value,
typename ValueType::AllocatorType& allocator)
const {
698 return Create(root, allocator).Swap(
value);
702 template <
typename stackAllocator>
704 return Create(document).Swap(
value);
718 if (tokenCount_ == 0)
721 ValueType* v = &root;
722 const Token*
last = tokens_ + (tokenCount_ - 1);
723 for (
const Token *
t = tokens_;
t !=
last; ++
t) {
724 switch (v->GetType()) {
728 if (m == v->MemberEnd())
736 v = &((*v)[
t->index]);
743 switch (v->GetType()) {
749 v->Erase(v->Begin() +
last->index);
770 nameBufferSize +=
t->length;
773 tokens_ =
static_cast<Token *
>(allocator_->Malloc(tokenCount_ *
sizeof(Token) + (nameBufferSize + extraNameBufferSize) *
sizeof(
Ch)));
774 nameBuffer_ =
reinterpret_cast<Ch *
>(tokens_ + tokenCount_);
778 if (nameBufferSize > 0) {
779 std::memcpy(nameBuffer_, rhs.
nameBuffer_, nameBufferSize *
sizeof(
Ch));
783 std::ptrdiff_t diff = nameBuffer_ - rhs.
nameBuffer_;
787 return nameBuffer_ + nameBufferSize;
796 return !((c >=
'0' && c <=
'9') || (c >=
'A' && c <=
'Z') || (c >=
'a' && c <=
'z') || c ==
'-' || c ==
'.' || c ==
'_' || c ==
'~');
822 Token* token = tokens_ =
static_cast<Token *
>(allocator_->Malloc(tokenCount_ *
sizeof(Token) + length *
sizeof(
Ch)));
823 Ch* name = nameBuffer_ =
reinterpret_cast<Ch *
>(tokens_ + tokenCount_);
827 bool uriFragment =
false;
833 if (
i != length &&
source[
i] !=
'/') {
843 bool isNumber =
true;
845 while (
i < length &&
source[
i] !=
'/') {
868 else if (NeedPercentEncode(c)) {
880 if (c ==
'0') c =
'~';
881 else if (c ==
'1') c =
'/';
895 if (c < '0' || c >
'9')
900 token->length =
static_cast<SizeType>(name - token->name);
901 if (token->length == 0)
906 if (isNumber && token->length > 1 && token->name[0] ==
'0')
912 for (
size_t j = 0; j < token->length; j++) {
935 parseErrorOffset_ =
i;
945 template<
bool uriFragment,
typename OutputStream>
952 for (Token *
t = tokens_;
t != tokens_ + tokenCount_; ++
t) {
954 for (
size_t j = 0; j <
t->length; j++) {
964 else if (uriFragment && NeedPercentEncode(c)) {
967 PercentEncodeStream<OutputStream> target(os);
987 typedef typename ValueType::Ch
Ch;
997 if (*src_ !=
'%' || src_ + 3 > end_) {
1003 for (
int j = 0; j < 2; j++) {
1004 c =
static_cast<Ch>(c << 4);
1006 if (h >=
'0' && h <=
'9') c =
static_cast<Ch>(c + h -
'0');
1007 else if (h >=
'A' && h <=
'F') c =
static_cast<Ch>(c + h -
'A' + 10);
1008 else if (h >=
'a' && h <=
'f') c =
static_cast<Ch>(c + h -
'a' + 10);
1018 size_t Tell()
const {
return static_cast<size_t>(src_ - head_); }
1029 template <
typename OutputStream>
1034 unsigned char u =
static_cast<unsigned char>(c);
1035 static const char hexDigits[16] = {
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'A',
'B',
'C',
'D',
'E',
'F' };
1037 os_.Put(
static_cast<typename OutputStream::Ch
>(hexDigits[u >> 4]));
1038 os_.Put(
static_cast<typename OutputStream::Ch
>(hexDigits[u & 15]));
1061 template <
typename T>
1066 template <
typename T,
typename CharType,
size_t N>
1073 template <
typename DocumentType>
1075 return pointer.Create(document);
1078 template <
typename DocumentType,
typename CharType,
size_t N>
1085 template <
typename T>
1087 return pointer.Get(root, unresolvedTokenIndex);
1090 template <
typename T>
1092 return pointer.Get(root, unresolvedTokenIndex);
1095 template <
typename T,
typename CharType,
size_t N>
1100 template <
typename T,
typename CharType,
size_t N>
1107 template <
typename T>
1112 template <
typename T>
1117 #if RAPIDJSON_HAS_STDSTRING
1118 template <
typename T>
1124 template <
typename T,
typename T2>
1130 template <
typename T,
typename CharType,
size_t N>
1135 template <
typename T,
typename CharType,
size_t N>
1140 #if RAPIDJSON_HAS_STDSTRING
1141 template <
typename T,
typename CharType,
size_t N>
1143 return GenericPointer<typename T::ValueType>(
source,
N - 1).GetWithDefault(root,
defaultValue,
a);
1147 template <
typename T,
typename CharType,
size_t N,
typename T2>
1155 template <
typename DocumentType>
1160 template <
typename DocumentType>
1165 #if RAPIDJSON_HAS_STDSTRING
1166 template <
typename DocumentType>
1172 template <
typename DocumentType,
typename T2>
1178 template <
typename DocumentType,
typename CharType,
size_t N>
1183 template <
typename DocumentType,
typename CharType,
size_t N>
1188 #if RAPIDJSON_HAS_STDSTRING
1189 template <
typename DocumentType,
typename CharType,
size_t N>
1191 return GenericPointer<typename DocumentType::ValueType>(
source,
N - 1).GetWithDefault(document,
defaultValue);
1195 template <
typename DocumentType,
typename CharType,
size_t N,
typename T2>
1203 template <
typename T>
1208 template <
typename T>
1213 template <
typename T>
1218 #if RAPIDJSON_HAS_STDSTRING
1219 template <
typename T>
1220 typename T::ValueType&
SetValueByPointer(
T& root,
const GenericPointer<typename T::ValueType>&
pointer,
const std::basic_string<typename T::Ch>&
value,
typename T::AllocatorType&
a) {
1225 template <
typename T,
typename T2>
1226 RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T2>, internal::IsGenericValue<T2> >), (
typename T::ValueType&))
1231 template <
typename T,
typename CharType,
size_t N>
1236 template <
typename T,
typename CharType,
size_t N>
1241 template <
typename T,
typename CharType,
size_t N>
1246 #if RAPIDJSON_HAS_STDSTRING
1247 template <
typename T,
typename CharType,
size_t N>
1248 typename T::ValueType&
SetValueByPointer(
T& root,
const CharType(&
source)[
N],
const std::basic_string<typename T::Ch>&
value,
typename T::AllocatorType&
a) {
1249 return GenericPointer<typename T::ValueType>(
source,
N - 1).Set(root,
value,
a);
1253 template <
typename T,
typename CharType,
size_t N,
typename T2>
1254 RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T2>, internal::IsGenericValue<T2> >), (
typename T::ValueType&))
1256 return GenericPointer<typename T::ValueType>(
source,
N - 1).Set(root,
value,
a);
1261 template <
typename DocumentType>
1266 template <
typename DocumentType>
1271 template <
typename DocumentType>
1276 #if RAPIDJSON_HAS_STDSTRING
1277 template <
typename DocumentType>
1278 typename DocumentType::ValueType&
SetValueByPointer(DocumentType& document,
const GenericPointer<typename DocumentType::ValueType>&
pointer,
const std::basic_string<typename DocumentType::Ch>&
value) {
1283 template <
typename DocumentType,
typename T2>
1284 RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T2>, internal::IsGenericValue<T2> >), (
typename DocumentType::ValueType&))
1289 template <
typename DocumentType,
typename CharType,
size_t N>
1294 template <
typename DocumentType,
typename CharType,
size_t N>
1299 template <
typename DocumentType,
typename CharType,
size_t N>
1304 #if RAPIDJSON_HAS_STDSTRING
1305 template <
typename DocumentType,
typename CharType,
size_t N>
1306 typename DocumentType::ValueType&
SetValueByPointer(DocumentType& document,
const CharType(&
source)[
N],
const std::basic_string<typename DocumentType::Ch>&
value) {
1307 return GenericPointer<typename DocumentType::ValueType>(
source,
N - 1).Set(document,
value);
1311 template <
typename DocumentType,
typename CharType,
size_t N,
typename T2>
1312 RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T2>, internal::IsGenericValue<T2> >), (
typename DocumentType::ValueType&))
1314 return GenericPointer<typename DocumentType::ValueType>(
source,
N - 1).Set(document,
value);
1319 template <
typename T>
1324 template <
typename T,
typename CharType,
size_t N>
1329 template <
typename DocumentType>
1334 template <
typename DocumentType,
typename CharType,
size_t N>
1341 template <
typename T>
1346 template <
typename T,
typename CharType,
size_t N>
bool operator!=(const _Ht_iterator< _Val, _Nonconst_traits< _Val >, _Key, _HF, _ExK, _EqK, _All > &__x, const _Ht_iterator< _Val, _Const_traits< _Val >, _Key, _HF, _ExK, _EqK, _All > &__y)
Concept for allocating, resizing and freeing memory block.
A document for parsing JSON text as DOM.
Allocator & GetAllocator() const
Get the allocator of this document.
A helper stream for decoding a percent-encoded sequence into code unit.
bool valid_
Whether the parsing is valid.
const Ch * src_
Current read position.
PercentDecodeStream(const Ch *source, const Ch *end)
Constructor.
const Ch * head_
Original head of the string.
const Ch * end_
Past-the-end position.
A helper stream to encode character (UTF-8 code unit) into percent-encoded sequence.
PercentEncodeStream(OutputStream &os)
Represents a JSON Pointer. Use Pointer for UTF8 encoding and default allocator.
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.
ValueType & Set(ValueType &root, ValueType &value, typename ValueType::AllocatorType &allocator) const
Set a value in a subtree, with move semantics.
RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr< internal::IsPointer< T >, internal::IsGenericValue< T > >),(ValueType &)) Set(ValueType &root
Set a primitive value in a subtree.
~GenericPointer()
Destructor.
PointerParseErrorCode parseErrorCode_
Parsing error code.
GenericPointer & operator=(const GenericPointer &rhs)
Assignment operator.
bool Stringify(OutputStream &os) const
Stringify to string or URI fragment representation.
size_t parseErrorOffset_
Offset in code unit when parsing fail.
ValueType & Swap(GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, ValueType &value) const
Swap a value with a value in a document.
Allocator * allocator_
The current allocator. It is either user-supplied or equal to ownAllocator_.
GenericPointer Append(const Ch *name, SizeType length, Allocator *allocator=0) const
Append a name token with length, and return a new Pointer.
bool NeedPercentEncode(Ch c) const
Check whether a character should be percent-encoded.
Ch * CopyFromRaw(const GenericPointer &rhs, size_t extraToken=0, size_t extraNameBufferSize=0)
Clone the content from rhs to this.
Ch * nameBuffer_
A buffer containing all names in tokens.
ValueType::EncodingType EncodingType
Encoding type from Value.
void Parse(const Ch *source, size_t length)
Parse a JSON String or its URI fragment representation into tokens.
ValueType & Swap(ValueType &root, ValueType &value, typename ValueType::AllocatorType &allocator) const
Swap a value with a value in a subtree.
ValueType & Set(ValueType &root, const Ch *value, typename ValueType::AllocatorType &allocator) const
Set a null-terminated string in a subtree.
Allocator stackAllocator RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr< internal::IsPointer< T >, internal::IsGenericValue< T > >),(ValueType &)) GetWithDefault(GenericDocument< EncodingType
GenericPointer(const Token *tokens, size_t tokenCount)
Constructor with user-supplied tokens.
GenericPointer Append(const Token &token, Allocator *allocator=0) const
Append a token and return a new Pointer.
RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr< internal::IsPointer< T >, internal::IsGenericValue< T > >),(ValueType &)) Set(GenericDocument< EncodingType
Set a primitive value in a document.
ValueType::Ch Ch
Character type from Value.
Allocator * ownAllocator_
Allocator owned by this Pointer.
GenericPointer(const Ch *source, Allocator *allocator=0)
Constructor that parses a string or URI fragment representation.
bool Erase(ValueType &root) const
Erase a value in a subtree.
ValueType & Set(GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, ValueType &value) const
Set a value in a document, with move semantics.
GenericPointer(const GenericPointer &rhs, Allocator *allocator=0)
Copy constructor.
GenericPointer(Allocator *allocator=0)
Default constructor.
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.
size_t tokenCount_
Number of tokens in tokens_.
Token * tokens_
A list of tokens.
ValueType & Set(GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, const ValueType &value) const
Set a value in a document, with copy semantics.
ValueType & Set(ValueType &root, const ValueType &value, typename ValueType::AllocatorType &allocator) const
Set a value in a subtree, with copy semantics.
ValueType & Set(GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, const Ch *value) const
Set a null-terminated string in a document.
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
bool operator==(const CEquivRange &A, const CEquivRange &B)
bool IsValid(const CSeq_point &pt, CScope *scope)
Checks that point >= 0 and point < length of Bioseq.
#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.
@ kPointerParseErrorInvalidPercentEncoding
Invalid percent encoding in URI fragment.
@ kPointerParseErrorTokenMustBeginWithSolidus
A token must begin with a '/'.
@ kPointerParseErrorInvalidEscape
Invalid escape.
@ kPointerParseErrorNone
The parse is successful.
@ kPointerParseErrorCharacterMustPercentEncode
A character must percent encoded in URI fragment.
const TYPE & Get(const CNamedParameterList *param)
char * u32toa(uint32_t value, char *buffer)
char * u64toa(uint64_t value, char *buffer)
RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr< internal::IsPointer< T2 >, internal::IsGenericValue< T2 > >),(typename DocumentType::ValueType &)) GetValueByPointerWithDefault(DocumentType &document
const GenericPointer< typename T::ValueType > T2 defaultValue
const CharType(& source)[N]
unsigned SizeType
Size type (for string lengths, array sizes, etc.)
DocumentType::ValueType & GetValueByPointerWithDefault(DocumentType &document, const CharType(&source)[N], const typename DocumentType::Ch *defaultValue)
DocumentType::ValueType & CreateValueByPointer(DocumentType &document, const CharType(&source)[N])
static const SizeType kPointerInvalidIndex
Represents an invalid index in GenericPointer::Token.
const GenericPointer< typename T::ValueType > & pointer
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
const T::ValueType * GetValueByPointer(const T &root, const CharType(&source)[N], size_t *unresolvedTokenIndex=0)
DocumentType::ValueType & SwapValueByPointer(DocumentType &document, const CharType(&source)[N], typename DocumentType::ValueType &value)
DocumentType::ValueType & SetValueByPointer(DocumentType &document, const CharType(&source)[N], const typename DocumentType::Ch *value)
bool EraseValueByPointer(T &root, const CharType(&source)[N])
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static pcre_uint8 * buffer
#define RAPIDJSON_DELETE(x)
! customization point for global delete
#define RAPIDJSON_NEW(TypeName)
! customization point for global new
A read-write string stream.
A token is the basic units of internal representation.
SizeType index
A valid array index, if it is not equal to kPointerInvalidIndex.
const Ch * name
Name of the token. It has null character at the end but it can contain null character.
SizeType length
Length of the name.
Reference to a constant string (not taking a copy)