summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/orecordlist.h
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/orecordlist.h') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/orecordlist.h142
1 files changed, 104 insertions, 38 deletions
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h
index 8f0011b..1742dcc 100644
--- a/libopie2/opiepim/orecordlist.h
+++ b/libopie2/opiepim/orecordlist.h
@@ -29,7 +29,6 @@
-#ifndef OPIE_RECORD_LIST_H
-#define OPIE_RECORD_LIST_H
-
-#include <qarray.h>
+#ifndef ORECORDLIST_H
+#define ORECORDLIST_H
+/* OPIE */
#include <opie2/otemplatebase.h>
@@ -37,3 +36,7 @@
-namespace Opie {
+/* QT */
+#include <qarray.h>
+
+namespace Opie
+{
@@ -49,4 +52,6 @@ template <class T> class ORecordList;
template <class T = OPimRecord>
-class ORecordListIterator {
+class ORecordListIterator
+{
friend class ORecordList<T>;
+
public:
@@ -107,2 +112,3 @@ private:
+
class ORecordListPrivate;
@@ -113,3 +119,4 @@ class ORecordListPrivate;
template <class T = OPimRecord >
-class ORecordList {
+class ORecordList
+{
public:
@@ -121,4 +128,4 @@ public:
*/
- ORecordList () {
- }
+ ORecordList ()
+ {}
ORecordList( const QArray<int>& ids,
@@ -160,5 +167,7 @@ private:
+
/* ok now implement it */
template <class T>
-ORecordListIterator<T>::ORecordListIterator() {
+ORecordListIterator<T>::ORecordListIterator()
+{
m_current = 0;
@@ -170,4 +179,7 @@ ORecordListIterator<T>::ORecordListIterator() {
}
+
+
template <class T>
-ORecordListIterator<T>::~ORecordListIterator() {
+ORecordListIterator<T>::~ORecordListIterator()
+{
/* nothing to delete */
@@ -175,4 +187,6 @@ ORecordListIterator<T>::~ORecordListIterator() {
+
template <class T>
-ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) {
+ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it )
+{
// qWarning("ORecordListIterator copy c'tor");
@@ -186,4 +200,6 @@ ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) {
+
template <class T>
-ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) {
+ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it )
+{
m_uids = it.m_uids;
@@ -197,4 +213,6 @@ ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIter
+
template <class T>
-T ORecordListIterator<T>::operator*() {
+T ORecordListIterator<T>::operator*()
+{
//qWarning("operator* %d %d", m_current, m_uids[m_current] );
@@ -210,9 +228,13 @@ T ORecordListIterator<T>::operator*() {
+
template <class T>
-ORecordListIterator<T> &ORecordListIterator<T>::operator++() {
+ORecordListIterator<T> &ORecordListIterator<T>::operator++()
+{
m_direction = true;
- if (m_current < m_uids.count() ) {
+ if ( m_current < m_uids.count() )
+ {
m_end = false;
++m_current;
- }else
+ }
+ else
m_end = true;
@@ -221,9 +243,14 @@ ORecordListIterator<T> &ORecordListIterator<T>::operator++() {
}
+
+
template <class T>
-ORecordListIterator<T> &ORecordListIterator<T>::operator--() {
+ORecordListIterator<T> &ORecordListIterator<T>::operator--()
+{
m_direction = false;
- if ( m_current > 0 ) {
+ if ( m_current > 0 )
+ {
--m_current;
m_end = false;
- } else
+ }
+ else
m_end = true;
@@ -233,4 +260,6 @@ ORecordListIterator<T> &ORecordListIterator<T>::operator--() {
+
template <class T>
-bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) {
+bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it )
+{
@@ -245,6 +274,11 @@ bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) {
}
+
+
template <class T>
-bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) {
+bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it )
+{
return !(*this == it );
}
+
+
template <class T>
@@ -259,9 +293,16 @@ ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids,
}
+
+
template <class T>
-uint ORecordListIterator<T>::current()const {
+uint ORecordListIterator<T>::current() const
+{
return m_current;
}
+
+
template <class T>
-void ORecordListIterator<T>::setCurrent( uint cur ) {
- if( cur < m_uids.count() ) {
+void ORecordListIterator<T>::setCurrent( uint cur )
+{
+ if ( cur < m_uids.count() )
+ {
m_end = false;
@@ -271,5 +312,8 @@ void ORecordListIterator<T>::setCurrent( uint cur ) {
template <class T>
-uint ORecordListIterator<T>::count()const {
+uint ORecordListIterator<T>::count() const
+{
return m_uids.count();
}
+
+
template <class T>
@@ -278,10 +322,15 @@ ORecordList<T>::ORecordList( const QArray<int>& ids,
: m_ids( ids ), m_acc( acc )
-{
-}
+{}
+
+
template <class T>
-ORecordList<T>::~ORecordList() {
+ORecordList<T>::~ORecordList()
+{
/* nothing to do here */
}
+
+
template <class T>
-typename ORecordList<T>::Iterator ORecordList<T>::begin() {
+typename ORecordList<T>::Iterator ORecordList<T>::begin()
+{
Iterator it( m_ids, m_acc );
@@ -289,4 +338,7 @@ typename ORecordList<T>::Iterator ORecordList<T>::begin() {
}
+
+
template <class T>
-typename ORecordList<T>::Iterator ORecordList<T>::end() {
+typename ORecordList<T>::Iterator ORecordList<T>::end()
+{
Iterator it( m_ids, m_acc );
@@ -297,8 +349,14 @@ typename ORecordList<T>::Iterator ORecordList<T>::end() {
}
+
+
template <class T>
-uint ORecordList<T>::count()const {
+uint ORecordList<T>::count() const
+{
return m_ids.count();
}
+
+
template <class T>
-T ORecordList<T>::operator[]( uint i ) {
+T ORecordList<T>::operator[] ( uint i )
+{
if ( i >= m_ids.count() )
@@ -308,4 +366,7 @@ T ORecordList<T>::operator[]( uint i ) {
}
+
+
template <class T>
-int ORecordList<T>::uidAt( uint i ) {
+int ORecordList<T>::uidAt( uint i )
+{
return m_ids[i];
@@ -313,4 +374,6 @@ int ORecordList<T>::uidAt( uint i ) {
+
template <class T>
-bool ORecordList<T>::remove( int uid ) {
+bool ORecordList<T>::remove( int uid )
+{
QArray<int> copy( m_ids.count() );
@@ -319,7 +382,10 @@ bool ORecordList<T>::remove( int uid ) {
- for (uint i = 0; i < m_ids.count(); i++){
- if ( m_ids[i] != uid ){
+ for ( uint i = 0; i < m_ids.count(); i++ )
+ {
+ if ( m_ids[ i ] != uid )
+ {
copy[counter++] = m_ids[i];
- }else
+ }
+ else
ret_val = true;