9#include <nlohmann/detail/meta/type_traits.hpp>
10#include <nlohmann/detail/value_t.hpp>
16template<
typename string_type>
17void int_to_string( string_type& target, std::size_t
value )
26 using difference_type = std::ptrdiff_t;
30 using iterator_category = std::input_iterator_tag;
31 using string_type =
typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().
key() ) >::type >::type;
37 std::size_t array_index = 0;
39 mutable std::size_t array_index_last = 0;
41 mutable string_type array_index_str =
"0";
43 const string_type empty_str{};
47 : anchor(std::move(it))
68 return anchor == o.anchor;
74 return anchor != o.anchor;
78 const string_type&
key()
const
80 JSON_ASSERT(anchor.m_object !=
nullptr);
82 switch (anchor.m_object->type())
87 if (array_index != array_index_last)
89 int_to_string( array_index_str, array_index );
90 array_index_last = array_index;
92 return array_index_str;
114 typename IteratorType::reference
value()
const
116 return anchor.value();
125 typename IteratorType::reference container;
147template<std::
size_t N,
typename IteratorType, enable_if_t<N == 0,
int> = 0>
155template<std::
size_t N,
typename IteratorType, enable_if_t<N == 1,
int> = 0>
169#if defined(__clang__)
171 #pragma clang diagnostic push
172 #pragma clang diagnostic ignored "-Wmismatched-tags"
174template<
typename IteratorType>
176 :
public std::integral_constant<std::size_t, 2> {};
178template<std::
size_t N,
typename IteratorType>
182 using type =
decltype(
183 get<N>(std::declval <
186#if defined(__clang__)
187 #pragma clang diagnostic pop
Definition iteration_proxy.hpp:24
bool operator!=(const iteration_proxy_value &o) const
inequality operator (needed for range-based for)
Definition iteration_proxy.hpp:72
IteratorType::reference value() const
return value of the iterator
Definition iteration_proxy.hpp:114
iteration_proxy_value & operator++()
increment operator (needed for range-based for)
Definition iteration_proxy.hpp:57
iteration_proxy_value & operator*()
dereference operator (needed for range-based for)
Definition iteration_proxy.hpp:51
const string_type & key() const
return key of the iterator
Definition iteration_proxy.hpp:78
bool operator==(const iteration_proxy_value &o) const
equality operator (needed for InputIterator)
Definition iteration_proxy.hpp:66
proxy class for the items() function
Definition iteration_proxy.hpp:122
iteration_proxy_value< IteratorType > begin() noexcept
return iterator begin (needed for range-based for)
Definition iteration_proxy.hpp:133
iteration_proxy_value< IteratorType > end() noexcept
return iterator end (needed for range-based for)
Definition iteration_proxy.hpp:139
iteration_proxy(typename IteratorType::reference cont) noexcept
construct iteration proxy from a container
Definition iteration_proxy.hpp:129
@ 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)
@ value
the parser finished reading a JSON value
namespace for Niels Lohmann
Definition adl_serializer.hpp:12
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
Definition json.hpp:8969