|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Class for handling area searching for landmarks. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPOSLMLOCALAREASEARCH_H |
|
20 #define CPOSLMLOCALAREASEARCH_H |
|
21 |
|
22 #include "EPos_CPosLmLocalSearchHandler.h" |
|
23 |
|
24 class CPosLmAreaCriteria; |
|
25 |
|
26 /** |
|
27 * Class for handling area searching for landmarks. |
|
28 */ |
|
29 class CPosLmLocalAreaSearch : public CPosLmLocalSearchHandler |
|
30 { |
|
31 public: // Constructors and destructor |
|
32 |
|
33 /** |
|
34 * Two-phased constructor. |
|
35 * |
|
36 * @param[in] aDbAccess The access handle to the database to search in. |
|
37 * @param[in] aCriteria The search criteria. |
|
38 * @param[in] aSortPref A sort preference object. |
|
39 * @param[in] aDisplayData The displayable data. |
|
40 * @param[in] aMaxNumOfMatches The max number of items that will be |
|
41 * searched for. |
|
42 */ |
|
43 static CPosLmLocalAreaSearch* NewL( |
|
44 CPosLmLocalDatabase& aDatabase, |
|
45 const CPosLmSearchCriteria& aCriteria, |
|
46 const TPosLmLocalSortPref& aSortPref, |
|
47 CPosLmDisplayData* aDisplayData, |
|
48 TInt aMaxNumOfMatches ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 ~CPosLmLocalAreaSearch(); |
|
54 |
|
55 public: // From CPosLmLocalSearchHandler |
|
56 |
|
57 /** |
|
58 * @return ETrue. |
|
59 */ |
|
60 TBool IsValidForLandmarkSearch() const; |
|
61 |
|
62 /** |
|
63 * @param[out] aProgress Will be set to the progress of the search when |
|
64 * the step has finished. |
|
65 * @return @p KPosLmOperationNotComplete if the step has completed but |
|
66 * more steps are needed before the search has finished, |
|
67 * @p KErrNone if the search has finished successfully. |
|
68 */ |
|
69 TInt NextStepL( TReal32& aProgress ); |
|
70 |
|
71 /** Returns ETrue if current row in landmark table |
|
72 * matches the criteria, EFalse - otherwise */ |
|
73 TBool CurrentRowMatch( RDbRowSet& aView ); |
|
74 |
|
75 private: |
|
76 |
|
77 void PrepareSearchL(); |
|
78 void PrepareQueryL( TBool aFullData ); |
|
79 void UnsortedSearchL(); |
|
80 void SortedSearchL(); |
|
81 |
|
82 /** |
|
83 * @param[in] aDbAccess The access handle to the database to search in. |
|
84 * @param[in] aCriteria The search criteria. |
|
85 * @param[in] aSortPref A sort preference object. |
|
86 * @param[in] aMaxNumOfMatches The max number of items that will be |
|
87 * searched for. |
|
88 */ |
|
89 CPosLmLocalAreaSearch( |
|
90 CPosLmLocalDatabase& aDatabase, |
|
91 const CPosLmSearchCriteria& aCriteria, |
|
92 const TPosLmLocalSortPref& aSortPref, |
|
93 TInt aMaxNumOfMatches ); |
|
94 |
|
95 /** |
|
96 * @param[in] aCriteria The search criteria. |
|
97 * @param[in] aDisplayData The displayable data. |
|
98 */ |
|
99 void ConstructL( |
|
100 const CPosLmSearchCriteria& aCriteria, |
|
101 CPosLmDisplayData* aDisplayData ); |
|
102 |
|
103 // By default, prohibit copy constructor |
|
104 CPosLmLocalAreaSearch( const CPosLmLocalAreaSearch& ); |
|
105 // Prohibit assigment operator |
|
106 CPosLmLocalAreaSearch& operator= ( const CPosLmLocalAreaSearch& ); |
|
107 |
|
108 private: |
|
109 |
|
110 enum TSearchStatus |
|
111 { |
|
112 ESearchNotStarted = 0, |
|
113 |
|
114 EPrepareUnsortedSearch, |
|
115 EUnsortedSearch, |
|
116 |
|
117 EPrepareSortedSearch, |
|
118 ESortedSearch, |
|
119 |
|
120 ESearchCompleted |
|
121 }; |
|
122 |
|
123 TSearchStatus iSearchStatus; |
|
124 |
|
125 TReal64 iSouth; |
|
126 TReal64 iNorth; |
|
127 TReal64 iWest; |
|
128 TReal64 iEast; |
|
129 }; |
|
130 |
|
131 #endif // CPOSLMLOCALAREASEARCH_H |
|
132 |