Diffstat (limited to 'libopie2/opiepim/orecordlist.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/orecordlist.h | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h index a3955b0..3b30a73 100644 --- a/libopie2/opiepim/orecordlist.h +++ b/libopie2/opiepim/orecordlist.h | |||
@@ -4,22 +4,43 @@ | |||
4 | 4 | ||
5 | #include <qarray.h> | 5 | #include <qarray.h> |
6 | 6 | ||
7 | #include "otemplatebase.h" | 7 | #include "otemplatebase.h" |
8 | #include "opimrecord.h" | 8 | #include "opimrecord.h" |
9 | 9 | ||
10 | 10 | /** | |
11 | * Our List Iterator | ||
12 | * it behaves like STL or Qt | ||
13 | * | ||
14 | * for(it = list.begin(); it != list.end(); ++it ) | ||
15 | * doSomeCoolStuff( (*it) ); | ||
16 | */ | ||
11 | template <class T = OPimRecord> | 17 | template <class T = OPimRecord> |
12 | class ORecordListIterator { | 18 | class ORecordListIterator { |
13 | public: | 19 | public: |
14 | typedef OTemplateBase<T> Base; | 20 | typedef OTemplateBase<T> Base; |
21 | |||
22 | /** | ||
23 | * The c'tor used internally from | ||
24 | * ORecordList | ||
25 | */ | ||
15 | ORecordListIterator( const QArray<int>, const Base* ); | 26 | ORecordListIterator( const QArray<int>, const Base* ); |
27 | |||
28 | /** | ||
29 | * The standard c'tor | ||
30 | */ | ||
16 | ORecordListIterator(); | 31 | ORecordListIterator(); |
17 | ~ORecordListIterator(); | 32 | ~ORecordListIterator(); |
33 | |||
18 | ORecordListIterator( const ORecordListIterator& ); | 34 | ORecordListIterator( const ORecordListIterator& ); |
19 | ORecordListIterator &operator=(const ORecordListIterator& ); | 35 | ORecordListIterator &operator=(const ORecordListIterator& ); |
36 | |||
37 | /** | ||
38 | * a * operator ;) | ||
39 | * use it like this T = (*it); | ||
40 | */ | ||
20 | T &operator*(); | 41 | T &operator*(); |
21 | ORecordListIterator &operator++(); | 42 | ORecordListIterator &operator++(); |
22 | ORecordListIterator &operator--(); | 43 | ORecordListIterator &operator--(); |
23 | 44 | ||
24 | bool operator==( const ORecordListIterator& it ); | 45 | bool operator==( const ORecordListIterator& it ); |
25 | bool operator!=( const ORecordListIterator& it ); | 46 | bool operator!=( const ORecordListIterator& it ); |
@@ -32,22 +53,37 @@ private: | |||
32 | T m_record; | 53 | T m_record; |
33 | 54 | ||
34 | /* d pointer for future versions */ | 55 | /* d pointer for future versions */ |
35 | class IteratorPrivate; | 56 | class IteratorPrivate; |
36 | IteratorPrivate *d; | 57 | IteratorPrivate *d; |
37 | }; | 58 | }; |
38 | 59 | /** | |
60 | * The recordlist used as a return type | ||
61 | * from OPimAccessTemplate | ||
62 | */ | ||
39 | template <class T = OPimRecord > | 63 | template <class T = OPimRecord > |
40 | class ORecordList { | 64 | class ORecordList { |
41 | public: | 65 | public: |
42 | typedef OTemplateBase<T> Base; | 66 | typedef OTemplateBase<T> Base; |
43 | typedef ORecordListIterator<T> Iterator; | 67 | typedef ORecordListIterator<T> Iterator; |
68 | |||
69 | /** | ||
70 | * c'tor | ||
71 | */ | ||
44 | ORecordList( const QArray<int>& ids, | 72 | ORecordList( const QArray<int>& ids, |
45 | const Base* ); | 73 | const Base* ); |
46 | ~ORecordList(); | 74 | ~ORecordList(); |
75 | |||
76 | /** | ||
77 | * the first iterator | ||
78 | */ | ||
47 | Iterator begin(); | 79 | Iterator begin(); |
80 | |||
81 | /** | ||
82 | * the end | ||
83 | */ | ||
48 | Iterator end(); | 84 | Iterator end(); |
49 | /* | 85 | /* |
50 | ConstIterator begin()const; | 86 | ConstIterator begin()const; |
51 | ConstIterator end()const; | 87 | ConstIterator end()const; |
52 | */ | 88 | */ |
53 | private: | 89 | private: |