Diffstat (limited to 'libopie2/opiepim/backend/opimaccessbackend.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/opimaccessbackend.h | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h index fd264fc..505358e 100644 --- a/libopie2/opiepim/backend/opimaccessbackend.h +++ b/libopie2/opiepim/backend/opimaccessbackend.h | |||
@@ -1,34 +1,63 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) The Main Author <main-author@whereever.org> | ||
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
1 | #ifndef OPIE_PIM_ACCESS_BACKEND | 29 | #ifndef OPIE_PIM_ACCESS_BACKEND |
2 | #define OPIE_PIM_ACCESS_BACKEND | 30 | #define OPIE_PIM_ACCESS_BACKEND |
3 | 31 | ||
4 | #include <qarray.h> | 32 | #include <qarray.h> |
5 | #include <qdatetime.h> | 33 | #include <qdatetime.h> |
6 | 34 | ||
7 | #include <opie/otemplatebase.h> | 35 | #include <opie2/otemplatebase.h> |
8 | #include <opie/opimrecord.h> | 36 | #include <opie2/opimrecord.h> |
9 | 37 | ||
10 | 38 | ||
39 | namespace Opie { | ||
11 | class OPimAccessBackendPrivate; | 40 | class OPimAccessBackendPrivate; |
12 | /** | 41 | /** |
13 | * OPimAccessBackend is the base class | 42 | * OPimAccessBackend is the base class |
14 | * for all private backends | 43 | * for all private backends |
15 | * it operates on OPimRecord as the base class | 44 | * it operates on OPimRecord as the base class |
16 | * and it's responsible for fast manipulating | 45 | * and it's responsible for fast manipulating |
17 | * the resource the implementation takes care | 46 | * the resource the implementation takes care |
18 | * of | 47 | * of |
19 | */ | 48 | */ |
20 | template <class T = OPimRecord> | 49 | template <class T = OPimRecord> |
21 | class OPimAccessBackend { | 50 | class OPimAccessBackend { |
22 | public: | 51 | public: |
23 | typedef OTemplateBase<T> Frontend; | 52 | typedef OTemplateBase<T> Frontend; |
24 | 53 | ||
25 | /** The access hint from the frontend */ | 54 | /** The access hint from the frontend */ |
26 | OPimAccessBackend(int access = 0); | 55 | OPimAccessBackend(int access = 0); |
27 | virtual ~OPimAccessBackend(); | 56 | virtual ~OPimAccessBackend(); |
28 | 57 | ||
29 | /** | 58 | /** |
30 | * load the resource | 59 | * load the resource |
31 | */ | 60 | */ |
32 | virtual bool load() = 0; | 61 | virtual bool load() = 0; |
33 | 62 | ||
34 | /** | 63 | /** |
@@ -136,25 +165,28 @@ void OPimAccessBackend<T>::cache( const T& t )const { | |||
136 | m_front->cache( t ); | 165 | m_front->cache( t ); |
137 | } | 166 | } |
138 | template <class T> | 167 | template <class T> |
139 | void OPimAccessBackend<T>::setSaneCacheSize( int size) { | 168 | void OPimAccessBackend<T>::setSaneCacheSize( int size) { |
140 | if (m_front ) | 169 | if (m_front ) |
141 | m_front->setSaneCacheSize( size ); | 170 | m_front->setSaneCacheSize( size ); |
142 | } | 171 | } |
143 | template <class T> | 172 | template <class T> |
144 | T OPimAccessBackend<T>::find( int uid, const QArray<int>&, | 173 | T OPimAccessBackend<T>::find( int uid, const QArray<int>&, |
145 | uint, typename Frontend::CacheDirection )const { | 174 | uint, typename Frontend::CacheDirection )const { |
146 | return find( uid ); | 175 | return find( uid ); |
147 | } | 176 | } |
148 | template <class T> | 177 | template <class T> |
149 | void OPimAccessBackend<T>::setReadAhead( uint count ) { | 178 | void OPimAccessBackend<T>::setReadAhead( uint count ) { |
150 | m_read = count; | 179 | m_read = count; |
151 | } | 180 | } |
152 | template <class T> | 181 | template <class T> |
153 | uint OPimAccessBackend<T>::readAhead()const { | 182 | uint OPimAccessBackend<T>::readAhead()const { |
154 | return m_read; | 183 | return m_read; |
155 | } | 184 | } |
156 | template <class T> | 185 | template <class T> |
157 | int OPimAccessBackend<T>::access()const { | 186 | int OPimAccessBackend<T>::access()const { |
158 | return m_acc; | 187 | return m_acc; |
159 | } | 188 | } |
189 | |||
190 | } | ||
191 | |||
160 | #endif | 192 | #endif |