|
1 /* |
|
2 * Copyright (c) 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 searching for landmark categories with a certain name. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPOSLMLOCALCATNAMESEARCH_H |
|
20 #define CPOSLMLOCALCATNAMESEARCH_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "EPos_CPosLmLocalSearchHandler.h" |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CPosLmCatNameCriteria; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Class for handling searching for landmark categories with a certain name. |
|
35 */ |
|
36 class CPosLmLocalCatNameSearch : public CPosLmLocalSearchHandler |
|
37 { |
|
38 public: // Constructors and destructor |
|
39 |
|
40 /** |
|
41 * Two-phased constructor. |
|
42 * |
|
43 * @param[in] aDbAccess The access handle to the database to search in. |
|
44 * @param[in] aCriteria The search criteria. |
|
45 * @param[in] aSortPref A sort preference object. |
|
46 * @param[in] aDisplayData The displayable data. |
|
47 * @param[in] aMaxNumOfMatches The max number of items that will be |
|
48 * searched for. |
|
49 */ |
|
50 static CPosLmLocalCatNameSearch* NewL( |
|
51 CPosLmLocalDatabase& aDatabase, |
|
52 const CPosLmSearchCriteria& aCriteria, |
|
53 const TPosLmLocalSortPref& aSortPref, |
|
54 CPosLmDisplayData* aDisplayData, |
|
55 TInt aMaxNumOfMatches ); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 ~CPosLmLocalCatNameSearch(); |
|
61 |
|
62 public: // New functions |
|
63 |
|
64 /** |
|
65 * Validates that the criteria is correct according to the search API. |
|
66 * Leaves with KErrArgument if the criteria is not correctly set. |
|
67 * |
|
68 * @param aCriteria The criteria to validate. |
|
69 */ |
|
70 static void ValidateCriteriaL( |
|
71 /* IN */ const CPosLmCatNameCriteria& aCriteria |
|
72 ); |
|
73 |
|
74 public: // From base classes |
|
75 |
|
76 /** |
|
77 * From CPosLmLocalSearchHandler. |
|
78 * |
|
79 * @return ETrue. |
|
80 */ |
|
81 TBool IsValidForCategorySearch() const; |
|
82 |
|
83 /** |
|
84 * From CPosLmLocalSearchHandler. |
|
85 * |
|
86 * @param aProgress Will be set to the progress of the search when |
|
87 * the step has finished. |
|
88 * @return @p KPosLmOperationNotComplete if the step has completed but |
|
89 * more steps are needed before the search has finished, |
|
90 * @p KErrNone if the search has finished successfully. |
|
91 */ |
|
92 TInt NextStepL( |
|
93 /* OUT */ TReal32& aProgress |
|
94 ); |
|
95 |
|
96 protected: |
|
97 |
|
98 private: |
|
99 |
|
100 void PrepareSearchL(); |
|
101 void PrepareQueryL(); |
|
102 void SearchL(); |
|
103 |
|
104 /** |
|
105 * C++ default constructor. |
|
106 * @param[in] aDbAccess The access handle to the database to search in. |
|
107 * @param aCriteria The search criteria. |
|
108 * @param aSortPref A sort preference object. |
|
109 * @param aMaxNumOfMatches The max number of items that will be |
|
110 * searched for. |
|
111 */ |
|
112 CPosLmLocalCatNameSearch( |
|
113 CPosLmLocalDatabase& aDatabase, |
|
114 /* IN */ const CPosLmSearchCriteria& aCriteria, |
|
115 /* IN */ const TPosLmLocalSortPref& aSortPref, |
|
116 /* IN */ TInt aMaxNumOfMatches |
|
117 ); |
|
118 |
|
119 /** |
|
120 * By default Symbian 2nd phase constructor is private. |
|
121 * @param aCriteria The search criteria. |
|
122 * @param aDisplayData The displayable data. |
|
123 */ |
|
124 void ConstructL( |
|
125 /* IN */ const CPosLmSearchCriteria& aCriteria, |
|
126 /* IN */ CPosLmDisplayData* aDisplayData |
|
127 ); |
|
128 |
|
129 // By default, prohibit copy constructor |
|
130 CPosLmLocalCatNameSearch( const CPosLmLocalCatNameSearch& ); |
|
131 // Prohibit assigment operator |
|
132 CPosLmLocalCatNameSearch& operator= ( const CPosLmLocalCatNameSearch& ); |
|
133 |
|
134 private: |
|
135 |
|
136 enum TPosCategoryNameSearchStatus |
|
137 { |
|
138 EPosSearchNotStarted = 0, |
|
139 EPosCatNameSearch, |
|
140 EPosSearchCompleted |
|
141 }; |
|
142 |
|
143 TPosCategoryNameSearchStatus iSearchStatus; |
|
144 |
|
145 CPosLmCatNameCriteria* iCriteria; |
|
146 |
|
147 }; |
|
148 |
|
149 #endif // CPOSLMLOCALCATNAMESEARCH_H |
|
150 |
|
151 // End of File |