All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Attributes | List of all members
nlohmann::detail::iteration_proxy_value< IteratorType > Class Template Reference

#include <json.hpp>

Public Types

using difference_type = std::ptrdiff_t
 
using value_type = iteration_proxy_value
 
using pointer = value_type *
 
using reference = value_type &
 
using iterator_category = std::input_iterator_tag
 
using string_type = typename std::remove_cv< typename std::remove_reference< decltype(std::declval< IteratorType >().key()) >::type >::type
 

Public Member Functions

 iteration_proxy_value (IteratorType it) noexcept
 
iteration_proxy_valueoperator* ()
 dereference operator (needed for range-based for) More...
 
iteration_proxy_valueoperator++ ()
 increment operator (needed for range-based for) More...
 
bool operator== (const iteration_proxy_value &o) const
 equality operator (needed for InputIterator) More...
 
bool operator!= (const iteration_proxy_value &o) const
 inequality operator (needed for range-based for) More...
 
const string_typekey () const
 return key of the iterator More...
 
IteratorType::reference value () const
 return value of the iterator More...
 

Private Attributes

IteratorType anchor
 the iterator More...
 
std::size_t array_index = 0
 an index for arrays (used to create key names) More...
 
std::size_t array_index_last = 0
 last stringified array index More...
 
string_type array_index_str = "0"
 a string representation of the array index More...
 
const string_type empty_str = ""
 an empty string (to return a reference for primitive values) More...
 

Detailed Description

template<typename IteratorType>
class nlohmann::detail::iteration_proxy_value< IteratorType >

Definition at line 3297 of file json.hpp.

Member Typedef Documentation

template<typename IteratorType>
using nlohmann::detail::iteration_proxy_value< IteratorType >::difference_type = std::ptrdiff_t

Definition at line 3300 of file json.hpp.

template<typename IteratorType>
using nlohmann::detail::iteration_proxy_value< IteratorType >::iterator_category = std::input_iterator_tag

Definition at line 3304 of file json.hpp.

template<typename IteratorType>
using nlohmann::detail::iteration_proxy_value< IteratorType >::pointer = value_type *

Definition at line 3302 of file json.hpp.

template<typename IteratorType>
using nlohmann::detail::iteration_proxy_value< IteratorType >::reference = value_type &

Definition at line 3303 of file json.hpp.

template<typename IteratorType>
using nlohmann::detail::iteration_proxy_value< IteratorType >::string_type = typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().key() ) >::type >::type

Definition at line 3305 of file json.hpp.

template<typename IteratorType>
using nlohmann::detail::iteration_proxy_value< IteratorType >::value_type = iteration_proxy_value

Definition at line 3301 of file json.hpp.

Constructor & Destructor Documentation

template<typename IteratorType>
nlohmann::detail::iteration_proxy_value< IteratorType >::iteration_proxy_value ( IteratorType  it)
inlineexplicitnoexcept

Definition at line 3320 of file json.hpp.

3320 : anchor(it) {}
IteratorType anchor
the iterator
Definition: json.hpp:3309

Member Function Documentation

template<typename IteratorType>
const string_type& nlohmann::detail::iteration_proxy_value< IteratorType >::key ( ) const
inline

return key of the iterator

Definition at line 3350 of file json.hpp.

3351  {
3352  assert(anchor.m_object != nullptr);
3353 
3354  switch (anchor.m_object->type())
3355  {
3356  // use integer array index as key
3357  case value_t::array:
3358  {
3360  {
3363  }
3364  return array_index_str;
3365  }
3366 
3367  // use key from the object
3368  case value_t::object:
3369  return anchor.key();
3370 
3371  // use an empty key for all primitive types
3372  default:
3373  return empty_str;
3374  }
3375  }
array (ordered collection of values)
const string_type empty_str
an empty string (to return a reference for primitive values)
Definition: json.hpp:3317
std::size_t array_index_last
last stringified array index
Definition: json.hpp:3313
std::size_t array_index
an index for arrays (used to create key names)
Definition: json.hpp:3311
object (unordered set of name/value pairs)
string_type array_index_str
a string representation of the array index
Definition: json.hpp:3315
IteratorType anchor
the iterator
Definition: json.hpp:3309
void int_to_string(string_type &target, std::size_t value)
Definition: json.hpp:3293
template<typename IteratorType>
bool nlohmann::detail::iteration_proxy_value< IteratorType >::operator!= ( const iteration_proxy_value< IteratorType > &  o) const
inline

inequality operator (needed for range-based for)

Definition at line 3344 of file json.hpp.

3345  {
3346  return anchor != o.anchor;
3347  }
IteratorType anchor
the iterator
Definition: json.hpp:3309
template<typename IteratorType>
iteration_proxy_value& nlohmann::detail::iteration_proxy_value< IteratorType >::operator* ( )
inline

dereference operator (needed for range-based for)

Definition at line 3323 of file json.hpp.

3324  {
3325  return *this;
3326  }
template<typename IteratorType>
iteration_proxy_value& nlohmann::detail::iteration_proxy_value< IteratorType >::operator++ ( )
inline

increment operator (needed for range-based for)

Definition at line 3329 of file json.hpp.

3330  {
3331  ++anchor;
3332  ++array_index;
3333 
3334  return *this;
3335  }
std::size_t array_index
an index for arrays (used to create key names)
Definition: json.hpp:3311
IteratorType anchor
the iterator
Definition: json.hpp:3309
template<typename IteratorType>
bool nlohmann::detail::iteration_proxy_value< IteratorType >::operator== ( const iteration_proxy_value< IteratorType > &  o) const
inline

equality operator (needed for InputIterator)

Definition at line 3338 of file json.hpp.

3339  {
3340  return anchor == o.anchor;
3341  }
IteratorType anchor
the iterator
Definition: json.hpp:3309
template<typename IteratorType>
IteratorType::reference nlohmann::detail::iteration_proxy_value< IteratorType >::value ( ) const
inline

return value of the iterator

Definition at line 3378 of file json.hpp.

3379  {
3380  return anchor.value();
3381  }
IteratorType anchor
the iterator
Definition: json.hpp:3309

Member Data Documentation

template<typename IteratorType>
IteratorType nlohmann::detail::iteration_proxy_value< IteratorType >::anchor
private

the iterator

Definition at line 3309 of file json.hpp.

template<typename IteratorType>
std::size_t nlohmann::detail::iteration_proxy_value< IteratorType >::array_index = 0
private

an index for arrays (used to create key names)

Definition at line 3311 of file json.hpp.

template<typename IteratorType>
std::size_t nlohmann::detail::iteration_proxy_value< IteratorType >::array_index_last = 0
mutableprivate

last stringified array index

Definition at line 3313 of file json.hpp.

template<typename IteratorType>
string_type nlohmann::detail::iteration_proxy_value< IteratorType >::array_index_str = "0"
mutableprivate

a string representation of the array index

Definition at line 3315 of file json.hpp.

template<typename IteratorType>
const string_type nlohmann::detail::iteration_proxy_value< IteratorType >::empty_str = ""
private

an empty string (to return a reference for primitive values)

Definition at line 3317 of file json.hpp.


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