|
bool | Erase (ValueType &root) const |
| Erase a value in a subtree. More...
|
|
|
| GenericPointer () |
| Default constructor.
|
|
| GenericPointer (const Ch *source, Allocator *allocator=0) |
| Constructor that parses a string or URI fragment representation. More...
|
|
| GenericPointer (const std::basic_string< Ch > &source, Allocator *allocator=0) |
| Constructor that parses a string or URI fragment representation. More...
|
|
| 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. More...
|
|
| GenericPointer (const Token *tokens, size_t tokenCount) |
| Constructor with user-supplied tokens. More...
|
|
| GenericPointer (const GenericPointer &rhs) |
| Copy constructor.
|
|
| ~GenericPointer () |
| Destructor.
|
|
GenericPointer & | operator= (const GenericPointer &rhs) |
| Assignment operator.
|
|
|
GenericPointer | Append (const Token &token, Allocator *allocator=0) const |
| Append a token and return a new Pointer. More...
|
|
GenericPointer | Append (const Ch *name, SizeType length, Allocator *allocator=0) const |
| Append a name token with length, and return a new Pointer. More...
|
|
template<typename T > |
GenericPointer | Append (T *name, Allocator *allocator=0) const |
| Append a name token without length, and return a new Pointer. More...
|
|
GenericPointer | Append (const std::basic_string< Ch > &name, Allocator *allocator=0) const |
| Append a name token, and return a new Pointer. More...
|
|
GenericPointer | Append (SizeType index, Allocator *allocator=0) const |
| Append a index token, and return a new Pointer. More...
|
|
GenericPointer | Append (const ValueType &token, Allocator *allocator=0) const |
| Append a token by value, and return a new Pointer. More...
|
|
|
bool | IsValid () const |
| Check whether this is a valid pointer.
|
|
size_t | GetParseErrorOffset () const |
| Get the parsing error offset in code unit.
|
|
PointerParseErrorCode | GetParseErrorCode () const |
| Get the parsing error code.
|
|
|
const Token * | GetTokens () const |
| Get the token array (const version only).
|
|
size_t | GetTokenCount () const |
| Get the number of tokens.
|
|
|
bool | operator== (const GenericPointer &rhs) const |
| Equality operator. More...
|
|
bool | operator!= (const GenericPointer &rhs) const |
| Inequality operator. More...
|
|
|
template<typename OutputStream > |
bool | Stringify (OutputStream &os) const |
| Stringify the pointer into string representation. More...
|
|
template<typename OutputStream > |
bool | StringifyUriFragment (OutputStream &os) const |
| Stringify the pointer into URI fragment representation. More...
|
|
|
ValueType & | Create (ValueType &root, typename ValueType::AllocatorType &allocator, bool *alreadyExist=0) const |
| Create a value in a subtree. More...
|
|
template<typename stackAllocator > |
ValueType & | Create (GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, bool *alreadyExist=0) const |
| Creates a value in a document. More...
|
|
|
ValueType * | Get (ValueType &root) const |
| Query a value in a subtree. More...
|
|
const ValueType * | Get (const ValueType &root) const |
| Query a const value in a const subtree. More...
|
|
|
ValueType & | GetWithDefault (ValueType &root, const ValueType &defaultValue, typename ValueType::AllocatorType &allocator) const |
| Query a value in a subtree with default value. More...
|
|
ValueType & | GetWithDefault (ValueType &root, const Ch *defaultValue, typename ValueType::AllocatorType &allocator) const |
| Query a value in a subtree with default null-terminated string.
|
|
ValueType & | GetWithDefault (ValueType &root, const std::basic_string< Ch > &defaultValue, typename ValueType::AllocatorType &allocator) const |
| Query a value in a subtree with default std::basic_string.
|
|
template<typename T > |
ValueType & | GetWithDefault (ValueType &root, T defaultValue, typename ValueType::AllocatorType &allocator) const |
| Query a value in a subtree with default primitive value. More...
|
|
template<typename stackAllocator > |
ValueType & | GetWithDefault (GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, const ValueType &defaultValue) const |
| Query a value in a document with default value.
|
|
template<typename stackAllocator > |
ValueType & | GetWithDefault (GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, const Ch *defaultValue) const |
| Query a value in a document with default null-terminated string.
|
|
template<typename stackAllocator > |
ValueType & | GetWithDefault (GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, const std::basic_string< Ch > &defaultValue) const |
| Query a value in a document with default std::basic_string.
|
|
template<typename T , typename stackAllocator > |
ValueType & | GetWithDefault (GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, T defaultValue) const |
| Query a value in a document with default primitive value. More...
|
|
|
ValueType & | Set (ValueType &root, ValueType &value, typename ValueType::AllocatorType &allocator) const |
| Set a value in a subtree, with move semantics. More...
|
|
ValueType & | Set (ValueType &root, const ValueType &value, typename ValueType::AllocatorType &allocator) const |
| Set a value in a subtree, with copy semantics.
|
|
ValueType & | Set (ValueType &root, const Ch *value, typename ValueType::AllocatorType &allocator) const |
| Set a null-terminated string in a subtree.
|
|
ValueType & | Set (ValueType &root, const std::basic_string< Ch > &value, typename ValueType::AllocatorType &allocator) const |
| Set a std::basic_string in a subtree.
|
|
template<typename T > |
ValueType & | Set (ValueType &root, T value, typename ValueType::AllocatorType &allocator) const |
| Set a primitive value in a subtree. More...
|
|
template<typename stackAllocator > |
ValueType & | Set (GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, ValueType &value) const |
| Set a value in a document, with move semantics.
|
|
template<typename stackAllocator > |
ValueType & | Set (GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, const ValueType &value) const |
| Set a value in a document, with copy semantics.
|
|
template<typename stackAllocator > |
ValueType & | Set (GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, const Ch *value) const |
| Set a null-terminated string in a document.
|
|
template<typename stackAllocator > |
ValueType & | Set (GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, const std::basic_string< Ch > &value) const |
| Sets a std::basic_string in a document.
|
|
template<typename T , typename stackAllocator > |
ValueType & | Set (GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, T value) const |
| Set a primitive value in a document. More...
|
|
|
ValueType & | Swap (ValueType &root, ValueType &value, typename ValueType::AllocatorType &allocator) const |
| Swap a value with a value in a subtree. More...
|
|
template<typename stackAllocator > |
ValueType & | Swap (GenericDocument< EncodingType, typename ValueType::AllocatorType, stackAllocator > &document, ValueType &value) const |
| Swap a value with a value in a document.
|
|
template<typename ValueType, typename Allocator = CrtAllocator>
class rapidjson::GenericPointer< ValueType, Allocator >
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
-
ValueType | The value type of the DOM tree. E.g. GenericValue<UTF8<> > |
Allocator | The allocator type for allocating memory for internal representation. |
- Note
- GenericPointer uses same encoding of ValueType. However, Allocator of GenericPointer is independent of Allocator of Value.