author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
parent 2 | 2fe1408b6811 |
permissions | -rw-r--r-- |
williamr@2 | 1 |
/* |
williamr@2 | 2 |
* Copyright (c) 2005-2006 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: CPosLmTextCriteria class |
williamr@2 | 15 |
* |
williamr@2 | 16 |
*/ |
williamr@2 | 17 |
|
williamr@2 | 18 |
|
williamr@2 | 19 |
#ifndef CPOSLMTEXTCRITERIA_H |
williamr@2 | 20 |
#define CPOSLMTEXTCRITERIA_H |
williamr@2 | 21 |
|
williamr@2 | 22 |
#include <e32base.h> |
williamr@4 | 23 |
#include <lbsfields.h> |
williamr@2 | 24 |
#include <EPos_CPosLandmark.h> |
williamr@2 | 25 |
#include "EPos_CPosLmSearchCriteria.h" |
williamr@2 | 26 |
|
williamr@2 | 27 |
const TInt KPosLmMaxSearchStringLength = 255; |
williamr@2 | 28 |
|
williamr@2 | 29 |
/** |
williamr@2 | 30 |
* Criterion for searching for landmarks which contain a certain text. |
williamr@2 | 31 |
* |
williamr@2 | 32 |
* The search is defined by providing a text to search for and the position |
williamr@2 | 33 |
* fields and text attributes to search. |
williamr@2 | 34 |
* |
williamr@2 | 35 |
* If no attributes are specified for the search, all text attributes in the |
williamr@2 | 36 |
* landmarks are searched. If no position fields are specified, then all |
williamr@2 | 37 |
* fields are searched. |
williamr@2 | 38 |
* |
williamr@2 | 39 |
* If this criterion is passed to |
williamr@2 | 40 |
* @ref CPosLandmarkSearch::StartLandmarkSearchL, only landmarks which contain |
williamr@2 | 41 |
* the specified text are returned. |
williamr@2 | 42 |
* |
williamr@2 | 43 |
* Wild-card characters are supported. |
williamr@2 | 44 |
* |
williamr@2 | 45 |
* This criterion is only valid when searching for landmarks, i.e. if it |
williamr@2 | 46 |
* is passed to @p CPosLandmarkSearch::StartCategorySearchL, the function |
williamr@2 | 47 |
* will fail with error code @p KErrArgument. |
williamr@2 | 48 |
* |
williamr@2 | 49 |
* @lib eposlmsearchlib.lib |
williamr@2 | 50 |
* @since S60 3.0 |
williamr@2 | 51 |
*/ |
williamr@2 | 52 |
class CPosLmTextCriteria : public CPosLmSearchCriteria |
williamr@2 | 53 |
{ |
williamr@2 | 54 |
public: |
williamr@2 | 55 |
|
williamr@2 | 56 |
/** |
williamr@2 | 57 |
* Two-phased constructor. |
williamr@2 | 58 |
* @returns A new instance of this class. |
williamr@2 | 59 |
*/ |
williamr@2 | 60 |
IMPORT_C static CPosLmTextCriteria* NewLC(); |
williamr@2 | 61 |
|
williamr@2 | 62 |
/** |
williamr@2 | 63 |
* Destructor. |
williamr@2 | 64 |
*/ |
williamr@2 | 65 |
virtual ~CPosLmTextCriteria(); |
williamr@2 | 66 |
|
williamr@2 | 67 |
public: |
williamr@2 | 68 |
|
williamr@2 | 69 |
/** |
williamr@2 | 70 |
* Retrieves the text to search for. |
williamr@2 | 71 |
* |
williamr@2 | 72 |
* @return The text to search for. |
williamr@2 | 73 |
*/ |
williamr@2 | 74 |
IMPORT_C TPtrC Text() const; |
williamr@2 | 75 |
|
williamr@2 | 76 |
/** |
williamr@2 | 77 |
* Sets the search string. |
williamr@2 | 78 |
* |
williamr@2 | 79 |
* A non-empty text string must be set, otherwise |
williamr@2 | 80 |
* @ref CPosLandmarkSearch::StartLandmarkSearchL will leave with error |
williamr@2 | 81 |
* code @p KErrArgument. |
williamr@2 | 82 |
* |
williamr@2 | 83 |
* The search is case insensitive. |
williamr@2 | 84 |
* |
williamr@2 | 85 |
* Wild-card characters "?" and "*" are supported in the search string. |
williamr@2 | 86 |
* "?" matches a single occurrence of any character and "*" matches |
williamr@2 | 87 |
* zero or more consecutive occurrences of any characters. |
williamr@2 | 88 |
* |
williamr@2 | 89 |
* A landmark matches the criterion if specified text is found anywhere |
williamr@2 | 90 |
* in selected attributes or position fields. |
williamr@2 | 91 |
* |
williamr@2 | 92 |
* @param aText The text to search for. |
williamr@2 | 93 |
* |
williamr@2 | 94 |
* @leave KErrArgument The search string is longer than @p KPosLmMaxSearchStringLength. |
williamr@2 | 95 |
*/ |
williamr@2 | 96 |
IMPORT_C void SetTextL( const TDesC& aText ); |
williamr@2 | 97 |
|
williamr@2 | 98 |
/** |
williamr@2 | 99 |
* Retrieves the landmark attributes which should be searched. |
williamr@2 | 100 |
* |
williamr@2 | 101 |
* This function returns a bitmap of landmark attributes. The landmark |
williamr@2 | 102 |
* attributes are defined by @p CPosLandmark::_TAttributes. It is only |
williamr@2 | 103 |
* possible to search the @p ELandmarkName and @p EDescription |
williamr@2 | 104 |
* attributes. |
williamr@2 | 105 |
* |
williamr@2 | 106 |
* @return A bitmap indicating which landmark attributes should be |
williamr@2 | 107 |
* searched. |
williamr@2 | 108 |
*/ |
williamr@2 | 109 |
IMPORT_C CPosLandmark::TAttributes AttributesToSearch() const; |
williamr@2 | 110 |
|
williamr@2 | 111 |
/** |
williamr@2 | 112 |
* Sets which landmark attributes to search. |
williamr@2 | 113 |
* |
williamr@2 | 114 |
* The client passes a bitmap of the landmark attributes to search. It |
williamr@2 | 115 |
* is only possible to search the @p ELandmarkName and @p EDescription |
williamr@2 | 116 |
* attributes. |
williamr@2 | 117 |
* |
williamr@2 | 118 |
* @param aAttributes A bitmap indicating which landmark attributes |
williamr@2 | 119 |
* should be searched. |
williamr@2 | 120 |
* |
williamr@2 | 121 |
* @panic "Landmarks Client"-EPosInvalidLandmarkAttribute |
williamr@2 | 122 |
* Unsupported attribute is passed. |
williamr@2 | 123 |
*/ |
williamr@2 | 124 |
IMPORT_C void SetAttributesToSearch( |
williamr@2 | 125 |
CPosLandmark::TAttributes aAttributes |
williamr@2 | 126 |
); |
williamr@2 | 127 |
|
williamr@2 | 128 |
/** |
williamr@2 | 129 |
* Retrieves a list of the position fields to search. |
williamr@2 | 130 |
* |
williamr@2 | 131 |
* @param[out] aFieldArray On return, contains a list of the position fields |
williamr@2 | 132 |
* which are used in a search. If no position fields have been set, |
williamr@2 | 133 |
* the array is empty. Position fields are identified by values defined |
williamr@2 | 134 |
* in @p TPositionFieldId. |
williamr@2 | 135 |
*/ |
williamr@2 | 136 |
IMPORT_C void GetPositionFieldsToSearchL( |
williamr@2 | 137 |
RArray<TUint>& aFieldArray |
williamr@2 | 138 |
) const; |
williamr@2 | 139 |
|
williamr@2 | 140 |
/** |
williamr@2 | 141 |
* Sets the position fields to search. |
williamr@2 | 142 |
* |
williamr@2 | 143 |
* Any previously set position fields are cleared by this call. |
williamr@2 | 144 |
* |
williamr@2 | 145 |
* @param[in] aFieldArray A list of the position fields to search. |
williamr@2 | 146 |
* Position fields are identified by values defined in |
williamr@2 | 147 |
* @p TPositionFieldId. |
williamr@2 | 148 |
*/ |
williamr@2 | 149 |
IMPORT_C void SetPositionFieldsToSearchL( |
williamr@2 | 150 |
const RArray<TUint>& aFieldArray |
williamr@2 | 151 |
); |
williamr@2 | 152 |
|
williamr@2 | 153 |
/** |
williamr@2 | 154 |
* Clears the position fields list used in a search. |
williamr@2 | 155 |
*/ |
williamr@2 | 156 |
IMPORT_C void ClearPositionFieldsToSearch(); |
williamr@2 | 157 |
|
williamr@2 | 158 |
private: |
williamr@2 | 159 |
|
williamr@2 | 160 |
CPosLmTextCriteria(); |
williamr@2 | 161 |
|
williamr@2 | 162 |
void ConstructL(); |
williamr@2 | 163 |
|
williamr@2 | 164 |
// Prohibit copy constructor |
williamr@2 | 165 |
CPosLmTextCriteria( const CPosLmTextCriteria& ); |
williamr@2 | 166 |
// Prohibit assigment operator |
williamr@2 | 167 |
CPosLmTextCriteria& operator= ( const CPosLmTextCriteria& ); |
williamr@2 | 168 |
|
williamr@2 | 169 |
private: |
williamr@2 | 170 |
|
williamr@2 | 171 |
HBufC* iText; |
williamr@2 | 172 |
RArray<TUint> iPositionFieldArray; |
williamr@2 | 173 |
CPosLandmark::TAttributes iAttributes; |
williamr@2 | 174 |
|
williamr@2 | 175 |
}; |
williamr@2 | 176 |
|
williamr@2 | 177 |
#endif // CPOSLMTEXTCRITERIA_H |
williamr@2 | 178 |
|
williamr@2 | 179 |