flexiblesusy is hosted by Hepforge, IPPP Durham
FlexibleSUSY
nlohmann::json_abi_v3_11_3::json_pointer< RefStringType > 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_abi_v3_11_3::json_pointer< RefStringType >:
Collaboration graph

Classes

struct  string_t_helper
 
struct  string_t_helper< basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass > >
 

Public Types

using string_t = typename string_t_helper< RefStringType >::type
 

Public Member Functions

const string_tback () const
 return last reference token More...
 
bool empty () const noexcept
 return whether pointer points to the root document More...
 
 json_pointer (const string_t &s="")
 create JSON pointer More...
 
 operator string_t () 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/= (string_t 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 string_t &token)
 append an unescaped token at the end of the reference pointer More...
 
void push_back (string_t &&token)
 append an unescaped token at the end of the reference pointer More...
 
string_t to_string () const
 return a string representation of the JSON pointer More...
 

Private Member Functions

template<typename BasicJsonType >
bool contains (const BasicJsonType *ptr) const
 
json_pointer< string_tconvert () &&
 
json_pointer< string_tconvert () const &
 
template<typename BasicJsonType >
BasicJsonType & get_and_create (BasicJsonType &j) const
 create and return a reference to the pointed to value More...
 
template<typename BasicJsonType >
BasicJsonType & get_checked (BasicJsonType *ptr) const
 
template<typename BasicJsonType >
const BasicJsonType & get_checked (const BasicJsonType *ptr) const
 
template<typename BasicJsonType >
BasicJsonType & get_unchecked (BasicJsonType *ptr) const
 return a reference to the pointed to value More...
 
template<typename BasicJsonType >
const BasicJsonType & get_unchecked (const BasicJsonType *ptr) const
 return a const reference to the pointed to value More...
 
json_pointer top () const
 

Static Private Member Functions

template<typename BasicJsonType >
static BasicJsonType::size_type array_index (const string_t &s)
 
template<typename BasicJsonType >
static void flatten (const string_t &reference_string, const BasicJsonType &value, BasicJsonType &result)
 
static std::vector< string_tsplit (const string_t &reference_string)
 split the string input to reference tokens More...
 
template<typename BasicJsonType >
static BasicJsonType unflatten (const BasicJsonType &value)
 

Private Attributes

std::vector< string_treference_tokens
 the reference tokens More...
 

Friends

template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer, class BinaryType , class CustomBaseClass >
class basic_json
 
template<typename >
class json_pointer
 
template<typename RefStringTypeLhs , typename RefStringTypeRhs >
bool operator!= (const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept
 compares two JSON pointers for inequality More...
 
template<typename RefStringTypeLhs , typename StringType >
bool operator!= (const json_pointer< RefStringTypeLhs > &lhs, const StringType &rhs)
 compares JSON pointer and string for inequality More...
 
template<typename RefStringTypeRhs , typename StringType >
bool operator!= (const StringType &lhs, const json_pointer< RefStringTypeRhs > &rhs)
 compares string and JSON pointer 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, string_t token)
 create a new JSON pointer by appending the unescaped token at the end of the JSON pointer More...
 
