summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/orecordlist.h
authorzecke <zecke>2002-10-07 09:10:05 (UTC)
committer zecke <zecke>2002-10-07 09:10:05 (UTC)
commitacd2d0062dd87635feb03927663b1f700305d67b (patch) (unidiff)
tree179217749ec7ba3217ca71f80a6e1064f249d1b0 /libopie2/opiepim/orecordlist.h
parentde56dc7c5a21cbd70e9d1e66ab68ca95a277c45c (diff)
downloadopie-acd2d0062dd87635feb03927663b1f700305d67b.zip
opie-acd2d0062dd87635feb03927663b1f700305d67b.tar.gz
opie-acd2d0062dd87635feb03927663b1f700305d67b.tar.bz2
First SQL backend Resource
The DB layout is not fully what we've in mind but for example I do lack the Categories infrastructure for that I've to implement sorted lists and then I'll make Todolist fast
Diffstat (limited to 'libopie2/opiepim/orecordlist.h') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/orecordlist.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h
index 1fd0741..b6fa7fa 100644
--- a/libopie2/opiepim/orecordlist.h
+++ b/libopie2/opiepim/orecordlist.h
@@ -109,103 +109,102 @@ public:
109 109
110 T operator[]( uint i ); 110 T operator[]( uint i );
111 // FIXME implemenent remove 111 // FIXME implemenent remove
112 /* 112 /*
113 ConstIterator begin()const; 113 ConstIterator begin()const;
114 ConstIterator end()const; 114 ConstIterator end()const;
115 */ 115 */
116private: 116private:
117 QArray<int> m_ids; 117 QArray<int> m_ids;
118 const Base* m_acc; 118 const Base* m_acc;
119}; 119};
120 120
121/* ok now implement it */ 121/* ok now implement it */
122template <class T> 122template <class T>
123ORecordListIterator<T>::ORecordListIterator() { 123ORecordListIterator<T>::ORecordListIterator() {
124 m_current = 0; 124 m_current = 0;
125 m_temp = 0l; 125 m_temp = 0l;
126 m_end = true; 126 m_end = true;
127 m_record = T(); 127 m_record = T();
128} 128}
129template <class T> 129template <class T>
130ORecordListIterator<T>::~ORecordListIterator() { 130ORecordListIterator<T>::~ORecordListIterator() {
131/* nothing to delete */ 131/* nothing to delete */
132} 132}
133 133
134template <class T> 134template <class T>
135ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) { 135ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) {
136// qWarning("ORecordListIterator copy c'tor"); 136// qWarning("ORecordListIterator copy c'tor");
137 m_uids = it.m_uids; 137 m_uids = it.m_uids;
138 m_current = it.m_current; 138 m_current = it.m_current;
139 m_temp = it.m_temp; 139 m_temp = it.m_temp;
140 m_end = it.m_end; 140 m_end = it.m_end;
141 m_record = it.m_record; 141 m_record = it.m_record;
142} 142}
143 143
144template <class T> 144template <class T>
145ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) { 145ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) {
146 m_uids = it.m_uids; 146 m_uids = it.m_uids;
147 m_current = it.m_current; 147 m_current = it.m_current;
148 m_temp = it.m_temp; 148 m_temp = it.m_temp;
149 m_end = it.m_end; 149 m_end = it.m_end;
150 m_record = it.m_record; 150 m_record = it.m_record;
151 151
152 return *this; 152 return *this;
153} 153}
154 154
155template <class T> 155template <class T>
156T ORecordListIterator<T>::operator*() { 156T ORecordListIterator<T>::operator*() {
157// qWarning("operator* %d %d", m_current, m_uids[m_current] ); 157 qWarning("operator* %d %d", m_current, m_uids[m_current] );
158 if (!m_end ) 158 if (!m_end )
159 /* FIXME 159 /* FIXME
160 * until the cache is in place 160 * until the cache is in place
161 * we do the uid match uid check 161 * we do the uid match uid check
162 */ 162 */
163 if(m_record.uid() != m_uids[m_current] )
164 m_record = m_temp->find( m_uids[m_current] ); 163 m_record = m_temp->find( m_uids[m_current] );
165 else 164 else
166 m_record = T(); 165 m_record = T();
167 166
168 return m_record; 167 return m_record;
169} 168}
170 169
171template <class T> 170template <class T>
172ORecordListIterator<T> &ORecordListIterator<T>::operator++() { 171ORecordListIterator<T> &ORecordListIterator<T>::operator++() {
173 if (m_current < m_uids.count() ) { 172 if (m_current < m_uids.count() ) {
174 m_end = false; 173 m_end = false;
175 ++m_current; 174 ++m_current;
176 }else 175 }else
177 m_end = true; 176 m_end = true;
178 177
179 return *this; 178 return *this;
180} 179}
181template <class T> 180template <class T>
182ORecordListIterator<T> &ORecordListIterator<T>::operator--() { 181ORecordListIterator<T> &ORecordListIterator<T>::operator--() {
183 if ( m_current > 0 ) { 182 if ( m_current > 0 ) {
184 --m_current; 183 --m_current;
185 m_end = false; 184 m_end = false;
186 } else 185 } else
187 m_end = true; 186 m_end = true;
188 187
189 return *this; 188 return *this;
190} 189}
191 190
192template <class T> 191template <class T>
193bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { 192bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) {
194 193
195 /* if both are at we're the same.... */ 194 /* if both are at we're the same.... */
196 if ( m_end == it.m_end ) return true; 195 if ( m_end == it.m_end ) return true;
197 196
198 if ( m_uids != it.m_uids ) return false; 197 if ( m_uids != it.m_uids ) return false;
199 if ( m_current != it.m_current ) return false; 198 if ( m_current != it.m_current ) return false;
200 if ( m_temp != it.m_temp ) return false; 199 if ( m_temp != it.m_temp ) return false;
201 200
202 return true; 201 return true;
203} 202}
204template <class T> 203template <class T>
205bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { 204bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) {
206 return !(*this == it ); 205 return !(*this == it );
207} 206}
208template <class T> 207template <class T>
209ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, 208ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids,
210 const Base* t ) 209 const Base* t )
211 : 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 )