summaryrefslogtreecommitdiff
path: root/libopie/pim/opimaccesstemplate.h
Unidiff
Diffstat (limited to 'libopie/pim/opimaccesstemplate.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/opimaccesstemplate.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/libopie/pim/opimaccesstemplate.h b/libopie/pim/opimaccesstemplate.h
index 8ff205c..ecbeb68 100644
--- a/libopie/pim/opimaccesstemplate.h
+++ b/libopie/pim/opimaccesstemplate.h
@@ -1,36 +1,37 @@
1#ifndef OPIE_PIM_ACCESS_TEMPLATE_H 1#ifndef OPIE_PIM_ACCESS_TEMPLATE_H
2#define OPIE_PIM_ACCESS_TEMPLATE_H 2#define OPIE_PIM_ACCESS_TEMPLATE_H
3 3
4#include <qarray.h> 4#include <qarray.h>
5 5
6#include <opie/opimrecord.h> 6#include <opie/opimrecord.h>
7#include <opie/opimaccessbackend.h> 7#include <opie/opimaccessbackend.h>
8#include <opie/orecordlist.h> 8#include <opie/orecordlist.h>
9 9
10#include "opimcache.h" 10#include "opimcache.h"
11#include "otemplatebase.h" 11#include "otemplatebase.h"
12 12
13class OPimAccessTemplatePrivate;
13/** 14/**
14 * Thats the frontend to our OPIE PIM 15 * Thats the frontend to our OPIE PIM
15 * Library. Either you want to use it's 16 * Library. Either you want to use it's
16 * interface or you want to implement 17 * interface or you want to implement
17 * your own Access lib 18 * your own Access lib
18 * Just create a OPimRecord and inherit from 19 * Just create a OPimRecord and inherit from
19 * the plugins 20 * the plugins
20 */ 21 */
21 22
22template <class T = OPimRecord > 23template <class T = OPimRecord >
23class OPimAccessTemplate : public OTemplateBase<T> { 24class OPimAccessTemplate : public OTemplateBase<T> {
24public: 25public:
25 enum Access { 26 enum Access {
26 Random = 0, 27 Random = 0,
27 SortedAccess 28 SortedAccess
28 }; 29 };
29 typedef ORecordList<T> List; 30 typedef ORecordList<T> List;
30 typedef OPimAccessBackend<T> BackEnd; 31 typedef OPimAccessBackend<T> BackEnd;
31 typedef OPimCache<T> Cache; 32 typedef OPimCache<T> Cache;
32 33
33 /** 34 /**
34 * c'tor BackEnd 35 * c'tor BackEnd
35 * enum Access a small hint on how to handle the backend 36 * enum Access a small hint on how to handle the backend
36 */ 37 */
@@ -131,48 +132,51 @@ public:
131 virtual bool replace( const T& t) ; 132 virtual bool replace( const T& t) ;
132 133
133 void setReadAhead( uint count ); 134 void setReadAhead( uint count );
134 /** 135 /**
135 * @internal 136 * @internal
136 */ 137 */
137 void cache( const T& )const; 138 void cache( const T& )const;
138 void setSaneCacheSize( int ); 139 void setSaneCacheSize( int );
139 140
140 QArray<int> records()const; 141 QArray<int> records()const;
141protected: 142protected:
142 /** 143 /**
143 * invalidate the cache 144 * invalidate the cache
144 */ 145 */
145 void invalidateCache(); 146 void invalidateCache();
146 147
147 void setBackEnd( BackEnd* end ); 148 void setBackEnd( BackEnd* end );
148 /** 149 /**
149 * returns the backend 150 * returns the backend
150 */ 151 */
151 BackEnd* backEnd(); 152 BackEnd* backEnd();
152 BackEnd* m_backEnd; 153 BackEnd* m_backEnd;
153 Cache m_cache; 154 Cache m_cache;
154 155
156private:
157 OPimAccessTemplatePrivate *d;
158
155}; 159};
156 160
157template <class T> 161template <class T>
158OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) 162OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end )
159 : OTemplateBase<T>(), m_backEnd( end ) 163 : OTemplateBase<T>(), m_backEnd( end )
160{ 164{
161 if (end ) 165 if (end )
162 end->setFrontend( this ); 166 end->setFrontend( this );
163} 167}
164template <class T> 168template <class T>
165OPimAccessTemplate<T>::~OPimAccessTemplate() { 169OPimAccessTemplate<T>::~OPimAccessTemplate() {
166 qWarning("~OPimAccessTemplate<T>"); 170 qWarning("~OPimAccessTemplate<T>");
167 delete m_backEnd; 171 delete m_backEnd;
168} 172}
169template <class T> 173template <class T>
170bool OPimAccessTemplate<T>::load() { 174bool OPimAccessTemplate<T>::load() {
171 invalidateCache(); 175 invalidateCache();
172 return m_backEnd->load(); 176 return m_backEnd->load();
173} 177}
174template <class T> 178template <class T>
175bool OPimAccessTemplate<T>::reload() { 179bool OPimAccessTemplate<T>::reload() {
176 invalidateCache(); // zecke: I think this should be added (se) 180 invalidateCache(); // zecke: I think this should be added (se)
177 return m_backEnd->reload(); 181 return m_backEnd->reload();
178} 182}