Eclipse SUMO - Simulation of Urban MObility
nlohmann::json_pointer< BasicJsonType > Class Template Reference

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

#include <json.hpp>

Collaboration diagram for nlohmann::json_pointer< BasicJsonType >:
[legend]

Public Member Functions

const std::string & back () const
 return last reference token More...
 
bool empty () const noexcept
 return whether pointer points to the root document More...
 
 json_pointer (const std::string &s="")
 create JSON pointer More...
 
 operator std::string () const
 return a string representation of the JSON pointer More...
 
json_pointeroperator/= (const json_pointer &ptr)
 append another JSON pointer at the end of this JSON pointer More...
 
json_pointeroperator/= (std::size_t array_idx)
 append an array index at the end of this JSON pointer More...
 
json_pointeroperator/= (std::string token)
 append an unescaped reference token at the end of this JSON pointer More...
 
json_pointer parent_pointer () const
 returns the parent of this JSON pointer More...
 
void pop_back ()
 remove last reference token More...
 
void push_back (const std::string &token)
 append an unescaped token at the end of the reference pointer More...
 
void push_back (std::string &&token)
 append an unescaped token at the end of the reference pointer More...
 
std::string to_string () const
 return a string representation of the JSON pointer More...
 

Private Member Functions

JSON_PRIVATE_UNLESS_TESTED JSON pointer has no BasicJsonType ()))
 
bool contains (const BasicJsonType *ptr) const
 
BasicJsonTypeget_and_create (BasicJsonType &j) const
 create and return a reference to the pointed to value More...
 
BasicJsonTypeget_checked (BasicJsonType *ptr) const
 
const BasicJsonTypeget_checked (const BasicJsonType *ptr) const
 
BasicJsonTypeget_unchecked (BasicJsonType *ptr) const
 return a reference to the pointed to value More...
 
const BasicJsonTypeget_unchecked (const BasicJsonType *ptr) const
 return a const reference to the pointed to value More...
 

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 More...
 
static BasicJsonType unflatten (const BasicJsonType &value)
 

Private Attributes

JSON_PRIVATE_UNLESS_TESTED __pad0__: 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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
bool operator== (json_pointer const &lhs, json_pointer const &rhs) noexcept
 compares two JSON pointers for equality More...
 

Detailed Description

template<typename BasicJsonType>
class nlohmann::json_pointer< BasicJsonType >

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

See also
https://json.nlohmann.me/api/json_pointer/

Definition at line 12259 of file json.hpp.

Constructor & Destructor Documentation

◆ json_pointer()

template<typename BasicJsonType >
nlohmann::json_pointer< BasicJsonType >::json_pointer ( const std::string &  s = "")
inlineexplicit

create JSON pointer

See also
https://json.nlohmann.me/api/json_pointer/json_pointer/

Definition at line 12268 of file json.hpp.

Referenced by nlohmann::json_pointer< BasicJsonType >::unflatten().

Here is the caller graph for this function:

Member Function Documentation

◆ array_index()

template<typename BasicJsonType >
static BasicJsonType::size_type nlohmann::json_pointer< BasicJsonType >::array_index ( const std::string &  s)
inlinestaticprivate
Parameters
[in]sreference token to be converted into an array index
Returns
integer representation of s
Exceptions
parse_error.106if an array index begins with '0'
parse_error.109if an array index begins not with a digit
out_of_range.404if string s could not be converted to an integer
out_of_range.410if 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_unchecked(), and nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::patch().

Here is the caller graph for this function:

◆ back()

◆ BasicJsonType()

template<typename BasicJsonType >
JSON_PRIVATE_UNLESS_TESTED JSON pointer has no nlohmann::json_pointer< BasicJsonType >::BasicJsonType ( )
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().

Here is the caller graph for this function:

◆ contains()

template<typename BasicJsonType >
bool nlohmann::json_pointer< BasicJsonType >::contains ( const BasicJsonType ptr) const
inlineprivate

◆ empty()

template<typename BasicJsonType >
bool nlohmann::json_pointer< BasicJsonType >::empty ( ) const
inlinenoexcept

◆ flatten()

template<typename BasicJsonType >
static void nlohmann::json_pointer< BasicJsonType >::flatten ( const std::string &  reference_string,
const BasicJsonType value,
BasicJsonType result 
)
inlinestaticprivate
Parameters
[in]reference_stringthe reference string to the current value
[in]valuethe value to consider
[in,out]resultthe result object to insert values to
Note
Empty objects or arrays are flattened 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::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, nlohmann::json_pointer< BasicJsonType >::result, nlohmann::detail::string, and nlohmann::to_string().

