summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimcache.h
Unidiff
Diffstat (limited to 'libopie2/opiepim/core/opimcache.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimcache.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/libopie2/opiepim/core/opimcache.h b/libopie2/opiepim/core/opimcache.h
index 7f7cff5..e70a910 100644
--- a/libopie2/opiepim/core/opimcache.h
+++ b/libopie2/opiepim/core/opimcache.h
@@ -1,19 +1,48 @@
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_CACHE_H 29#ifndef OPIE_PIM_CACHE_H
2#define OPIE_PIM_CACHE_H 30#define OPIE_PIM_CACHE_H
3 31
4#include <qintcache.h> 32#include <qintcache.h>
5 33
6#include "opimrecord.h" 34#include <opie2/opimrecord.h>
7 35
36namespace Opie {
8class OPimCacheItemPrivate; 37class OPimCacheItemPrivate;
9 38
10template <class T = OPimRecord> 39template <class T = OPimRecord>
11class OPimCacheItem { 40class OPimCacheItem {
12public: 41public:
13 OPimCacheItem( const T& t = T() ); 42 OPimCacheItem( const T& t = T() );
14 OPimCacheItem( const OPimCacheItem& ); 43 OPimCacheItem( const OPimCacheItem& );
15 ~OPimCacheItem(); 44 ~OPimCacheItem();
16 45
17 OPimCacheItem &operator=( const OPimCacheItem& ); 46 OPimCacheItem &operator=( const OPimCacheItem& );
18 47
19 T record()const; 48 T record()const;
@@ -119,13 +148,15 @@ void OPimCache<T>::add( const T& t ) {
119template <class T> 148template <class T>
120void OPimCache<T>::remove( int uid ) { 149void OPimCache<T>::remove( int uid ) {
121 m_cache.remove( uid ); 150 m_cache.remove( uid );
122} 151}
123template <class T> 152template <class T>
124void OPimCache<T>::replace( const T& t) { 153void OPimCache<T>::replace( const T& t) {
125 Item *it = m_cache.find( t.uid() ); 154 Item *it = m_cache.find( t.uid() );
126 if ( it ) { 155 if ( it ) {
127 it->setRecord( t ); 156 it->setRecord( t );
128 } 157 }
129} 158}
130 159
160}
161
131#endif 162#endif