summaryrefslogtreecommitdiff
authoreilers <eilers>2005-03-19 17:13:47 (UTC)
committer eilers <eilers>2005-03-19 17:13:47 (UTC)
commit205bc8739f3f2c464b046bf8ea53f985a62c12a4 (patch) (unidiff)
tree74d807160d4cbebbfef2bf26af975f11bed8da72
parentea15abad0554edab0746f342fafddd461a0fb0eb (diff)
downloadopie-205bc8739f3f2c464b046bf8ea53f985a62c12a4.zip
opie-205bc8739f3f2c464b046bf8ea53f985a62c12a4.tar.gz
opie-205bc8739f3f2c464b046bf8ea53f985a62c12a4.tar.bz2
Oops.. member variable m_read was not initialized.
This may cause crash as reported by #1608 (hopefully)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ChangeLog1
-rw-r--r--libopie2/opiepim/backend/opimaccessbackend.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/libopie2/opiepim/ChangeLog b/libopie2/opiepim/ChangeLog
index a1b4db0..84517fb 100644
--- a/libopie2/opiepim/ChangeLog
+++ b/libopie2/opiepim/ChangeLog
@@ -1,33 +1,34 @@
12005-03.19 Stefan Eilers <stefan@eilers-online.net> 12005-03.19 Stefan Eilers <stefan@eilers-online.net>
2 * Minor update for sorted(). Now ignoring any category search if "DoNotShowWithCategory" filter is activated. 2 * Minor update for sorted(). Now ignoring any category search if "DoNotShowWithCategory" filter is activated.
3 * Fixing uninitialized member variable, caused crash of backend
32005-03-18 Stefan Eilers <stefan@eilers-online.net> 42005-03-18 Stefan Eilers <stefan@eilers-online.net>
4 * Rewrote generic sorted filter and added filter for "DoNotShowWithCategory", needed by addressbook (other filters need to be added!) 5 * Rewrote generic sorted filter and added filter for "DoNotShowWithCategory", needed by addressbook (other filters need to be added!)
52005-01-16 Stefan Eilers <stefan@eilers-online.net> 62005-01-16 Stefan Eilers <stefan@eilers-online.net>
6 * Added new OPimEventSortVector class, improved OPimSortVector 7 * Added new OPimEventSortVector class, improved OPimSortVector
7 * OPimAccessBackend now supports generic sorting. 8 * OPimAccessBackend now supports generic sorting.
82005-01-03 Stefan Eilers <stefan@eilers-online.net> 92005-01-03 Stefan Eilers <stefan@eilers-online.net>
9 * Fixing bug in API documentation 10 * Fixing bug in API documentation
10 * Moving hasQuerySettings() and querySettings() to OPimAccessTemplate to be available for all frontends 11 * Moving hasQuerySettings() and querySettings() to OPimAccessTemplate to be available for all frontends
112004-12-28 Stefan Eilers <stefan@eilers-online.net> 122004-12-28 Stefan Eilers <stefan@eilers-online.net>
12 * Make improved query by example accessable via frontend 13 * Make improved query by example accessable via frontend
13 * Some API documentation improvement 14 * Some API documentation improvement
14 * Cleanup of backend api.. 15 * Cleanup of backend api..
15 * Fixing bug #1501 16 * Fixing bug #1501
162004-11-23 Stefan Eilers <stefan@eilers-online.net> 172004-11-23 Stefan Eilers <stefan@eilers-online.net>
17 * Implement fast and full featured version of sorted() for addressbook 18 * Implement fast and full featured version of sorted() for addressbook
18 * Implement generic queryByExample for all Addressboook backends. It allows incremental search. 19 * Implement generic queryByExample for all Addressboook backends. It allows incremental search.
19 * Update of API Documentation 20 * Update of API Documentation
202004-11-18 Holger Freyther <freyther@handhelds.org> 212004-11-18 Holger Freyther <freyther@handhelds.org>
21 * Every Access can give a set of Occurrences for a period or a datetime 22 * Every Access can give a set of Occurrences for a period or a datetime
22 * QueryByExample, Find, Sort can be generically accessed by OPimBase 23 * QueryByExample, Find, Sort can be generically accessed by OPimBase
23 pointer interface 24 pointer interface
24 * OPimBackendOccurrence gets split up to OPimOccurrences by 25 * OPimBackendOccurrence gets split up to OPimOccurrences by
25 OPimTemplateBase 26 OPimTemplateBase
26 * Add safeCast to various OPimRecords 27 * Add safeCast to various OPimRecords
27 * Kill memleak in OPimTodo 28 * Kill memleak in OPimTodo
28 * Add SortVector implementations for OPimTodo and OPimContact 29 * Add SortVector implementations for OPimTodo and OPimContact
29 30
30 2004-??-??The Opie Team <opie@handhelds.org> 31 2004-??-??The Opie Team <opie@handhelds.org>
31 * Implemented some important modifications to allow to use OPimRecords as it is, without 32 * Implemented some important modifications to allow to use OPimRecords as it is, without
32 have to cast them. This makes it possible to write applications which handling pim 33 have to cast them. This makes it possible to write applications which handling pim
33 data in a generic manner (see opimconvertion tool) (eilers) \ No newline at end of file 34 data in a generic manner (see opimconvertion tool) (eilers) \ No newline at end of file
diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h
index 6666fd6..71f81f4 100644
--- a/libopie2/opiepim/backend/opimaccessbackend.h
+++ b/libopie2/opiepim/backend/opimaccessbackend.h
@@ -1,445 +1,446 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org> 3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
6 .>+-= 6 .>+-=
7 _;:, .> :=|. This program is free software; you can 7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License, 11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21 : = ...= . :.=- 21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU 22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29#ifndef OPIE_PIM_ACCESS_BACKEND 29#ifndef OPIE_PIM_ACCESS_BACKEND
30#define OPIE_PIM_ACCESS_BACKEND 30#define OPIE_PIM_ACCESS_BACKEND
31 31
32#include <qarray.h> 32#include <qarray.h>
33#include <qdatetime.h> 33#include <qdatetime.h>
34 34
35#include <opie2/opimtemplatebase.h> 35#include <opie2/opimtemplatebase.h>
36#include <opie2/opimrecord.h> 36#include <opie2/opimrecord.h>
37#include <opie2/opimbackendoccurrence.h> 37#include <opie2/opimbackendoccurrence.h>
38 38
39namespace Opie { 39namespace Opie {
40class OPimAccessBackendPrivate; 40class OPimAccessBackendPrivate;
41 41
42/** 42/**
43 * OPimAccessBackend is the Backend Interface to be used 43 * OPimAccessBackend is the Backend Interface to be used
44 * by OTemplateBase based Frontends. 44 * by OTemplateBase based Frontends.
45 * For efficency reasons and to support delayed loading 45 * For efficency reasons and to support delayed loading
46 * most of the Frontend functions can be implemented 46 * most of the Frontend functions can be implemented
47 * by this backend. 47 * by this backend.
48 * This allows to utilise the best method on each backend. 48 * This allows to utilise the best method on each backend.
49 * For example we can use SQL queries instead of self made 49 * For example we can use SQL queries instead of self made
50 * query which is first more efficent and also uses less memory. 50 * query which is first more efficent and also uses less memory.
51 */ 51 */
52template <class T = OPimRecord> 52template <class T = OPimRecord>
53class OPimAccessBackend { 53class OPimAccessBackend {
54public: 54public:
55 typedef OTemplateBase<T> Frontend; 55 typedef OTemplateBase<T> Frontend;
56 56
57 //@{ 57 //@{
58 OPimAccessBackend(int access = 0); 58 OPimAccessBackend(int access = 0);
59 virtual ~OPimAccessBackend(); 59 virtual ~OPimAccessBackend();
60 //@} 60 //@}
61 61
62 //@{ 62 //@{
63 virtual bool load() = 0; 63 virtual bool load() = 0;
64 virtual bool reload() = 0; 64 virtual bool reload() = 0;
65 virtual bool save() = 0; 65 virtual bool save() = 0;
66 virtual void clear() = 0; 66 virtual void clear() = 0;
67 //@} 67 //@}
68 68
69 //@{ 69 //@{
70 // FIXME: Uncommented some of the abstract functions below. This should be removed as they are implemented in 70 // FIXME: Uncommented some of the abstract functions below. This should be removed as they are implemented in
71 // all typespecifc backenends (eilers) 71 // all typespecifc backenends (eilers)
72 /** 72 /**
73 * Return all possible settings for queryByExample() 73 * Return all possible settings for queryByExample()
74 * @return All settings provided by the current backend 74 * @return All settings provided by the current backend
75 * (i.e.: query_WildCards & query_IgnoreCase) 75 * (i.e.: query_WildCards & query_IgnoreCase)
76 * See implementation in the specific backends for contacts, todo and dates. 76 * See implementation in the specific backends for contacts, todo and dates.
77 */ 77 */
78 virtual const uint querySettings() const = 0; 78 virtual const uint querySettings() const = 0;
79 79
80 /** 80 /**
81 * Check whether settings are correct for queryByExample() 81 * Check whether settings are correct for queryByExample()
82 * See implementation in the specific backends for OPimContactAccess, OPimTodoAccess and ODateBookAccess. 82 * See implementation in the specific backends for OPimContactAccess, OPimTodoAccess and ODateBookAccess.
83 * @return <i>true</i> if the given settings are correct and possible. 83 * @return <i>true</i> if the given settings are correct and possible.
84 */ 84 */
85 virtual bool hasQuerySettings (uint querySettings) const = 0; 85 virtual bool hasQuerySettings (uint querySettings) const = 0;
86 //@} 86 //@}
87 87
88 88
89 //@{ 89 //@{
90 virtual UIDArray allRecords()const = 0; 90 virtual UIDArray allRecords()const = 0;
91 virtual UIDArray matchRegexp(const QRegExp &r) const; 91 virtual UIDArray matchRegexp(const QRegExp &r) const;
92 virtual UIDArray queryByExample( const UIDArray&, const T& t, 92 virtual UIDArray queryByExample( const UIDArray&, const T& t,
93 int settings, const QDateTime& d = QDateTime() )const = 0; 93 int settings, const QDateTime& d = QDateTime() )const = 0;
94 virtual UIDArray queryByExample( const T& t, int settings, const QDateTime& d = QDateTime() )const; 94 virtual UIDArray queryByExample( const T& t, int settings, const QDateTime& d = QDateTime() )const;
95 virtual UIDArray queryByExample( const OPimRecord* rec, int settings, const QDateTime& d = QDateTime() )const; 95 virtual UIDArray queryByExample( const OPimRecord* rec, int settings, const QDateTime& d = QDateTime() )const;
96 virtual UIDArray sorted( const UIDArray&, bool asc, int sortOrder, int sortFilter, const QArray<int>& cats )const = 0; 96 virtual UIDArray sorted( const UIDArray&, bool asc, int sortOrder, int sortFilter, const QArray<int>& cats )const = 0;
97 virtual UIDArray sorted( bool asc, int sortOrder, int sortFilter, const QArray<int>& cats )const; 97 virtual UIDArray sorted( bool asc, int sortOrder, int sortFilter, const QArray<int>& cats )const;
98 virtual OPimBackendOccurrence::List occurrences( const QDate& start, const QDate& end)const; 98 virtual OPimBackendOccurrence::List occurrences( const QDate& start, const QDate& end)const;
99 virtual OPimBackendOccurrence::List occurrences( const QDateTime& dt )const; 99 virtual OPimBackendOccurrence::List occurrences( const QDateTime& dt )const;
100 //@} 100 //@}
101 101
102 102
103 //@{ 103 //@{
104 virtual T find(UID uid )const = 0; 104 virtual T find(UID uid )const = 0;
105 virtual T find(UID uid, const QArray<UID>& items, 105 virtual T find(UID uid, const QArray<UID>& items,
106 uint current, typename Frontend::CacheDirection )const ; 106 uint current, typename Frontend::CacheDirection )const ;
107 //@} 107 //@}
108 108
109 109
110 //@{ 110 //@{
111 virtual bool add( const T& t ) = 0; 111 virtual bool add( const T& t ) = 0;
112 virtual bool remove( UID uid ) = 0; 112 virtual bool remove( UID uid ) = 0;
113 virtual bool replace( const T& t ) = 0; 113 virtual bool replace( const T& t ) = 0;
114 //@} 114 //@}
115 115
116 116
117 117
118 void setFrontend( Frontend* front ); 118 void setFrontend( Frontend* front );
119 119
120 /** 120 /**
121 * set the read ahead count 121 * set the read ahead count
122 */ 122 */
123 void setReadAhead( uint count ); 123 void setReadAhead( uint count );
124protected: 124protected:
125 //@{ 125 //@{
126 int access()const; 126 int access()const;
127 void cache( const T& t )const; 127 void cache( const T& t )const;
128 void setSaneCacheSize( int ); 128 void setSaneCacheSize( int );
129 uint readAhead()const; 129 uint readAhead()const;
130 //@} 130 //@}
131 131
132private: 132private:
133 OPimAccessBackendPrivate *d; 133 OPimAccessBackendPrivate *d;
134 Frontend* m_front; 134 Frontend* m_front;
135 uint m_read; 135 uint m_read;
136 int m_acc; 136 int m_acc;
137 137
138}; 138};
139 139
140template <class T> 140template <class T>
141OPimAccessBackend<T>::OPimAccessBackend(int acc) 141OPimAccessBackend<T>::OPimAccessBackend(int acc)
142 : m_acc( acc ) 142 : m_acc( acc )
143{ 143{
144 m_front = 0l; 144 m_front = 0l;
145 m_read = 20;
145} 146}
146template <class T> 147template <class T>
147OPimAccessBackend<T>::~OPimAccessBackend() { 148OPimAccessBackend<T>::~OPimAccessBackend() {
148 149
149} 150}
150 151
151/* 152/*
152 * Slow but default matchRegexp Implementation 153 * Slow but default matchRegexp Implementation
153 * Create a Big Enough QArray and then iterate 154 * Create a Big Enough QArray and then iterate
154 * over all Records and matchRegexp them. 155 * over all Records and matchRegexp them.
155 * At the end we will resize the array to the actual 156 * At the end we will resize the array to the actual
156 * number of items 157 * number of items
157 */ 158 */
158template <class T> 159template <class T>
159UIDArray OPimAccessBackend<T>::matchRegexp( const QRegExp& reg )const { 160UIDArray OPimAccessBackend<T>::matchRegexp( const QRegExp& reg )const {
160 UIDArray all_rec = allRecords(); 161 UIDArray all_rec = allRecords();
161 UIDArray result( all_rec.count() ); 162 UIDArray result( all_rec.count() );
162 uint used_records = 0, all_rec_count = all_rec.count(); 163 uint used_records = 0, all_rec_count = all_rec.count();
163 164
164 for ( uint i = 0; i < all_rec_count; ++i ) 165 for ( uint i = 0; i < all_rec_count; ++i )
165 if (find( all_rec[i], all_rec, i, Frontend::Forward ).match( reg ) ) 166 if (find( all_rec[i], all_rec, i, Frontend::Forward ).match( reg ) )
166 result[used_records++] = all_rec[i]; 167 result[used_records++] = all_rec[i];
167 168
168 /* shrink to fit */ 169 /* shrink to fit */
169 result.resize( used_records ); 170 result.resize( used_records );
170 return result; 171 return result;
171} 172}
172 173
173template <class T> 174template <class T>
174UIDArray OPimAccessBackend<T>::queryByExample( const T& rec, int settings, 175UIDArray OPimAccessBackend<T>::queryByExample( const T& rec, int settings,
175 const QDateTime& datetime )const { 176 const QDateTime& datetime )const {
176 177
177 return queryByExample( allRecords(), rec, settings, datetime ); 178 return queryByExample( allRecords(), rec, settings, datetime );
178} 179}
179 180
180template <class T> 181template <class T>
181UIDArray OPimAccessBackend<T>::queryByExample( const OPimRecord* rec, int settings, 182UIDArray OPimAccessBackend<T>::queryByExample( const OPimRecord* rec, int settings,
182 const QDateTime& datetime )const { 183 const QDateTime& datetime )const {
183 T* tmp_rec = T::safeCast( rec ); 184 T* tmp_rec = T::safeCast( rec );
184 UIDArray ar; 185 UIDArray ar;
185 if ( tmp_rec ) 186 if ( tmp_rec )
186 ar = queryByExample( *tmp_rec, settings, datetime ); 187 ar = queryByExample( *tmp_rec, settings, datetime );
187 188
188 return ar; 189 return ar;
189} 190}
190 191
191template <class T> 192template <class T>
192UIDArray OPimAccessBackend<T>::sorted( bool asc, int order, int filter, 193UIDArray OPimAccessBackend<T>::sorted( bool asc, int order, int filter,
193 const QArray<int>& cats )const { 194 const QArray<int>& cats )const {
194 return sorted( allRecords(), asc, order, filter, cats ); 195 return sorted( allRecords(), asc, order, filter, cats );
195} 196}
196 197
197template<class T> 198template<class T>
198OPimBackendOccurrence::List OPimAccessBackend<T>::occurrences( const QDate&, 199OPimBackendOccurrence::List OPimAccessBackend<T>::occurrences( const QDate&,
199 const QDate& )const { 200 const QDate& )const {
200 return OPimBackendOccurrence::List(); 201 return OPimBackendOccurrence::List();
201} 202}
202 203
203template<class T> 204template<class T>
204OPimBackendOccurrence::List OPimAccessBackend<T>::occurrences( const QDateTime& dt )const { 205OPimBackendOccurrence::List OPimAccessBackend<T>::occurrences( const QDateTime& dt )const {
205 QDate date = dt.date(); 206 QDate date = dt.date();
206 return occurrences( date, date ); 207 return occurrences( date, date );
207} 208}
208 209
209template <class T> 210template <class T>
210void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { 211void OPimAccessBackend<T>::setFrontend( Frontend* fr ) {
211 m_front = fr; 212 m_front = fr;
212} 213}
213template <class T> 214template <class T>
214void OPimAccessBackend<T>::cache( const T& t )const { 215void OPimAccessBackend<T>::cache( const T& t )const {
215 if ( m_front ) 216 if ( m_front )
216 m_front->cache( t ); 217 m_front->cache( t );
217} 218}
218 219
219template <class T> 220template <class T>
220void OPimAccessBackend<T>::setSaneCacheSize( int size) { 221void OPimAccessBackend<T>::setSaneCacheSize( int size) {
221 if ( m_front ) 222 if ( m_front )
222 m_front->setSaneCacheSize( size ); 223 m_front->setSaneCacheSize( size );
223} 224}
224template <class T> 225template <class T>
225T OPimAccessBackend<T>::find( int uid, const QArray<int>&, 226T OPimAccessBackend<T>::find( int uid, const QArray<int>&,
226 uint, typename Frontend::CacheDirection ) const{ 227 uint, typename Frontend::CacheDirection ) const{
227 qDebug( "*** Lookahead feature not supported. Fallback to default find!!" ); 228 qDebug( "*** Lookahead feature not supported. Fallback to default find!!" );
228 return find( uid ); 229 return find( uid );
229} 230}
230template <class T> 231template <class T>
231void OPimAccessBackend<T>::setReadAhead( uint count ) { 232void OPimAccessBackend<T>::setReadAhead( uint count ) {
232 m_read = count; 233 m_read = count;
233} 234}
234template <class T> 235template <class T>
235uint OPimAccessBackend<T>::readAhead()const { 236uint OPimAccessBackend<T>::readAhead()const {
236 return m_read; 237 return m_read;
237} 238}
238template <class T> 239template <class T>
239int OPimAccessBackend<T>::access()const { 240int OPimAccessBackend<T>::access()const {
240 return m_acc; 241 return m_acc;
241} 242}
242 243
243} 244}
244 245
245/** 246/**
246 * \fn template <class T> OPimAccessBackend<T>::OPimAccessBackend(int hint ) 247 * \fn template <class T> OPimAccessBackend<T>::OPimAccessBackend(int hint )
247 * @param hint The access hint from the frontend 248 * @param hint The access hint from the frontend
248 */ 249 */
249 250
250/** 251/**
251 * \fn template <class T> bool OPimAccessBackend<T>::load() 252 * \fn template <class T> bool OPimAccessBackend<T>::load()
252 * Opens the DataBase and does necessary 253 * Opens the DataBase and does necessary
253 * initialisation of internal structures. 254 * initialisation of internal structures.
254 * 255 *
255 * @return true If the DataBase could be opened and 256 * @return true If the DataBase could be opened and
256 * Information was successfully loaded 257 * Information was successfully loaded
257 */ 258 */
258 259
259/** 260/**
260 * \fn template <class T> bool OPimAccessBackend<T>::reload() 261 * \fn template <class T> bool OPimAccessBackend<T>::reload()
261 * Reinitialise the DataBase and merges the external changes 262 * Reinitialise the DataBase and merges the external changes
262 * with your local changes. 263 * with your local changes.
263 * 264 *
264 * @return True if the DataBase was reloaded. 265 * @return True if the DataBase was reloaded.
265 * 266 *
266 */ 267 */
267 268
268/** 269/**
269 * \fn template <class T> bool OPimAccessBackend<T>::save() 270 * \fn template <class T> bool OPimAccessBackend<T>::save()
270 * 271 *
271 * Save the changes to storage. In case of memory or 272 * Save the changes to storage. In case of memory or
272 * disk shortage, return false. 273 * disk shortage, return false.
273 * 274 *
274 * 275 *
275 * @return True if the DataBase could be saved to storage. 276 * @return True if the DataBase could be saved to storage.
276 */ 277 */
277 278
278/** 279/**
279 * \fn template <class T> bool OPimAccessBackend<T>::clear() 280 * \fn template <class T> bool OPimAccessBackend<T>::clear()
280 * Until a \sa save() changes shouldn't be comitted 281 * Until a \sa save() changes shouldn't be comitted
281 * 282 *
282 * 283 *
283 * @return True if the DataBase could be cleared 284 * @return True if the DataBase could be cleared
284 * @todo Introduce a 'Commit' 285 * @todo Introduce a 'Commit'
285 */ 286 */
286 287
287/** 288/**
288 * \fn template <class T> QArray<UID> OPimAccessBackend<T>::allRecords()const 289 * \fn template <class T> QArray<UID> OPimAccessBackend<T>::allRecords()const
289 * Return an array of all available uids in the loaded 290 * Return an array of all available uids in the loaded
290 * DataBase. 291 * DataBase.
291 * @see load 292 * @see load
292 */ 293 */
293 294
294/** 295/**
295 * \fn template <class T> QArray<UID> OPimAccessBackend<T>::matchRegexp(const QRegExp& r)const 296 * \fn template <class T> QArray<UID> OPimAccessBackend<T>::matchRegexp(const QRegExp& r)const
296 * Return a List of records that match the regex \par r. 297 * Return a List of records that match the regex \par r.
297 * 298 *
298 * @param r The QRegExp to match. 299 * @param r The QRegExp to match.
299 */ 300 */
300 301
301/** 302/**
302 * \fn template <class T> QArray<UID> OPimAccessBackend<T>::queryByExample(const T& t, int settings, const QDateTime& d = QDateTime() ) 303 * \fn template <class T> QArray<UID> OPimAccessBackend<T>::queryByExample(const T& t, int settings, const QDateTime& d = QDateTime() )
303 * 304 *
304 * Implement QueryByExample. An Example record is filled and with the 305 * Implement QueryByExample. An Example record is filled and with the
305 * settings and QDateTime it is determined how the query should be executed. 306 * settings and QDateTime it is determined how the query should be executed.
306 * Return a list of UIDs that match the Example 307 * Return a list of UIDs that match the Example
307 * 308 *
308 * @param t The Example record 309 * @param t The Example record
309 * @param settings Gives 310 * @param settings Gives
310 * 311 *
311 */ 312 */
312 313
313/** 314/**
314 * \fn template<class T> QArray<UID> OPimAccessBackend<T>::sorted(const QArray<UID>& ids, bool asc, int sortOrder, int sortFilter, int cat) 315 * \fn template<class T> QArray<UID> OPimAccessBackend<T>::sorted(const QArray<UID>& ids, bool asc, int sortOrder, int sortFilter, int cat)
315 * \brief Sort the List of records according to the preference 316 * \brief Sort the List of records according to the preference
316 * 317 *
317 * Implement sorting in your backend. The default implementation is 318 * Implement sorting in your backend. The default implementation is
318 * to return the list as it was passed. 319 * to return the list as it was passed.
319 * The default Backend Implementation should do unaccelerated filtering 320 * The default Backend Implementation should do unaccelerated filtering
320 * 321 *
321 * 322 *
322 * @param ids The Records to sort 323 * @param ids The Records to sort
323 * @param asc Sort ascending or descending 324 * @param asc Sort ascending or descending
324 * @param sortOrder 325 * @param sortOrder
325 * @param sortFilter Sort filter 326 * @param sortFilter Sort filter
326 * @param cat The Category to include 327 * @param cat The Category to include
327 */ 328 */
328 329
329/** 330/**
330 * \fn template <class T> T OPimAccessBackend<T>::find(UID uid)const 331 * \fn template <class T> T OPimAccessBackend<T>::find(UID uid)const
331 * \brief Find the Record with the UID 332 * \brief Find the Record with the UID
332 * 333 *
333 * Find the UID in the database and return the record. 334 * Find the UID in the database and return the record.
334 * @param uid The uid to be searched for 335 * @param uid The uid to be searched for
335 * @return The record or an empty record (T.isEmpty()) 336 * @return The record or an empty record (T.isEmpty())
336 * 337 *
337 */ 338 */
338 339
339/** 340/**
340 * \fn template <class T> T OPimAccessBackend<T>::find( UID uid, const QArray<UID>& items, uint current, typename Frontend::CacheDirection d)const 341 * \fn template <class T> T OPimAccessBackend<T>::find( UID uid, const QArray<UID>& items, uint current, typename Frontend::CacheDirection d)const
341 * \brief find a Record and do a read ahead or read behind 342 * \brief find a Record and do a read ahead or read behind
342 * 343 *
343 * @param uid The UID to search for 344 * @param uid The UID to search for
344 * @param items The list of items from where your search 345 * @param items The list of items from where your search
345 * @param current The index of \param uid 346 * @param current The index of \param uid
346 * @param d The direction to search for 347 * @param d The direction to search for
347 * 348 *
348 * @see find 349 * @see find
349 */ 350 */
350 351
351 352
352/** 353/**
353 * \fn template<class T> bool OPimAccessBackend<T>::add(const T& t) 354 * \fn template<class T> bool OPimAccessBackend<T>::add(const T& t)
354 * 355 *
355 * \brief Add the record to the internal database 356 * \brief Add the record to the internal database
356 * 357 *
357 * If an record with the same t.uid() is already present internally 358 * If an record with the same t.uid() is already present internally
358 * the behaviour is undefined but the state of the database 359 * the behaviour is undefined but the state of the database
359 * needs to be stable. 360 * needs to be stable.
360 * For modifying a record use \sa replace. 361 * For modifying a record use \sa replace.
361 * 362 *
362 * 363 *
363 * @return true if the record could be added or false if not 364 * @return true if the record could be added or false if not
364 * @todo Eilers your opinion on readd/replace 365 * @todo Eilers your opinion on readd/replace
365 */ 366 */
366 367
367/** 368/**
368 * \fn template<class T> bool OPimAccessBackend<T>::remove(UID uid) 369 * \fn template<class T> bool OPimAccessBackend<T>::remove(UID uid)
369 * \brief Remove a record by its UID 370 * \brief Remove a record by its UID
370 * 371 *
371 * Remove the records with UID from the internal Database. 372 * Remove the records with UID from the internal Database.
372 * 373 *
373 * @return True if the record could be removed. 374 * @return True if the record could be removed.
374 * 375 *
375 */ 376 */
376 377
377/** 378/**
378 * \fn template<class T> bool OPimAccessBackend<T>::replace(const T& t) 379 * \fn template<class T> bool OPimAccessBackend<T>::replace(const T& t)
379 * \brief Take this Record and replace the old version. 380 * \brief Take this Record and replace the old version.
380 * 381 *
381 * Take \param t as the new record for t.uid(). It is not described 382 * Take \param t as the new record for t.uid(). It is not described
382 * what happens if the record is not present in the database. 383 * what happens if the record is not present in the database.
383 * Normally the record is determined by the UID. 384 * Normally the record is determined by the UID.
384 * 385 *
385 * @param t The record to use internally. 386 * @param t The record to use internally.
386 */ 387 */
387 388
388/** 389/**
389 * \fn template<class T> void OPimAccessBackend<T>::setFrontend( Frontend* fron) 390 * \fn template<class T> void OPimAccessBackend<T>::setFrontend( Frontend* fron)
390 * \@aram fron The Frontend that uses this backend 391 * \@aram fron The Frontend that uses this backend
391 * 392 *
392 * This function is called by the frontend and is used 393 * This function is called by the frontend and is used
393 */ 394 */
394 395
395/** 396/**
396 * \fn template<class T> void OPimAccessBackend<T>::setReadAhead(uint count) 397 * \fn template<class T> void OPimAccessBackend<T>::setReadAhead(uint count)
397 * \brief Set the number of items to Read-Ahead/Read-Behind 398 * \brief Set the number of items to Read-Ahead/Read-Behind
398 * 399 *
399 * @param count The number of records to read ahead 400 * @param count The number of records to read ahead
400 */ 401 */
401 402
402/** 403/**
403 * \fn template<class T> void OPimAccessBackend<T>::cache( const T& t)const 404 * \fn template<class T> void OPimAccessBackend<T>::cache( const T& t)const
404 * \brief Add the Record to the PIM Cache 405 * \brief Add the Record to the PIM Cache
405 * 406 *
406 * This will add the Record to the PIM cache, which is owned 407 * This will add the Record to the PIM cache, which is owned
407 * by the FrontEnd. If no FrontEnd is available the item will 408 * by the FrontEnd. If no FrontEnd is available the item will
408 * not be cached. 409 * not be cached.
409 * 410 *
410 * 411 *
411 * @param t The Item to be added to the Cache 412 * @param t The Item to be added to the Cache
412 */ 413 */
413 414
414/** 415/**
415 * \fn template<class T> void OPimAccessBackend<T>::setSaneCacheSize(int items) 416 * \fn template<class T> void OPimAccessBackend<T>::setSaneCacheSize(int items)
416 * \brief Give a hint on the number of too cached items 417 * \brief Give a hint on the number of too cached items
417 * 418 *
418 * Give the Frontend a hint on the number of items to be cached. Use 419 * Give the Frontend a hint on the number of items to be cached. Use
419 * a prime number for best performance. 420 * a prime number for best performance.
420 * 421 *
421 * @param items The number of items to be cached 422 * @param items The number of items to be cached
422 */ 423 */
423 424
424/** 425/**
425 * \fn template<class T> uint OPimAccessBackend<T>::readAhead()const 426 * \fn template<class T> uint OPimAccessBackend<T>::readAhead()const
426 * \brief Return the number of Items to be ReadAhead 427 * \brief Return the number of Items to be ReadAhead
427 * 428 *
428 * @return The number of Items to read ahead/read behind 429 * @return The number of Items to read ahead/read behind
429 */ 430 */
430 431
431/** 432/**
432 * \fn template<class T> QArray<OPimBackendOccurence> OPimAccessBackend<T>::occurrences(const QDateTime& start,const QDateTime& end) 433 * \fn template<class T> QArray<OPimBackendOccurence> OPimAccessBackend<T>::occurrences(const QDateTime& start,const QDateTime& end)
433 * \brief Get a List of Occurrences for a period of time 434 * \brief Get a List of Occurrences for a period of time
434 * 435 *
435 * Return an Array of OPimBackendOccurence for a period of time. If start == end date 436 * Return an Array of OPimBackendOccurence for a period of time. If start == end date
436 * return only occurrences for the start date. If end is smaller the start date 437 * return only occurrences for the start date. If end is smaller the start date
437 * the result is not defined. You could switch dates or return an empty list. 438 * the result is not defined. You could switch dates or return an empty list.
438 * 439 *
439 * @return Return an array of OPimBackendOccurence for the period specified by the parameters 440 * @return Return an array of OPimBackendOccurence for the period specified by the parameters
440 * @param start The start of the period. 441 * @param start The start of the period.
441 * @param end The end of the period. 442 * @param end The end of the period.
442 * 443 *
443 */ 444 */
444 445
445#endif 446#endif