Referenced by nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::flatten().

Here is the caller graph for this function:

◆ get_and_create()

template<typename BasicJsonType >
BasicJsonType& nlohmann::json_pointer< BasicJsonType >::get_and_create ( BasicJsonType j) const
inlineprivate

◆ get_checked() [1/2]

◆ get_checked() [2/2]

template<typename BasicJsonType >
const BasicJsonType& nlohmann::json_pointer< BasicJsonType >::get_checked ( const BasicJsonType ptr) const
inlineprivate

◆ get_unchecked() [1/2]

template<typename BasicJsonType >
BasicJsonType& nlohmann::json_pointer< BasicJsonType >::get_unchecked ( BasicJsonType ptr) const
inlineprivate

return a reference to the pointed to value

Note
This version does not throw if a value is not present, but tries to create nested values instead. For instance, calling this function with pointer "/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.
Parameters
[in]ptra JSON value
Returns
reference to the JSON value pointed to by the JSON pointer

@complexity Linear in the length of the JSON pointer.

Exceptions
parse_error.106if an array index begins with '0'
parse_error.109if an array index was not a number
out_of_range.404if 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[]().

Here is the caller graph for this function:

◆ get_unchecked() [2/2]

template<typename BasicJsonType >
const BasicJsonType& nlohmann::json_pointer< BasicJsonType >::get_unchecked ( const BasicJsonType ptr) const
inlineprivate

return a const reference to the pointed to value

Parameters
[in]ptra JSON value
Returns
const reference to the JSON value pointed to by the JSON pointer
Exceptions
parse_error.106if an array index begins with '0'
parse_error.109if an array index was not a number
out_of_range.402if the array index '-' is used
out_of_range.404if 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, nlohmann::detail::string, and nlohmann::to_string().

◆ operator std::string()

template<typename BasicJsonType >
nlohmann::json_pointer< BasicJsonType >::operator std::string ( ) const
inline

return a string representation of the JSON pointer

See also
https://json.nlohmann.me/api/json_pointer/operator_string/

Definition at line 12286 of file json.hpp.

References nlohmann::json_pointer< BasicJsonType >::to_string().

◆ operator/=() [1/3]

template<typename BasicJsonType >
json_pointer& nlohmann::json_pointer< BasicJsonType >::operator/= ( const json_pointer< BasicJsonType > &  ptr)
inline

append another JSON pointer at the end of this JSON pointer

See also
https://json.nlohmann.me/api/json_pointer/operator_slasheq/

Definition at line 12293 of file json.hpp.

References nlohmann::json_pointer< BasicJsonType >::reference_tokens.

◆ operator/=() [2/3]

template<typename BasicJsonType >
json_pointer& nlohmann::json_pointer< BasicJsonType >::operator/= ( std::size_t  array_idx)
inline

append an array index at the end of this JSON pointer

See also
https://json.nlohmann.me/api/json_pointer/operator_slasheq/

Definition at line 12311 of file json.hpp.

References nlohmann::to_string().

◆ operator/=() [3/3]

template<typename BasicJsonType >
json_pointer& nlohmann::json_pointer< BasicJsonType >::operator/= ( std::string  token)
inline

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

See also
https://json.nlohmann.me/api/json_pointer/operator_slasheq/

Definition at line 12303 of file json.hpp.

References nlohmann::json_pointer< BasicJsonType >::push_back().

◆ parent_pointer()

template<typename BasicJsonType >
json_pointer nlohmann::json_pointer< BasicJsonType >::parent_pointer ( ) const
inline

◆ pop_back()

◆ push_back() [1/2]

template<typename BasicJsonType >
void nlohmann::json_pointer< BasicJsonType >::push_back ( const std::string &  token)
inline

append an unescaped token at the end of the reference pointer

See also
https://json.nlohmann.me/api/json_pointer/push_back/

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().

Here is the caller graph for this function:

◆ push_back() [2/2]

template<typename BasicJsonType >
void nlohmann::json_pointer< BasicJsonType >::push_back ( std::string &&  token)
inline

append an unescaped token at the end of the reference pointer

See also
https://json.nlohmann.me/api/json_pointer/push_back/

Definition at line 12385 of file json.hpp.

References nlohmann::json_pointer< BasicJsonType >::reference_tokens.

◆ split()

