|
1 /* |
|
2 * Copyright (c) 2008 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: Defines a landmark search criteria |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TLAPISEARCHCRITERIA_H |
|
20 #define TLAPISEARCHCRITERIA_H |
|
21 |
|
22 // EXTERNAL INCLUDES |
|
23 #include <e32std.h> |
|
24 |
|
25 /** |
|
26 * Defines a landmark search criteria |
|
27 * |
|
28 * The class is only a container class for the data. It does not own |
|
29 * any of the search attributes but delegates them to the search |
|
30 * provider |
|
31 * |
|
32 * @lib N/A |
|
33 * @since S60 3.2 |
|
34 */ |
|
35 NONSHARABLE_CLASS(TLAPISearchCriteria) |
|
36 { |
|
37 |
|
38 public: // Constructors |
|
39 |
|
40 /** |
|
41 * Constructs a default search criteria. The default |
|
42 * will return all available items |
|
43 */ |
|
44 inline TLAPISearchCriteria(); |
|
45 |
|
46 public: // New functions |
|
47 |
|
48 /** |
|
49 * Sets the attributes of a search text. The attributes |
|
50 * indicate that which text fields are searched from |
|
51 * each landmark to find the matching items. |
|
52 * |
|
53 * Currently, the only supported fields are name and description |
|
54 * |
|
55 * @param aTextAttributes The attributes of a search text |
|
56 */ |
|
57 inline void SetTextAttributes(TUint aTextAttributes); |
|
58 |
|
59 /** |
|
60 * Sets the search string. |
|
61 * |
|
62 * The text must be a non-empty descriptor. Otherwise the search |
|
63 * will fail with KErrArgument. The search is case insensitive. |
|
64 * |
|
65 * Wild card characters "?" and "*" are supported in the search string. |
|
66 * "?" matches a single occurrence of any character and "*" matches |
|
67 * zero or more consecutive occurrences of any characters. |
|
68 * |
|
69 * A landmark matches the criteria if specified text is found anywhere |
|
70 * in selected attributes set using SetTextAttributes |
|
71 * |
|
72 * @param aText The text to search for. |
|
73 */ |
|
74 inline void SetText(const TDesC* aText); |
|
75 |
|
76 /** |
|
77 * Sets the name of the category which should be used as landmark |
|
78 * search criteria. The whole category name must be specified. Category |
|
79 * searching is not supported using wild cards and will be considered |
|
80 * as ordinary characters |
|
81 * |
|
82 * The matching is case sensitive. An empty descriptor means uncategorized |
|
83 * landmarks search. |
|
84 * |
|
85 * @param aCategoryName The category name. |
|
86 */ |
|
87 inline void SetCategoryName(const TDesC* aCategoryName); |
|
88 |
|
89 /** |
|
90 * Define the search area from which the landmarks are searched |
|
91 * |
|
92 * If the parameters are out of range. The search will faile with KErrArgument |
|
93 * The correct ranges are: |
|
94 * -# -90 =< aSouthLatitude =< aNorthLatitude =< 90 |
|
95 * -# -180 <= aWestLongitude < 180 |
|
96 * -# -180 <= aEastLongitude <= 180 |
|
97 * |
|
98 * @param aSouthLatitude The southern latitude border of the search area. |
|
99 * @param aNorthLatitude The northern latitude border of the search area. |
|
100 * @param aWestLongitude The western longitude border of the search area. |
|
101 * @param aEastLongitude The eastern longitude border of the search area. |
|
102 */ |
|
103 inline void SetArea(const TReal64& aSouthLatitude, |
|
104 const TReal64& aNorthLatitude, const TReal64& aWestLongitude, |
|
105 const TReal64& aEastLongitude); |
|
106 |
|
107 /** |
|
108 * Returns the search attributes of the search text |
|
109 */ |
|
110 inline TUint TextAttributes() const; |
|
111 |
|
112 /** |
|
113 * Returns the search text. NULL if not set |
|
114 */ |
|
115 inline const TDesC* Text() const; |
|
116 |
|
117 /** |
|
118 * Returns the search category name. NULL if not set |
|
119 */ |
|
120 inline const TDesC* CategoryName() const; |
|
121 |
|
122 /** |
|
123 * Checks if the coordinates are set using SetArea |
|
124 */ |
|
125 inline TBool HasValidCoordinates() const; |
|
126 |
|
127 /** |
|
128 * Gets the search area. The area may not have been set yet and |
|
129 * should be checked with HasValidCoordinates() |
|
130 */ |
|
131 inline void GetArea(TReal64& aSouthLatitude, TReal64& aNorthLatitude, |
|
132 TReal64& aWestLongitude, TReal64& aEastLongitude) const; |
|
133 |
|
134 private: // Data |
|
135 |
|
136 // Search text. Not owned |
|
137 const TDesC* iText; |
|
138 |
|
139 // Search text attributes |
|
140 TUint iTextAttributes; |
|
141 |
|
142 // Searched category. Not owned |
|
143 const TDesC* iCategoryName; |
|
144 |
|
145 // Marks a search area |
|
146 TReal64 iSouthLatitude; |
|
147 TReal64 iNorthLatitude; |
|
148 TReal64 iWestLongitude; |
|
149 TReal64 iEastLongitude; |
|
150 |
|
151 } |
|
152 ; |
|
153 |
|
154 // Inline functions |
|
155 #include "tlapisearchcriteria.inl" |
|
156 |
|
157 #endif // TLAPISEARCHCRITERIA_H |
|
158 // End of file |