MySQL 9.0.0
Source Code Documentation
Json_wrapper_object_iterator Class Reference

Class that iterates over all members of a JSON object that is wrapped in a Json_wrapper instance. More...

#include <json_dom.h>

Public Types

using value_type = std::pair< MYSQL_LEX_CSTRING, Json_wrapper >
 
using reference = const value_type &
 
using pointer = const value_type *
 
using difference_type = ptrdiff_t
 
using iterator_category = std::forward_iterator_tag
 

Public Member Functions

 Json_wrapper_object_iterator (const Json_wrapper &wrapper, bool begin)
 Creates an iterator that iterates over all members of the given Json_wrapper, if it wraps a JSON object. More...
 
 Json_wrapper_object_iterator ()=default
 Forward iterators must be default constructible. More...
 
Json_wrapper_object_iteratoroperator++ ()
 Advances the iterator to the next element. More...
 
const Json_wrapper_object_iterator operator++ (int)
 Advances the iterator to the next element and returns an iterator that points to the current element (post-increment operator). More...
 
bool operator== (const Json_wrapper_object_iterator &other) const
 Checks two iterators for equality. More...
 
bool operator!= (const Json_wrapper_object_iterator &other) const
 Checks two iterators for inequality. More...
 
pointer operator-> ()
 
reference operator* ()
 

Private Member Functions

bool is_dom () const
 Returns true if iterating over a DOM. More...
 
void initialize_current_member ()
 Fill m_current_member with the key and value of the current member. More...
 

Private Attributes

value_type m_current_member
 Pair holding the key and value of the member pointed to by the iterator. More...
 
bool m_current_member_initialized {false}
 True if m_current_member is initialized. More...
 
const json_binary::Valuem_binary_value
 The binary JSON object being iterated over, or nullptr for DOMs. More...
 
size_t m_current_element_index
 The index of the current member in the binary JSON object. More...
 
Json_object::const_iterator m_iter
 Iterator pointing to the current member in the JSON DOM object. More...
 

Detailed Description

Class that iterates over all members of a JSON object that is wrapped in a Json_wrapper instance.

Member Typedef Documentation

◆ difference_type

◆ iterator_category

using Json_wrapper_object_iterator::iterator_category = std::forward_iterator_tag

◆ pointer

◆ reference

◆ value_type

Constructor & Destructor Documentation

◆ Json_wrapper_object_iterator() [1/2]

Json_wrapper_object_iterator::Json_wrapper_object_iterator ( const Json_wrapper wrapper,
bool  begin 
)

Creates an iterator that iterates over all members of the given Json_wrapper, if it wraps a JSON object.

If the wrapper does not wrap a JSON object, the result is undefined.

Parameters
wrapperthe Json_wrapper to iterate over
begintrue to construct an iterator that points to the first member of the object, false to construct a past-the-end iterator

◆ Json_wrapper_object_iterator() [2/2]

Json_wrapper_object_iterator::Json_wrapper_object_iterator ( )
default

Forward iterators must be default constructible.

Member Function Documentation

◆ initialize_current_member()

void Json_wrapper_object_iterator::initialize_current_member ( )
private

Fill m_current_member with the key and value of the current member.

◆ is_dom()

bool Json_wrapper_object_iterator::is_dom ( ) const
inlineprivate

Returns true if iterating over a DOM.

◆ operator!=()

Checks two iterators for inequality.

◆ operator*()

reference Json_wrapper_object_iterator::operator* ( )
inline

◆ operator++() [1/2]

Json_wrapper_object_iterator & Json_wrapper_object_iterator::operator++ ( )
inline

Advances the iterator to the next element.

◆ operator++() [2/2]

const Json_wrapper_object_iterator Json_wrapper_object_iterator::operator++ ( int  )
inline

Advances the iterator to the next element and returns an iterator that points to the current element (post-increment operator).

◆ operator->()

pointer Json_wrapper_object_iterator::operator-> ( )
inline

◆ operator==()

bool Json_wrapper_object_iterator::operator== ( const Json_wrapper_object_iterator other) const
inline

Checks two iterators for equality.

Member Data Documentation

◆ m_binary_value

const json_binary::Value* Json_wrapper_object_iterator::m_binary_value
private

The binary JSON object being iterated over, or nullptr for DOMs.

◆ m_current_element_index

size_t Json_wrapper_object_iterator::m_current_element_index
private

The index of the current member in the binary JSON object.

◆ m_current_member

value_type Json_wrapper_object_iterator::m_current_member
private

Pair holding the key and value of the member pointed to by the iterator.

◆ m_current_member_initialized

bool Json_wrapper_object_iterator::m_current_member_initialized {false}
private

True if m_current_member is initialized.

◆ m_iter

Json_object::const_iterator Json_wrapper_object_iterator::m_iter
private

Iterator pointing to the current member in the JSON DOM object.


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