Belle II Software light-2505-deimos
ObjectStatement< ObjectType, Columns >::iterator Class Reference

Iterator class to allow iterating over the rows. More...

#include <sqlite.h>

Collaboration diagram for ObjectStatement< ObjectType, Columns >::iterator:

Public Types

using iterator_category = std::input_iterator_tag
 Iterator category.
 
using value_type = ObjectType
 Value type.
 
using difference_type = size_t
 Difference type.
 
using pointer = value_type*
 Pointer.
 
using reference = value_type&
 Reference.
 

Public Member Functions

 iterator ()=default
 with a default constructor
 
 iterator (ObjectStatement *instance)
 and a real constructor to a statement
 
iteratoroperator++ ()
 increment to next row, stop in case we are done
 
iterator operator++ (int)
 also postfix increment
 
bool operator== (const iterator &other) const
 and equality check
 
bool operator!= (const iterator &other) const
 as well as inequality check
 
value_type operator* () const
 and a dereference operator
 

Private Attributes

ObjectStatementm_instance {nullptr}
 pointer to the statement
 
int64_t m_row { -1}
 current row index
 

Detailed Description

template<class ObjectType, class ... Columns>
class sqlite::ObjectStatement< ObjectType, Columns >::iterator

Iterator class to allow iterating over the rows.

Definition at line 200 of file sqlite.h.

Member Typedef Documentation

◆ difference_type

template<class ObjectType, class ... Columns>
using difference_type = size_t

Difference type.

Definition at line 210 of file sqlite.h.

◆ iterator_category

template<class ObjectType, class ... Columns>
using iterator_category = std::input_iterator_tag

Iterator category.

Definition at line 204 of file sqlite.h.

◆ pointer

template<class ObjectType, class ... Columns>
using pointer = value_type*

Pointer.

Definition at line 213 of file sqlite.h.

◆ reference

template<class ObjectType, class ... Columns>
using reference = value_type&

Reference.

Definition at line 216 of file sqlite.h.

◆ value_type

template<class ObjectType, class ... Columns>
using value_type = ObjectType

Value type.

Definition at line 207 of file sqlite.h.

Constructor & Destructor Documentation

◆ iterator()

template<class ObjectType, class ... Columns>
iterator ( ObjectStatement * instance)
inlineexplicit

and a real constructor to a statement

Definition at line 221 of file sqlite.h.

221 : m_instance(instance), m_row{0}
222 {
223 (*this)++;
224 }

Member Function Documentation

◆ operator!=()

template<class ObjectType, class ... Columns>
bool operator!= ( const iterator & other) const
inline

as well as inequality check

Definition at line 238 of file sqlite.h.

238{ return m_row != other.m_row; }

◆ operator*()

template<class ObjectType, class ... Columns>
value_type operator* ( ) const
inline

and a dereference operator

Definition at line 240 of file sqlite.h.

240{ return m_instance->getRow(); }

◆ operator++() [1/2]

template<class ObjectType, class ... Columns>
iterator & operator++ ( )
inline

increment to next row, stop in case we are done

Definition at line 226 of file sqlite.h.

227 {
228 if (m_row < 0) return *this;
229 ++m_row;
230 if (!m_instance->step()) m_row = -1;
231 return *this;
232 }

◆ operator++() [2/2]

template<class ObjectType, class ... Columns>
iterator operator++ ( int )
inline

also postfix increment

Definition at line 234 of file sqlite.h.

234{iterator retval = *this; ++(*this); return retval;}

◆ operator==()

template<class ObjectType, class ... Columns>
bool operator== ( const iterator & other) const
inline

and equality check

Definition at line 236 of file sqlite.h.

236{ return m_row == other.m_row; }

Member Data Documentation

◆ m_instance

template<class ObjectType, class ... Columns>
ObjectStatement* m_instance {nullptr}
private

pointer to the statement

Definition at line 243 of file sqlite.h.

243{nullptr};

◆ m_row

template<class ObjectType, class ... Columns>
int64_t m_row { -1}
private

current row index

Definition at line 245 of file sqlite.h.

245{ -1};

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