summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimaccesstemplate.h
Unidiff
Diffstat (limited to 'libopie2/opiepim/core/opimaccesstemplate.h') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index e438980..55d600a 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -21,32 +21,35 @@
21++= -. .` .: details. 21++= -. .` .: details.
22 : = ...= . :.=- 22 : = ...= . :.=-
23 -. .:....=;==+<; You should have received a copy of the GNU 23 -. .:....=;==+<; You should have received a copy of the GNU
24 -_. . . )=. = Library General Public License along with 24 -_. . . )=. = Library General Public License along with
25 -- :-=` this library; see the file COPYING.LIB. 25 -- :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29*/ 29*/
30#ifndef OPIE_PIM_ACCESS_TEMPLATE_H 30#ifndef OPIE_PIM_ACCESS_TEMPLATE_H
31#define OPIE_PIM_ACCESS_TEMPLATE_H 31#define OPIE_PIM_ACCESS_TEMPLATE_H
32 32
33#include <qarray.h> 33/* OPIE */
34
35#include <opie2/opimrecord.h> 34#include <opie2/opimrecord.h>
36#include <opie2/opimaccessbackend.h> 35#include <opie2/opimaccessbackend.h>
37#include <opie2/opimrecordlist.h> 36#include <opie2/opimrecordlist.h>
38 37
39#include <opie2/opimcache.h> 38#include <opie2/opimcache.h>
40#include <opie2/opimtemplatebase.h> 39#include <opie2/opimtemplatebase.h>
40#include <opie2/odebug.h>
41
42/* QT */
43#include <qarray.h>
41 44
42namespace Opie { 45namespace Opie {
43 46
44class OPimAccessTemplatePrivate; 47class OPimAccessTemplatePrivate;
45/** 48/**
46 * Thats the frontend to our OPIE PIM 49 * Thats the frontend to our OPIE PIM
47 * Library. Either you want to use it's 50 * Library. Either you want to use it's
48 * interface or you want to implement 51 * interface or you want to implement
49 * your own Access lib 52 * your own Access lib
50 * Just create a OPimRecord and inherit from 53 * Just create a OPimRecord and inherit from
51 * the templates 54 * the templates
52 */ 55 */
@@ -196,25 +199,25 @@ private:
196 199
197}; 200};
198 201
199template <class T> 202template <class T>
200OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) 203OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end )
201 : OTemplateBase<T>(), m_backEnd( end ) 204 : OTemplateBase<T>(), m_backEnd( end )
202{ 205{
203 if (end ) 206 if (end )
204 end->setFrontend( this ); 207 end->setFrontend( this );
205} 208}
206template <class T> 209template <class T>
207OPimAccessTemplate<T>::~OPimAccessTemplate() { 210OPimAccessTemplate<T>::~OPimAccessTemplate() {
208 qWarning("~OPimAccessTemplate<T>"); 211 owarn << "~OPimAccessTemplate<T>" << oendl;
209 delete m_backEnd; 212 delete m_backEnd;
210} 213}
211template <class T> 214template <class T>
212bool OPimAccessTemplate<T>::load() { 215bool OPimAccessTemplate<T>::load() {
213 invalidateCache(); 216 invalidateCache();
214 return m_backEnd->load(); 217 return m_backEnd->load();
215} 218}
216template <class T> 219template <class T>
217bool OPimAccessTemplate<T>::reload() { 220bool OPimAccessTemplate<T>::reload() {
218 invalidateCache(); // zecke: I think this should be added (se) 221 invalidateCache(); // zecke: I think this should be added (se)
219 return m_backEnd->reload(); 222 return m_backEnd->reload();
220} 223}
@@ -251,25 +254,25 @@ T OPimAccessTemplate<T>::find( int uid ) const{
251 T t = m_backEnd->find( uid ); 254 T t = m_backEnd->find( uid );
252 cache( t ); 255 cache( t );
253 return t; 256 return t;
254} 257}
255template <class T> 258template <class T>
256T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, 259T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar,
257 uint current, typename OTemplateBase<T>::CacheDirection dir )const { 260 uint current, typename OTemplateBase<T>::CacheDirection dir )const {
258 /* 261 /*
259 * better do T.isEmpty() 262 * better do T.isEmpty()
260 * after a find this way we would 263 * after a find this way we would
261 * avoid two finds in QCache... 264 * avoid two finds in QCache...
262 */ 265 */
263 // qWarning("find it now %d", uid ); 266 // owarn << "find it now " << uid << oendl;
264 if (m_cache.contains( uid ) ) { 267 if (m_cache.contains( uid ) ) {
265 return m_cache.find( uid ); 268 return m_cache.find( uid );
266 } 269 }
267 270
268 T t = m_backEnd->find( uid, ar, current, dir ); 271 T t = m_backEnd->find( uid, ar, current, dir );
269 cache( t ); 272 cache( t );
270 return t; 273 return t;
271} 274}
272template <class T> 275template <class T>
273void OPimAccessTemplate<T>::clear() { 276void OPimAccessTemplate<T>::clear() {
274 invalidateCache(); 277 invalidateCache();
275 m_backEnd->clear(); 278 m_backEnd->clear();