template<typename RefStringTypeLhs , typename RefStringTypeRhs >
bool operator< (const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept
 compares two JSON pointer for less-than More...
 
std::ostream & operator<< (std::ostream &o, const json_pointer &ptr)
 write string representation of the JSON pointer to stream More...
 
template<typename RefStringTypeLhs , typename RefStringTypeRhs >
bool operator== (const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept
 compares two JSON pointers for equality More...
 
template<typename RefStringTypeLhs , typename StringType >
bool operator== (const json_pointer< RefStringTypeLhs > &lhs, const StringType &rhs)
 compares JSON pointer and string for equality More...
 
template<typename RefStringTypeRhs , typename StringType >
bool operator== (const StringType &lhs, const json_pointer< RefStringTypeRhs > &rhs)
 compares string and JSON pointer for equality More...
 

Detailed Description

template<typename RefStringType>
class nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >

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 13840 of file json.hpp.

Member Typedef Documentation

◆ string_t

template<typename RefStringType >
using nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::string_t = typename string_t_helper<RefStringType>::type

Definition at line 13863 of file json.hpp.

Constructor & Destructor Documentation

◆ json_pointer()

template<typename RefStringType >
nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::json_pointer ( const string_t s = "")
inlineexplicit

create JSON pointer

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

Definition at line 13867 of file json.hpp.

Member Function Documentation

◆ array_index()

template<typename RefStringType >
template<typename BasicJsonType >
static BasicJsonType::size_type nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::array_index ( const string_t 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 14019 of file json.hpp.

References nlohmann::json_abi_v3_11_3::detail::concat(), JSON_HEDLEY_UNLIKELY, and JSON_THROW.

◆ back()

◆ contains()

template<typename RefStringType >
template<typename BasicJsonType >
bool nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::contains ( const BasicJsonType *  ptr) const
inlineprivate
Exceptions
parse_error.106if an array index begins with '0'
parse_error.109if an array index was not a number

Definition at line 14383 of file json.hpp.

References JSON_HEDLEY_UNLIKELY.

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

◆ convert() [1/2]

template<typename RefStringType >
json_pointer< string_t > nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::convert ( ) &&
inlineprivate

◆ convert() [2/2]

template<typename RefStringType >
json_pointer< string_t > nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::convert ( ) const &
inlineprivate

◆ empty()

◆ flatten()

template<typename RefStringType >
template<typename BasicJsonType >
static void nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::flatten ( const string_t 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 14540 of file json.hpp.

References nlohmann::json_abi_v3_11_3::detail::concat(), nlohmann::json_abi_v3_11_3::detail::escape(), and nlohmann::json_abi_v3_11_3::to_string().

◆ get_and_create()

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

create and return a reference to the pointed to value

@complexity Linear in the number of reference tokens.

Exceptions
parse_error.109if array index is not a number
type_error.313if value cannot be unflattened

Definition at line 14079 of file json.hpp.

References JSON_THROW.

Referenced by nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::unflatten().

◆ get_checked() [1/2]

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

◆ get_checked() [2/2]

template<typename RefStringType >
template<typename BasicJsonType >
const BasicJsonType & nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::get_checked ( const BasicJsonType *  ptr) const
inlineprivate
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 14334 of file json.hpp.

References nlohmann::json_abi_v3_11_3::detail::concat(), JSON_HEDLEY_UNLIKELY, JSON_THROW, and nlohmann::json_abi_v3_11_3::to_string().

◆ get_unchecked() [1/2]

template<typename RefStringType >
template<typename BasicJsonType >
BasicJsonType & nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::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 14159 of file json.hpp.

References nlohmann::json_abi_v3_11_3::detail::concat(), and JSON_THROW.

Referenced by nlohmann::json_abi_v3_11_3::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass >::operator[]().

◆ get_unchecked() [2/2]

template<typename RefStringType >
template<typename BasicJsonType >
const BasicJsonType & nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::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 14285 of file json.hpp.

References nlohmann::json_abi_v3_11_3::detail::concat(), JSON_HEDLEY_UNLIKELY, JSON_THROW, and nlohmann::json_abi_v3_11_3::to_string().

◆ operator string_t()

template<typename RefStringType >
nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::operator string_t ( ) const
inline

return a string representation of the JSON pointer

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

Definition at line 13886 of file json.hpp.

References nlohmann::json_abi_v3_11_3::to_string().

◆ operator/=() [1/3]

template<typename RefStringType >
json_pointer & nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::operator/= ( const json_pointer< RefStringType > &  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 13903 of file json.hpp.

References nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::reference_tokens.

◆ operator/=() [2/3]

template<typename RefStringType >
json_pointer & nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::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 13921 of file json.hpp.

References nlohmann::json_abi_v3_11_3::to_string().

◆ operator/=() [3/3]

template<typename RefStringType >
json_pointer & nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::operator/= ( string_t  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 13913 of file json.hpp.

◆ parent_pointer()

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

returns the parent of this JSON pointer

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

Definition at line 13950 of file json.hpp.

References nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::pop_back().

◆ pop_back()

◆ push_back() [1/2]

template<typename RefStringType >
void nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::push_back ( const string_t 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 13988 of file json.hpp.

◆ push_back() [2/2]

template<typename RefStringType >
void nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::push_back ( string_t &&  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 13995 of file json.hpp.

◆ split()

template<typename RefStringType >
static std::vector< string_t > nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::split ( const string_t 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 14471 of file json.hpp.

References nlohmann::json_abi_v3_11_3::detail::concat(), JSON_ASSERT, JSON_HEDLEY_UNLIKELY, JSON_THROW, and nlohmann::json_abi_v3_11_3::detail::unescape().

◆ to_string()

template<typename RefStringType >
string_t nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::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 13873 of file json.hpp.

◆ top()

◆ unflatten()

template<typename RefStringType >
template<typename BasicJsonType >
static BasicJsonType nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::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 14612 of file json.hpp.

References nlohmann::json_abi_v3_11_3::json_pointer< RefStringType >::get_and_create(), JSON_HEDLEY_UNLIKELY, and JSON_THROW.

Friends And Related Function Documentation

◆ basic_json

template<typename RefStringType >
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer, class BinaryType , class CustomBaseClass >
friend class basic_json
friend

Definition at line 13844 of file json.hpp.

◆ json_pointer

template<typename RefStringType >
template<typename >
friend class json_pointer
friend

Definition at line 13847 of file json.hpp.

◆ operator!= [1/3]

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

compares two JSON pointers for inequality

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

Definition at line 14761 of file json.hpp.

◆ operator!= [2/3]

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

compares JSON pointer and string for inequality

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

Definition at line 14770 of file json.hpp.

◆ operator!= [3/3]

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

compares string and JSON pointer for inequality

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

Definition at line 14779 of file json.hpp.

◆ operator/ [1/3]

template<typename RefStringType >
json_pointer operator/ ( const json_pointer< RefStringType > &  lhs,
const json_pointer< RefStringType > &  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 13928 of file json.hpp.

◆ operator/ [2/3]

template<typename RefStringType >
json_pointer operator/ ( const json_pointer< RefStringType > &  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 13943 of file json.hpp.

◆ operator/ [3/3]

template<typename RefStringType >
json_pointer operator/ ( const json_pointer< RefStringType > &  lhs,
string_t  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 13936 of file json.hpp.

◆ operator<

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

compares two JSON pointer for less-than

Definition at line 14786 of file json.hpp.

◆ operator<<

template<typename RefStringType >
std::ostream & operator<< ( std::ostream &  o,
const json_pointer< RefStringType > &  ptr 
)
friend

write string representation of the JSON pointer to stream

See also
https://json.nlohmann.me/api/basic_json/operator_ltlt/

Definition at line 13894 of file json.hpp.

◆ operator== [1/3]

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

compares two JSON pointers for equality

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

Definition at line 14736 of file json.hpp.

◆ operator== [2/3]

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

compares JSON pointer and string for equality

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

Definition at line 14745 of file json.hpp.

◆ operator== [3/3]

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

compares string and JSON pointer for equality

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

Definition at line 14754 of file json.hpp.

Member Data Documentation

◆ reference_tokens


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