nfx-json 1.5.2
Modern C++20 JSON library with schema validation and generation
Loading...
Searching...
No Matches
nfx::json::Document::ObjectIterator Class Reference

Object iterator wrapper that provides key() and value(). More...

#include <nfx/json/Document.h>

Collaboration diagram for nfx::json::Document::ObjectIterator:

Public Types

using iterator_category = std::forward_iterator_tag
 iterator category (forward iterator)
using value_type = std::pair<const std::string, Document>
 iterator value type
using difference_type = std::ptrdiff_t
 iterator difference type
using pointer = const value_type*
 iterator pointer type
using reference = const value_type&
 iterator reference type
using MapIterator = Object::const_iterator
 Underlying iterator type for Object.

Public Member Functions

 ObjectIterator (MapIterator iter)
 Construct from underlying iterator.
 ObjectIterator (const ObjectIterator &)=default
 Copy constructor.
 ObjectIterator (ObjectIterator &&) noexcept=default
 Move constructor.
ObjectIteratoroperator= (const ObjectIterator &)=default
 Copy assignment.
ObjectIteratoroperator= (ObjectIterator &&) noexcept=default
 Move assignment.
const std::string & key () const
 Get the key of the current element.
const Documentvalue () const
 Get the value of the current element (const).
Documentvalue ()
 Get the value of the current element (mutable).
const Documentoperator* () const
 Dereference operator (const).
Documentoperator* ()
 Dereference operator (mutable).
ObjectIteratoroperator++ ()
 Pre-increment operator.
bool operator!= (const ObjectIterator &other) const
 Inequality comparison.
bool operator== (const ObjectIterator &other) const
 Equality comparison.
MapIterator base () const
 Get the underlying iterator.

Public Attributes

MapIterator it
 The underlying iterator.

Detailed Description

Object iterator wrapper that provides key() and value().

Definition at line 716 of file Document.h.

Member Typedef Documentation

◆ difference_type

iterator difference type

Definition at line 726 of file Document.h.

◆ iterator_category

using nfx::json::Document::ObjectIterator::iterator_category = std::forward_iterator_tag

iterator category (forward iterator)

Definition at line 720 of file Document.h.

◆ MapIterator

using nfx::json::Document::ObjectIterator::MapIterator = Object::const_iterator

Underlying iterator type for Object.

Definition at line 735 of file Document.h.

◆ pointer

iterator pointer type

Definition at line 729 of file Document.h.

◆ reference

iterator reference type

Definition at line 732 of file Document.h.

◆ value_type

using nfx::json::Document::ObjectIterator::value_type = std::pair<const std::string, Document>

iterator value type

Definition at line 723 of file Document.h.

Constructor & Destructor Documentation

◆ ObjectIterator()

nfx::json::Document::ObjectIterator::ObjectIterator ( MapIterator iter)
inline

Construct from underlying iterator.

Parameters
iterThe underlying iterator to wrap

Member Function Documentation

◆ base()

MapIterator nfx::json::Document::ObjectIterator::base ( ) const
inline

Get the underlying iterator.

Returns
The underlying MapIterator

◆ key()

const std::string & nfx::json::Document::ObjectIterator::key ( ) const
inline

Get the key of the current element.

Returns
Const reference to the key string

◆ operator!=()

bool nfx::json::Document::ObjectIterator::operator!= ( const ObjectIterator & other) const
inline

Inequality comparison.

Parameters
otherThe iterator to compare with
Returns
true if iterators are not equal, false otherwise

◆ operator*() [1/2]

Document & nfx::json::Document::ObjectIterator::operator* ( )
inline

Dereference operator (mutable).

Returns
Mutable reference to the Document

◆ operator*() [2/2]

const Document & nfx::json::Document::ObjectIterator::operator* ( ) const
inline

Dereference operator (const).

Returns
Const reference to the Document

◆ operator++()

ObjectIterator & nfx::json::Document::ObjectIterator::operator++ ( )
inline

Pre-increment operator.

Returns
Reference to this iterator after increment

◆ operator=() [1/2]

ObjectIterator & nfx::json::Document::ObjectIterator::operator= ( const ObjectIterator & )
default

Copy assignment.

Returns
Reference to this iterator

◆ operator=() [2/2]

ObjectIterator & nfx::json::Document::ObjectIterator::operator= ( ObjectIterator && )
defaultnoexcept

Move assignment.

Returns
Reference to this iterator

◆ operator==()

bool nfx::json::Document::ObjectIterator::operator== ( const ObjectIterator & other) const
inline

Equality comparison.

Parameters
otherThe iterator to compare with
Returns
true if iterators are equal, false otherwise

◆ value() [1/2]

Document & nfx::json::Document::ObjectIterator::value ( )
inline

Get the value of the current element (mutable).

Returns
Mutable reference to the Document

◆ value() [2/2]

const Document & nfx::json::Document::ObjectIterator::value ( ) const
inline

Get the value of the current element (const).

Returns
Const reference to the Document

Member Data Documentation

◆ it

MapIterator nfx::json::Document::ObjectIterator::it

The underlying iterator.

Definition at line 738 of file Document.h.


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