williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: CPosLmMultiDbSearch class used to perform searches for landmarks or
|
williamr@2
|
15 |
* landmark categories in multiple databases.
|
williamr@2
|
16 |
*
|
williamr@2
|
17 |
*
|
williamr@2
|
18 |
*/
|
williamr@2
|
19 |
|
williamr@2
|
20 |
|
williamr@2
|
21 |
#ifndef CPOSLMMULTIDBSEARCH_H
|
williamr@2
|
22 |
#define CPOSLMMULTIDBSEARCH_H
|
williamr@2
|
23 |
|
williamr@2
|
24 |
#include <e32base.h>
|
williamr@2
|
25 |
#include <badesca.h>
|
williamr@4
|
26 |
#include <EPos_CPosLandmarkSearch.h>
|
williamr@4
|
27 |
#include <EPos_CPosLmCategoryManager.h>
|
williamr@2
|
28 |
|
williamr@2
|
29 |
class CPosLmSearchCriteria;
|
williamr@2
|
30 |
class CPosLmDisplayData;
|
williamr@2
|
31 |
class CPosLmMultiDbSearchOperation;
|
williamr@2
|
32 |
class CPosLmMultiDbSortPref;
|
williamr@2
|
33 |
class CPosLmMultiDbSearchItem;
|
williamr@2
|
34 |
|
williamr@2
|
35 |
/**
|
williamr@2
|
36 |
* @ref CPosLmMultiDbSearch is used to perform searches for landmarks or
|
williamr@2
|
37 |
* landmark categories in multiple databases.
|
williamr@2
|
38 |
*
|
williamr@2
|
39 |
* The client can specify which databases to search.
|
williamr@2
|
40 |
*
|
williamr@2
|
41 |
* Some criterion classes are used for searching for landmarks (e.g.
|
williamr@2
|
42 |
* @ref CPosLmCategoryCriteria is used for searching for landmarks which
|
williamr@2
|
43 |
* contain a certain category) and some are used
|
williamr@2
|
44 |
* to search for landmark categories (e.g. @ref CPosLmCatNameCriteria is used
|
williamr@2
|
45 |
* to search for landmark categories by specifying a category name).
|
williamr@2
|
46 |
*
|
williamr@2
|
47 |
* Searches can be run in incremental mode.
|
williamr@2
|
48 |
* @ref StartLandmarkSearchL and @ref StartCategorySearchL both return a
|
williamr@2
|
49 |
* @p CPosLmOperation object which is used to execute the search. If it is
|
williamr@2
|
50 |
* sufficient to run the search synchronously, the client only has to
|
williamr@2
|
51 |
* call @p CPosLmOperation::ExecuteL. If it is run incrementally the client can
|
williamr@2
|
52 |
* supervise the progress of the operation. The @p CPosLmOperation::NextStep
|
williamr@2
|
53 |
* function in the search operations cannot be executed synchronously using
|
williamr@2
|
54 |
* @p User::WaitForRequest. Doing so may cause the operation to hang.
|
williamr@2
|
55 |
* @p CPosLmOperation::NextStep must be run using an active object. The client
|
williamr@2
|
56 |
* can cancel the search by deleting the @p CPosLmOperation object.
|
williamr@2
|
57 |
*
|
williamr@2
|
58 |
* By default, these functions start a new search, but the client can specify
|
williamr@2
|
59 |
* that only previous matches should be searched. This can be used to refine
|
williamr@2
|
60 |
* the search when there are many matches.
|
williamr@2
|
61 |
*
|
williamr@2
|
62 |
* It is not allowed to search by category item ID in
|
williamr@2
|
63 |
* @ref CPosLmCategoryCriteria since an item ID is only valid in one landmark
|
williamr@2
|
64 |
* database.
|
williamr@2
|
65 |
*
|
williamr@2
|
66 |
* It is only allowed to specify a named category, a global category,
|
williamr@2
|
67 |
* or no category. It is not allowed to search with @ref CPosLmIdListCriteria
|
williamr@2
|
68 |
* since an item ID is only valid in one landmark database. In both cases
|
williamr@2
|
69 |
* the search functions leave with error code @p KErrArgument.
|
williamr@2
|
70 |
*
|
williamr@2
|
71 |
* During the search execution, a read-lock is acquired for each database.
|
williamr@2
|
72 |
* Only one search can be performed at a time by the single instance of
|
williamr@2
|
73 |
* the class. If a search is already running, the search function leaves
|
williamr@2
|
74 |
* with error code @p KErrInUse.
|
williamr@2
|
75 |
*
|
williamr@2
|
76 |
* After search completion, the client can make a second search and specify
|
williamr@2
|
77 |
* that only the matches from the previous search shall be considered.
|
williamr@2
|
78 |
*
|
williamr@2
|
79 |
* The client can also set a limit on how many search matches should be
|
williamr@2
|
80 |
* returned (see @ref SetMaxNumOfMatches).
|
williamr@2
|
81 |
*
|
williamr@2
|
82 |
* The client retrieves the matches from the search by requesting an iterator
|
williamr@2
|
83 |
* (see @ref MatchIteratorL) or by using display data (see
|
williamr@2
|
84 |
* @ref SetDisplayData).
|
williamr@2
|
85 |
*
|
williamr@2
|
86 |
* If @ref CPosLmMultiDbSearch is used, the client must call the global
|
williamr@2
|
87 |
* function @ref ReleaseLandmarkResources before terminating in order to
|
williamr@2
|
88 |
* release all used landmark resources, otherwise the client may receive
|
williamr@2
|
89 |
* an ALLOC panic.
|
williamr@2
|
90 |
*
|
williamr@2
|
91 |
* @p NetworkServices capability is required for remote databases.
|
williamr@2
|
92 |
*
|
williamr@2
|
93 |
* @lib eposlmmultidbsearch.lib
|
williamr@2
|
94 |
* @since S60 3.0
|
williamr@2
|
95 |
* @version $Revision: 1.17 $, $Date: 2005/07/07 13:40:10 $
|
williamr@2
|
96 |
*/
|
williamr@2
|
97 |
class CPosLmMultiDbSearch : public CBase
|
williamr@2
|
98 |
{
|
williamr@2
|
99 |
public: // Data types
|
williamr@2
|
100 |
|
williamr@2
|
101 |
/**
|
williamr@2
|
102 |
* Struct containing a search error.
|
williamr@2
|
103 |
*/
|
williamr@2
|
104 |
struct TSearchError
|
williamr@2
|
105 |
{
|
williamr@2
|
106 |
TUint iDatabaseIndex; /**<
|
williamr@2
|
107 |
The index of the database where the search has failed. The
|
williamr@2
|
108 |
database URI can be retrieved by calling @ref DatabaseUriPtr.*/
|
williamr@2
|
109 |
TInt iErrorCode; /**<
|
williamr@2
|
110 |
The search error code for the database. */
|
williamr@2
|
111 |
};
|
williamr@2
|
112 |
|
williamr@2
|
113 |
public: // Constructors and destructor
|
williamr@2
|
114 |
|
williamr@2
|
115 |
/**
|
williamr@2
|
116 |
* Two-phased constructor.
|
williamr@2
|
117 |
*
|
williamr@2
|
118 |
* Leaves with @p KErrArgument if the database list is empty.
|
williamr@2
|
119 |
*
|
williamr@2
|
120 |
* @param[in] aDatabaseList An array containing the URIs of the landmark
|
williamr@2
|
121 |
* databases to be used in the search.
|
williamr@2
|
122 |
* @return A new instance of this class.
|
williamr@2
|
123 |
*/
|
williamr@2
|
124 |
IMPORT_C static CPosLmMultiDbSearch* NewL( const CDesCArray& aDatabaseList );
|
williamr@2
|
125 |
|
williamr@2
|
126 |
/**
|
williamr@2
|
127 |
* Destructor.
|
williamr@2
|
128 |
*/
|
williamr@2
|
129 |
IMPORT_C virtual ~CPosLmMultiDbSearch();
|
williamr@2
|
130 |
|
williamr@2
|
131 |
public: // New functions
|
williamr@2
|
132 |
|
williamr@2
|
133 |
/**
|
williamr@2
|
134 |
* Specifies the list of databases that should be used in the search.
|
williamr@2
|
135 |
*
|
williamr@2
|
136 |
* If this function is called and then @ref StartLandmarkSearchL or
|
williamr@2
|
137 |
* @ref StartCategorySearchL is called with the flag
|
williamr@2
|
138 |
* aSearchOnlyPreviousMatches set, new databases that were not a part
|
williamr@2
|
139 |
* of the previous search will generate no matches.
|
williamr@2
|
140 |
*
|
williamr@2
|
141 |
* If the client specifies database(s) that do not exist,
|
williamr@2
|
142 |
* @ref GetSearchError will report error code @p KErrNotFound for those
|
williamr@2
|
143 |
* databases after the search is started.
|
williamr@2
|
144 |
*
|
williamr@2
|
145 |
* This function will leave with @p KErrInUse if called during a
|
williamr@2
|
146 |
* search.
|
williamr@2
|
147 |
*
|
williamr@2
|
148 |
* If this function is called after a search has completed,
|
williamr@2
|
149 |
* database indexes in the results may become invalid.
|
williamr@2
|
150 |
*
|
williamr@2
|
151 |
* If a database is removed from a previously set list, the search
|
williamr@2
|
152 |
* result of that database is unavailable after this function
|
williamr@2
|
153 |
* is called. Search errors are reset after this function is called.
|
williamr@2
|
154 |
*
|
williamr@2
|
155 |
* Leaves with @p KErrArgument if the database list is empty.
|
williamr@2
|
156 |
*
|
williamr@2
|
157 |
* @since S60 3.0
|
williamr@2
|
158 |
* @param[in] aDatabaseList An array containing the URIs of the landmark
|
williamr@2
|
159 |
* databases to be used in the search.
|
williamr@2
|
160 |
*/
|
williamr@2
|
161 |
IMPORT_C void SetDatabasesToSearchL( const CDesCArray& aDatabaseList );
|
williamr@2
|
162 |
|
williamr@2
|
163 |
/**
|
williamr@2
|
164 |
* Returns the list of databases to search. Ownership is transferred
|
williamr@2
|
165 |
* to the caller.
|
williamr@2
|
166 |
*
|
williamr@2
|
167 |
* @return The list of databases to search.
|
williamr@2
|
168 |
*/
|
williamr@2
|
169 |
IMPORT_C CDesCArray* DatabasesToSearchL();
|
williamr@2
|
170 |
|
williamr@2
|
171 |
/**
|
williamr@2
|
172 |
* Sets the maximum number of search matches limit for each database.
|
williamr@2
|
173 |
*
|
williamr@2
|
174 |
* This function is used to limit the number of matches retrieved from
|
williamr@2
|
175 |
* each database in the search operation. If the limit is set, the
|
williamr@2
|
176 |
* search operation will stop when this limit is reached. By default
|
williamr@2
|
177 |
* the maximum number of matches is unlimited.
|
williamr@2
|
178 |
*
|
williamr@2
|
179 |
* If a new value for maximum number of matches is set when a search is
|
williamr@2
|
180 |
* ongoing, it will not affect the current search. The new maximum will
|
williamr@2
|
181 |
* be utilized in the next search.
|
williamr@2
|
182 |
*
|
williamr@2
|
183 |
* @since S60 3.0
|
williamr@2
|
184 |
* @param[in] aMaxNumOfMatches The maximum number of search matches for
|
williamr@2
|
185 |
* each landmark database involved in the search.
|
williamr@2
|
186 |
*/
|
williamr@2
|
187 |
IMPORT_C void SetMaxNumOfMatches( TInt aMaxNumOfMatches = KPosLmMaxNumOfMatchesUnlimited );
|
williamr@2
|
188 |
|
williamr@2
|
189 |
/**
|
williamr@2
|
190 |
* Starts a landmark search.
|
williamr@2
|
191 |
*
|
williamr@2
|
192 |
* If there are no previous matches and the client specifies that
|
williamr@2
|
193 |
* previous matches should be used, this function leaves with error
|
williamr@2
|
194 |
* code @p KErrArgument.
|
williamr@2
|
195 |
*
|
williamr@2
|
196 |
* If a search is already running, this function leaves with error
|
williamr@2
|
197 |
* code @p KErrInUse.
|
williamr@2
|
198 |
*
|
williamr@2
|
199 |
* If the search criterion is not valid for landmark searching, this
|
williamr@2
|
200 |
* function leaves with error code @p KErrArgument.
|
williamr@2
|
201 |
*
|
williamr@2
|
202 |
* If the search criterion is not supported, this function leaves
|
williamr@2
|
203 |
* with error code @p KErrNotSupported.
|
williamr@2
|
204 |
*
|
williamr@2
|
205 |
* If @ref CPosLmIdListCriteria is used or @ref CPosLmCategoryCriteria
|
williamr@2
|
206 |
* with item ID set, this function leaves with error code
|
williamr@2
|
207 |
* @p KErrArgument.
|
williamr@2
|
208 |
*
|
williamr@2
|
209 |
* The client takes ownership of the returned operation object.
|
williamr@2
|
210 |
*
|
williamr@2
|
211 |
* This function requires @p ReadUserData capability.
|
williamr@2
|
212 |
*
|
williamr@2
|
213 |
* @since S60 3.0
|
williamr@2
|
214 |
* @param[in] aCriteria The search criterion.
|
williamr@2
|
215 |
* @param[in] aSearchOnlyPreviousMatches This flag may be used to perform a
|
williamr@2
|
216 |
* search within the results of previous search.
|
williamr@2
|
217 |
* @returns A handle to the search operation.
|
williamr@2
|
218 |
*/
|
williamr@2
|
219 |
IMPORT_C CPosLmOperation* StartLandmarkSearchL(
|
williamr@2
|
220 |
const CPosLmSearchCriteria& aCriteria,
|
williamr@2
|
221 |
TBool aSearchOnlyPreviousMatches = EFalse );
|
williamr@2
|
222 |
|
williamr@2
|
223 |
/**
|
williamr@2
|
224 |
* Starts a landmark search.
|
williamr@2
|
225 |
*
|
williamr@2
|
226 |
* This overload of the @ref StartLandmarkSearchL function lets the
|
williamr@2
|
227 |
* client define the sort order for the search matches.
|
williamr@2
|
228 |
*
|
williamr@2
|
229 |
* Only sorting by landmark name is supported. If the client tries to
|
williamr@2
|
230 |
* sort by another attribute, this function leaves with error code
|
williamr@2
|
231 |
* @p KErrNotSupported.
|
williamr@2
|
232 |
*
|
williamr@2
|
233 |
* If there are no previous matches and the client specifies that
|
williamr@2
|
234 |
* previous matches should be used, this function leaves with error
|
williamr@2
|
235 |
* code @p KErrArgument.
|
williamr@2
|
236 |
*
|
williamr@2
|
237 |
* If a search is already running, this function will leave with error
|
williamr@2
|
238 |
* code @p KErrInUse.
|
williamr@2
|
239 |
*
|
williamr@2
|
240 |
* If the search criterion is not valid for landmark searching, this
|
williamr@2
|
241 |
* function leaves with error code @p KErrArgument.
|
williamr@2
|
242 |
*
|
williamr@2
|
243 |
* If the search criterion is not supported, this function will leave
|
williamr@2
|
244 |
* with error code @p KErrNotSupported.
|
williamr@2
|
245 |
*
|
williamr@2
|
246 |
* If @ref CPosLmIdListCriteria is used or @ref CPosLmCategoryCriteria
|
williamr@2
|
247 |
* with item ID set, this function leaves with error code
|
williamr@2
|
248 |
* @p KErrArgument.
|
williamr@2
|
249 |
*
|
williamr@2
|
250 |
* The client takes ownership of the returned operation object.
|
williamr@2
|
251 |
*
|
williamr@2
|
252 |
* This function requires @p ReadUserData capability.
|
williamr@2
|
253 |
*
|
williamr@2
|
254 |
* @since S60 3.0
|
williamr@2
|
255 |
* @param[in] aCriteria The search criterion.
|
williamr@2
|
256 |
* @param[in] aSortPref A sort preference object.
|
williamr@2
|
257 |
* @param[in] aSearchOnlyPreviousMatches This flag may be used to perform a
|
williamr@2
|
258 |
* search within the results of previous search.
|
williamr@2
|
259 |
* @returns A handle to the search operation.
|
williamr@2
|
260 |
*/
|
williamr@2
|
261 |
IMPORT_C CPosLmOperation* StartLandmarkSearchL(
|
williamr@2
|
262 |
const CPosLmSearchCriteria& aCriteria,
|
williamr@2
|
263 |
const TPosLmSortPref& aSortPref,
|
williamr@2
|
264 |
TBool aSearchOnlyPreviousMatches = EFalse );
|
williamr@2
|
265 |
|
williamr@2
|
266 |
/**
|
williamr@2
|
267 |
* Starts a search for landmark categories.
|
williamr@2
|
268 |
*
|
williamr@2
|
269 |
* If there are no previous matches and the client specifies that
|
williamr@2
|
270 |
* previous matches should be used, this function leaves with error
|
williamr@2
|
271 |
* code @p KErrArgument...
|
williamr@2
|
272 |
*
|
williamr@2
|
273 |
* The criterion, which defines if a landmark category is a match,
|
williamr@2
|
274 |
* is passed as input to this function.
|
williamr@2
|
275 |
*
|
williamr@2
|
276 |
* If a search is already running, this function leaves with error
|
williamr@2
|
277 |
* code @p KErrInUse.
|
williamr@2
|
278 |
*
|
williamr@2
|
279 |
* If the search criterion is not valid for landmark category searching,
|
williamr@2
|
280 |
* this function leaves with error code @p KErrArgument.
|
williamr@2
|
281 |
*
|
williamr@2
|
282 |
* If the search criterion is not supported, this function leaves
|
williamr@2
|
283 |
* with error code @p KErrNotSupported.
|
williamr@2
|
284 |
*
|
williamr@2
|
285 |
* The client takes ownership of the returned operation object.
|
williamr@2
|
286 |
*
|
williamr@2
|
287 |
* This function requires @p ReadUserData capability.
|
williamr@2
|
288 |
*
|
williamr@2
|
289 |
* @param[in] aCriteria The search criteria.
|
williamr@2
|
290 |
* @param[in] aSortPref Sort preference for the search results.
|
williamr@2
|
291 |
* @param[in] aSearchOnlyPreviousMatches This flag may be used to perform a
|
williamr@2
|
292 |
* search within the results of previous search.
|
williamr@2
|
293 |
* @returns A handle to the search operation.
|
williamr@2
|
294 |
*/
|
williamr@2
|
295 |
IMPORT_C CPosLmOperation* StartCategorySearchL(
|
williamr@2
|
296 |
const CPosLmSearchCriteria& aCriteria,
|
williamr@2
|
297 |
CPosLmCategoryManager::TCategorySortPref aSortPref,
|
williamr@2
|
298 |
TBool aSearchOnlyPreviousMatches = EFalse );
|
williamr@2
|
299 |
|
williamr@2
|
300 |
/**
|
williamr@2
|
301 |
* Returns the number of errors encountered during the search. This is
|
williamr@2
|
302 |
* the same as number of databases in which the search has failed.
|
williamr@2
|
303 |
*
|
williamr@2
|
304 |
* @since S60 3.0
|
williamr@2
|
305 |
* @return The number of errors encountered during the search.
|
williamr@2
|
306 |
*/
|
williamr@2
|
307 |
IMPORT_C TUint NumOfSearchErrors() const;
|
williamr@2
|
308 |
|
williamr@2
|
309 |
/**
|
williamr@2
|
310 |
* Returns errors encountered in the search.
|
williamr@2
|
311 |
*
|
williamr@2
|
312 |
* The client specifies an index of the error to retrieve. The index must
|
williamr@2
|
313 |
* be strictly less than @ref NumOfSearchErrors, otherwise this function
|
williamr@2
|
314 |
* panics with code @p EPosInvalidIndex. Whenever a new search is started
|
williamr@2
|
315 |
* this function must be called again to retrieve error codes, if any.
|
williamr@2
|
316 |
*
|
williamr@2
|
317 |
* @since S60 3.0
|
williamr@2
|
318 |
* @param[in] aErrorIndex The index of the error to retrieve.
|
williamr@2
|
319 |
* @param[out] aSearchError On return, contains the search error.
|
williamr@2
|
320 |
*/
|
williamr@2
|
321 |
IMPORT_C void GetSearchError(
|
williamr@2
|
322 |
TUint aErrorIndex,
|
williamr@2
|
323 |
TSearchError& aSearchError ) const;
|
williamr@2
|
324 |
|
williamr@2
|
325 |
/**
|
williamr@2
|
326 |
* Returns the total number of matches so far in the search.
|
williamr@2
|
327 |
*
|
williamr@2
|
328 |
* This function can also be called during a search operation.
|
williamr@2
|
329 |
*
|
williamr@2
|
330 |
* @since S60 3.0
|
williamr@2
|
331 |
* @return The number of search matches.
|
williamr@2
|
332 |
*/
|
williamr@2
|
333 |
IMPORT_C TUint TotalNumOfMatches() const;
|
williamr@2
|
334 |
|
williamr@2
|
335 |
/**
|
williamr@2
|
336 |
* Returns the number of matches so far in the search for a
|
williamr@2
|
337 |
* database specified by index.
|
williamr@2
|
338 |
*
|
williamr@2
|
339 |
* The index must be strictly less than @ref NumOfDatabasesToSearch,
|
williamr@2
|
340 |
* otherwise this function will panic with code @p EPosInvalidIndex.
|
williamr@2
|
341 |
* The URI of the database can be retrieved by calling
|
williamr@2
|
342 |
* @ref DatabaseUriPtr.
|
williamr@2
|
343 |
*
|
williamr@2
|
344 |
* This function can also be called during a search operation.
|
williamr@2
|
345 |
*
|
williamr@2
|
346 |
* @param[in] aDatabaseIndex The index of the database to get number
|
williamr@2
|
347 |
* of search matches for.
|
williamr@2
|
348 |
* @return The number of matches per database.
|
williamr@2
|
349 |
*/
|
williamr@2
|
350 |
IMPORT_C TUint NumOfMatches( TUint aDatabaseIndex ) const;
|
williamr@2
|
351 |
|
williamr@2
|
352 |
/**
|
williamr@2
|
353 |
* Returns the number of databases involved in the search.
|
williamr@2
|
354 |
*
|
williamr@2
|
355 |
* @since S60 3.0
|
williamr@2
|
356 |
* @return The number of databases involved in the search.
|
williamr@2
|
357 |
*/
|
williamr@2
|
358 |
IMPORT_C TUint NumOfDatabasesToSearch() const;
|
williamr@2
|
359 |
|
williamr@2
|
360 |
/**
|
williamr@2
|
361 |
* Returns the URI of a database involved in the search.
|
williamr@2
|
362 |
*
|
williamr@2
|
363 |
* The client specifies an index of the database URI to retrieve. The
|
williamr@2
|
364 |
* index must be strictly less than @ref NumOfDatabasesToSearch,
|
williamr@2
|
365 |
* otherwise this function will panic with code @p EPosInvalidIndex.
|
williamr@2
|
366 |
*
|
williamr@2
|
367 |
* @since S60 3.0
|
williamr@2
|
368 |
* @param[in] aDatabaseIndex The index of the database URI to retrieve.
|
williamr@2
|
369 |
* @return A pointer to the database URI descriptor. This pointer is
|
williamr@2
|
370 |
* only valid until @ref SetDatabasesToSearch is called, or the
|
williamr@2
|
371 |
* @ref CPosLmMultiDbSearch object is destroyed, whichever happens
|
williamr@2
|
372 |
* first.
|
williamr@2
|
373 |
*/
|
williamr@2
|
374 |
IMPORT_C TPtrC DatabaseUriPtr( TUint aDatabaseIndex ) const;
|
williamr@2
|
375 |
|
williamr@2
|
376 |
/**
|
williamr@2
|
377 |
* Creates an iterator object to iterate the matching landmarks or
|
williamr@2
|
378 |
* categories from one of the databases involved in the search.
|
williamr@2
|
379 |
*
|
williamr@2
|
380 |
* The database to get search matches for is specified by index. The
|
williamr@2
|
381 |
* index must be strictly less than @ref NumOfDatabasesToSearch,
|
williamr@2
|
382 |
* otherwise this function will panic with code @p EPosInvalidIndex.
|
williamr@2
|
383 |
* The URI of the database can be retrieved by calling
|
williamr@2
|
384 |
* @ref DatabaseUriPtr.
|
williamr@2
|
385 |
*
|
williamr@2
|
386 |
* This function can also be called during a search in order to read the
|
williamr@2
|
387 |
* matches encountered so far. Note that the iterator will not iterate
|
williamr@2
|
388 |
* any new matches. If new matches are found, a new iterator needs to be
|
williamr@2
|
389 |
* created to retrieve them. The previous matches will also be included.
|
williamr@2
|
390 |
*
|
williamr@2
|
391 |
* If the client has started a search, but no matches have been found
|
williamr@2
|
392 |
* yet in the database, an empty iterator is returned.
|
williamr@2
|
393 |
*
|
williamr@2
|
394 |
* If a sort preference was specified when the search was started, the
|
williamr@2
|
395 |
* landmarks or categories will be sorted when the search is complete
|
williamr@2
|
396 |
* but the items are not necessarily sorted if this function is
|
williamr@2
|
397 |
* called during a search.
|
williamr@2
|
398 |
*
|
williamr@2
|
399 |
* The client takes ownership of the returned iterator object.
|
williamr@2
|
400 |
*
|
williamr@2
|
401 |
* Note: The iterator iterates matches in @ref CPosLmMultiDbSearch.
|
williamr@2
|
402 |
* It cannot be used after the search object has been deleted.
|
williamr@2
|
403 |
*
|
williamr@2
|
404 |
* @since S60 3.0
|
williamr@2
|
405 |
* @param aDatabaseIndex The index of the database to get search matches
|
williamr@2
|
406 |
* for.
|
williamr@2
|
407 |
* @return A search results iterator.
|
williamr@2
|
408 |
*/
|
williamr@2
|
409 |
IMPORT_C CPosLmItemIterator* MatchIteratorL( TUint aDatabaseIndex );
|
williamr@2
|
410 |
|
williamr@2
|
411 |
/**
|
williamr@2
|
412 |
* Display data can be used as an alternative way to get result
|
williamr@2
|
413 |
* from a database search. Landmarks or categories are added to the
|
williamr@2
|
414 |
* display data collection during a search depending on the search type.
|
williamr@2
|
415 |
*
|
williamr@2
|
416 |
* This function may replace the combination of using
|
williamr@2
|
417 |
* @ref MatchIteratorL and reading landmark or category data.
|
williamr@2
|
418 |
* Result data is read already during the search and no duplicate
|
williamr@2
|
419 |
* access to database is needed.
|
williamr@2
|
420 |
*
|
williamr@2
|
421 |
* The display data object will be reset each time a new search is
|
williamr@2
|
422 |
* started. No items during the search are removed from the
|
williamr@2
|
423 |
* collection. New found matches can be added every time next
|
williamr@2
|
424 |
* search step is completed, see @ref CPosLmDisplayData::NewItemIndex.
|
williamr@2
|
425 |
*
|
williamr@2
|
426 |
* If the client sets display data during an ongoing search, this
|
williamr@2
|
427 |
* function panics with code @p EPosSearchOperationInUse.
|
williamr@2
|
428 |
*
|
williamr@2
|
429 |
* The client owns the display data object. If the client deletes it
|
williamr@2
|
430 |
* during a search, this may lead to unexpected errors. The client must
|
williamr@2
|
431 |
* call @ref UnsetDisplayData before it deletes the display data object.
|
williamr@2
|
432 |
*
|
williamr@2
|
433 |
* Search results from all databases are collected in the same
|
williamr@2
|
434 |
* displayable data collection. The @ref CPosLmDisplayItem::DatabaseIndex
|
williamr@2
|
435 |
* may be used to know which database every displayable item belongs to.
|
williamr@2
|
436 |
* The database index matches databases specified in this object,
|
williamr@2
|
437 |
* see @ref DatabaseUriPtr.
|
williamr@2
|
438 |
*
|
williamr@2
|
439 |
* @param[in,out] aData The displayable data.
|
williamr@2
|
440 |
*/
|
williamr@2
|
441 |
IMPORT_C void SetDisplayData( CPosLmDisplayData& aData );
|
williamr@2
|
442 |
|
williamr@2
|
443 |
/**
|
williamr@2
|
444 |
* Unsets display data. No further data will be added to the display
|
williamr@2
|
445 |
* data set with @ref SetDisplayData.
|
williamr@2
|
446 |
*
|
williamr@2
|
447 |
* If the client unsets display data during an ongoing search, this
|
williamr@2
|
448 |
* function panics with code @p EPosSearchOperationInUse.
|
williamr@2
|
449 |
*/
|
williamr@2
|
450 |
IMPORT_C void UnsetDisplayData();
|
williamr@2
|
451 |
|
williamr@2
|
452 |
/**
|
williamr@2
|
453 |
* Retrieves the maximum number of search matches limit for each
|
williamr@2
|
454 |
* database.
|
williamr@2
|
455 |
*
|
williamr@2
|
456 |
* By default the maximum number of matches is unlimited.
|
williamr@2
|
457 |
*
|
williamr@2
|
458 |
* @return The maximum number of search matches for each landmark
|
williamr@2
|
459 |
* database involved in the search or
|
williamr@2
|
460 |
* @p KPosLmMaxNumOfMatchesUnlimited if unlimited.
|
williamr@2
|
461 |
*/
|
williamr@2
|
462 |
IMPORT_C TInt MaxNumOfMatches() const;
|
williamr@2
|
463 |
|
williamr@2
|
464 |
/*
|
williamr@2
|
465 |
* Tells if the database with the specified database index is to be
|
williamr@2
|
466 |
* searched or not.
|
williamr@2
|
467 |
*
|
williamr@2
|
468 |
* @param aDatabaseIndex The index of the database.
|
williamr@2
|
469 |
* @return ETrue if the database is to be searched, otherwise EFalse.
|
williamr@2
|
470 |
*/
|
williamr@2
|
471 |
TBool ToBeSearched( TUint aDatabaseIndex ) const;
|
williamr@2
|
472 |
|
williamr@2
|
473 |
/*
|
williamr@2
|
474 |
* Gets a pointer to the database with the specified database index.
|
williamr@2
|
475 |
*
|
williamr@2
|
476 |
* @param aDatabaseIndex The index of the database.
|
williamr@2
|
477 |
* @return A pointer to the landmark database.
|
williamr@2
|
478 |
*/
|
williamr@2
|
479 |
CPosLandmarkDatabase* DatabaseL( TUint aDatabaseIndex );
|
williamr@2
|
480 |
|
williamr@2
|
481 |
/*
|
williamr@2
|
482 |
* Gets a pointer to the single search class for the database with the
|
williamr@2
|
483 |
* specified database index.
|
williamr@2
|
484 |
*
|
williamr@2
|
485 |
* @param aDatabaseIndex The index of the database.
|
williamr@2
|
486 |
* @return A pointer to the single search class.
|
williamr@2
|
487 |
*/
|
williamr@2
|
488 |
CPosLandmarkSearch* SearcherL( TUint aDatabaseIndex );
|
williamr@2
|
489 |
|
williamr@2
|
490 |
/*
|
williamr@2
|
491 |
* This method must be called to notify this class when a search has
|
williamr@2
|
492 |
* been started in the single search class corresponding to the
|
williamr@2
|
493 |
* specified database index.
|
williamr@2
|
494 |
*
|
williamr@2
|
495 |
* @param aDatabaseIndex The index of the database.
|
williamr@2
|
496 |
*/
|
williamr@2
|
497 |
void SearchStarted( TUint aDatabaseIndex );
|
williamr@2
|
498 |
|
williamr@2
|
499 |
/*
|
williamr@2
|
500 |
* This method must be called to notify this class when a search has
|
williamr@2
|
501 |
* been executed (partly or completely) in the single search class
|
williamr@2
|
502 |
* corresponding to the specified database index.
|
williamr@2
|
503 |
*
|
williamr@2
|
504 |
* @param[in] aDatabaseIndex The index of the database.
|
williamr@2
|
505 |
* @param[in] aSortPref The sort pref for the search.
|
williamr@2
|
506 |
*/
|
williamr@2
|
507 |
void SearchExecutedL(
|
williamr@2
|
508 |
TUint aDatabaseIndex,
|
williamr@2
|
509 |
const CPosLmMultiDbSortPref& aSortPref );
|
williamr@2
|
510 |
|
williamr@2
|
511 |
/*
|
williamr@2
|
512 |
* Adds a search error for the specified database index.
|
williamr@2
|
513 |
*
|
williamr@2
|
514 |
* @param aDatabaseIndex The index of the database.
|
williamr@2
|
515 |
* @param aErrorCode The error code.
|
williamr@2
|
516 |
*/
|
williamr@2
|
517 |
void AddSearchError( TUint aDatabaseIndex, TInt aErrorCode );
|
williamr@2
|
518 |
|
williamr@2
|
519 |
/*
|
williamr@2
|
520 |
* This function must be called by the CPosLmMultiDbSearchOperation
|
williamr@2
|
521 |
* when the search operation has completed or has been cancelled.
|
williamr@2
|
522 |
*/
|
williamr@2
|
523 |
void HandleSearchOperationCompleted();
|
williamr@2
|
524 |
|
williamr@2
|
525 |
private:
|
williamr@2
|
526 |
|
williamr@2
|
527 |
/**
|
williamr@2
|
528 |
* C++ default constructor.
|
williamr@2
|
529 |
*/
|
williamr@2
|
530 |
CPosLmMultiDbSearch();
|
williamr@2
|
531 |
|
williamr@2
|
532 |
/**
|
williamr@2
|
533 |
* By default Symbian 2nd phase constructor is private.
|
williamr@2
|
534 |
*/
|
williamr@2
|
535 |
void ConstructL(const CDesCArray& aDatabaseList);
|
williamr@2
|
536 |
|
williamr@2
|
537 |
void CloseDbsNotToSearch(const CDesCArray& aDatabaseList);
|
williamr@2
|
538 |
|
williamr@2
|
539 |
CPosLmOperation* StartSearchL(
|
williamr@2
|
540 |
const CPosLmSearchCriteria& aCriteria,
|
williamr@2
|
541 |
CPosLmMultiDbSortPref* aSortPref,
|
williamr@2
|
542 |
TBool aSearchOnlyPreviousMatches );
|
williamr@2
|
543 |
|
williamr@2
|
544 |
private: // Data
|
williamr@2
|
545 |
|
williamr@2
|
546 |
TInt iMaxNumOfMatches;
|
williamr@2
|
547 |
TInt iNewMaxNumOfMatches;
|
williamr@2
|
548 |
|
williamr@2
|
549 |
CPosLmMultiDbSearchOperation* iMultiSearchOperation; // No ownership
|
williamr@2
|
550 |
|
williamr@2
|
551 |
RPointerArray<CPosLmMultiDbSearchItem> iSearchItems;
|
williamr@2
|
552 |
|
williamr@2
|
553 |
RArray<TSearchError> iSearchErrors; // Can contain dummy errors.
|
williamr@2
|
554 |
TUint iNoOfSearchErrors; // Number of valid errors.
|
williamr@2
|
555 |
|
williamr@2
|
556 |
CPosLmDisplayData* iClientDisplayData; // No ownership
|
williamr@2
|
557 |
|
williamr@2
|
558 |
};
|
williamr@2
|
559 |
|
williamr@2
|
560 |
#endif // CPOSLMMULTIDBSEARCH_H
|
williamr@2
|
561 |
|