-rw-r--r-- | libopie/pim/orecordlist.h | 2 | ||||
-rw-r--r-- | libopie2/opiepim/orecordlist.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libopie/pim/orecordlist.h b/libopie/pim/orecordlist.h index b77a4ab..edcd729 100644 --- a/libopie/pim/orecordlist.h +++ b/libopie/pim/orecordlist.h | |||
@@ -172,129 +172,129 @@ T ORecordListIterator<T>::operator*() { | |||
172 | else | 172 | else |
173 | m_record = T(); | 173 | m_record = T(); |
174 | 174 | ||
175 | return m_record; | 175 | return m_record; |
176 | } | 176 | } |
177 | 177 | ||
178 | template <class T> | 178 | template <class T> |
179 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { | 179 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { |
180 | m_direction = true; | 180 | m_direction = true; |
181 | if (m_current < m_uids.count() ) { | 181 | if (m_current < m_uids.count() ) { |
182 | m_end = false; | 182 | m_end = false; |
183 | ++m_current; | 183 | ++m_current; |
184 | }else | 184 | }else |
185 | m_end = true; | 185 | m_end = true; |
186 | 186 | ||
187 | return *this; | 187 | return *this; |
188 | } | 188 | } |
189 | template <class T> | 189 | template <class T> |
190 | ORecordListIterator<T> &ORecordListIterator<T>::operator--() { | 190 | ORecordListIterator<T> &ORecordListIterator<T>::operator--() { |
191 | m_direction = false; | 191 | m_direction = false; |
192 | if ( m_current > 0 ) { | 192 | if ( m_current > 0 ) { |
193 | --m_current; | 193 | --m_current; |
194 | m_end = false; | 194 | m_end = false; |
195 | } else | 195 | } else |
196 | m_end = true; | 196 | m_end = true; |
197 | 197 | ||
198 | return *this; | 198 | return *this; |
199 | } | 199 | } |
200 | 200 | ||
201 | template <class T> | 201 | template <class T> |
202 | bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { | 202 | bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { |
203 | 203 | ||
204 | /* if both are at we're the same.... */ | 204 | /* if both are at we're the same.... */ |
205 | if ( m_end == it.m_end ) return true; | 205 | if ( m_end == it.m_end ) return true; |
206 | 206 | ||
207 | if ( m_uids != it.m_uids ) return false; | 207 | if ( m_uids != it.m_uids ) return false; |
208 | if ( m_current != it.m_current ) return false; | 208 | if ( m_current != it.m_current ) return false; |
209 | if ( m_temp != it.m_temp ) return false; | 209 | if ( m_temp != it.m_temp ) return false; |
210 | 210 | ||
211 | return true; | 211 | return true; |
212 | } | 212 | } |
213 | template <class T> | 213 | template <class T> |
214 | bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { | 214 | bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { |
215 | return !(*this == it ); | 215 | return !(*this == it ); |
216 | } | 216 | } |
217 | template <class T> | 217 | template <class T> |
218 | ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, | 218 | ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, |
219 | const Base* t ) | 219 | const Base* t ) |
220 | : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ), | 220 | : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ), |
221 | m_direction( false ) | 221 | m_direction( false ) |
222 | { | 222 | { |
223 | } | 223 | } |
224 | template <class T> | 224 | template <class T> |
225 | uint ORecordListIterator<T>::current()const { | 225 | uint ORecordListIterator<T>::current()const { |
226 | return m_current; | 226 | return m_current; |
227 | } | 227 | } |
228 | template <class T> | 228 | template <class T> |
229 | void ORecordListIterator<T>::setCurrent( uint cur ) { | 229 | void ORecordListIterator<T>::setCurrent( uint cur ) { |
230 | if( cur < m_uids.count() ) { | 230 | if( cur < m_uids.count() ) { |
231 | m_end = false; | 231 | m_end = false; |
232 | m_current= cur; | 232 | m_current= cur; |
233 | } | 233 | } |
234 | } | 234 | } |
235 | template <class T> | 235 | template <class T> |
236 | uint ORecordListIterator<T>::count()const { | 236 | uint ORecordListIterator<T>::count()const { |
237 | return m_uids.count(); | 237 | return m_uids.count(); |
238 | } | 238 | } |
239 | template <class T> | 239 | template <class T> |
240 | ORecordList<T>::ORecordList( const QArray<int>& ids, | 240 | ORecordList<T>::ORecordList( const QArray<int>& ids, |
241 | const Base* acc ) | 241 | const Base* acc ) |
242 | : m_ids( ids ), m_acc( acc ) | 242 | : m_ids( ids ), m_acc( acc ) |
243 | { | 243 | { |
244 | } | 244 | } |
245 | template <class T> | 245 | template <class T> |
246 | ORecordList<T>::~ORecordList() { | 246 | ORecordList<T>::~ORecordList() { |
247 | /* nothing to do here */ | 247 | /* nothing to do here */ |
248 | } | 248 | } |
249 | template <class T> | 249 | template <class T> |
250 | typename ORecordList<T>::Iterator ORecordList<T>::begin() { | 250 | typename ORecordList<T>::Iterator ORecordList<T>::begin() { |
251 | Iterator it( m_ids, m_acc ); | 251 | Iterator it( m_ids, m_acc ); |
252 | return it; | 252 | return it; |
253 | } | 253 | } |
254 | template <class T> | 254 | template <class T> |
255 | typename ORecordList<T>::Iterator ORecordList<T>::end() { | 255 | typename ORecordList<T>::Iterator ORecordList<T>::end() { |
256 | Iterator it( m_ids, m_acc ); | 256 | Iterator it( m_ids, m_acc ); |
257 | it.m_end = true; | 257 | it.m_end = true; |
258 | it.m_current = m_ids.count(); | 258 | it.m_current = m_ids.count(); |
259 | 259 | ||
260 | return it; | 260 | return it; |
261 | } | 261 | } |
262 | template <class T> | 262 | template <class T> |
263 | uint ORecordList<T>::count()const { | 263 | uint ORecordList<T>::count()const { |
264 | return m_ids.count(); | 264 | return m_ids.count(); |
265 | } | 265 | } |
266 | template <class T> | 266 | template <class T> |
267 | T ORecordList<T>::operator[]( uint i ) { | 267 | T ORecordList<T>::operator[]( uint i ) { |
268 | if ( i < 0 || (i+1) > m_ids.count() ) | 268 | if ( i >= m_ids.count() ) |
269 | return T(); | 269 | return T(); |
270 | /* forward */ | 270 | /* forward */ |
271 | return m_acc->find( m_ids[i], m_ids, i ); | 271 | return m_acc->find( m_ids[i], m_ids, i ); |
272 | } | 272 | } |
273 | template <class T> | 273 | template <class T> |
274 | int ORecordList<T>::uidAt( uint i ) { | 274 | int ORecordList<T>::uidAt( uint i ) { |
275 | return m_ids[i]; | 275 | return m_ids[i]; |
276 | } | 276 | } |
277 | 277 | ||
278 | template <class T> | 278 | template <class T> |
279 | bool ORecordList<T>::remove( int uid ) { | 279 | bool ORecordList<T>::remove( int uid ) { |
280 | QArray<int> copy( m_ids.count() ); | 280 | QArray<int> copy( m_ids.count() ); |
281 | int counter = 0; | 281 | int counter = 0; |
282 | bool ret_val = false; | 282 | bool ret_val = false; |
283 | 283 | ||
284 | for (uint i = 0; i < m_ids.count(); i++){ | 284 | for (uint i = 0; i < m_ids.count(); i++){ |
285 | if ( m_ids[i] != uid ){ | 285 | if ( m_ids[i] != uid ){ |
286 | copy[counter++] = m_ids[i]; | 286 | copy[counter++] = m_ids[i]; |
287 | 287 | ||
288 | }else | 288 | }else |
289 | ret_val = true; | 289 | ret_val = true; |
290 | } | 290 | } |
291 | 291 | ||
292 | copy.resize( counter ); | 292 | copy.resize( counter ); |
293 | m_ids = copy; | 293 | m_ids = copy; |
294 | 294 | ||
295 | 295 | ||
296 | return ret_val; | 296 | return ret_val; |
297 | } | 297 | } |
298 | 298 | ||
299 | 299 | ||
300 | #endif | 300 | #endif |
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h index b77a4ab..edcd729 100644 --- a/libopie2/opiepim/orecordlist.h +++ b/libopie2/opiepim/orecordlist.h | |||
@@ -172,129 +172,129 @@ T ORecordListIterator<T>::operator*() { | |||
172 | else | 172 | else |
173 | m_record = T(); | 173 | m_record = T(); |
174 | 174 | ||
175 | return m_record; | 175 | return m_record; |
176 | } | 176 | } |
177 | 177 | ||
178 | template <class T> | 178 | template <class T> |
179 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { | 179 | ORecordListIterator<T> &ORecordListIterator<T>::operator++() { |
180 | m_direction = true; | 180 | m_direction = true; |
181 | if (m_current < m_uids.count() ) { | 181 | if (m_current < m_uids.count() ) { |
182 | m_end = false; | 182 | m_end = false; |
183 | ++m_current; | 183 | ++m_current; |
184 | }else | 184 | }else |
185 | m_end = true; | 185 | m_end = true; |
186 | 186 | ||
187 | return *this; | 187 | return *this; |
188 | } | 188 | } |
189 | template <class T> | 189 | template <class T> |
190 | ORecordListIterator<T> &ORecordListIterator<T>::operator--() { | 190 | ORecordListIterator<T> &ORecordListIterator<T>::operator--() { |
191 | m_direction = false; | 191 | m_direction = false; |
192 | if ( m_current > 0 ) { | 192 | if ( m_current > 0 ) { |
193 | --m_current; | 193 | --m_current; |
194 | m_end = false; | 194 | m_end = false; |
195 | } else | 195 | } else |
196 | m_end = true; | 196 | m_end = true; |
197 | 197 | ||
198 | return *this; | 198 | return *this; |
199 | } | 199 | } |
200 | 200 | ||
201 | template <class T> | 201 | template <class T> |
202 | bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { | 202 | bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { |
203 | 203 | ||
204 | /* if both are at we're the same.... */ | 204 | /* if both are at we're the same.... */ |
205 | if ( m_end == it.m_end ) return true; | 205 | if ( m_end == it.m_end ) return true; |
206 | 206 | ||
207 | if ( m_uids != it.m_uids ) return false; | 207 | if ( m_uids != it.m_uids ) return false; |
208 | if ( m_current != it.m_current ) return false; | 208 | if ( m_current != it.m_current ) return false; |
209 | if ( m_temp != it.m_temp ) return false; | 209 | if ( m_temp != it.m_temp ) return false; |
210 | 210 | ||
211 | return true; | 211 | return true; |
212 | } | 212 | } |
213 | template <class T> | 213 | template <class T> |
214 | bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { | 214 | bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { |
215 | return !(*this == it ); | 215 | return !(*this == it ); |
216 | } | 216 | } |
217 | template <class T> | 217 | template <class T> |
218 | ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, | 218 | ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, |
219 | const Base* t ) | 219 | const Base* t ) |
220 | : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ), | 220 | : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ), |
221 | m_direction( false ) | 221 | m_direction( false ) |
222 | { | 222 | { |
223 | } | 223 | } |
224 | template <class T> | 224 | template <class T> |
225 | uint ORecordListIterator<T>::current()const { | 225 | uint ORecordListIterator<T>::current()const { |
226 | return m_current; | 226 | return m_current; |
227 | } | 227 | } |
228 | template <class T> | 228 | template <class T> |
229 | void ORecordListIterator<T>::setCurrent( uint cur ) { | 229 | void ORecordListIterator<T>::setCurrent( uint cur ) { |
230 | if( cur < m_uids.count() ) { | 230 | if( cur < m_uids.count() ) { |
231 | m_end = false; | 231 | m_end = false; |
232 | m_current= cur; | 232 | m_current= cur; |
233 | } | 233 | } |
234 | } | 234 | } |
235 | template <class T> | 235 | template <class T> |
236 | uint ORecordListIterator<T>::count()const { | 236 | uint ORecordListIterator<T>::count()const { |
237 | return m_uids.count(); | 237 | return m_uids.count(); |
238 | } | 238 | } |
239 | template <class T> | 239 | template <class T> |
240 | ORecordList<T>::ORecordList( const QArray<int>& ids, | 240 | ORecordList<T>::ORecordList( const QArray<int>& ids, |
241 | const Base* acc ) | 241 | const Base* acc ) |
242 | : m_ids( ids ), m_acc( acc ) | 242 | : m_ids( ids ), m_acc( acc ) |
243 | { | 243 | { |
244 | } | 244 | } |
245 | template <class T> | 245 | template <class T> |
246 | ORecordList<T>::~ORecordList() { | 246 | ORecordList<T>::~ORecordList() { |
247 | /* nothing to do here */ | 247 | /* nothing to do here */ |
248 | } | 248 | } |
249 | template <class T> | 249 | template <class T> |
250 | typename ORecordList<T>::Iterator ORecordList<T>::begin() { | 250 | typename ORecordList<T>::Iterator ORecordList<T>::begin() { |
251 | Iterator it( m_ids, m_acc ); | 251 | Iterator it( m_ids, m_acc ); |
252 | return it; | 252 | return it; |
253 | } | 253 | } |
254 | template <class T> | 254 | template <class T> |
255 | typename ORecordList<T>::Iterator ORecordList<T>::end() { | 255 | typename ORecordList<T>::Iterator ORecordList<T>::end() { |
256 | Iterator it( m_ids, m_acc ); | 256 | Iterator it( m_ids, m_acc ); |
257 | it.m_end = true; | 257 | it.m_end = true; |
258 | it.m_current = m_ids.count(); | 258 | it.m_current = m_ids.count(); |
259 | 259 | ||
260 | return it; | 260 | return it; |
261 | } | 261 | } |
262 | template <class T> | 262 | template <class T> |
263 | uint ORecordList<T>::count()const { | 263 | uint ORecordList<T>::count()const { |
264 | return m_ids.count(); | 264 | return m_ids.count(); |
265 | } | 265 | } |
266 | template <class T> | 266 | template <class T> |
267 | T ORecordList<T>::operator[]( uint i ) { | 267 | T ORecordList<T>::operator[]( uint i ) { |
268 | if ( i < 0 || (i+1) > m_ids.count() ) | 268 | if ( i >= m_ids.count() ) |
269 | return T(); | 269 | return T(); |
270 | /* forward */ | 270 | /* forward */ |
271 | return m_acc->find( m_ids[i], m_ids, i ); | 271 | return m_acc->find( m_ids[i], m_ids, i ); |
272 | } | 272 | } |
273 | template <class T> | 273 | template <class T> |
274 | int ORecordList<T>::uidAt( uint i ) { | 274 | int ORecordList<T>::uidAt( uint i ) { |
275 | return m_ids[i]; | 275 | return m_ids[i]; |
276 | } | 276 | } |
277 | 277 | ||
278 | template <class T> | 278 | template <class T> |
279 | bool ORecordList<T>::remove( int uid ) { | 279 | bool ORecordList<T>::remove( int uid ) { |
280 | QArray<int> copy( m_ids.count() ); | 280 | QArray<int> copy( m_ids.count() ); |
281 | int counter = 0; | 281 | int counter = 0; |
282 | bool ret_val = false; | 282 | bool ret_val = false; |
283 | 283 | ||
284 | for (uint i = 0; i < m_ids.count(); i++){ | 284 | for (uint i = 0; i < m_ids.count(); i++){ |
285 | if ( m_ids[i] != uid ){ | 285 | if ( m_ids[i] != uid ){ |
286 | copy[counter++] = m_ids[i]; | 286 | copy[counter++] = m_ids[i]; |
287 | 287 | ||
288 | }else | 288 | }else |
289 | ret_val = true; | 289 | ret_val = true; |
290 | } | 290 | } |
291 | 291 | ||
292 | copy.resize( counter ); | 292 | copy.resize( counter ); |
293 | m_ids = copy; | 293 | m_ids = copy; |
294 | 294 | ||
295 | 295 | ||
296 | return ret_val; | 296 | return ret_val; |
297 | } | 297 | } |
298 | 298 | ||
299 | 299 | ||
300 | #endif | 300 | #endif |