2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: CPosLmTextCriteria class
19 #ifndef CPOSLMTEXTCRITERIA_H
20 #define CPOSLMTEXTCRITERIA_H
23 #include <lbsfields.h>
24 #include <EPos_CPosLandmark.h>
25 #include "EPos_CPosLmSearchCriteria.h"
27 const TInt KPosLmMaxSearchStringLength = 255;
30 * Criterion for searching for landmarks which contain a certain text.
32 * The search is defined by providing a text to search for and the position
33 * fields and text attributes to search.
35 * If no attributes are specified for the search, all text attributes in the
36 * landmarks are searched. If no position fields are specified, then all
37 * fields are searched.
39 * If this criterion is passed to
40 * @ref CPosLandmarkSearch::StartLandmarkSearchL, only landmarks which contain
41 * the specified text are returned.
43 * Wild-card characters are supported.
45 * This criterion is only valid when searching for landmarks, i.e. if it
46 * is passed to @p CPosLandmarkSearch::StartCategorySearchL, the function
47 * will fail with error code @p KErrArgument.
49 * @lib eposlmsearchlib.lib
52 class CPosLmTextCriteria : public CPosLmSearchCriteria
57 * Two-phased constructor.
58 * @returns A new instance of this class.
60 IMPORT_C static CPosLmTextCriteria* NewLC();
65 virtual ~CPosLmTextCriteria();
70 * Retrieves the text to search for.
72 * @return The text to search for.
74 IMPORT_C TPtrC Text() const;
77 * Sets the search string.
79 * A non-empty text string must be set, otherwise
80 * @ref CPosLandmarkSearch::StartLandmarkSearchL will leave with error
81 * code @p KErrArgument.
83 * The search is case insensitive.
85 * Wild-card characters "?" and "*" are supported in the search string.
86 * "?" matches a single occurrence of any character and "*" matches
87 * zero or more consecutive occurrences of any characters.
89 * A landmark matches the criterion if specified text is found anywhere
90 * in selected attributes or position fields.
92 * @param aText The text to search for.
94 * @leave KErrArgument The search string is longer than @p KPosLmMaxSearchStringLength.
96 IMPORT_C void SetTextL( const TDesC& aText );
99 * Retrieves the landmark attributes which should be searched.
101 * This function returns a bitmap of landmark attributes. The landmark
102 * attributes are defined by @p CPosLandmark::_TAttributes. It is only
103 * possible to search the @p ELandmarkName and @p EDescription
106 * @return A bitmap indicating which landmark attributes should be
109 IMPORT_C CPosLandmark::TAttributes AttributesToSearch() const;
112 * Sets which landmark attributes to search.
114 * The client passes a bitmap of the landmark attributes to search. It
115 * is only possible to search the @p ELandmarkName and @p EDescription
118 * @param aAttributes A bitmap indicating which landmark attributes
119 * should be searched.
121 * @panic "Landmarks Client"-EPosInvalidLandmarkAttribute
122 * Unsupported attribute is passed.
124 IMPORT_C void SetAttributesToSearch(
125 CPosLandmark::TAttributes aAttributes
129 * Retrieves a list of the position fields to search.
131 * @param[out] aFieldArray On return, contains a list of the position fields
132 * which are used in a search. If no position fields have been set,
133 * the array is empty. Position fields are identified by values defined
134 * in @p TPositionFieldId.
136 IMPORT_C void GetPositionFieldsToSearchL(
137 RArray<TUint>& aFieldArray
141 * Sets the position fields to search.
143 * Any previously set position fields are cleared by this call.
145 * @param[in] aFieldArray A list of the position fields to search.
146 * Position fields are identified by values defined in
147 * @p TPositionFieldId.
149 IMPORT_C void SetPositionFieldsToSearchL(
150 const RArray<TUint>& aFieldArray
154 * Clears the position fields list used in a search.
156 IMPORT_C void ClearPositionFieldsToSearch();
160 CPosLmTextCriteria();
164 // Prohibit copy constructor
165 CPosLmTextCriteria( const CPosLmTextCriteria& );
166 // Prohibit assigment operator
167 CPosLmTextCriteria& operator= ( const CPosLmTextCriteria& );
172 RArray<TUint> iPositionFieldArray;
173 CPosLandmark::TAttributes iAttributes;
177 #endif // CPOSLMTEXTCRITERIA_H