-rw-r--r-- | libopie/pim/orecordlist.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/libopie/pim/orecordlist.h b/libopie/pim/orecordlist.h index b6fa7fa..08f5c85 100644 --- a/libopie/pim/orecordlist.h +++ b/libopie/pim/orecordlist.h @@ -67,8 +67,9 @@ private: uint m_current; const Base* m_temp; bool m_end : 1; T m_record; + bool m_direction :1; /* d pointer for future versions */ class IteratorPrivate; IteratorPrivate *d; @@ -124,8 +125,10 @@ ORecordListIterator<T>::ORecordListIterator() { m_current = 0; m_temp = 0l; m_end = true; m_record = T(); + /* forward */ + m_direction = TRUE; } template <class T> ORecordListIterator<T>::~ORecordListIterator() { /* nothing to delete */ @@ -138,8 +141,9 @@ ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) { m_current = it.m_current; m_temp = it.m_temp; m_end = it.m_end; m_record = it.m_record; + m_direction = it.m_direction; } template <class T> ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) { @@ -155,21 +159,20 @@ ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIter template <class T> T ORecordListIterator<T>::operator*() { qWarning("operator* %d %d", m_current, m_uids[m_current] ); if (!m_end ) - /* FIXME - * until the cache is in place - * we do the uid match uid check - */ - m_record = m_temp->find( m_uids[m_current] ); + m_record = m_temp->find( m_uids[m_current], m_uids, m_current, + m_direction ? Base::Forward : + Base::Reverse ); else m_record = T(); return m_record; } template <class T> ORecordListIterator<T> &ORecordListIterator<T>::operator++() { + m_direction = true; if (m_current < m_uids.count() ) { m_end = false; ++m_current; }else @@ -178,8 +181,9 @@ ORecordListIterator<T> &ORecordListIterator<T>::operator++() { return *this; } template <class T> ORecordListIterator<T> &ORecordListIterator<T>::operator--() { + m_direction = false; if ( m_current > 0 ) { --m_current; m_end = false; } else @@ -206,9 +210,10 @@ bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { } template <class T> ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, const Base* t ) - : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ) + : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ), + m_direction( false ) { } template <class T> uint ORecordListIterator<T>::current()const { @@ -253,7 +258,8 @@ uint ORecordList<T>::count()const { return m_ids.count(); } template <class T> T ORecordList<T>::operator[]( uint i ) { - return m_acc->find( m_ids[i] ); + /* forward */ + return m_acc->find( m_ids[i], m_ids, i ); } #endif |