Eclipse SUMO - Simulation of Urban MObility
|
JSON Pointer defines a string syntax for identifying a specific value within a JSON document. More...
#include <json.hpp>
Public Member Functions | |
const std::string & | back () const |
return last reference token | |
bool | empty () const noexcept |
return whether pointer points to the root document | |
json_pointer (const std::string &s="") | |
create JSON pointer | |
operator std::string () const | |
return a string representation of the JSON pointer | |
json_pointer & | operator/= (const json_pointer &ptr) |
append another JSON pointer at the end of this JSON pointer | |
json_pointer & | operator/= (std::size_t array_idx) |
append an array index at the end of this JSON pointer | |
json_pointer & | operator/= (std::string token) |
append an unescaped reference token at the end of this JSON pointer | |
json_pointer | parent_pointer () const |
returns the parent of this JSON pointer | |
void | pop_back () |
remove last reference token | |
void | push_back (const std::string &token) |
append an unescaped token at the end of the reference pointer | |
void | push_back (std::string &&token) |
append an unescaped token at the end of the reference pointer | |
std::string | to_string () const |
return a string representation of the JSON pointer | |
Private Member Functions | |
JSON_PRIVATE_UNLESS_TESTED JSON pointer has no | BasicJsonType ())) |
bool | contains (const BasicJsonType *ptr) const |
BasicJsonType & | get_and_create (BasicJsonType &j) const |
create and return a reference to the pointed to value | |
BasicJsonType & | get_checked (BasicJsonType *ptr) const |
const BasicJsonType & | get_checked (const BasicJsonType *ptr) const |
BasicJsonType & | get_unchecked (BasicJsonType *ptr) const |
return a reference to the pointed to value | |
const BasicJsonType & | get_unchecked (const BasicJsonType *ptr) const |
return a const reference to the pointed to value | |
Static Private Member Functions | |
static BasicJsonType::size_type | array_index (const std::string &s) |
static void | flatten (const std::string &reference_string, const BasicJsonType &value, BasicJsonType &result) |
static std::vector< std::string > | split (const std::string &reference_string) |
split the string input to reference tokens | |
static BasicJsonType | unflatten (const BasicJsonType &value) |
Private Attributes | |
JSON_PRIVATE_UNLESS_TESTED | : json_pointer top() const { if (JSON_HEDLEY_UNLIKELY(empty())) { JSON_THROW(detail::out_of_range::create(405 |
JSON_PRIVATE_UNLESS_TESTED JSON pointer has no | parent |
result | reference_tokens = {reference_tokens[0]} |
std::vector< std::string > | reference_tokens |
the reference tokens | |
json_pointer | result = *this |
return | result |
Friends | |
class | basic_json |
bool | operator!= (json_pointer const &lhs, json_pointer const &rhs) noexcept |
compares two JSON pointers for inequality | |
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 | |
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 | |
json_pointer | operator/ (const json_pointer &lhs, std::string token) |
create a new JSON pointer by appending the unescaped token at the end of the JSON pointer | |
bool | operator== (json_pointer const &lhs, json_pointer const &rhs) noexcept |
compares two JSON pointers for equality | |
JSON Pointer defines a string syntax for identifying a specific value within a JSON document.
|
inlineexplicit |
create JSON pointer
|
inlinestaticprivate |
[in] | s | reference token to be converted into an array index |
parse_error.106 | if an array index begins with '0' |
parse_error.109 | if an array index begins not with a digit |
out_of_range.404 | if string s could not be converted to an integer |
out_of_range.410 | if an array index exceeds size_type |
Definition at line 12408 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::BasicJsonType(), nlohmann::detail::parse_error::create(), nlohmann::detail::out_of_range::create(), JSON_CATCH, JSON_HEDLEY_UNLIKELY, JSON_THROW, and JSON_TRY.
Referenced by nlohmann::json_pointer< BasicJsonType >::contains(), nlohmann::json_pointer< BasicJsonType >::get_and_create(), nlohmann::json_pointer< BasicJsonType >::get_checked(), nlohmann::json_pointer< BasicJsonType >::get_checked(), nlohmann::json_pointer< BasicJsonType >::get_unchecked(), nlohmann::json_pointer< BasicJsonType >::get_unchecked(), and nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::patch().
|
inline |
return last reference token
Definition at line 12366 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::BasicJsonType(), nlohmann::detail::out_of_range::create(), nlohmann::json_pointer< BasicJsonType >::empty(), JSON_HEDLEY_UNLIKELY, JSON_THROW, and nlohmann::json_pointer< BasicJsonType >::reference_tokens.
|
private |
Referenced by nlohmann::json_pointer< BasicJsonType >::array_index(), nlohmann::json_pointer< BasicJsonType >::back(), nlohmann::json_pointer< BasicJsonType >::pop_back(), nlohmann::json_pointer< BasicJsonType >::split(), and nlohmann::json_pointer< BasicJsonType >::unflatten().
|
inlineprivate |
parse_error.106 | if an array index begins with '0' |
parse_error.109 | if an array index was not a number |
Definition at line 12772 of file json.hpp.
References nlohmann::detail::array, nlohmann::json_pointer< BasicJsonType >::array_index(), nlohmann::detail::binary, nlohmann::detail::boolean, nlohmann::detail::discarded, JSON_HEDLEY_UNLIKELY, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, nlohmann::json_pointer< BasicJsonType >::reference_tokens, and nlohmann::detail::string.
|
inlinenoexcept |
return whether pointer points to the root document
Definition at line 12392 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::reference_tokens.
Referenced by nlohmann::json_pointer< BasicJsonType >::back(), nlohmann::json_pointer< BasicJsonType >::parent_pointer(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::patch(), and nlohmann::json_pointer< BasicJsonType >::pop_back().
|
inlinestaticprivate |
[in] | reference_string | the reference string to the current value |
[in] | value | the value to consider |
[in,out] | result | the result object to insert values to |
null
. Definition at line 12928 of file json.hpp.
References nlohmann::detail::array, nlohmann::detail::binary, nlohmann::detail::boolean, nlohmann::detail::discarded, nlohmann::detail::escape(), nlohmann::json_pointer< BasicJsonType >::flatten(), nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, nlohmann::json_pointer< BasicJsonType >::result, and nlohmann::detail::string.
Referenced by nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::flatten(), and nlohmann::json_pointer< BasicJsonType >::flatten().
|
inlineprivate |
create and return a reference to the pointed to value
@complexity Linear in the number of reference tokens.
parse_error.109 | if array index is not a number |
type_error.313 | if value cannot be unflattened |
Definition at line 12473 of file json.hpp.
References nlohmann::detail::array, nlohmann::json_pointer< BasicJsonType >::array_index(), nlohmann::detail::binary, nlohmann::detail::boolean, nlohmann::detail::type_error::create(), nlohmann::detail::discarded, JSON_THROW, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, nlohmann::json_pointer< BasicJsonType >::reference_tokens, nlohmann::json_pointer< BasicJsonType >::result, and nlohmann::detail::string.
Referenced by nlohmann::json_pointer< BasicJsonType >::unflatten().
|
inlineprivate |
parse_error.106 | if an array index begins with '0' |
parse_error.109 | if an array index was not a number |
out_of_range.402 | if the array index '-' is used |
out_of_range.404 | if the JSON pointer can not be resolved |
Definition at line 12619 of file json.hpp.
References nlohmann::detail::array, nlohmann::json_pointer< BasicJsonType >::array_index(), nlohmann::detail::binary, nlohmann::detail::boolean, nlohmann::detail::out_of_range::create(), nlohmann::detail::discarded, JSON_HEDLEY_UNLIKELY, JSON_THROW, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, nlohmann::json_pointer< BasicJsonType >::reference_tokens, and nlohmann::detail::string.
Referenced by nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::at(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::at(), and nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::value().
|
inlineprivate |
parse_error.106 | if an array index begins with '0' |
parse_error.109 | if an array index was not a number |
out_of_range.402 | if the array index '-' is used |
out_of_range.404 | if the JSON pointer can not be resolved |
Definition at line 12724 of file json.hpp.
References nlohmann::detail::array, nlohmann::json_pointer< BasicJsonType >::array_index(), nlohmann::detail::binary, nlohmann::detail::boolean, nlohmann::detail::out_of_range::create(), nlohmann::detail::discarded, JSON_HEDLEY_UNLIKELY, JSON_THROW, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, nlohmann::json_pointer< BasicJsonType >::reference_tokens, and nlohmann::detail::string.
|
inlineprivate |
return a reference to the pointed to value
"/this/that"
on a null value is equivalent to calling operator[]("this").operator[]("that")
on that value, effectively changing the null value to an object.[in] | ptr | a JSON value |
@complexity Linear in the length of the JSON pointer.
parse_error.106 | if an array index begins with '0' |
parse_error.109 | if an array index was not a number |
out_of_range.404 | if the JSON pointer can not be resolved |
Definition at line 12552 of file json.hpp.
References nlohmann::detail::array, nlohmann::json_pointer< BasicJsonType >::array_index(), nlohmann::detail::binary, nlohmann::detail::boolean, nlohmann::detail::out_of_range::create(), nlohmann::detail::discarded, JSON_THROW, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, nlohmann::json_pointer< BasicJsonType >::reference_tokens, and nlohmann::detail::string.
Referenced by nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::operator[](), and nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::operator[]().
|
inlineprivate |
return a const reference to the pointed to value
[in] | ptr | a JSON value |
parse_error.106 | if an array index begins with '0' |
parse_error.109 | if an array index was not a number |
out_of_range.402 | if the array index '-' is used |
out_of_range.404 | if the JSON pointer can not be resolved |
Definition at line 12676 of file json.hpp.
References nlohmann::detail::array, nlohmann::json_pointer< BasicJsonType >::array_index(), nlohmann::detail::binary, nlohmann::detail::boolean, nlohmann::detail::out_of_range::create(), nlohmann::detail::discarded, JSON_HEDLEY_UNLIKELY, JSON_THROW, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, nlohmann::json_pointer< BasicJsonType >::reference_tokens, and nlohmann::detail::string.
|
inline |
return a string representation of the JSON pointer
Definition at line 12286 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::to_string().
|
inline |
append another JSON pointer at the end of this JSON pointer
Definition at line 12293 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::reference_tokens.
|
inline |
append an array index at the end of this JSON pointer
|
inline |
append an unescaped reference token at the end of this JSON pointer
Definition at line 12303 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::push_back().
|
inline |
returns the parent of this JSON pointer
Definition at line 12340 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::empty(), and nlohmann::json_pointer< BasicJsonType >::pop_back().
|
inline |
remove last reference token
Definition at line 12354 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::BasicJsonType(), nlohmann::detail::out_of_range::create(), nlohmann::json_pointer< BasicJsonType >::empty(), JSON_HEDLEY_UNLIKELY, JSON_THROW, and nlohmann::json_pointer< BasicJsonType >::reference_tokens.
Referenced by nlohmann::json_pointer< BasicJsonType >::parent_pointer(), and nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::patch().
|
inline |
append an unescaped token at the end of the reference pointer
Definition at line 12378 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::reference_tokens.
Referenced by nlohmann::json_pointer< BasicJsonType >::operator/=(), and nlohmann::json_pointer< BasicJsonType >::split().
|
inline |
append an unescaped token at the end of the reference pointer
Definition at line 12385 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::reference_tokens.
|
inlinestaticprivate |
split the string input to reference tokens
parse_error.107 | if the pointer is not empty or begins with '/' |
parse_error.108 | if character '~' is not followed by '0' or '1' |
Definition at line 12860 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::BasicJsonType(), nlohmann::detail::parse_error::create(), JSON_ASSERT, JSON_HEDLEY_UNLIKELY, JSON_THROW, nlohmann::json_pointer< BasicJsonType >::push_back(), nlohmann::json_pointer< BasicJsonType >::result, and nlohmann::detail::unescape().
|
inline |
return a string representation of the JSON pointer
Definition at line 12274 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::reference_tokens.
Referenced by nlohmann::json_pointer< BasicJsonType >::operator std::string().
|
inlinestaticprivate |
[in] | value | flattened JSON |
parse_error.109 | if array index is not a number |
type_error.314 | if value is not an object |
type_error.315 | if object values are not primitive |
type_error.313 | if value cannot be unflattened |
Definition at line 12999 of file json.hpp.
References nlohmann::json_pointer< BasicJsonType >::BasicJsonType(), nlohmann::detail::type_error::create(), nlohmann::json_pointer< BasicJsonType >::get_and_create(), JSON_HEDLEY_UNLIKELY, JSON_THROW, and nlohmann::json_pointer< BasicJsonType >::result.
|
friend |
|
friend |
compares two JSON pointers for inequality
[in] | lhs | JSON pointer to compare |
[in] | rhs | JSON pointer to compare |
@complexity Linear in the length of the JSON pointer
@exceptionsafety No-throw guarantee: this function never throws exceptions.
|
friend |
create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer
|
friend |
create a new JSON pointer by appending the array-index-token at the end of the JSON pointer
|
friend |
create a new JSON pointer by appending the unescaped token at the end of the JSON pointer
|
friend |
compares two JSON pointers for equality
[in] | lhs | JSON pointer to compare |
[in] | rhs | JSON pointer to compare |
@complexity Linear in the length of the JSON pointer
@exceptionsafety No-throw guarantee: this function never throws exceptions.
|
private |
|
private |
|
private |
Definition at line 12460 of file json.hpp.
Referenced by nlohmann::json_pointer< BasicJsonType >::back(), nlohmann::json_pointer< BasicJsonType >::contains(), nlohmann::json_pointer< BasicJsonType >::empty(), nlohmann::json_pointer< BasicJsonType >::get_and_create(), nlohmann::json_pointer< BasicJsonType >::get_checked(), nlohmann::json_pointer< BasicJsonType >::get_checked(), nlohmann::json_pointer< BasicJsonType >::get_unchecked(), nlohmann::json_pointer< BasicJsonType >::get_unchecked(), nlohmann::json_pointer< BasicJsonType >::operator/=(), nlohmann::json_pointer< BasicJsonType >::pop_back(), nlohmann::json_pointer< BasicJsonType >::push_back(), nlohmann::json_pointer< BasicJsonType >::push_back(), and nlohmann::json_pointer< BasicJsonType >::to_string().
|
private |
|
private |
Definition at line 12459 of file json.hpp.
Referenced by nlohmann::json_pointer< BasicJsonType >::flatten(), nlohmann::json_pointer< BasicJsonType >::get_and_create(), nlohmann::json_pointer< BasicJsonType >::split(), and nlohmann::json_pointer< BasicJsonType >::unflatten().
|
private |