template<typename BasicJsonType >
static std::vector<std::string> nlohmann::json_pointer< BasicJsonType >::split ( const std::string &  reference_string)
inlinestaticprivate

split the string input to reference tokens

Note
This function is only called by the json_pointer constructor. All exceptions below are documented there.
Exceptions
parse_error.107if the pointer is not empty or begins with '/'
parse_error.108if 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().

◆ to_string()

template<typename BasicJsonType >
std::string nlohmann::json_pointer< BasicJsonType >::to_string ( ) const
inline

return a string representation of the JSON pointer

See also
https://json.nlohmann.me/api/json_pointer/to_string/

Definition at line 12274 of file json.hpp.

References nlohmann::json_pointer< BasicJsonType >::reference_tokens.

Referenced by nlohmann::json_pointer< BasicJsonType >::operator std::string().

Here is the caller graph for this function:

◆ unflatten()

template<typename BasicJsonType >
static BasicJsonType nlohmann::json_pointer< BasicJsonType >::unflatten ( const BasicJsonType value)
inlinestaticprivate
Parameters
[in]valueflattened JSON
Returns
unflattened JSON
Exceptions
parse_error.109if array index is not a number
type_error.314if value is not an object
type_error.315if object values are not primitive
type_error.313if value cannot be unflattened

Definition at line 12999 of file json.hpp.

References nlohmann::json_pointer< BasicJsonType >::BasicJsonType(), nlohmann::detail::type_error::create(), JSON_HEDLEY_UNLIKELY, nlohmann::json_pointer< BasicJsonType >::json_pointer(), JSON_THROW, and nlohmann::json_pointer< BasicJsonType >::result.

Referenced by nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::unflatten().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ basic_json

template<typename BasicJsonType >
friend class basic_json
friend

Definition at line 12263 of file json.hpp.

◆ operator!=

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

compares two JSON pointers for inequality

Parameters
[in]lhsJSON pointer to compare
[in]rhsJSON pointer to compare
Returns
whether lhs is not equal rhs

@complexity Linear in the length of the JSON pointer

@exceptionsafety No-throw guarantee: this function never throws exceptions.

Definition at line 13054 of file json.hpp.

◆ operator/ [1/3]

template<typename BasicJsonType >
json_pointer operator/ ( const json_pointer< BasicJsonType > &  lhs,
const json_pointer< BasicJsonType > &  rhs 
)
friend

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

See also
https://json.nlohmann.me/api/json_pointer/operator_slash/

Definition at line 12318 of file json.hpp.

◆ operator/ [2/3]

template<typename BasicJsonType >
json_pointer operator/ ( const json_pointer< BasicJsonType > &  lhs,
std::size_t  array_idx 
)
friend

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

See also
https://json.nlohmann.me/api/json_pointer/operator_slash/

Definition at line 12333 of file json.hpp.

◆ operator/ [3/3]

template<typename BasicJsonType >
json_pointer operator/ ( const json_pointer< BasicJsonType > &  lhs,
std::string  token 
)
friend

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

See also
https://json.nlohmann.me/api/json_pointer/operator_slash/

Definition at line 12326 of file json.hpp.

◆ operator==

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

compares two JSON pointers for equality

Parameters
[in]lhsJSON pointer to compare
[in]rhsJSON pointer to compare
Returns
whether lhs is equal to rhs

@complexity Linear in the length of the JSON pointer

@exceptionsafety No-throw guarantee: this function never throws exceptions.

Definition at line 13037 of file json.hpp.

Field Documentation

◆ __pad0__

template<typename BasicJsonType >
JSON_PRIVATE_UNLESS_TESTED nlohmann::json_pointer< BasicJsonType >::__pad0__
private

Definition at line 12451 of file json.hpp.

◆ parent

template<typename BasicJsonType >
JSON_PRIVATE_UNLESS_TESTED JSON pointer has no nlohmann::json_pointer< BasicJsonType >::parent
private

Definition at line 12456 of file json.hpp.

◆ reference_tokens [1/2]

◆ reference_tokens [2/2]

template<typename BasicJsonType >
std::vector<std::string> nlohmann::json_pointer< BasicJsonType >::reference_tokens
private

the reference tokens

Definition at line 13061 of file json.hpp.

◆ result [1/2]

◆ result [2/2]

template<typename BasicJsonType >
return nlohmann::json_pointer< BasicJsonType >::result
private

Definition at line 12461 of file json.hpp.


The documentation for this class was generated from the following file: