williamr@2: /* williamr@2: * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: CPosLmTextCriteria class williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef CPOSLMTEXTCRITERIA_H williamr@2: #define CPOSLMTEXTCRITERIA_H williamr@2: williamr@2: #include williamr@4: #include williamr@2: #include williamr@2: #include "EPos_CPosLmSearchCriteria.h" williamr@2: williamr@2: const TInt KPosLmMaxSearchStringLength = 255; williamr@2: williamr@2: /** williamr@2: * Criterion for searching for landmarks which contain a certain text. williamr@2: * williamr@2: * The search is defined by providing a text to search for and the position williamr@2: * fields and text attributes to search. williamr@2: * williamr@2: * If no attributes are specified for the search, all text attributes in the williamr@2: * landmarks are searched. If no position fields are specified, then all williamr@2: * fields are searched. williamr@2: * williamr@2: * If this criterion is passed to williamr@2: * @ref CPosLandmarkSearch::StartLandmarkSearchL, only landmarks which contain williamr@2: * the specified text are returned. williamr@2: * williamr@2: * Wild-card characters are supported. williamr@2: * williamr@2: * This criterion is only valid when searching for landmarks, i.e. if it williamr@2: * is passed to @p CPosLandmarkSearch::StartCategorySearchL, the function williamr@2: * will fail with error code @p KErrArgument. williamr@2: * williamr@2: * @lib eposlmsearchlib.lib williamr@2: * @since S60 3.0 williamr@2: */ williamr@2: class CPosLmTextCriteria : public CPosLmSearchCriteria williamr@2: { williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * @returns A new instance of this class. williamr@2: */ williamr@2: IMPORT_C static CPosLmTextCriteria* NewLC(); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: virtual ~CPosLmTextCriteria(); williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Retrieves the text to search for. williamr@2: * williamr@2: * @return The text to search for. williamr@2: */ williamr@2: IMPORT_C TPtrC Text() const; williamr@2: williamr@2: /** williamr@2: * Sets the search string. williamr@2: * williamr@2: * A non-empty text string must be set, otherwise williamr@2: * @ref CPosLandmarkSearch::StartLandmarkSearchL will leave with error williamr@2: * code @p KErrArgument. williamr@2: * williamr@2: * The search is case insensitive. williamr@2: * williamr@2: * Wild-card characters "?" and "*" are supported in the search string. williamr@2: * "?" matches a single occurrence of any character and "*" matches williamr@2: * zero or more consecutive occurrences of any characters. williamr@2: * williamr@2: * A landmark matches the criterion if specified text is found anywhere williamr@2: * in selected attributes or position fields. williamr@2: * williamr@2: * @param aText The text to search for. williamr@2: * williamr@2: * @leave KErrArgument The search string is longer than @p KPosLmMaxSearchStringLength. williamr@2: */ williamr@2: IMPORT_C void SetTextL( const TDesC& aText ); williamr@2: williamr@2: /** williamr@2: * Retrieves the landmark attributes which should be searched. williamr@2: * williamr@2: * This function returns a bitmap of landmark attributes. The landmark williamr@2: * attributes are defined by @p CPosLandmark::_TAttributes. It is only williamr@2: * possible to search the @p ELandmarkName and @p EDescription williamr@2: * attributes. williamr@2: * williamr@2: * @return A bitmap indicating which landmark attributes should be williamr@2: * searched. williamr@2: */ williamr@2: IMPORT_C CPosLandmark::TAttributes AttributesToSearch() const; williamr@2: williamr@2: /** williamr@2: * Sets which landmark attributes to search. williamr@2: * williamr@2: * The client passes a bitmap of the landmark attributes to search. It williamr@2: * is only possible to search the @p ELandmarkName and @p EDescription williamr@2: * attributes. williamr@2: * williamr@2: * @param aAttributes A bitmap indicating which landmark attributes williamr@2: * should be searched. williamr@2: * williamr@2: * @panic "Landmarks Client"-EPosInvalidLandmarkAttribute williamr@2: * Unsupported attribute is passed. williamr@2: */ williamr@2: IMPORT_C void SetAttributesToSearch( williamr@2: CPosLandmark::TAttributes aAttributes williamr@2: ); williamr@2: williamr@2: /** williamr@2: * Retrieves a list of the position fields to search. williamr@2: * williamr@2: * @param[out] aFieldArray On return, contains a list of the position fields williamr@2: * which are used in a search. If no position fields have been set, williamr@2: * the array is empty. Position fields are identified by values defined williamr@2: * in @p TPositionFieldId. williamr@2: */ williamr@2: IMPORT_C void GetPositionFieldsToSearchL( williamr@2: RArray& aFieldArray williamr@2: ) const; williamr@2: williamr@2: /** williamr@2: * Sets the position fields to search. williamr@2: * williamr@2: * Any previously set position fields are cleared by this call. williamr@2: * williamr@2: * @param[in] aFieldArray A list of the position fields to search. williamr@2: * Position fields are identified by values defined in williamr@2: * @p TPositionFieldId. williamr@2: */ williamr@2: IMPORT_C void SetPositionFieldsToSearchL( williamr@2: const RArray& aFieldArray williamr@2: ); williamr@2: williamr@2: /** williamr@2: * Clears the position fields list used in a search. williamr@2: */ williamr@2: IMPORT_C void ClearPositionFieldsToSearch(); williamr@2: williamr@2: private: williamr@2: williamr@2: CPosLmTextCriteria(); williamr@2: williamr@2: void ConstructL(); williamr@2: williamr@2: // Prohibit copy constructor williamr@2: CPosLmTextCriteria( const CPosLmTextCriteria& ); williamr@2: // Prohibit assigment operator williamr@2: CPosLmTextCriteria& operator= ( const CPosLmTextCriteria& ); williamr@2: williamr@2: private: williamr@2: williamr@2: HBufC* iText; williamr@2: RArray iPositionFieldArray; williamr@2: CPosLandmark::TAttributes iAttributes; williamr@2: williamr@2: }; williamr@2: williamr@2: #endif // CPOSLMTEXTCRITERIA_H williamr@2: williamr@2: