MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / GenericPointer

Class GenericPointer

rapidjson/pointer.h:81–1046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79*/
80template <typename ValueType, typename Allocator = CrtAllocator>
81class GenericPointer {
82public:
83 typedef typename ValueType::EncodingType EncodingType; //!< Encoding type from Value
84 typedef typename ValueType::Ch Ch; //!< Character type from Value
85
86 //! A token is the basic units of internal representation.
87 /*!
88 A JSON pointer string representation "/foo/123" is parsed to two tokens:
89 "foo" and 123. 123 will be represented in both numeric form and string form.
90 They are resolved according to the actual value type (object or array).
91
92 For token that are not numbers, or the numeric value is out of bound
93 (greater than limits of SizeType), they are only treated as string form
94 (i.e. the token's index will be equal to kPointerInvalidIndex).
95
96 This struct is public so that user can create a Pointer without parsing and
97 allocation, using a special constructor.
98 */
99 struct Token {
100 const Ch* name; //!< Name of the token. It has null character at the end but it can contain null character.
101 SizeType length; //!< Length of the name.
102 SizeType index; //!< A valid array index, if it is not equal to kPointerInvalidIndex.
103 };
104
105 //!@name Constructors and destructor.
106 //@{
107
108 //! Default constructor.
109 GenericPointer(Allocator* allocator = 0) : allocator_(allocator), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) {}
110
111 //! Constructor that parses a string or URI fragment representation.
112 /*!
113 \param source A null-terminated, string or URI fragment representation of JSON pointer.
114 \param allocator User supplied allocator for this pointer. If no allocator is provided, it creates a self-owned one.
115 */
116 explicit GenericPointer(const Ch* source, Allocator* allocator = 0) : allocator_(allocator), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) {
117 Parse(source, internal::StrLen(source));
118 }
119
120#if RAPIDJSON_HAS_STDSTRING
121 //! Constructor that parses a string or URI fragment representation.
122 /*!
123 \param source A string or URI fragment representation of JSON pointer.
124 \param allocator User supplied allocator for this pointer. If no allocator is provided, it creates a self-owned one.
125 \note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING.
126 */
127 explicit GenericPointer(const std::basic_string<Ch>& source, Allocator* allocator = 0) : allocator_(allocator), ownAllocator_(), nameBuffer_(), tokens_(), tokenCount_(), parseErrorOffset_(), parseErrorCode_(kPointerParseErrorNone) {
128 Parse(source.c_str(), source.size());
129 }
130#endif
131
132 //! Constructor that parses a string or URI fragment representation, with length of the source string.
133 /*!
134 \param source A string or URI fragment representation of JSON pointer.
135 \param length Length of source.
136 \param allocator User supplied allocator for this pointer. If no allocator is provided, it creates a self-owned one.
137 \note Slightly faster than the overload without length.
138 */

Callers

nothing calls this directly

Calls 8

ValueTypeEnum · 0.85
FindMemberMethod · 0.80
MemberEndMethod · 0.80
AddMemberMethod · 0.80
IsArrayMethod · 0.45
PushBackMethod · 0.45
SizeMethod · 0.45
ReserveMethod · 0.45

Tested by

no test coverage detected