author | eilers <eilers> | 2005-03-19 17:13:47 (UTC) |
---|---|---|
committer | eilers <eilers> | 2005-03-19 17:13:47 (UTC) |
commit | 205bc8739f3f2c464b046bf8ea53f985a62c12a4 (patch) (unidiff) | |
tree | 74d807160d4cbebbfef2bf26af975f11bed8da72 /libopie2 | |
parent | ea15abad0554edab0746f342fafddd461a0fb0eb (diff) | |
download | opie-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)
-rw-r--r-- | libopie2/opiepim/ChangeLog | 1 | ||||
-rw-r--r-- | libopie2/opiepim/backend/opimaccessbackend.h | 1 |
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 @@ | |||
1 | 2005-03.19 Stefan Eilers <stefan@eilers-online.net> | 1 | 2005-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 | ||
3 | 2005-03-18 Stefan Eilers <stefan@eilers-online.net> | 4 | 2005-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!) |
5 | 2005-01-16 Stefan Eilers <stefan@eilers-online.net> | 6 | 2005-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. |
8 | 2005-01-03 Stefan Eilers <stefan@eilers-online.net> | 9 | 2005-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 |
11 | 2004-12-28 Stefan Eilers <stefan@eilers-online.net> | 12 | 2004-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 |
16 | 2004-11-23 Stefan Eilers <stefan@eilers-online.net> | 17 | 2004-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 |
20 | 2004-11-18 Holger Freyther <freyther@handhelds.org> | 21 | 2004-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,336 +1,337 @@ | |||
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 | ||
39 | namespace Opie { | 39 | namespace Opie { |
40 | class OPimAccessBackendPrivate; | 40 | class 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 | */ |
52 | template <class T = OPimRecord> | 52 | template <class T = OPimRecord> |
53 | class OPimAccessBackend { | 53 | class OPimAccessBackend { |
54 | public: | 54 | public: |
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 ); |
124 | protected: | 124 | protected: |
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 | ||
132 | private: | 132 | private: |
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 | ||
140 | template <class T> | 140 | template <class T> |
141 | OPimAccessBackend<T>::OPimAccessBackend(int acc) | 141 | OPimAccessBackend<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 | } |
146 | template <class T> | 147 | template <class T> |
147 | OPimAccessBackend<T>::~OPimAccessBackend() { | 148 | OPimAccessBackend<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 | */ |
158 | template <class T> | 159 | template <class T> |
159 | UIDArray OPimAccessBackend<T>::matchRegexp( const QRegExp& reg )const { | 160 | UIDArray 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 | ||
173 | template <class T> | 174 | template <class T> |
174 | UIDArray OPimAccessBackend<T>::queryByExample( const T& rec, int settings, | 175 | UIDArray 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 | ||
180 | template <class T> | 181 | template <class T> |
181 | UIDArray OPimAccessBackend<T>::queryByExample( const OPimRecord* rec, int settings, | 182 | UIDArray 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 | ||
191 | template <class T> | 192 | template <class T> |
192 | UIDArray OPimAccessBackend<T>::sorted( bool asc, int order, int filter, | 193 | UIDArray 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 | ||
197 | template<class T> | 198 | template<class T> |
198 | OPimBackendOccurrence::List OPimAccessBackend<T>::occurrences( const QDate&, | 199 | OPimBackendOccurrence::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 | ||
203 | template<class T> | 204 | template<class T> |
204 | OPimBackendOccurrence::List OPimAccessBackend<T>::occurrences( const QDateTime& dt )const { | 205 | OPimBackendOccurrence::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 | ||
209 | template <class T> | 210 | template <class T> |
210 | void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { | 211 | void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { |
211 | m_front = fr; | 212 | m_front = fr; |
212 | } | 213 | } |
213 | template <class T> | 214 | template <class T> |
214 | void OPimAccessBackend<T>::cache( const T& t )const { | 215 | void 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 | ||
219 | template <class T> | 220 | template <class T> |
220 | void OPimAccessBackend<T>::setSaneCacheSize( int size) { | 221 | void 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 | } |
224 | template <class T> | 225 | template <class T> |
225 | T OPimAccessBackend<T>::find( int uid, const QArray<int>&, | 226 | T 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 | } |
230 | template <class T> | 231 | template <class T> |
231 | void OPimAccessBackend<T>::setReadAhead( uint count ) { | 232 | void OPimAccessBackend<T>::setReadAhead( uint count ) { |
232 | m_read = count; | 233 | m_read = count; |
233 | } | 234 | } |
234 | template <class T> | 235 | template <class T> |
235 | uint OPimAccessBackend<T>::readAhead()const { | 236 | uint OPimAccessBackend<T>::readAhead()const { |
236 | return m_read; | 237 | return m_read; |
237 | } | 238 | } |
238 | template <class T> | 239 | template <class T> |
239 | int OPimAccessBackend<T>::access()const { | 240 | int 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 | * |