Diffstat (limited to 'libopie2/opiepim/core/opimrecordlist.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimrecordlist.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libopie2/opiepim/core/opimrecordlist.h b/libopie2/opiepim/core/opimrecordlist.h index 1d5027f..0459f41 100644 --- a/libopie2/opiepim/core/opimrecordlist.h +++ b/libopie2/opiepim/core/opimrecordlist.h | |||
@@ -38,12 +38,13 @@ | |||
38 | /* QT */ | 38 | /* QT */ |
39 | #include <qarray.h> | 39 | #include <qarray.h> |
40 | 40 | ||
41 | namespace Opie | 41 | namespace Opie |
42 | { | 42 | { |
43 | 43 | ||
44 | template<class T> class OPimAccessTemplate; | ||
44 | class OPimRecordListIteratorPrivate; | 45 | class OPimRecordListIteratorPrivate; |
45 | /** | 46 | /** |
46 | * Our List Iterator | 47 | * Our List Iterator |
47 | * it behaves like STL or Qt | 48 | * it behaves like STL or Qt |
48 | * | 49 | * |
49 | * for(it = list.begin(); it != list.end(); ++it ) | 50 | * for(it = list.begin(); it != list.end(); ++it ) |
@@ -117,23 +118,23 @@ class OPimRecordListPrivate; | |||
117 | * The recordlist used as a return type | 118 | * The recordlist used as a return type |
118 | * from OPimAccessTemplate | 119 | * from OPimAccessTemplate |
119 | */ | 120 | */ |
120 | template <class T = OPimRecord > | 121 | template <class T = OPimRecord > |
121 | class OPimRecordList | 122 | class OPimRecordList |
122 | { | 123 | { |
124 | template<class> friend class OPimAccessTemplate; | ||
123 | public: | 125 | public: |
124 | typedef OTemplateBase<T> Base; | 126 | typedef OTemplateBase<T> Base; |
125 | typedef OPimRecordListIterator<T> Iterator; | 127 | typedef OPimRecordListIterator<T> Iterator; |
126 | 128 | ||
127 | /** | 129 | /** |
128 | * c'tor | 130 | * c'tor |
129 | */ | 131 | */ |
130 | OPimRecordList () | 132 | OPimRecordList (){} |
131 | {} | ||
132 | OPimRecordList( const QArray<int>& ids, | 133 | OPimRecordList( const QArray<int>& ids, |
133 | const Base* ); | 134 | const Base* ); |
134 | ~OPimRecordList(); | 135 | ~OPimRecordList(); |
135 | 136 | ||
136 | /** | 137 | /** |
137 | * the first iterator | 138 | * the first iterator |
138 | */ | 139 | */ |
139 | Iterator begin(); | 140 | Iterator begin(); |
@@ -157,12 +158,15 @@ class OPimRecordList | |||
157 | bool remove( int uid ); | 158 | bool remove( int uid ); |
158 | 159 | ||
159 | /* | 160 | /* |
160 | ConstIterator begin()const; | 161 | ConstIterator begin()const; |
161 | ConstIterator end()const; | 162 | ConstIterator end()const; |
162 | */ | 163 | */ |
164 | protected: | ||
165 | UIDArray uids()const; | ||
166 | |||
163 | private: | 167 | private: |
164 | QArray<int> m_ids; | 168 | QArray<int> m_ids; |
165 | const Base* m_acc; | 169 | const Base* m_acc; |
166 | OPimRecordListPrivate *d; | 170 | OPimRecordListPrivate *d; |
167 | }; | 171 | }; |
168 | 172 | ||
@@ -187,13 +191,12 @@ OPimRecordListIterator<T>::~OPimRecordListIterator() | |||
187 | } | 191 | } |
188 | 192 | ||
189 | 193 | ||
190 | template <class T> | 194 | template <class T> |
191 | OPimRecordListIterator<T>::OPimRecordListIterator( const OPimRecordListIterator<T>& it ) | 195 | OPimRecordListIterator<T>::OPimRecordListIterator( const OPimRecordListIterator<T>& it ) |
192 | { | 196 | { |
193 | //owarn << "OPimRecordListIterator copy c'tor" << oendl; | ||
194 | m_uids = it.m_uids; | 197 | m_uids = it.m_uids; |
195 | m_current = it.m_current; | 198 | m_current = it.m_current; |
196 | m_temp = it.m_temp; | 199 | m_temp = it.m_temp; |
197 | m_end = it.m_end; | 200 | m_end = it.m_end; |
198 | m_record = it.m_record; | 201 | m_record = it.m_record; |
199 | m_direction = it.m_direction; | 202 | m_direction = it.m_direction; |
@@ -213,13 +216,12 @@ OPimRecordListIterator<T> &OPimRecordListIterator<T>::operator=( const OPimRecor | |||
213 | } | 216 | } |
214 | 217 | ||
215 | 218 | ||
216 | template <class T> | 219 | template <class T> |
217 | T OPimRecordListIterator<T>::operator*() | 220 | T OPimRecordListIterator<T>::operator*() |
218 | { | 221 | { |
219 | //owarn << "operator* " << m_current << " " << m_uids[m_current] << oendl; | ||
220 | if ( !m_end ) | 222 | if ( !m_end ) |
221 | m_record = m_temp->find( m_uids[ m_current ], m_uids, m_current, | 223 | m_record = m_temp->find( m_uids[ m_current ], m_uids, m_current, |
222 | m_direction ? Base::Forward : | 224 | m_direction ? Base::Forward : |
223 | Base::Reverse ); | 225 | Base::Reverse ); |
224 | else | 226 | else |
225 | m_record = T(); | 227 | m_record = T(); |
@@ -396,8 +398,13 @@ bool OPimRecordList<T>::remove( int uid ) | |||
396 | m_ids = copy; | 398 | m_ids = copy; |
397 | 399 | ||
398 | 400 | ||
399 | return ret_val; | 401 | return ret_val; |
400 | } | 402 | } |
401 | 403 | ||
404 | template<class T> | ||
405 | UIDArray OPimRecordList<T>::uids()const { | ||
406 | return m_ids; | ||
407 | } | ||
408 | |||
402 | } | 409 | } |
403 | #endif | 410 | #endif |