-rw-r--r-- | libopie/pim/orecordlist.h | 53 | ||||
-rw-r--r-- | libopie2/opiepim/orecordlist.h | 53 |
2 files changed, 98 insertions, 8 deletions
diff --git a/libopie/pim/orecordlist.h b/libopie/pim/orecordlist.h index 1795938..c63d813 100644 --- a/libopie/pim/orecordlist.h +++ b/libopie/pim/orecordlist.h | |||
@@ -25,186 +25,231 @@ public: | |||
25 | * The c'tor used internally from | 25 | * The c'tor used internally from |
26 | * ORecordList | 26 | * ORecordList |
27 | */ | 27 | */ |
28 | ORecordListIterator( const QArray<int>, const Base* ); | 28 | ORecordListIterator( const QArray<int>, const Base* ); |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * The standard c'tor | 31 | * The standard c'tor |
32 | */ | 32 | */ |
33 | ORecordListIterator(); | 33 | ORecordListIterator(); |
34 | ~ORecordListIterator(); | 34 | ~ORecordListIterator(); |
35 | 35 | ||
36 | ORecordListIterator( const ORecordListIterator& ); | 36 | ORecordListIterator( const ORecordListIterator& ); |
37 | ORecordListIterator &operator=(const ORecordListIterator& ); | 37 | ORecordListIterator &operator=(const ORecordListIterator& ); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * a * operator ;) | 40 | * a * operator ;) |
41 | * use it like this T = (*it); | 41 | * use it like this T = (*it); |
42 | */ | 42 | */ |
43 | T operator*(); | 43 | T operator*(); |
44 | ORecordListIterator &operator++(); | 44 | ORecordListIterator &operator++(); |
45 | ORecordListIterator &operator--(); | 45 | ORecordListIterator &operator--(); |
46 | 46 | ||
47 | bool operator==( const ORecordListIterator& it ); | 47 | bool operator==( const ORecordListIterator& it ); |
48 | bool operator!=( const ORecordListIterator& it ); | 48 | bool operator!=( const ORecordListIterator& it ); |
49 | |||
50 | /** | ||
51 | * the current item | ||
52 | */ | ||
53 | uint current()const; | ||
54 | |||
55 | /** | ||
56 | * the number of items | ||
57 | */ | ||
58 | uint count()const; | ||
59 | |||
60 | /** | ||
61 | * sets the current item | ||
62 | */ | ||
63 | void setCurrent( uint cur ); | ||
49 | 64 | ||
50 | private: | 65 | private: |
51 | QArray<int> m_uids; | 66 | QArray<int> m_uids; |
52 | int m_current; | 67 | uint m_current; |
53 | const Base* m_temp; | 68 | const Base* m_temp; |
54 | bool m_end : 1; | 69 | bool m_end : 1; |
55 | T m_record; | 70 | T m_record; |
56 | 71 | ||
57 | /* d pointer for future versions */ | 72 | /* d pointer for future versions */ |
58 | class IteratorPrivate; | 73 | class IteratorPrivate; |
59 | IteratorPrivate *d; | 74 | IteratorPrivate *d; |
60 | }; | 75 | }; |
61 | /** | 76 | /** |
62 | * The recordlist used as a return type | 77 | * The recordlist used as a return type |
63 | * from OPimAccessTemplate | 78 | * from OPimAccessTemplate |
64 | */ | 79 | */ |
65 | template <class T = OPimRecord > | 80 | template <class T = OPimRecord > |
66 | class ORecordList { | 81 | class ORecordList { |
67 | public: | 82 | public: |
68 | typedef OTemplateBase<T> Base; | 83 | typedef OTemplateBase<T> Base; |
69 | typedef ORecordListIterator<T> Iterator; | 84 | typedef ORecordListIterator<T> Iterator; |
70 | 85 | ||
71 | /** | 86 | /** |
72 | * c'tor | 87 | * c'tor |
73 | */ | 88 | */ |
74 | ORecordList () { | 89 | ORecordList () { |
75 | } | 90 | } |
76 | ORecordList( const QArray<int>& ids, | 91 | ORecordList( const QArray<int>& ids, |
77 | const Base* ); | 92 | const Base* ); |
78 | ~ORecordList(); | 93 | ~ORecordList(); |
79 | 94 | ||
80 | /** | 95 | /** |
81 | * the first iterator | 96 | * the first iterator |
82 | */ | 97 | */ |
83 | Iterator begin(); | 98 | Iterator begin(); |
84 | 99 | ||
85 | /** | 100 | /** |
86 | * the end | 101 | * the end |
87 | */ | 102 | */ |
88 | Iterator end(); | 103 | Iterator end(); |
104 | |||
105 | /** | ||
106 | * the number of items in the list | ||
107 | */ | ||
108 | uint count()const; | ||
109 | |||
110 | // FIXME implemenent remove | ||
89 | /* | 111 | /* |
90 | ConstIterator begin()const; | 112 | ConstIterator begin()const; |
91 | ConstIterator end()const; | 113 | ConstIterator end()const; |
92 | */ | 114 | */ |
93 | private: | 115 | private: |
94 | QArray<int> m_ids; | 116 | QArray<int> m_ids; |
95 | const Base* m_acc; | 117 | const Base* m_acc; |
96 | }; | 118 | }; |
97 | 119 | ||
98 | /* ok now implement it */ | 120 | /* ok now implement it */ |
99 | template <class T> | 121 | template <class T> |
100 | ORecordListIterator<T>::ORecordListIterator() { | 122 | ORecordListIterator<T>::ORecordListIterator() { |
101 | m_current = 0; | 123 | m_current = 0; |
102 | m_temp = 0l; | 124 | m_temp = 0l; |
103 | m_end = true; | 125 | m_end = true; |
104 | m_record = T(); | 126 | m_record = T(); |
105 | } | 127 | } |
106 | template <class T> | 128 | template <class T> |
107 | ORecordListIterator<T>::~ORecordListIterator() { | 129 | ORecordListIterator<T>::~ORecordListIterator() { |
108 | /* nothing to delete */ | 130 | /* nothing to delete */ |
109 | } | 131 | } |
110 | 132 | ||
111 | template <class T> | 133 | template <class T> |
112 | ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) { | 134 | ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) { |
113 | // qWarning("ORecordListIterator copy c'tor"); | 135 | // qWarning("ORecordListIterator copy c'tor"); |
114 | m_uids = it.m_uids; | 136 | m_uids = it.m_uids; |
115 | m_current = it.m_current; | 137 | m_current = it.m_current; |
116 | m_temp = it.m_temp; | 138 | m_temp = it.m_temp; |
117 | m_end = it.m_end; | 139 | m_end = it.m_end; |
118 | m_record = it.m_record; | 140 | m_record = it.m_record; |
119 | } | 141 | } |
120 | 142 | ||
121 | template <class T> | 143 | template <class T> |
122 | ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) { | 144 | ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) { |
123 | m_uids = it.m_uids; | 145 | m_uids = it.m_uids; |
124 | m_current = it.m_current; | 146 | m_current = it.m_current; |
125 | m_temp = it.m_temp; | 147 | m_temp = it.m_temp; |
126 | m_end = it.m_end; | 148 | m_end = it.m_end; |
127 | // m_record = it.m_record; | 149 | // m_record = it.m_record; |
128 | 150 | ||
129 | return *this; | 151 | return *this; |
130 | } | 152 | } |
131 | 153 | ||
132 | template <class T> | 154 | template <class T> |
133 | T ORecordListIterator<T>::operator*() { | 155 | T ORecordListIterator<T>::operator*() { |
134 | // qWarning("operator* %d %d", m_current, m_uids[m_current] ); | 156 | // qWarning("operator* %d %d", m_current, m_uids[m_current] ); |
135 | if (!m_end ) | 157 | if (!m_end ) |
136 | m_record = m_temp->find( m_uids[m_current] ); | 158 | /* FIXME |
159 | * until the cache is in place | ||
160 | * we do the uid match uid check | ||
161 | */ | ||
162 | if(m_record.uid() != m_uids[m_current] ) | ||
163 | m_record = m_temp->find( m_uids[m_current] ); | ||
137 | else | 164 | else |
138 | m_record = T(); | 165 | m_record = T(); |
139 | 166 | ||
140 | return m_record; | 167 | return m_record; |
141 | } | 168 | } |
142 | 169 | ||
143 | template <class T> | 170 | template <class T> |
144 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { | 171 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { |
145 | if (m_current < (int)m_uids.count() ) { | 172 | if (m_current < m_uids.count() ) { |
146 | m_end = false; | 173 | m_end = false; |
147 | ++m_current; | 174 | ++m_current; |
148 | }else | 175 | }else |
149 | m_end = true; | 176 | m_end = true; |
150 | 177 | ||
151 | return *this; | 178 | return *this; |
152 | } | 179 | } |
153 | template <class T> | 180 | template <class T> |
154 | ORecordListIterator<T> &ORecordListIterator<T>::operator--() { | 181 | ORecordListIterator<T> &ORecordListIterator<T>::operator--() { |
155 | if ( m_current > 0 ) { | 182 | if ( m_current > 0 ) { |
156 | --m_current; | 183 | --m_current; |
157 | m_end = false; | 184 | m_end = false; |
158 | } else | 185 | } else |
159 | m_end = true; | 186 | m_end = true; |
160 | 187 | ||
161 | return *this; | 188 | return *this; |
162 | } | 189 | } |
163 | 190 | ||
164 | template <class T> | 191 | template <class T> |
165 | bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { | 192 | bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { |
166 | 193 | ||
167 | /* if both are at we're the same.... */ | 194 | /* if both are at we're the same.... */ |
168 | if ( m_end == it.m_end ) return true; | 195 | if ( m_end == it.m_end ) return true; |
169 | 196 | ||
170 | if ( m_uids != it.m_uids ) return false; | 197 | if ( m_uids != it.m_uids ) return false; |
171 | if ( m_current != it.m_current ) return false; | 198 | if ( m_current != it.m_current ) return false; |
172 | if ( m_temp != it.m_temp ) return false; | 199 | if ( m_temp != it.m_temp ) return false; |
173 | 200 | ||
174 | return true; | 201 | return true; |
175 | } | 202 | } |
176 | template <class T> | 203 | template <class T> |
177 | bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { | 204 | bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { |
178 | return !(*this == it ); | 205 | return !(*this == it ); |
179 | } | 206 | } |
180 | template <class T> | 207 | template <class T> |
181 | ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, | 208 | ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, |
182 | const Base* t ) | 209 | const Base* t ) |
183 | : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ) | 210 | : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ) |
184 | { | 211 | { |
185 | } | 212 | } |
186 | 213 | template <class T> | |
214 | uint ORecordListIterator<T>::current()const { | ||
215 | return m_current; | ||
216 | } | ||
217 | template <class T> | ||
218 | void ORecordListIterator<T>::setCurrent( uint cur ) { | ||
219 | if( cur < m_uids.count() ) { | ||
220 | m_end = false; | ||
221 | m_current= cur; | ||
222 | } | ||
223 | } | ||
224 | template <class T> | ||
225 | uint ORecordListIterator<T>::count()const { | ||
226 | return m_uids.count(); | ||
227 | } | ||
187 | template <class T> | 228 | template <class T> |
188 | ORecordList<T>::ORecordList( const QArray<int>& ids, | 229 | ORecordList<T>::ORecordList( const QArray<int>& ids, |
189 | const Base* acc ) | 230 | const Base* acc ) |
190 | : m_ids( ids ), m_acc( acc ) | 231 | : m_ids( ids ), m_acc( acc ) |
191 | { | 232 | { |
192 | } | 233 | } |
193 | template <class T> | 234 | template <class T> |
194 | ORecordList<T>::~ORecordList() { | 235 | ORecordList<T>::~ORecordList() { |
195 | /* nothing to do here */ | 236 | /* nothing to do here */ |
196 | } | 237 | } |
197 | template <class T> | 238 | template <class T> |
198 | ORecordList<T>::Iterator ORecordList<T>::begin() { | 239 | ORecordList<T>::Iterator ORecordList<T>::begin() { |
199 | Iterator it( m_ids, m_acc ); | 240 | Iterator it( m_ids, m_acc ); |
200 | return it; | 241 | return it; |
201 | } | 242 | } |
202 | template <class T> | 243 | template <class T> |
203 | ORecordList<T>::Iterator ORecordList<T>::end() { | 244 | ORecordList<T>::Iterator ORecordList<T>::end() { |
204 | Iterator it( m_ids, m_acc ); | 245 | Iterator it( m_ids, m_acc ); |
205 | it.m_end = true; | 246 | it.m_end = true; |
206 | it.m_current = m_ids.count(); | 247 | it.m_current = m_ids.count(); |
207 | 248 | ||
208 | return it; | 249 | return it; |
209 | } | 250 | } |
251 | template <class T> | ||
252 | uint ORecordList<T>::count()const { | ||
253 | return m_ids.count(); | ||
254 | } | ||
210 | #endif | 255 | #endif |
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h index 1795938..c63d813 100644 --- a/libopie2/opiepim/orecordlist.h +++ b/libopie2/opiepim/orecordlist.h | |||
@@ -25,186 +25,231 @@ public: | |||
25 | * The c'tor used internally from | 25 | * The c'tor used internally from |
26 | * ORecordList | 26 | * ORecordList |
27 | */ | 27 | */ |
28 | ORecordListIterator( const QArray<int>, const Base* ); | 28 | ORecordListIterator( const QArray<int>, const Base* ); |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * The standard c'tor | 31 | * The standard c'tor |
32 | */ | 32 | */ |
33 | ORecordListIterator(); | 33 | ORecordListIterator(); |
34 | ~ORecordListIterator(); | 34 | ~ORecordListIterator(); |
35 | 35 | ||
36 | ORecordListIterator( const ORecordListIterator& ); | 36 | ORecordListIterator( const ORecordListIterator& ); |
37 | ORecordListIterator &operator=(const ORecordListIterator& ); | 37 | ORecordListIterator &operator=(const ORecordListIterator& ); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * a * operator ;) | 40 | * a * operator ;) |
41 | * use it like this T = (*it); | 41 | * use it like this T = (*it); |
42 | */ | 42 | */ |
43 | T operator*(); | 43 | T operator*(); |
44 | ORecordListIterator &operator++(); | 44 | ORecordListIterator &operator++(); |
45 | ORecordListIterator &operator--(); | 45 | ORecordListIterator &operator--(); |
46 | 46 | ||
47 | bool operator==( const ORecordListIterator& it ); | 47 | bool operator==( const ORecordListIterator& it ); |
48 | bool operator!=( const ORecordListIterator& it ); | 48 | bool operator!=( const ORecordListIterator& it ); |
49 | |||
50 | /** | ||
51 | * the current item | ||
52 | */ | ||
53 | uint current()const; | ||
54 | |||
55 | /** | ||
56 | * the number of items | ||
57 | */ | ||
58 | uint count()const; | ||
59 | |||
60 | /** | ||
61 | * sets the current item | ||
62 | */ | ||
63 | void setCurrent( uint cur ); | ||
49 | 64 | ||
50 | private: | 65 | private: |
51 | QArray<int> m_uids; | 66 | QArray<int> m_uids; |
52 | int m_current; | 67 | uint m_current; |
53 | const Base* m_temp; | 68 | const Base* m_temp; |
54 | bool m_end : 1; | 69 | bool m_end : 1; |
55 | T m_record; | 70 | T m_record; |
56 | 71 | ||
57 | /* d pointer for future versions */ | 72 | /* d pointer for future versions */ |
58 | class IteratorPrivate; | 73 | class IteratorPrivate; |
59 | IteratorPrivate *d; | 74 | IteratorPrivate *d; |
60 | }; | 75 | }; |
61 | /** | 76 | /** |
62 | * The recordlist used as a return type | 77 | * The recordlist used as a return type |
63 | * from OPimAccessTemplate | 78 | * from OPimAccessTemplate |
64 | */ | 79 | */ |
65 | template <class T = OPimRecord > | 80 | template <class T = OPimRecord > |
66 | class ORecordList { | 81 | class ORecordList { |
67 | public: | 82 | public: |
68 | typedef OTemplateBase<T> Base; | 83 | typedef OTemplateBase<T> Base; |
69 | typedef ORecordListIterator<T> Iterator; | 84 | typedef ORecordListIterator<T> Iterator; |
70 | 85 | ||
71 | /** | 86 | /** |
72 | * c'tor | 87 | * c'tor |
73 | */ | 88 | */ |
74 | ORecordList () { | 89 | ORecordList () { |
75 | } | 90 | } |
76 | ORecordList( const QArray<int>& ids, | 91 | ORecordList( const QArray<int>& ids, |
77 | const Base* ); | 92 | const Base* ); |
78 | ~ORecordList(); | 93 | ~ORecordList(); |
79 | 94 | ||
80 | /** | 95 | /** |
81 | * the first iterator | 96 | * the first iterator |
82 | */ | 97 | */ |
83 | Iterator begin(); | 98 | Iterator begin(); |
84 | 99 | ||
85 | /** | 100 | /** |
86 | * the end | 101 | * the end |
87 | */ | 102 | */ |
88 | Iterator end(); | 103 | Iterator end(); |
104 | |||
105 | /** | ||
106 | * the number of items in the list | ||
107 | */ | ||
108 | uint count()const; | ||
109 | |||
110 | // FIXME implemenent remove | ||
89 | /* | 111 | /* |
90 | ConstIterator begin()const; | 112 | ConstIterator begin()const; |
91 | ConstIterator end()const; | 113 | ConstIterator end()const; |
92 | */ | 114 | */ |
93 | private: | 115 | private: |
94 | QArray<int> m_ids; | 116 | QArray<int> m_ids; |
95 | const Base* m_acc; | 117 | const Base* m_acc; |
96 | }; | 118 | }; |
97 | 119 | ||
98 | /* ok now implement it */ | 120 | /* ok now implement it */ |
99 | template <class T> | 121 | template <class T> |
100 | ORecordListIterator<T>::ORecordListIterator() { | 122 | ORecordListIterator<T>::ORecordListIterator() { |
101 | m_current = 0; | 123 | m_current = 0; |
102 | m_temp = 0l; | 124 | m_temp = 0l; |
103 | m_end = true; | 125 | m_end = true; |
104 | m_record = T(); | 126 | m_record = T(); |
105 | } | 127 | } |
106 | template <class T> | 128 | template <class T> |
107 | ORecordListIterator<T>::~ORecordListIterator() { | 129 | ORecordListIterator<T>::~ORecordListIterator() { |
108 | /* nothing to delete */ | 130 | /* nothing to delete */ |
109 | } | 131 | } |
110 | 132 | ||
111 | template <class T> | 133 | template <class T> |
112 | ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) { | 134 | ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) { |
113 | // qWarning("ORecordListIterator copy c'tor"); | 135 | // qWarning("ORecordListIterator copy c'tor"); |
114 | m_uids = it.m_uids; | 136 | m_uids = it.m_uids; |
115 | m_current = it.m_current; | 137 | m_current = it.m_current; |
116 | m_temp = it.m_temp; | 138 | m_temp = it.m_temp; |
117 | m_end = it.m_end; | 139 | m_end = it.m_end; |
118 | m_record = it.m_record; | 140 | m_record = it.m_record; |
119 | } | 141 | } |
120 | 142 | ||
121 | template <class T> | 143 | template <class T> |
122 | ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) { | 144 | ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) { |
123 | m_uids = it.m_uids; | 145 | m_uids = it.m_uids; |
124 | m_current = it.m_current; | 146 | m_current = it.m_current; |
125 | m_temp = it.m_temp; | 147 | m_temp = it.m_temp; |
126 | m_end = it.m_end; | 148 | m_end = it.m_end; |
127 | // m_record = it.m_record; | 149 | // m_record = it.m_record; |
128 | 150 | ||
129 | return *this; | 151 | return *this; |
130 | } | 152 | } |
131 | 153 | ||
132 | template <class T> | 154 | template <class T> |
133 | T ORecordListIterator<T>::operator*() { | 155 | T ORecordListIterator<T>::operator*() { |
134 | // qWarning("operator* %d %d", m_current, m_uids[m_current] ); | 156 | // qWarning("operator* %d %d", m_current, m_uids[m_current] ); |
135 | if (!m_end ) | 157 | if (!m_end ) |
136 | m_record = m_temp->find( m_uids[m_current] ); | 158 | /* FIXME |
159 | * until the cache is in place | ||
160 | * we do the uid match uid check | ||
161 | */ | ||
162 | if(m_record.uid() != m_uids[m_current] ) | ||
163 | m_record = m_temp->find( m_uids[m_current] ); | ||
137 | else | 164 | else |
138 | m_record = T(); | 165 | m_record = T(); |
139 | 166 | ||
140 | return m_record; | 167 | return m_record; |
141 | } | 168 | } |
142 | 169 | ||
143 | template <class T> | 170 | template <class T> |
144 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { | 171 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { |
145 | if (m_current < (int)m_uids.count() ) { | 172 | if (m_current < m_uids.count() ) { |
146 | m_end = false; | 173 | m_end = false; |
147 | ++m_current; | 174 | ++m_current; |
148 | }else | 175 | }else |
149 | m_end = true; | 176 | m_end = true; |
150 | 177 | ||
151 | return *this; | 178 | return *this; |
152 | } | 179 | } |
153 | template <class T> | 180 | template <class T> |
154 | ORecordListIterator<T> &ORecordListIterator<T>::operator--() { | 181 | ORecordListIterator<T> &ORecordListIterator<T>::operator--() { |
155 | if ( m_current > 0 ) { | 182 | if ( m_current > 0 ) { |
156 | --m_current; | 183 | --m_current; |
157 | m_end = false; | 184 | m_end = false; |
158 | } else | 185 | } else |
159 | m_end = true; | 186 | m_end = true; |
160 | 187 | ||
161 | return *this; | 188 | return *this; |
162 | } | 189 | } |
163 | 190 | ||
164 | template <class T> | 191 | template <class T> |
165 | bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { | 192 | bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { |
166 | 193 | ||
167 | /* if both are at we're the same.... */ | 194 | /* if both are at we're the same.... */ |
168 | if ( m_end == it.m_end ) return true; | 195 | if ( m_end == it.m_end ) return true; |
169 | 196 | ||
170 | if ( m_uids != it.m_uids ) return false; | 197 | if ( m_uids != it.m_uids ) return false; |
171 | if ( m_current != it.m_current ) return false; | 198 | if ( m_current != it.m_current ) return false; |
172 | if ( m_temp != it.m_temp ) return false; | 199 | if ( m_temp != it.m_temp ) return false; |
173 | 200 | ||
174 | return true; | 201 | return true; |
175 | } | 202 | } |
176 | template <class T> | 203 | template <class T> |
177 | bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { | 204 | bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { |
178 | return !(*this == it ); | 205 | return !(*this == it ); |
179 | } | 206 | } |
180 | template <class T> | 207 | template <class T> |
181 | ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, | 208 | ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, |
182 | const Base* t ) | 209 | const Base* t ) |
183 | : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ) | 210 | : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ) |
184 | { | 211 | { |
185 | } | 212 | } |
186 | 213 | template <class T> | |
214 | uint ORecordListIterator<T>::current()const { | ||
215 | return m_current; | ||
216 | } | ||
217 | template <class T> | ||
218 | void ORecordListIterator<T>::setCurrent( uint cur ) { | ||
219 | if( cur < m_uids.count() ) { | ||
220 | m_end = false; | ||
221 | m_current= cur; | ||
222 | } | ||
223 | } | ||
224 | template <class T> | ||
225 | uint ORecordListIterator<T>::count()const { | ||
226 | return m_uids.count(); | ||
227 | } | ||
187 | template <class T> | 228 | template <class T> |
188 | ORecordList<T>::ORecordList( const QArray<int>& ids, | 229 | ORecordList<T>::ORecordList( const QArray<int>& ids, |
189 | const Base* acc ) | 230 | const Base* acc ) |
190 | : m_ids( ids ), m_acc( acc ) | 231 | : m_ids( ids ), m_acc( acc ) |
191 | { | 232 | { |
192 | } | 233 | } |
193 | template <class T> | 234 | template <class T> |
194 | ORecordList<T>::~ORecordList() { | 235 | ORecordList<T>::~ORecordList() { |
195 | /* nothing to do here */ | 236 | /* nothing to do here */ |
196 | } | 237 | } |
197 | template <class T> | 238 | template <class T> |
198 | ORecordList<T>::Iterator ORecordList<T>::begin() { | 239 | ORecordList<T>::Iterator ORecordList<T>::begin() { |
199 | Iterator it( m_ids, m_acc ); | 240 | Iterator it( m_ids, m_acc ); |
200 | return it; | 241 | return it; |
201 | } | 242 | } |
202 | template <class T> | 243 | template <class T> |
203 | ORecordList<T>::Iterator ORecordList<T>::end() { | 244 | ORecordList<T>::Iterator ORecordList<T>::end() { |
204 | Iterator it( m_ids, m_acc ); | 245 | Iterator it( m_ids, m_acc ); |
205 | it.m_end = true; | 246 | it.m_end = true; |
206 | it.m_current = m_ids.count(); | 247 | it.m_current = m_ids.count(); |
207 | 248 | ||
208 | return it; | 249 | return it; |
209 | } | 250 | } |
251 | template <class T> | ||
252 | uint ORecordList<T>::count()const { | ||
253 | return m_ids.count(); | ||
254 | } | ||
210 | #endif | 255 | #endif |