Arduino KVComm  master
Key-Value pair communication library for Arduino
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
KV_Iterator::iterator Class Reference

#include <KVComm/KV_Iterator.hpp>

Collaboration diagram for KV_Iterator::iterator:

Public Types

using difference_type = void
 
using value_type = KV
 
using pointer = KV *
 
using reference = KV &
 
using iterator_category = std::input_iterator_tag
 

Public Member Functions

 iterator ()
 Default constructor. Used as "end" iterator (sentinel). More...
 
 iterator (const uint8_t *buffer, size_t length)
 Create KV_Iterator that iterates over the elements in the buffer. More...
 
iteratoroperator++ ()
 Advance the iterator. More...
 
bool operator!= (const iterator &other) const
 Compare the iterator to the "end" iterator. More...
 
const KVoperator* () const
 
const KVoperator-> () const
 
 operator bool () const
 Check if the iterator is valid. More...
 

Protected Member Functions

void checkLength ()
 

Private Attributes

KV kv
 
size_t remainingBufferLength
 

Detailed Description

Definition at line 268 of file KV_Iterator.hpp.

Member Typedef Documentation

◆ difference_type

using difference_type = void

Definition at line 295 of file KV_Iterator.hpp.

◆ value_type

using value_type = KV

Definition at line 296 of file KV_Iterator.hpp.

◆ pointer

using pointer = KV *

Definition at line 297 of file KV_Iterator.hpp.

◆ reference

using reference = KV &

Definition at line 298 of file KV_Iterator.hpp.

◆ iterator_category

using iterator_category = std::input_iterator_tag

Definition at line 299 of file KV_Iterator.hpp.

Constructor & Destructor Documentation

◆ iterator() [1/2]

iterator ( )

Default constructor. Used as "end" iterator (sentinel).

Definition at line 19 of file KV_Iterator.cpp.

◆ iterator() [2/2]

iterator ( const uint8_t *  buffer,
size_t  length 
)

Create KV_Iterator that iterates over the elements in the buffer.

Only the pointer is saved, the buffer itself is not copied over, so its lifetime must be longer than all iterators that point to it.

Definition at line 21 of file KV_Iterator.cpp.

Member Function Documentation

◆ operator++()

KV_Iterator::iterator & operator++ ( )

Advance the iterator.

Definition at line 26 of file KV_Iterator.cpp.

◆ operator!=()

bool operator!= ( const iterator other) const

Compare the iterator to the "end" iterator.

(Only compares the buffer pointer, which is nullptr for the "end" iterator.)

Definition at line 36 of file KV_Iterator.cpp.

◆ operator*()

const KV& operator* ( ) const
inline

Definition at line 289 of file KV_Iterator.hpp.

◆ operator->()

const KV* operator-> ( ) const
inline

Definition at line 290 of file KV_Iterator.hpp.

◆ operator bool()

operator bool ( ) const
inlineexplicit

Check if the iterator is valid.

Definition at line 293 of file KV_Iterator.hpp.

◆ checkLength()

void checkLength ( )
protected

Definition at line 47 of file KV_Iterator.cpp.

Member Data Documentation

◆ kv

KV kv
private

Definition at line 305 of file KV_Iterator.hpp.

◆ remainingBufferLength

size_t remainingBufferLength
private

Definition at line 306 of file KV_Iterator.hpp.


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