Template Class json_pointer

Nested Relationships

Nested Types

Class Documentation

template<typename RefStringType>
class json_pointer

JSON Pointer defines a string syntax for identifying a specific value within a JSON document.

Public Types

using string_t = typename string_t_helper<RefStringType>::type

Public Functions

inline explicit json_pointer(const string_t &s = "")

create JSON pointer

inline string_t to_string() const

return a string representation of the JSON pointer

inline operator string_t() const

return a string representation of the JSON pointer

inline json_pointer &operator/=(const json_pointer &ptr)

append another JSON pointer at the end of this JSON pointer

inline json_pointer &operator/=(string_t token)

append an unescaped reference token at the end of this JSON pointer

inline json_pointer &operator/=(std::size_t array_idx)

append an array index at the end of this JSON pointer

inline json_pointer parent_pointer() const

returns the parent of this JSON pointer

inline void pop_back()

remove last reference token

inline const string_t &back() const

return last reference token

inline void push_back(const string_t &token)

append an unescaped token at the end of the reference pointer

inline void push_back(string_t &&token)

append an unescaped token at the end of the reference pointer

inline bool empty() const noexcept

return whether pointer points to the root document

Friends

inline friend std::ostream &operator<<(std::ostream &o, const json_pointer &ptr)

write string representation of the JSON pointer to stream

inline friend json_pointer operator/(const json_pointer &lhs, const json_pointer &rhs)

create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer

inline friend json_pointer operator/(const json_pointer &lhs, string_t token)

create a new JSON pointer by appending the unescaped token at the end of the JSON pointer

inline friend json_pointer operator/(const json_pointer &lhs, std::size_t array_idx)

create a new JSON pointer by appending the array-index-token at the end of the JSON pointer

template<typename RefStringTypeLhs, typename RefStringTypeRhs>
friend bool operator==(const json_pointer<RefStringTypeLhs> &lhs, const json_pointer<RefStringTypeRhs> &rhs) noexcept

compares two JSON pointers for equality

template<typename RefStringTypeLhs, typename StringType>
friend bool operator==(const json_pointer<RefStringTypeLhs> &lhs, const StringType &rhs)

compares JSON pointer and string for equality

template<typename RefStringTypeRhs, typename StringType>
friend bool operator==(const StringType &lhs, const json_pointer<RefStringTypeRhs> &rhs)

compares string and JSON pointer for equality

template<typename RefStringTypeLhs, typename RefStringTypeRhs>
friend bool operator!=(const json_pointer<RefStringTypeLhs> &lhs, const json_pointer<RefStringTypeRhs> &rhs) noexcept

compares two JSON pointers for inequality

template<typename RefStringTypeLhs, typename StringType>
friend bool operator!=(const json_pointer<RefStringTypeLhs> &lhs, const StringType &rhs)

compares JSON pointer and string for inequality

template<typename RefStringTypeRhs, typename StringType>
friend bool operator!=(const StringType &lhs, const json_pointer<RefStringTypeRhs> &rhs)

compares string and JSON pointer for inequality

template<typename RefStringTypeLhs, typename RefStringTypeRhs>
friend bool operator<(const json_pointer<RefStringTypeLhs> &lhs, const json_pointer<RefStringTypeRhs> &rhs) noexcept

compares two JSON pointer for less-than