QxOrm 1.4.9
C++ Object Relational Mapping library
Loading...
Searching...
No Matches

qx::QxCollectionIterator : Java-style iterator to iterate over a qx::QxCollection<Key, Value> container More...

#include <QxCollectionIterator.h>

Public Member Functions

 QxCollectionIterator (const QxCollection< Key, Value > &col)
 Construct an iterator for traversing the collection. The iterator is set to be at the front of the list (before the first item)
 
 ~QxCollectionIterator ()
 Destroy the iterator.
 
const Key & key () const
 Return the 'key' at current position.
 
const Value & value () const
 Return the 'value' at current position.
 
void toFirst ()
 Move the iterator to the front of the container (before the first item)
 
void toLast ()
 Move the iterator to the back of the container (after the last item)
 
bool next ()
 Advance the iterator by one position. Return 'true' if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise return 'false'.
 
bool previous ()
 Move the iterator back by one position. Return 'true' if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise return 'false'.
 

Private Member Functions

 QxCollectionIterator (const QxCollectionIterator &other)
 
QxCollectionIteratoroperator= (const QxCollectionIterator &other)
 

Private Attributes

const QxCollection< Key, Value > * m_pCollection
 Collection to iterate over.
 
long m_lCurrIndex
 Current index (position) in the collection.
 

Detailed Description

template<typename Key, typename Value>
class qx::QxCollectionIterator< Key, Value >

qx::QxCollectionIterator : Java-style iterator to iterate over a qx::QxCollection<Key, Value> container

Quick sample using qx::QxCollectionIterator Java-style iterator :

// iterate over a drugs container using 'qx::QxCollectionIterator' Java-style iterator
while (itr.next())
{
QString code = itr.key();
qDebug() << qPrintable(itr.value()->name) << " " << qPrintable(itr.value()->desc);
}
qx::QxCollectionIterator : Java-style iterator to iterate over a qx::QxCollection<Key,...

Definition at line 66 of file QxCollectionIterator.h.

Constructor & Destructor Documentation

◆ QxCollectionIterator() [1/2]

template<typename Key , typename Value >
qx::QxCollectionIterator< Key, Value >::QxCollectionIterator ( const QxCollection< Key, Value > & col)

Construct an iterator for traversing the collection. The iterator is set to be at the front of the list (before the first item)

◆ ~QxCollectionIterator()

template<typename Key , typename Value >
qx::QxCollectionIterator< Key, Value >::~QxCollectionIterator ( )

Destroy the iterator.

◆ QxCollectionIterator() [2/2]

template<typename Key , typename Value >
qx::QxCollectionIterator< Key, Value >::QxCollectionIterator ( const QxCollectionIterator< Key, Value > & other)
inlineprivate

Definition at line 90 of file QxCollectionIterator.h.

Member Function Documentation

◆ key()

template<typename Key , typename Value >
const Key & qx::QxCollectionIterator< Key, Value >::key ( ) const
inline

Return the 'key' at current position.

◆ next()

template<typename Key , typename Value >
bool qx::QxCollectionIterator< Key, Value >::next ( )
inline

Advance the iterator by one position. Return 'true' if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise return 'false'.

◆ operator=()

template<typename Key , typename Value >
QxCollectionIterator & qx::QxCollectionIterator< Key, Value >::operator= ( const QxCollectionIterator< Key, Value > & other)
inlineprivate

Definition at line 91 of file QxCollectionIterator.h.

◆ previous()

template<typename Key , typename Value >
bool qx::QxCollectionIterator< Key, Value >::previous ( )
inline

Move the iterator back by one position. Return 'true' if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise return 'false'.

◆ toFirst()

template<typename Key , typename Value >
void qx::QxCollectionIterator< Key, Value >::toFirst ( )
inline

Move the iterator to the front of the container (before the first item)

◆ toLast()

template<typename Key , typename Value >
void qx::QxCollectionIterator< Key, Value >::toLast ( )
inline

Move the iterator to the back of the container (after the last item)

◆ value()

template<typename Key , typename Value >
const Value & qx::QxCollectionIterator< Key, Value >::value ( ) const
inline

Return the 'value' at current position.

Member Data Documentation

◆ m_lCurrIndex

template<typename Key , typename Value >
long qx::QxCollectionIterator< Key, Value >::m_lCurrIndex
private

Current index (position) in the collection.

Definition at line 72 of file QxCollectionIterator.h.

◆ m_pCollection

template<typename Key , typename Value >
const QxCollection<Key, Value>* qx::QxCollectionIterator< Key, Value >::m_pCollection
private

Collection to iterate over.

Definition at line 71 of file QxCollectionIterator.h.


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