classicui_plat/findutil_api/inc/FindUtil.h
changeset 33 b3425bf29f82
equal deleted inserted replaced
21:558113899881 33:b3425bf29f82
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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 the License "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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __FINDUTIL_H__
       
    21 #define __FINDUTIL_H__
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 /**
       
    26 * Identify the match policy for FindUtil API
       
    27 */
       
    28 enum TMatchPolicy
       
    29 {
       
    30     EDefault,
       
    31     ECustomConverter
       
    32 };
       
    33 
       
    34 /**
       
    35 * Interface for the conversion of find string
       
    36 */
       
    37 class MFindStringConverter
       
    38     {
       
    39 public:
       
    40     virtual void Converter(const TDesC& aSourStr, TDes& aDestStr) = 0;
       
    41     };
       
    42     
       
    43 /**
       
    44 * FindUtil API
       
    45 */
       
    46 class MFindUtil
       
    47 	{
       
    48 public:
       
    49 	virtual TBool Match(const TDesC& aContactsField, const TDesC& aWord) = 0;
       
    50 	virtual TBool MatchRefineL( const TDesC& aItemString, const TDesC &aSearchText) = 0;
       
    51 	virtual TBool IsWordValidForMatching(const TDesC& aWord) = 0;
       
    52 	virtual TBool MatchAdaptiveRefineL( const TDesC& aItemString, const TDesC &aSearchText, HBufC*& aNextChars ) = 0;	
       
    53 	virtual TBool MatchRefineL( const TDesC& aItemString, const TDesC& aSearchText, 
       
    54                                 TMatchPolicy aPolicy, MFindStringConverter* aConverter) = 0;
       
    55 	};
       
    56 
       
    57 /**
       
    58 * CFindUtil instance gives access to MFindUtil interface.
       
    59 */
       
    60 NONSHARABLE_CLASS(CFindUtil) : public CBase
       
    61     {
       
    62     public: // Constructors and destructor
       
    63 
       
    64         /**
       
    65         * Creates a new CFindUtil instance.
       
    66         * In those language variants, where FindUtil is not used,
       
    67         * this method returns NULL.
       
    68         */
       
    69         IMPORT_C static CFindUtil* NewL();
       
    70         IMPORT_C ~CFindUtil();
       
    71 
       
    72     public: // New functions
       
    73         MFindUtil* Interface() {return iInterface;}
       
    74 
       
    75     private: // Private constructors
       
    76         CFindUtil();
       
    77         void ConstructL();
       
    78 
       
    79     private: // Data
       
    80         MFindUtil* iInterface;
       
    81         RLibrary iLib;
       
    82     };
       
    83 
       
    84 #endif