summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/orecordlist.h
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/orecordlist.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/orecordlist.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h
index edcd729..5211f57 100644
--- a/libopie2/opiepim/orecordlist.h
+++ b/libopie2/opiepim/orecordlist.h
@@ -4,12 +4,13 @@
#include <qarray.h>
#include "otemplatebase.h"
#include "opimrecord.h"
+class ORecordListIteratorPrivate;
/**
* Our List Iterator
* it behaves like STL or Qt
*
* for(it = list.begin(); it != list.end(); ++it )
* doSomeCoolStuff( (*it) );
@@ -68,15 +69,16 @@ private:
const Base* m_temp;
bool m_end : 1;
T m_record;
bool m_direction :1;
/* d pointer for future versions */
- class IteratorPrivate;
- IteratorPrivate *d;
+ ORecordListIteratorPrivate *d;
};
+
+class ORecordListPrivate;
/**
* The recordlist used as a return type
* from OPimAccessTemplate
*/
template <class T = OPimRecord >
class ORecordList {
@@ -108,24 +110,25 @@ ORecordList( const QArray<int>& ids,
*/
uint count()const;
T operator[]( uint i );
int uidAt(uint i );
- /**
+ /**
* Remove the contact with given uid
*/
bool remove( int uid );
/*
ConstIterator begin()const;
ConstIterator end()const;
*/
private:
QArray<int> m_ids;
const Base* m_acc;
+ ORecordListPrivate *d;
};
/* ok now implement it */
template <class T>
ORecordListIterator<T>::ORecordListIterator() {
m_current = 0;
@@ -217,12 +220,15 @@ 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_direction( false )
{
+ /* if the list is empty we're already at the end of the list */
+ if (uids.count() == 0 )
+ m_end = true;
}
template <class T>
uint ORecordListIterator<T>::current()const {
return m_current;
}
template <class T>