TerraForge3D  2.3.1
3D Terrain And Landscape Generator

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

13150 {
13151 for (const auto &reference_token : reference_tokens)
13152 {
13153 switch (ptr->type())
13154 {
13156 {
13157 // use unchecked object access
13158 ptr = &ptr->operator[](reference_token);
13159 break;
13160 }
13161
13163 {
13164 if (JSON_HEDLEY_UNLIKELY(reference_token == "-"))
13165 {
13166 // "-" cannot be used for const access
13167 JSON_THROW(detail::out_of_range::create(402, "array index '-' (" + std::to_string(ptr->m_value.array->size()) + ") is out of range", *ptr));
13168 }
13169
13170 // use unchecked array access
13171 ptr = &ptr->operator[](array_index(reference_token));
13172 break;
13173 }
13174
13183 default:
13184 JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'", *ptr));
13185 }
13186 }
13187
13188 return *ptr;
13189 }
static BasicJsonType::size_type array_index(const std::string &s)
Definition: json.hpp:12878
@ number_integer
number value (signed integer)
@ discarded
discarded by the parser callback function
@ binary
binary array (ordered collection of bytes)
@ object
object (unordered set of name/value pairs)
@ number_float
number value (floating-point)
@ number_unsigned
number value (unsigned integer)
@ array
array (ordered collection of values)