MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / operator[]

Function operator[]

Source/external/json.hpp:13470–13502  ·  view source on GitHub ↗

! @brief access to successor @pre The iterator is initialized; i.e. `m_object != nullptr`. */

Source from the content-addressed store, hash-verified

13468 @pre The iterator is initialized; i.e. `m_object != nullptr`.
13469 */
13470 reference operator[](difference_type n) const
13471 {
13472 JSON_ASSERT(m_object != nullptr);
13473
13474 switch (m_object->m_type)
13475 {
13476 case value_t::object:
13477 JSON_THROW(invalid_iterator::create(208, "cannot use operator[] for object iterators", m_object));
13478
13479 case value_t::array:
13480 return *std::next(m_it.array_iterator, n);
13481
13482 case value_t::null:
13483 JSON_THROW(invalid_iterator::create(214, "cannot get value", m_object));
13484
13485 case value_t::string:
13486 case value_t::boolean:
13487 case value_t::number_integer:
13488 case value_t::number_unsigned:
13489 case value_t::number_float:
13490 case value_t::binary:
13491 case value_t::discarded:
13492 default:
13493 {
13494 if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.get_value() == -n))
13495 {
13496 return *m_object;
13497 }
13498
13499 JSON_THROW(invalid_iterator::create(214, "cannot get value", m_object));
13500 }
13501 }
13502 }
13503
13504 /*!
13505 @brief return the key of an object iterator

Callers

nothing calls this directly

Calls 14

createFunction · 0.85
is_nullFunction · 0.85
is_arrayFunction · 0.85
set_parentsFunction · 0.85
beginFunction · 0.85
concatFunction · 0.85
type_nameFunction · 0.85
is_objectFunction · 0.85
set_parentFunction · 0.85
get_valueMethod · 0.80
sizeMethod · 0.80
capacityMethod · 0.80

Tested by

no test coverage detected