summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/opimaccessbackend.h
Unidiff
Diffstat (limited to 'libopie2/opiepim/backend/opimaccessbackend.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/opimaccessbackend.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h
index c27acbb..27d3cb8 100644
--- a/libopie2/opiepim/backend/opimaccessbackend.h
+++ b/libopie2/opiepim/backend/opimaccessbackend.h
@@ -4,4 +4,5 @@
4#include <qarray.h> 4#include <qarray.h>
5 5
6#include <opie/otemplatebase.h>
6#include <opie/opimrecord.h> 7#include <opie/opimrecord.h>
7 8
@@ -18,4 +19,5 @@ template <class T = OPimRecord>
18class OPimAccessBackend { 19class OPimAccessBackend {
19public: 20public:
21 typedef OTemplateBase<T> Frontend;
20 OPimAccessBackend(); 22 OPimAccessBackend();
21 virtual ~OPimAccessBackend(); 23 virtual ~OPimAccessBackend();
@@ -55,4 +57,6 @@ public:
55 virtual T find(int uid )const = 0; 57 virtual T find(int uid )const = 0;
56 58
59 virtual T find(int uid, const QArray<int>& items,
60 uint current, Frontend::CacheDirection )const ;
57 /** 61 /**
58 * clear the back end 62 * clear the back end
@@ -75,4 +79,19 @@ public:
75 virtual bool replace( const T& t ) = 0; 79 virtual bool replace( const T& t ) = 0;
76 80
81 /*
82 * setTheFrontEnd!!!
83 */
84 void setFrontend( Frontend* front );
85
86protected:
87 void cache( const T& t )const;
88
89 /**
90 * use a prime number here!
91 */
92 void setSaneCacheSize( int );
93
94private:
95 Frontend* m_front;
77 96
78}; 97};
@@ -80,5 +99,5 @@ public:
80template <class T> 99template <class T>
81OPimAccessBackend<T>::OPimAccessBackend() { 100OPimAccessBackend<T>::OPimAccessBackend() {
82 101 m_front = 0l;
83} 102}
84template <class T> 103template <class T>
@@ -86,4 +105,23 @@ OPimAccessBackend<T>::~OPimAccessBackend() {
86 105
87} 106}
107template <class T>
108void OPimAccessBackend<T>::setFrontend( Frontend* fr ) {
109 m_front = fr;
110}
111template <class T>
112void OPimAccessBackend<T>::cache( const T& t )const {
113 if (m_front )
114 m_front->cache( t );
115}
116template <class T>
117void OPimAccessBackend<T>::setSaneCacheSize( int size) {
118 if (m_front )
119 m_front->setSaneCacheSize( size );
120}
121template <class T>
122T OPimAccessBackend<T>::find( int uid, const QArray<int>&,
123 uint, Frontend::CacheDirection )const {
124 return find( uid );
125}
88 126
89#endif 127#endif