Diffstat (limited to 'libopie2/opiepim/core/opimaccesstemplate.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimaccesstemplate.h | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h index ecbeb68..5826cbc 100644 --- a/libopie2/opiepim/core/opimaccesstemplate.h +++ b/libopie2/opiepim/core/opimaccesstemplate.h | |||
@@ -1,35 +1,65 @@ | |||
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_TEMPLATE_H | 29 | #ifndef OPIE_PIM_ACCESS_TEMPLATE_H |
2 | #define OPIE_PIM_ACCESS_TEMPLATE_H | 30 | #define OPIE_PIM_ACCESS_TEMPLATE_H |
3 | 31 | ||
4 | #include <qarray.h> | 32 | #include <qarray.h> |
5 | 33 | ||
6 | #include <opie/opimrecord.h> | 34 | #include <opie2/opimrecord.h> |
7 | #include <opie/opimaccessbackend.h> | 35 | #include <opie2/opimaccessbackend.h> |
8 | #include <opie/orecordlist.h> | 36 | #include <opie2/orecordlist.h> |
37 | |||
38 | #include <opie2/opimcache.h> | ||
39 | #include <opie2/otemplatebase.h> | ||
9 | 40 | ||
10 | #include "opimcache.h" | 41 | namespace Opie { |
11 | #include "otemplatebase.h" | ||
12 | 42 | ||
13 | class OPimAccessTemplatePrivate; | 43 | class OPimAccessTemplatePrivate; |
14 | /** | 44 | /** |
15 | * Thats the frontend to our OPIE PIM | 45 | * Thats the frontend to our OPIE PIM |
16 | * Library. Either you want to use it's | 46 | * Library. Either you want to use it's |
17 | * interface or you want to implement | 47 | * interface or you want to implement |
18 | * your own Access lib | 48 | * your own Access lib |
19 | * Just create a OPimRecord and inherit from | 49 | * Just create a OPimRecord and inherit from |
20 | * the plugins | 50 | * the plugins |
21 | */ | 51 | */ |
22 | 52 | ||
23 | template <class T = OPimRecord > | 53 | template <class T = OPimRecord > |
24 | class OPimAccessTemplate : public OTemplateBase<T> { | 54 | class OPimAccessTemplate : public OTemplateBase<T> { |
25 | public: | 55 | public: |
26 | enum Access { | 56 | enum Access { |
27 | Random = 0, | 57 | Random = 0, |
28 | SortedAccess | 58 | SortedAccess |
29 | }; | 59 | }; |
30 | typedef ORecordList<T> List; | 60 | typedef ORecordList<T> List; |
31 | typedef OPimAccessBackend<T> BackEnd; | 61 | typedef OPimAccessBackend<T> BackEnd; |
32 | typedef OPimCache<T> Cache; | 62 | typedef OPimCache<T> Cache; |
33 | 63 | ||
34 | /** | 64 | /** |
35 | * c'tor BackEnd | 65 | * c'tor BackEnd |
@@ -278,25 +308,28 @@ typename OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() { | |||
278 | } | 308 | } |
279 | template <class T> | 309 | template <class T> |
280 | bool OPimAccessTemplate<T>::wasChangedExternally()const { | 310 | bool OPimAccessTemplate<T>::wasChangedExternally()const { |
281 | return false; | 311 | return false; |
282 | } | 312 | } |
283 | template <class T> | 313 | template <class T> |
284 | void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) { | 314 | void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) { |
285 | m_backEnd = end; | 315 | m_backEnd = end; |
286 | if (m_backEnd ) | 316 | if (m_backEnd ) |
287 | m_backEnd->setFrontend( this ); | 317 | m_backEnd->setFrontend( this ); |
288 | } | 318 | } |
289 | template <class T> | 319 | template <class T> |
290 | void OPimAccessTemplate<T>::cache( const T& t ) const{ | 320 | void OPimAccessTemplate<T>::cache( const T& t ) const{ |
291 | /* hacky we need to work around the const*/ | 321 | /* hacky we need to work around the const*/ |
292 | ((OPimAccessTemplate<T>*)this)->m_cache.add( t ); | 322 | ((OPimAccessTemplate<T>*)this)->m_cache.add( t ); |
293 | } | 323 | } |
294 | template <class T> | 324 | template <class T> |
295 | void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { | 325 | void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { |
296 | m_cache.setSize( size ); | 326 | m_cache.setSize( size ); |
297 | } | 327 | } |
298 | template <class T> | 328 | template <class T> |
299 | void OPimAccessTemplate<T>::setReadAhead( uint count ) { | 329 | void OPimAccessTemplate<T>::setReadAhead( uint count ) { |
300 | m_backEnd->setReadAhead( count ); | 330 | m_backEnd->setReadAhead( count ); |
301 | } | 331 | } |
332 | |||
333 | } | ||
334 | |||
302 | #endif | 335 | #endif |