author | zecke <zecke> | 2002-09-24 14:58:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-24 14:58:51 (UTC) |
commit | 7b065f0388604e0485fa64a14abdf939dceab954 (patch) (unidiff) | |
tree | d98925bb12547a078467421d6823ac875f09f025 | |
parent | 70328f952e475eb7eb0bc961420b875eefd05211 (diff) | |
download | opie-7b065f0388604e0485fa64a14abdf939dceab954.zip opie-7b065f0388604e0485fa64a14abdf939dceab954.tar.gz opie-7b065f0388604e0485fa64a14abdf939dceab954.tar.bz2 |
Add some hooks to ORecordList and Iterator
current() for Iterator
setCurrent() for Iterator
count() for both
-rw-r--r-- | libopie/pim/orecordlist.h | 51 | ||||
-rw-r--r-- | libopie2/opiepim/orecordlist.h | 51 |
2 files changed, 96 insertions, 6 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 | |||
@@ -49,5 +49,20 @@ public: | |||
49 | 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 ); | ||
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; |
@@ -88,2 +103,9 @@ public: | |||
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 | /* |
@@ -135,2 +157,7 @@ T ORecordListIterator<T>::operator*() { | |||
135 | if (!m_end ) | 157 | if (!m_end ) |
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] ) | ||
136 | m_record = m_temp->find( m_uids[m_current] ); | 163 | m_record = m_temp->find( m_uids[m_current] ); |
@@ -144,3 +171,3 @@ 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; |
@@ -185,3 +212,17 @@ ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, | |||
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> |
@@ -209,2 +250,6 @@ ORecordList<T>::Iterator ORecordList<T>::end() { | |||
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 | |||
@@ -49,5 +49,20 @@ public: | |||
49 | 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 ); | ||
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; |
@@ -88,2 +103,9 @@ public: | |||
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 | /* |
@@ -135,2 +157,7 @@ T ORecordListIterator<T>::operator*() { | |||
135 | if (!m_end ) | 157 | if (!m_end ) |
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] ) | ||
136 | m_record = m_temp->find( m_uids[m_current] ); | 163 | m_record = m_temp->find( m_uids[m_current] ); |
@@ -144,3 +171,3 @@ 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; |
@@ -185,3 +212,17 @@ ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, | |||
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> |
@@ -209,2 +250,6 @@ ORecordList<T>::Iterator ORecordList<T>::end() { | |||
209 | } | 250 | } |
251 | template <class T> | ||
252 | uint ORecordList<T>::count()const { | ||
253 | return m_ids.count(); | ||
254 | } | ||
210 | #endif | 255 | #endif |