author | eilers <eilers> | 2003-11-17 15:57:10 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-11-17 15:57:10 (UTC) |
commit | 5228be0c7dfe6ce10330133fde6a5b15f836403b (patch) (unidiff) | |
tree | af8e5771fce916db0544f23e5c513d3cb3d60c7b /libopie | |
parent | 3ba032c6a4833260ef6274b6b2bf6a6a9ccc2540 (diff) | |
download | opie-5228be0c7dfe6ce10330133fde6a5b15f836403b.zip opie-5228be0c7dfe6ce10330133fde6a5b15f836403b.tar.gz opie-5228be0c7dfe6ce10330133fde6a5b15f836403b.tar.bz2 |
Added #include QDateTime which is needed by this header file itself
-rw-r--r-- | libopie/pim/opimaccessbackend.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libopie/pim/opimaccessbackend.h b/libopie/pim/opimaccessbackend.h index c3d91f7..fd264fc 100644 --- a/libopie/pim/opimaccessbackend.h +++ b/libopie/pim/opimaccessbackend.h | |||
@@ -1,159 +1,160 @@ | |||
1 | #ifndef OPIE_PIM_ACCESS_BACKEND | 1 | #ifndef OPIE_PIM_ACCESS_BACKEND |
2 | #define OPIE_PIM_ACCESS_BACKEND | 2 | #define OPIE_PIM_ACCESS_BACKEND |
3 | 3 | ||
4 | #include <qarray.h> | 4 | #include <qarray.h> |
5 | #include <qdatetime.h> | ||
5 | 6 | ||
6 | #include <opie/otemplatebase.h> | 7 | #include <opie/otemplatebase.h> |
7 | #include <opie/opimrecord.h> | 8 | #include <opie/opimrecord.h> |
8 | 9 | ||
9 | 10 | ||
10 | class OPimAccessBackendPrivate; | 11 | class OPimAccessBackendPrivate; |
11 | /** | 12 | /** |
12 | * OPimAccessBackend is the base class | 13 | * OPimAccessBackend is the base class |
13 | * for all private backends | 14 | * for all private backends |
14 | * it operates on OPimRecord as the base class | 15 | * it operates on OPimRecord as the base class |
15 | * and it's responsible for fast manipulating | 16 | * and it's responsible for fast manipulating |
16 | * the resource the implementation takes care | 17 | * the resource the implementation takes care |
17 | * of | 18 | * of |
18 | */ | 19 | */ |
19 | template <class T = OPimRecord> | 20 | template <class T = OPimRecord> |
20 | class OPimAccessBackend { | 21 | class OPimAccessBackend { |
21 | public: | 22 | public: |
22 | typedef OTemplateBase<T> Frontend; | 23 | typedef OTemplateBase<T> Frontend; |
23 | 24 | ||
24 | /** The access hint from the frontend */ | 25 | /** The access hint from the frontend */ |
25 | OPimAccessBackend(int access = 0); | 26 | OPimAccessBackend(int access = 0); |
26 | virtual ~OPimAccessBackend(); | 27 | virtual ~OPimAccessBackend(); |
27 | 28 | ||
28 | /** | 29 | /** |
29 | * load the resource | 30 | * load the resource |
30 | */ | 31 | */ |
31 | virtual bool load() = 0; | 32 | virtual bool load() = 0; |
32 | 33 | ||
33 | /** | 34 | /** |
34 | * reload the resource | 35 | * reload the resource |
35 | */ | 36 | */ |
36 | virtual bool reload() = 0; | 37 | virtual bool reload() = 0; |
37 | 38 | ||
38 | /** | 39 | /** |
39 | * save the resource and | 40 | * save the resource and |
40 | * all it's changes | 41 | * all it's changes |
41 | */ | 42 | */ |
42 | virtual bool save() = 0; | 43 | virtual bool save() = 0; |
43 | 44 | ||
44 | /** | 45 | /** |
45 | * return an array of | 46 | * return an array of |
46 | * all available uids | 47 | * all available uids |
47 | */ | 48 | */ |
48 | virtual QArray<int> allRecords()const = 0; | 49 | virtual QArray<int> allRecords()const = 0; |
49 | 50 | ||
50 | /** | 51 | /** |
51 | * return a List of records | 52 | * return a List of records |
52 | * that match the regex | 53 | * that match the regex |
53 | */ | 54 | */ |
54 | virtual QArray<int> matchRegexp(const QRegExp &r) const = 0; | 55 | virtual QArray<int> matchRegexp(const QRegExp &r) const = 0; |
55 | 56 | ||
56 | /** | 57 | /** |
57 | * queryByExample for T with the given Settings | 58 | * queryByExample for T with the given Settings |
58 | * | 59 | * |
59 | */ | 60 | */ |
60 | virtual QArray<int> queryByExample( const T& t, int settings, const QDateTime& d = QDateTime() ) = 0; | 61 | virtual QArray<int> queryByExample( const T& t, int settings, const QDateTime& d = QDateTime() ) = 0; |
61 | 62 | ||
62 | /** | 63 | /** |
63 | * find the OPimRecord with uid @param uid | 64 | * find the OPimRecord with uid @param uid |
64 | * returns T and T.isEmpty() if nothing was found | 65 | * returns T and T.isEmpty() if nothing was found |
65 | */ | 66 | */ |
66 | virtual T find(int uid )const = 0; | 67 | virtual T find(int uid )const = 0; |
67 | 68 | ||
68 | virtual T find(int uid, const QArray<int>& items, | 69 | virtual T find(int uid, const QArray<int>& items, |
69 | uint current, typename Frontend::CacheDirection )const ; | 70 | uint current, typename Frontend::CacheDirection )const ; |
70 | /** | 71 | /** |
71 | * clear the back end | 72 | * clear the back end |
72 | */ | 73 | */ |
73 | virtual void clear() = 0; | 74 | virtual void clear() = 0; |
74 | 75 | ||
75 | /** | 76 | /** |
76 | * add T | 77 | * add T |
77 | */ | 78 | */ |
78 | virtual bool add( const T& t ) = 0; | 79 | virtual bool add( const T& t ) = 0; |
79 | 80 | ||
80 | /** | 81 | /** |
81 | * remove | 82 | * remove |
82 | */ | 83 | */ |
83 | virtual bool remove( int uid ) = 0; | 84 | virtual bool remove( int uid ) = 0; |
84 | 85 | ||
85 | /** | 86 | /** |
86 | * replace a record with T.uid() | 87 | * replace a record with T.uid() |
87 | */ | 88 | */ |
88 | virtual bool replace( const T& t ) = 0; | 89 | virtual bool replace( const T& t ) = 0; |
89 | 90 | ||
90 | /* | 91 | /* |
91 | * setTheFrontEnd!!! | 92 | * setTheFrontEnd!!! |
92 | */ | 93 | */ |
93 | void setFrontend( Frontend* front ); | 94 | void setFrontend( Frontend* front ); |
94 | 95 | ||
95 | /** | 96 | /** |
96 | * set the read ahead count | 97 | * set the read ahead count |
97 | */ | 98 | */ |
98 | void setReadAhead( uint count ); | 99 | void setReadAhead( uint count ); |
99 | protected: | 100 | protected: |
100 | int access()const; | 101 | int access()const; |
101 | void cache( const T& t )const; | 102 | void cache( const T& t )const; |
102 | 103 | ||
103 | /** | 104 | /** |
104 | * use a prime number here! | 105 | * use a prime number here! |
105 | */ | 106 | */ |
106 | void setSaneCacheSize( int ); | 107 | void setSaneCacheSize( int ); |
107 | 108 | ||
108 | uint readAhead()const; | 109 | uint readAhead()const; |
109 | 110 | ||
110 | private: | 111 | private: |
111 | OPimAccessBackendPrivate *d; | 112 | OPimAccessBackendPrivate *d; |
112 | Frontend* m_front; | 113 | Frontend* m_front; |
113 | uint m_read; | 114 | uint m_read; |
114 | int m_acc; | 115 | int m_acc; |
115 | 116 | ||
116 | }; | 117 | }; |
117 | 118 | ||
118 | template <class T> | 119 | template <class T> |
119 | OPimAccessBackend<T>::OPimAccessBackend(int acc) | 120 | OPimAccessBackend<T>::OPimAccessBackend(int acc) |
120 | : m_acc( acc ) | 121 | : m_acc( acc ) |
121 | { | 122 | { |
122 | m_front = 0l; | 123 | m_front = 0l; |
123 | } | 124 | } |
124 | template <class T> | 125 | template <class T> |
125 | OPimAccessBackend<T>::~OPimAccessBackend() { | 126 | OPimAccessBackend<T>::~OPimAccessBackend() { |
126 | 127 | ||
127 | } | 128 | } |
128 | template <class T> | 129 | template <class T> |
129 | void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { | 130 | void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { |
130 | m_front = fr; | 131 | m_front = fr; |
131 | } | 132 | } |
132 | template <class T> | 133 | template <class T> |
133 | void OPimAccessBackend<T>::cache( const T& t )const { | 134 | void OPimAccessBackend<T>::cache( const T& t )const { |
134 | if (m_front ) | 135 | if (m_front ) |
135 | m_front->cache( t ); | 136 | m_front->cache( t ); |
136 | } | 137 | } |
137 | template <class T> | 138 | template <class T> |
138 | void OPimAccessBackend<T>::setSaneCacheSize( int size) { | 139 | void OPimAccessBackend<T>::setSaneCacheSize( int size) { |
139 | if (m_front ) | 140 | if (m_front ) |
140 | m_front->setSaneCacheSize( size ); | 141 | m_front->setSaneCacheSize( size ); |
141 | } | 142 | } |
142 | template <class T> | 143 | template <class T> |
143 | T OPimAccessBackend<T>::find( int uid, const QArray<int>&, | 144 | T OPimAccessBackend<T>::find( int uid, const QArray<int>&, |
144 | uint, typename Frontend::CacheDirection )const { | 145 | uint, typename Frontend::CacheDirection )const { |
145 | return find( uid ); | 146 | return find( uid ); |
146 | } | 147 | } |
147 | template <class T> | 148 | template <class T> |
148 | void OPimAccessBackend<T>::setReadAhead( uint count ) { | 149 | void OPimAccessBackend<T>::setReadAhead( uint count ) { |
149 | m_read = count; | 150 | m_read = count; |
150 | } | 151 | } |
151 | template <class T> | 152 | template <class T> |
152 | uint OPimAccessBackend<T>::readAhead()const { | 153 | uint OPimAccessBackend<T>::readAhead()const { |
153 | return m_read; | 154 | return m_read; |
154 | } | 155 | } |
155 | template <class T> | 156 | template <class T> |
156 | int OPimAccessBackend<T>::access()const { | 157 | int OPimAccessBackend<T>::access()const { |
157 | return m_acc; | 158 | return m_acc; |
158 | } | 159 | } |
159 | #endif | 160 | #endif |