Diffstat (limited to 'libopie2/opiepim/backend/opimaccessbackend.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/opimaccessbackend.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h index f4bbe35..c3d91f7 100644 --- a/libopie2/opiepim/backend/opimaccessbackend.h +++ b/libopie2/opiepim/backend/opimaccessbackend.h | |||
@@ -1,33 +1,34 @@ | |||
1 | #ifndef OPIE_PIM_ACCESS_BACKEND | 1 | #ifndef OPIE_PIM_ACCESS_BACKEND |
2 | #define OPIE_PIM_ACCESS_BACKEND | 2 | #define OPIE_PIM_ACCESS_BACKEND |
3 | 3 | ||
4 | #include <qarray.h> | 4 | #include <qarray.h> |
5 | 5 | ||
6 | #include <opie/otemplatebase.h> | 6 | #include <opie/otemplatebase.h> |
7 | #include <opie/opimrecord.h> | 7 | #include <opie/opimrecord.h> |
8 | 8 | ||
9 | 9 | ||
10 | class OPimAccessBackendPrivate; | ||
10 | /** | 11 | /** |
11 | * OPimAccessBackend is the base class | 12 | * OPimAccessBackend is the base class |
12 | * for all private backends | 13 | * for all private backends |
13 | * it operates on OPimRecord as the base class | 14 | * it operates on OPimRecord as the base class |
14 | * and it's responsible for fast manipulating | 15 | * and it's responsible for fast manipulating |
15 | * the resource the implementation takes care | 16 | * the resource the implementation takes care |
16 | * of | 17 | * of |
17 | */ | 18 | */ |
18 | template <class T = OPimRecord> | 19 | template <class T = OPimRecord> |
19 | class OPimAccessBackend { | 20 | class OPimAccessBackend { |
20 | public: | 21 | public: |
21 | typedef OTemplateBase<T> Frontend; | 22 | typedef OTemplateBase<T> Frontend; |
22 | 23 | ||
23 | /** The access hint from the frontend */ | 24 | /** The access hint from the frontend */ |
24 | OPimAccessBackend(int access = 0); | 25 | OPimAccessBackend(int access = 0); |
25 | virtual ~OPimAccessBackend(); | 26 | virtual ~OPimAccessBackend(); |
26 | 27 | ||
27 | /** | 28 | /** |
28 | * load the resource | 29 | * load the resource |
29 | */ | 30 | */ |
30 | virtual bool load() = 0; | 31 | virtual bool load() = 0; |
31 | 32 | ||
32 | /** | 33 | /** |
33 | * reload the resource | 34 | * reload the resource |
@@ -86,50 +87,49 @@ public: | |||
86 | */ | 87 | */ |
87 | virtual bool replace( const T& t ) = 0; | 88 | virtual bool replace( const T& t ) = 0; |
88 | 89 | ||
89 | /* | 90 | /* |
90 | * setTheFrontEnd!!! | 91 | * setTheFrontEnd!!! |
91 | */ | 92 | */ |
92 | void setFrontend( Frontend* front ); | 93 | void setFrontend( Frontend* front ); |
93 | 94 | ||
94 | /** | 95 | /** |
95 | * set the read ahead count | 96 | * set the read ahead count |
96 | */ | 97 | */ |
97 | void setReadAhead( uint count ); | 98 | void setReadAhead( uint count ); |
98 | protected: | 99 | protected: |
99 | int access()const; | 100 | int access()const; |
100 | void cache( const T& t )const; | 101 | void cache( const T& t )const; |
101 | 102 | ||
102 | /** | 103 | /** |
103 | * use a prime number here! | 104 | * use a prime number here! |
104 | */ | 105 | */ |
105 | void setSaneCacheSize( int ); | 106 | void setSaneCacheSize( int ); |
106 | 107 | ||
107 | uint readAhead()const; | 108 | uint readAhead()const; |
108 | 109 | ||
109 | private: | 110 | private: |
110 | class Private; | 111 | OPimAccessBackendPrivate *d; |
111 | Private* d; | ||
112 | Frontend* m_front; | 112 | Frontend* m_front; |
113 | uint m_read; | 113 | uint m_read; |
114 | int m_acc; | 114 | int m_acc; |
115 | 115 | ||
116 | }; | 116 | }; |
117 | 117 | ||
118 | template <class T> | 118 | template <class T> |
119 | OPimAccessBackend<T>::OPimAccessBackend(int acc) | 119 | OPimAccessBackend<T>::OPimAccessBackend(int acc) |
120 | : m_acc( acc ) | 120 | : m_acc( acc ) |
121 | { | 121 | { |
122 | m_front = 0l; | 122 | m_front = 0l; |
123 | } | 123 | } |
124 | template <class T> | 124 | template <class T> |
125 | OPimAccessBackend<T>::~OPimAccessBackend() { | 125 | OPimAccessBackend<T>::~OPimAccessBackend() { |
126 | 126 | ||
127 | } | 127 | } |
128 | template <class T> | 128 | template <class T> |
129 | void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { | 129 | void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { |
130 | m_front = fr; | 130 | m_front = fr; |
131 | } | 131 | } |
132 | template <class T> | 132 | template <class T> |
133 | void OPimAccessBackend<T>::cache( const T& t )const { | 133 | void OPimAccessBackend<T>::cache( const T& t )const { |
134 | if (m_front ) | 134 | if (m_front ) |
135 | m_front->cache( t ); | 135 | m_front->cache( t ); |