-rw-r--r-- | libopie/pim/opimcache.h | 6 |
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 | ||
8 | template <class T = OPimRecord> | 8 | template <class T = OPimRecord> |
9 | class OPimCacheItem { | 9 | class OPimCacheItem { |
10 | public: | 10 | public: |
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& ); |
16 | private: | 19 | private: |
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 | */ |
25 | template <class T = OPimRecord> | 28 | template <class T = OPimRecord> |
26 | class OPimCache { | 29 | class OPimCache { |
27 | public: | 30 | public: |
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 | ||
41 | private: | 47 | private: |
42 | QIntCache<Item> m_cache; | 48 | QIntCache<Item> m_cache; |
43 | }; | 49 | }; |