jubilant-funicular
Public Types | Public Member Functions | Private Attributes | List of all members
utils::Json::iterator< c > Class Template Reference

#include <Json.h>

Collaboration diagram for utils::Json::iterator< c >:
Collaboration graph
[legend]

Public Types

using value_type = typename std::conditional< c, const Json, Json >::type
 
using difference_type = std::ptrdiff_t
 
using pointer = typename std::conditional< c, const Json *, Json * >::type
 
using reference = typename std::conditional< c, const Json &, Json & >::type
 
using iterator_category = std::bidirectional_iterator_tag
 

Public Member Functions

 iterator (pointer json)
 
reference operator* () const
 
pointer operator-> () const
 
iteratoroperator++ ()
 
iterator operator++ (int)
 
iteratoroperator-- ()
 
iterator operator-- (int)
 
bool operator== (const iterator &rhs) const
 
bool operator!= (const iterator &rhs) const
 
std::string key ()
 
reference value ()
 
void set_begin (SetBeginEndKey _)
 
void set_end (SetBeginEndKey _)
 

Private Attributes

pointer m_json
 
union {
JsonObject::iterator m_obj_iter
 
JsonArray::iterator m_arr_iter
 
}; 
 

Detailed Description

template<bool c = 0>
class utils::Json::iterator< c >

Custom iterator for looping over Json values

For Arrays: loops over the elements

For Objects: loops over the values (keys accessible via Json::iterator::key())

For None: empty iterator

For anything else (except None): returns the value itself (see tests/utils/json_tests.cpp)

c=0 gives a regular iterator and c=1 gives a const_iterator

Definition at line 115 of file Json.h.


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