Represents a JSON Pointer. Use Pointer for UTF8 encoding and default allocator. Plus de détails...
#include <arcane/utils/internal/json/rapidjson/pointer.h>
Classes | |
class | PercentEncodeStream |
A helper stream to encode character (UTF-8 code unit) into percent-encoded sequence. Plus de détails... | |
struct | Token |
A token is the basic units of internal representation. Plus de détails... | |
Types publics | |
typedef ValueType::EncodingType | EncodingType |
Encoding type from Value. | |
typedef ValueType::Ch | Ch |
Character type from Value. | |
Append token | |
Allocator * | allocator |
Allocator * | allocator_ |
The current allocator. It is either user-supplied or equal to ownAllocator_. | |
Allocator * | ownAllocator_ |
Allocator owned by this Pointer. | |
Ch * | nameBuffer_ |
A buffer containing all names in tokens. | |
Token * | tokens_ |
A list of tokens. | |
size_t | tokenCount_ |
Number of tokens in tokens_. | |
size_t | parseErrorOffset_ |
Offset in code unit when parsing fail. | |
PointerParseErrorCode | parseErrorCode_ |
Parsing error code. | |
GenericPointer | Append (const Token &token, Allocator *allocator=0) const |
Append a token and return a new Pointer. | |
GenericPointer | Append (const Ch *name, SizeType length, Allocator *allocator=0) const |
Append a name token with length, and return a new Pointer. | |
template<typename T > | |
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. | |
Constructors and destructor. | |
GenericPointer (Allocator *allocator=0) | |
Default constructor. | |
GenericPointer (const Ch *source, Allocator *allocator=0) | |
Constructor that parses a string or URI fragment representation. | |
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 (const Token *tokens, size_t tokenCount) | |
Constructor with user-supplied tokens. | |
GenericPointer (const GenericPointer &rhs) | |
Copy constructor. | |
GenericPointer (const GenericPointer &rhs, Allocator *allocator) | |
Copy constructor. | |
~GenericPointer () | |
Destructor. | |
GenericPointer & | operator= (const GenericPointer &rhs) |
Assignment operator. | |
GenericPointer & | Swap (GenericPointer &other) RAPIDJSON_NOEXCEPT |
Swap the content of this pointer with an other. | |
void | swap (GenericPointer &a, GenericPointer &b) RAPIDJSON_NOEXCEPT |
free-standing swap function helper | |
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.
ValueType | The value type of the DOM tree. E.g. GenericValue<UTF8<> > |
Allocator | The allocator type for allocating memory for internal representation. |
typedef ValueType::Ch GenericPointer< ValueType, Allocator >::Ch |
typedef ValueType::EncodingType GenericPointer< ValueType, Allocator >::EncodingType |
|
inline |
|
inlineexplicit |
Constructor that parses a string or URI fragment representation.
source | A null-terminated, string or URI fragment representation of JSON pointer. |
allocator | User supplied allocator for this pointer. If no allocator is provided, it creates a self-owned one. |
|
inline |
Constructor that parses a string or URI fragment representation, with length of the source string.
source | A string or URI fragment representation of JSON pointer. |
length | Length of source. |
allocator | User supplied allocator for this pointer. If no allocator is provided, it creates a self-owned one. |
|
inline |
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.
tokens | An constant array of tokens representing the JSON pointer. |
tokenCount | Number of tokens. |
Example
|
inline |
|
inline |
|
inline |
Destructor.
Définition à la ligne 177 du fichier pointer.h.
Références GenericPointer< ValueType, Allocator >::nameBuffer_, GenericPointer< ValueType, Allocator >::ownAllocator_, RAPIDJSON_DELETE, et GenericPointer< ValueType, Allocator >::tokens_.
|
inline |
Append a name token with length, and return a new Pointer.
name | Name to be appended. |
length | Length of name. |
allocator | Allocator for the newly return Pointer. |
Définition à la ligne 263 du fichier pointer.h.
Références GenericPointer< ValueType, Allocator >::Append().
|
inline |
Append a token and return a new Pointer.
token | Token to be appended. |
allocator | Allocator for the newly return Pointer. |
Définition à la ligne 245 du fichier pointer.h.
Références GenericPointer< ValueType, Allocator >::allocator_, GenericPointer< ValueType, Allocator >::Token::index, GenericPointer< ValueType, Allocator >::Token::length, GenericPointer< ValueType, Allocator >::Token::name, GenericPointer< ValueType, Allocator >::tokenCount_, et GenericPointer< ValueType, Allocator >::tokens_.
Référencé par GenericPointer< ValueType, Allocator >::Append(), et GenericPointer< ValueType, Allocator >::RAPIDJSON_DISABLEIF_RETURN().
|
inline |
Assignment operator.
Définition à la ligne 184 du fichier pointer.h.
Références GenericPointer< ValueType, Allocator >::nameBuffer_, GenericPointer< ValueType, Allocator >::parseErrorCode_, GenericPointer< ValueType, Allocator >::parseErrorOffset_, GenericPointer< ValueType, Allocator >::tokenCount_, et GenericPointer< ValueType, Allocator >::tokens_.
GenericPointer< ValueType, Allocator >::RAPIDJSON_DISABLEIF_RETURN | ( | (internal::NotExpr< internal::IsSame< typename internal::RemoveConst< T >::Type, Ch > >) | , |
(GenericPointer< ValueType, Allocator >) | |||
) |
Append a name token without length, and return a new Pointer.
name | Name (const Ch*) to be appended. |
allocator | Allocator for the newly return Pointer. |
Références GenericPointer< ValueType, Allocator >::Append().
|
inline |
Swap the content of this pointer with an other.
other | The pointer to swap with. |
Définition à la ligne 209 du fichier pointer.h.
Références GenericPointer< ValueType, Allocator >::allocator_, GenericPointer< ValueType, Allocator >::nameBuffer_, GenericPointer< ValueType, Allocator >::ownAllocator_, GenericPointer< ValueType, Allocator >::parseErrorCode_, GenericPointer< ValueType, Allocator >::parseErrorOffset_, GenericPointer< ValueType, Allocator >::tokenCount_, et GenericPointer< ValueType, Allocator >::tokens_.
|
friend |
free-standing swap function helper
Helper function to enable support for common swap implementation pattern based on std::swap:
Allocator* GenericPointer< ValueType, Allocator >::allocator |
Allocator* GenericPointer< ValueType, Allocator >::allocator_ |
The current allocator. It is either user-supplied or equal to ownAllocator_.
Définition à la ligne 1101 du fichier pointer.h.
Référencé par GenericPointer< ValueType, Allocator >::Append(), et GenericPointer< ValueType, Allocator >::Swap().
Ch* GenericPointer< ValueType, Allocator >::nameBuffer_ |
A buffer containing all names in tokens.
Définition à la ligne 1103 du fichier pointer.h.
Référencé par GenericPointer< ValueType, Allocator >::operator=(), GenericPointer< ValueType, Allocator >::Swap(), et GenericPointer< ValueType, Allocator >::~GenericPointer().
Allocator* GenericPointer< ValueType, Allocator >::ownAllocator_ |
Allocator owned by this Pointer.
Définition à la ligne 1102 du fichier pointer.h.
Référencé par GenericPointer< ValueType, Allocator >::Swap(), et GenericPointer< ValueType, Allocator >::~GenericPointer().
PointerParseErrorCode GenericPointer< ValueType, Allocator >::parseErrorCode_ |
Parsing error code.
Définition à la ligne 1107 du fichier pointer.h.
Référencé par GenericPointer< ValueType, Allocator >::operator=(), et GenericPointer< ValueType, Allocator >::Swap().
size_t GenericPointer< ValueType, Allocator >::parseErrorOffset_ |
Offset in code unit when parsing fail.
Définition à la ligne 1106 du fichier pointer.h.
Référencé par GenericPointer< ValueType, Allocator >::operator=(), et GenericPointer< ValueType, Allocator >::Swap().
size_t GenericPointer< ValueType, Allocator >::tokenCount_ |
Number of tokens in tokens_.
Définition à la ligne 1105 du fichier pointer.h.
Référencé par GenericPointer< ValueType, Allocator >::Append(), GenericPointer< ValueType, Allocator >::operator=(), et GenericPointer< ValueType, Allocator >::Swap().
Token* GenericPointer< ValueType, Allocator >::tokens_ |
A list of tokens.
Définition à la ligne 1104 du fichier pointer.h.
Référencé par GenericPointer< ValueType, Allocator >::Append(), GenericPointer< ValueType, Allocator >::operator=(), GenericPointer< ValueType, Allocator >::Swap(), et GenericPointer< ValueType, Allocator >::~GenericPointer().