template <typename ValueType, typename Allocator = CrtAllocator>
class GenericPointer
Defined at line 68 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
Represents a JSON Pointer. Use Pointer for UTF8 encoding and default allocator.
This class implements RFC 6901 "JavaScript Object Notation (JSON) Pointer"
(https://tools.ietf.org/html/rfc6901).
A JSON pointer is for identifying a specific value in a JSON document
(GenericDocument). It can simplify coding of DOM tree manipulation, because it
can access multiple-level depth of DOM tree with single API call.
After it parses a string representation (e.g. "/foo/0" or URI fragment
representation (e.g. "#/foo/0") into its internal representation (tokens),
it can be used to resolve a specific value in multiple documents, or sub-tree
of documents.
Contrary to GenericValue, Pointer can be copy constructed and copy assigned.
Apart from assignment, a Pointer cannot be modified after construction.
Although Pointer is very convenient, please aware that constructing Pointer
involves parsing and dynamic memory allocation. A special constructor with user-
supplied tokens eliminates these.
GenericPointer depends on GenericDocument and GenericValue.
Template Parameters
Public Methods
void GenericPointer<ValueType, Allocator> (Allocator * allocator)
Default constructor.
Defined at line 98 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
void GenericPointer<ValueType, Allocator> (const Ch * source, Allocator * allocator)
Constructor that parses a string or URI fragment representation.
Parameters
Defined at line 105 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
void GenericPointer<ValueType, Allocator> (const std::basic_string<Ch> & source, Allocator * allocator)
Constructor that parses a string or URI fragment representation.
Parameters
Defined at line 116 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
void GenericPointer<ValueType, Allocator> (const Ch * source, size_t length, Allocator * allocator)
Constructor that parses a string or URI fragment representation, with length of the source string.
Parameters
Defined at line 128 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
void GenericPointer<ValueType, Allocator> (const Token * tokens, size_t tokenCount)
Constructor with user-supplied tokens.
This constructor let user supplies const array of tokens.
This prevents the parsing process and eliminates allocation.
This is preferred for memory constrained environments.
Parameters
Code
#define NAME(s) { s, sizeof(s) / sizeof(s[0]) - 1, kPointerInvalidIndex }
#define INDEX(i) { #i, sizeof(#i) - 1, i }
static const Pointer::Token kTokens[] = { NAME("foo"), INDEX(123) };
static const Pointer p(kTokens, sizeof(kTokens) / sizeof(kTokens[0]));
// Equivalent to static const Pointer p("/foo/123");
#undef NAME
#undef INDEX
Defined at line 154 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
void GenericPointer<ValueType, Allocator> (const GenericPointer<ValueType, Allocator> & rhs)
Copy constructor.
Defined at line 157 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
void GenericPointer<ValueType, Allocator> (const GenericPointer<ValueType, Allocator> & rhs, Allocator * allocator)
Copy constructor.
Defined at line 162 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
void ~GenericPointer<ValueType, Allocator> ()
Destructor.
Defined at line 167 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
GenericPointer<ValueType, Allocator> & operator= (const GenericPointer<ValueType, Allocator> & rhs)
Assignment operator.
Defined at line 174 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
GenericPointer<ValueType, Allocator> & Swap (GenericPointer<ValueType, Allocator> & other)
Swap the content of this pointer with an other.
Parameters
Defined at line 199 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
GenericPointer<ValueType, Allocator> Append (const Token & token, Allocator * allocator)
Append a token and return a new Pointer
Parameters
Returns
A new Pointer with appended token.
Defined at line 235 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
GenericPointer<ValueType, Allocator> Append (const Ch * name, SizeType length, Allocator * allocator)
Append a name token with length, and return a new Pointer
Parameters
Returns
A new Pointer with appended token.
Defined at line 253 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename T>
typename ::rapidjson::internal::DisableIf<typename ::rapidjson::internal::RemoveSfinaeTag< ::rapidjson::internal::SfinaeTag &(*)(internal::NotExpr<internal::IsSame<typename internal::RemoveConst<T>::Type, Ch>>)>::Type, typename ::rapidjson::internal::RemoveSfinaeTag< ::rapidjson::internal::SfinaeTag &(*)(GenericPointer<ValueType, Allocator>)>::Type>::Type Append (T * name, Allocator * allocator)
Append a name token without length, and return a new Pointer
Parameters
Returns
A new Pointer with appended token.
Defined at line 265 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
GenericPointer<ValueType, Allocator> Append (const std::basic_string<Ch> & name, Allocator * allocator)
Append a name token, and return a new Pointer
Parameters
Returns
A new Pointer with appended token.
Defined at line 277 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
GenericPointer<ValueType, Allocator> Append (SizeType index, Allocator * allocator)
Append a index token, and return a new Pointer
Parameters
Returns
A new Pointer with appended token.
Defined at line 288 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
GenericPointer<ValueType, Allocator> Append (const ValueType & token, Allocator * allocator)
Append a token by value, and return a new Pointer
Parameters
Returns
A new Pointer with appended token.
Defined at line 313 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
bool IsValid ()
Check whether this is a valid pointer.
Defined at line 327 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
size_t GetParseErrorOffset ()
Get the parsing error offset in code unit.
Defined at line 330 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
PointerParseErrorCode GetParseErrorCode ()
Get the parsing error code.
Defined at line 333 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
Allocator & GetAllocator ()
Get the allocator of this pointer.
Defined at line 338 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
const Token * GetTokens ()
Get the token array (const version only).
Defined at line 344 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
size_t GetTokenCount ()
Get the number of tokens.
Defined at line 347 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
bool operator== (const GenericPointer<ValueType, Allocator> & rhs)
Equality operator.
Defined at line 358 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
bool operator!= (const GenericPointer<ValueType, Allocator> & rhs)
Inequality operator.
Defined at line 378 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
bool operator< (const GenericPointer<ValueType, Allocator> & rhs)
Less than operator.
Defined at line 384 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename OutputStream>
bool Stringify (OutputStream & os)
Stringify the pointer into string representation.
Parameters
Template Parameters
Defined at line 418 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename OutputStream>
bool StringifyUriFragment (OutputStream & os)
Stringify the pointer into URI fragment representation.
Parameters
Template Parameters
Defined at line 428 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
ValueType & Create (ValueType & root, typename ValueType::AllocatorType & allocator, bool * alreadyExist)
Create a value in a subtree.
If the value is not exist, it creates all parent values and a JSON Null value.
So it always succeed and return the newly created or existing value.
Remind that it may change types of parents according to tokens, so it
potentially removes previously stored values. For example, if a document
was an array, and "/foo" is used to create a value, then the document
will be changed to an object, and all existing array elements are lost.
Parameters
Returns
The resolved newly created (a JSON Null value), or already exists value.
Defined at line 452 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename stackAllocator>
ValueType & Create (GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator> & document, bool * alreadyExist)
Creates a value in a document.
Parameters
Returns
The resolved newly created, or already exists value.
Defined at line 508 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
UriType GetUri (ValueType & root, const UriType & rootUri, size_t * unresolvedTokenIndex, Allocator * allocator)
Compute the in-scope URI for a subtree.
For use with JSON pointers into JSON schema documents.
Use unresolvedTokenIndex to retrieve the token index.
Parameters
Returns
Uri if it can be resolved. Otherwise null.
Defined at line 534 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
UriType GetUri (const ValueType & root, const UriType & rootUri, size_t * unresolvedTokenIndex, Allocator * allocator)
Defined at line 573 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
ValueType * Get (ValueType & root, size_t * unresolvedTokenIndex)
Query a value in a subtree.
Use unresolvedTokenIndex to retrieve the token index.
Parameters
Returns
Pointer to the value if it can be resolved. Otherwise null.
Defined at line 595 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
const ValueType * Get (const ValueType & root, size_t * unresolvedTokenIndex)
Query a const value in a const subtree.
Parameters
Returns
Pointer to the value if it can be resolved. Otherwise null.
Defined at line 630 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
ValueType & GetWithDefault (ValueType & root, const ValueType & defaultValue, typename ValueType::AllocatorType & allocator)
Query a value in a subtree with default value.
Similar to Get(), but if the specified value do not exists, it creates all parents and clone the default value.
So that this function always succeed.
Parameters
Defined at line 649 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
ValueType & GetWithDefault (ValueType & root, const Ch * defaultValue, typename ValueType::AllocatorType & allocator)
Query a value in a subtree with default null-terminated string.
Defined at line 656 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
ValueType & GetWithDefault (ValueType & root, const std::basic_string<Ch> & defaultValue, typename ValueType::AllocatorType & allocator)
Query a value in a subtree with default std::basic_string.
Defined at line 664 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename T>
typename ::rapidjson::internal::DisableIf<typename ::rapidjson::internal::RemoveSfinaeTag< ::rapidjson::internal::SfinaeTag &(*)(internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T>>)>::Type, typename ::rapidjson::internal::RemoveSfinaeTag< ::rapidjson::internal::SfinaeTag &(*)(ValueType &)>::Type>::Type GetWithDefault (ValueType & root, T defaultValue, typename ValueType::AllocatorType & allocator)
Query a value in a subtree with default primitive value.
Template Parameters
Defined at line 676 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename stackAllocator>
ValueType & GetWithDefault (GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator> & document, const ValueType & defaultValue)
Query a value in a document with default value.
Defined at line 683 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename stackAllocator>
ValueType & GetWithDefault (GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator> & document, const Ch * defaultValue)
Query a value in a document with default null-terminated string.
Defined at line 689 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename stackAllocator>
ValueType & GetWithDefault (GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator> & document, const std::basic_string<Ch> & defaultValue)
Query a value in a document with default std::basic_string.
Defined at line 696 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename T, typename stackAllocator>
typename ::rapidjson::internal::DisableIf<typename ::rapidjson::internal::RemoveSfinaeTag< ::rapidjson::internal::SfinaeTag &(*)(internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T>>)>::Type, typename ::rapidjson::internal::RemoveSfinaeTag< ::rapidjson::internal::SfinaeTag &(*)(ValueType &)>::Type>::Type GetWithDefault (GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator> & document, T defaultValue)
Query a value in a document with default primitive value.
Template Parameters
Defined at line 706 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
ValueType & Set (ValueType & root, ValueType & value, typename ValueType::AllocatorType & allocator)
Set a value in a subtree, with move semantics.
It creates all parents if they are not exist or types are different to the tokens.
So this function always succeeds but potentially remove existing values.
Parameters
Defined at line 726 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
ValueType & Set (ValueType & root, const ValueType & value, typename ValueType::AllocatorType & allocator)
Set a value in a subtree, with copy semantics.
Defined at line 731 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
ValueType & Set (ValueType & root, const Ch * value, typename ValueType::AllocatorType & allocator)
Set a null-terminated string in a subtree.
Defined at line 736 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
ValueType & Set (ValueType & root, const std::basic_string<Ch> & value, typename ValueType::AllocatorType & allocator)
Set a std::basic_string in a subtree.
Defined at line 742 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename T>
typename ::rapidjson::internal::DisableIf<typename ::rapidjson::internal::RemoveSfinaeTag< ::rapidjson::internal::SfinaeTag &(*)(internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T>>)>::Type, typename ::rapidjson::internal::RemoveSfinaeTag< ::rapidjson::internal::SfinaeTag &(*)(ValueType &)>::Type>::Type Set (ValueType & root, T value, typename ValueType::AllocatorType & allocator)
Set a primitive value in a subtree.
Template Parameters
Defined at line 752 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename stackAllocator>
ValueType & Set (GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator> & document, ValueType & value)
Set a value in a document, with move semantics.
Defined at line 759 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename stackAllocator>
ValueType & Set (GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator> & document, const ValueType & value)
Set a value in a document, with copy semantics.
Defined at line 765 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename stackAllocator>
ValueType & Set (GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator> & document, const Ch * value)
Set a null-terminated string in a document.
Defined at line 771 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename stackAllocator>
ValueType & Set (GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator> & document, const std::basic_string<Ch> & value)
Sets a std::basic_string in a document.
Defined at line 778 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename T, typename stackAllocator>
typename ::rapidjson::internal::DisableIf<typename ::rapidjson::internal::RemoveSfinaeTag< ::rapidjson::internal::SfinaeTag &(*)(internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T>>)>::Type, typename ::rapidjson::internal::RemoveSfinaeTag< ::rapidjson::internal::SfinaeTag &(*)(ValueType &)>::Type>::Type Set (GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator> & document, T value)
Set a primitive value in a document.
Template Parameters
Defined at line 788 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
ValueType & Swap (ValueType & root, ValueType & value, typename ValueType::AllocatorType & allocator)
Swap a value with a value in a subtree.
It creates all parents if they are not exist or types are different to the tokens.
So this function always succeeds but potentially remove existing values.
Parameters
Defined at line 808 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
template <typename stackAllocator>
ValueType & Swap (GenericDocument<EncodingType, typename ValueType::AllocatorType, stackAllocator> & document, ValueType & value)
Swap a value with a value in a document.
Defined at line 814 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
bool Erase (ValueType & root)
Erase a value in a subtree.
Parameters
Returns
Whether the resolved value is found and erased.
Defined at line 827 of file ../../third_party/rapidjson/include/rapidjson/pointer.h
Records
Friends
template <typename ValueTypetypename Allocator = CrtAllocator>
void GenericPointer (GenericPointer<ValueType, Allocator> & aGenericPointer<ValueType, Allocator> & b)