summaryrefslogtreecommitdiff
path: root/libopie/pim/opimcache.h
Unidiff
Diffstat (limited to 'libopie/pim/opimcache.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/opimcache.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/libopie/pim/opimcache.h b/libopie/pim/opimcache.h
index 839550c..73414e5 100644
--- a/libopie/pim/opimcache.h
+++ b/libopie/pim/opimcache.h
@@ -1,43 +1,49 @@
1#ifndef OPIE_PIM_CACHE_H 1#ifndef OPIE_PIM_CACHE_H
2#define OPIE_PIM_CACHE_H 2#define OPIE_PIM_CACHE_H
3 3
4#include <qintcache.h> 4#include <qintcache.h>
5 5
6#include "opimrecord.h" 6#include "opimrecord.h"
7 7
8template <class T = OPimRecord> 8template <class T = OPimRecord>
9class OPimCacheItem { 9class OPimCacheItem {
10public: 10public:
11 OPimCacheItem( const T& t = T() ); 11 OPimCacheItem( const T& t = T() );
12 OPimCacheItem( const OPimCacheItem& );
12 ~OPimCacheItem(); 13 ~OPimCacheItem();
13 14
15 OPimCacheItem &operator=( const OPimCacheItem& );
16
14 T record()const; 17 T record()const;
15 void setRecord( const T& ); 18 void setRecord( const T& );
16private: 19private:
17 T m_t; 20 T m_t;
18}; 21};
19 22
20/** 23/**
21 * OPimCache for caching the items 24 * OPimCache for caching the items
22 * We support adding, removing 25 * We support adding, removing
23 * and finding 26 * and finding
24 */ 27 */
25template <class T = OPimRecord> 28template <class T = OPimRecord>
26class OPimCache { 29class OPimCache {
27public: 30public:
28 typedef OPimCacheItem<T> Item; 31 typedef OPimCacheItem<T> Item;
29 OPimCache(); 32 OPimCache();
33 OPimCache( const OPimCache& );
30 ~OPimCache(); 34 ~OPimCache();
31 35
36 OPimCache &operator=( const OPimCache& );
37
32 bool contains(int uid)const; 38 bool contains(int uid)const;
33 void invalidate(); 39 void invalidate();
34 void setSize( int size ); 40 void setSize( int size );
35 41
36 T find(int uid )const; 42 T find(int uid )const;
37 void add( const T& ); 43 void add( const T& );
38 void remove( int uid ); 44 void remove( int uid );
39 void replace( const T& ); 45 void replace( const T& );
40 46
41private: 47private:
42 QIntCache<Item> m_cache; 48 QIntCache<Item> m_cache;
43}; 49};