-rw-r--r-- | libopie/pim/orecordlist.h | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/libopie/pim/orecordlist.h b/libopie/pim/orecordlist.h index a3955b0..3b30a73 100644 --- a/libopie/pim/orecordlist.h +++ b/libopie/pim/orecordlist.h @@ -2,26 +2,47 @@ #ifndef OPIE_RECORD_LIST_H #define OPIE_RECORD_LIST_H #include <qarray.h> #include "otemplatebase.h" #include "opimrecord.h" - +/** + * Our List Iterator + * it behaves like STL or Qt + * + * for(it = list.begin(); it != list.end(); ++it ) + * doSomeCoolStuff( (*it) ); + */ template <class T = OPimRecord> class ORecordListIterator { public: typedef OTemplateBase<T> Base; + + /** + * The c'tor used internally from + * ORecordList + */ ORecordListIterator( const QArray<int>, const Base* ); + + /** + * The standard c'tor + */ ORecordListIterator(); ~ORecordListIterator(); + ORecordListIterator( const ORecordListIterator& ); ORecordListIterator &operator=(const ORecordListIterator& ); + + /** + * a * operator ;) + * use it like this T = (*it); + */ T &operator*(); ORecordListIterator &operator++(); ORecordListIterator &operator--(); bool operator==( const ORecordListIterator& it ); bool operator!=( const ORecordListIterator& it ); private: @@ -30,26 +51,41 @@ private: const Base* m_temp; bool m_end : 1; T m_record; /* d pointer for future versions */ class IteratorPrivate; IteratorPrivate *d; }; - +/** + * The recordlist used as a return type + * from OPimAccessTemplate + */ template <class T = OPimRecord > class ORecordList { public: typedef OTemplateBase<T> Base; typedef ORecordListIterator<T> Iterator; + + /** + * c'tor + */ ORecordList( const QArray<int>& ids, const Base* ); ~ORecordList(); + + /** + * the first iterator + */ Iterator begin(); + + /** + * the end + */ Iterator end(); /* ConstIterator begin()const; ConstIterator end()const; */ private: QArray<int> m_ids; const Base* m_acc; |