summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimtemplatebase.h
authoreilers <eilers>2004-08-29 12:50:18 (UTC)
committer eilers <eilers>2004-08-29 12:50:18 (UTC)
commit679d9fef2673eea18fe5d9c85df2b10b09a8a250 (patch) (unidiff)
tree8b3d6dbef45568be6f5daac31094d6e599fdefdf /libopie2/opiepim/core/opimtemplatebase.h
parent45327ef3c0f093fc227682f79158632afc09e6d1 (diff)
downloadopie-679d9fef2673eea18fe5d9c85df2b10b09a8a250.zip
opie-679d9fef2673eea18fe5d9c85df2b10b09a8a250.tar.gz
opie-679d9fef2673eea18fe5d9c85df2b10b09a8a250.tar.bz2
Added lookahead caching for addressbook (SQL-only) for speed improvement.
Diffstat (limited to 'libopie2/opiepim/core/opimtemplatebase.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimtemplatebase.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/libopie2/opiepim/core/opimtemplatebase.h b/libopie2/opiepim/core/opimtemplatebase.h
index b48dfed..ec9a94e 100644
--- a/libopie2/opiepim/core/opimtemplatebase.h
+++ b/libopie2/opiepim/core/opimtemplatebase.h
@@ -31,6 +31,7 @@
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/opimrecord.h> 33#include <opie2/opimrecord.h>
34#include <opie2/opimcache.h>
34 35
35/* QT */ 36/* QT */
36#include <qarray.h> 37#include <qarray.h>
@@ -70,13 +71,15 @@ private:
70}; 71};
71/** 72/**
72 * internal template base 73 * internal template base
73 * T needs to implement the copy c'tor!!! 74 * Attention: T needs to implement the copy c'tor!!!
74 */ 75 */
75class OTemplateBasePrivate; 76class OTemplateBasePrivate;
76template <class T = OPimRecord> 77template <class T = OPimRecord>
77class OTemplateBase : public OPimBase { 78class OTemplateBase : public OPimBase {
78public: 79public:
80 /** Look ahead direction of cache */
79 enum CacheDirection { Forward=0, Reverse }; 81 enum CacheDirection { Forward=0, Reverse };
82
80 OTemplateBase() { 83 OTemplateBase() {
81 }; 84 };
82 virtual ~OTemplateBase() { 85 virtual ~OTemplateBase() {
@@ -88,12 +91,23 @@ public:
88 */ 91 */
89 virtual T find( int uid, const QArray<int>& items, 92 virtual T find( int uid, const QArray<int>& items,
90 uint current, CacheDirection dir = Forward )const = 0; 93 uint current, CacheDirection dir = Forward )const = 0;
94
95 /**
96 * Find in Cache..
97 * Returns empty object if nothing found.
98 */
99 virtual T cacheFind( int uid )const = 0;
100
101 /**
102 * Put element into Cache
103 */
91 virtual void cache( const T& )const = 0; 104 virtual void cache( const T& )const = 0;
92 virtual void setSaneCacheSize( int ) = 0; 105 virtual void setSaneCacheSize( int ) = 0;
93 106
94 OPimRecord* record()const; 107 OPimRecord* record()const;
95 OPimRecord* record(int uid )const; 108 OPimRecord* record(int uid )const;
96 static T* rec(); 109 static T* rec();
110
97 111
98private: 112private:
99 OTemplateBasePrivate *d; 113 OTemplateBasePrivate *d;