Belle II Software development
ObjectStatement< ObjectType, Columns >::iterator Class Reference

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

#include <sqlite.h>

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 unequality 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

using difference_type = size_t

Difference type.

Definition at line 210 of file sqlite.h.

◆ iterator_category

using iterator_category = std::input_iterator_tag

Iterator category.

Definition at line 204 of file sqlite.h.

◆ pointer

using pointer = value_type*

Pointer.

Definition at line 213 of file sqlite.h.

◆ reference

Reference.

Definition at line 216 of file sqlite.h.

◆ value_type

using value_type = ObjectType

Value type.

Definition at line 207 of file sqlite.h.

Constructor & Destructor Documentation

◆ iterator()

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 }
ObjectStatement * m_instance
pointer to the statement
Definition: sqlite.h:243
int64_t m_row
current row index
Definition: sqlite.h:245

Member Function Documentation

◆ operator!=()

bool operator!= ( const iterator other) const
inline

as well as unequality check

Definition at line 238 of file sqlite.h.

238{ return m_row != other.m_row; }

◆ operator*()

value_type operator* ( ) const
inline

and a dereference operator

Definition at line 240 of file sqlite.h.

240{ return m_instance->getRow(); }
value_type getRow() const
Return the current row.
Definition: sqlite.h:293

◆ operator++() [1/2]

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 }
bool step()
Step to the next row in the result.
Definition: sqlite.h:283

◆ operator++() [2/2]

iterator operator++ ( int  )
inline

also postfix increment

Definition at line 234 of file sqlite.h.

234{iterator retval = *this; ++(*this); return retval;}
iterator()=default
with a default constructor

◆ operator==()

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

ObjectStatement* m_instance {nullptr}
private

pointer to the statement

Definition at line 243 of file sqlite.h.

◆ m_row

int64_t m_row { -1}
private

current row index

Definition at line 245 of file sqlite.h.


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