QxOrm
1.5.0
C++ Object Relational Mapping library
|
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) | |
QxCollectionIterator & | operator= (const QxCollectionIterator &other) |
Private Attributes | |
const QxCollection< Key, Value > * | m_pCollection |
Collection to iterate over. | |
long | m_lCurrIndex |
Current index (position) in the collection. |
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 qx::QxCollectionIterator<QString, drug_ptr> itr(lstDrugs); while (itr.next()) { QString code = itr.key(); qDebug() << qPrintable(itr.value()->name) << " " << qPrintable(itr.value()->desc); }
Definition at line 66 of file QxCollectionIterator.h.
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)
qx::QxCollectionIterator< Key, Value >::~QxCollectionIterator | ( | ) |
Destroy the iterator.
qx::QxCollectionIterator< Key, Value >::QxCollectionIterator | ( | const QxCollectionIterator< Key, Value > & | other | ) | [inline, private] |
Definition at line 90 of file QxCollectionIterator.h.
const Key& qx::QxCollectionIterator< Key, Value >::key | ( | ) | const [inline] |
Return the 'key' at current position.
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'.
QxCollectionIterator& qx::QxCollectionIterator< Key, Value >::operator= | ( | const QxCollectionIterator< Key, Value > & | other | ) | [inline, private] |
Definition at line 91 of file QxCollectionIterator.h.
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'.
void qx::QxCollectionIterator< Key, Value >::toFirst | ( | ) | [inline] |
Move the iterator to the front of the container (before the first item)
void qx::QxCollectionIterator< Key, Value >::toLast | ( | ) | [inline] |
Move the iterator to the back of the container (after the last item)
const Value& qx::QxCollectionIterator< Key, Value >::value | ( | ) | const [inline] |
Return the 'value' at current position.
long qx::QxCollectionIterator< Key, Value >::m_lCurrIndex [private] |
Current index (position) in the collection.
Definition at line 72 of file QxCollectionIterator.h.
const QxCollection<Key, Value>* qx::QxCollectionIterator< Key, Value >::m_pCollection [private] |
Collection to iterate over.
Definition at line 71 of file QxCollectionIterator.h.