S60 3rd Edition API Reference: finditemengine.h Source File

finditemengine.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name        : FindItemEngine.h
00004 *  Part of     : Common Services / Common Engine
00005 *  Interface   : SDK, Find Item API
00006 *  Description : Find Item API offers methods for parsing phone numbers, email 
00007 *                addresses, URL addresses and URI addresses from given text.
00008 *  Version     : %version: ou1cfspd#14 %
00009 *
00010 *  Copyright © 2002-2006 Nokia.  All rights reserved.
00011 *  This material, including documentation and any related computer
00012 *  programs, is protected by copyright controlled by Nokia.  All
00013 *  rights are reserved.  Copying, including reproducing, storing,
00014 *  adapting or translating, any or all of this material requires the
00015 *  prior written consent of Nokia.  This material also contains
00016 *  confidential information which may not be disclosed to others
00017 *  without the prior written consent of Nokia.
00018 * ============================================================================
00019 */
00020 
00021 #ifndef FINDITEMENGINE_H
00022 #define FINDITEMENGINE_H
00023 
00024 //  INCLUDES
00025 #include <e32base.h>
00026 
00027 // CLASS DECLARATION
00028 
00101 class CFindItemEngine :public CBase
00102     {
00103     public:
00104 
00109         enum TFindItemSearchCase
00110             {
00113                         EFindItemSearchPhoneNumberBin = 4, 
00116             EFindItemSearchMailAddressBin = 8,
00119             EFindItemSearchURLBin  = 16,
00122             EFindItemSearchScheme  = 32
00123             };
00124 
00128         struct SFoundItem
00129             {
00132             TInt iStartPos;
00135             TInt iLength;
00138             TFindItemSearchCase iItemType;
00139                         };
00140 
00141     public:  // Constructors and destructor
00142         
00163         IMPORT_C static CFindItemEngine* NewL( const TDesC& aText, 
00164                                                const TFindItemSearchCase aSearchCase );
00165 
00166 #start_since SINCE_3_1_SDK
00167 
00191         IMPORT_C static CFindItemEngine* NewL( const TDesC& aText, 
00192                                                const TFindItemSearchCase aSearchCase,
00193                                                const TInt aMinNumbers );
00194 #end_since SINCE_3_1_SDK
00195 
00199         IMPORT_C virtual ~CFindItemEngine();
00200 
00201     public:
00208         IMPORT_C TBool Item( SFoundItem& aItem );
00209 
00218         IMPORT_C TBool NextItem( SFoundItem& aItem );
00219 
00228         IMPORT_C TBool PrevItem( SFoundItem& aItem );
00229                 
00239         IMPORT_C const CArrayFixFlat<SFoundItem>* ItemArray() const;
00240 
00249                 IMPORT_C TInt Position() const; 
00250         
00254         IMPORT_C void ResetPosition();
00255 
00261                 IMPORT_C TInt ItemCount() const;
00262                 
00282         IMPORT_C TInt DoNewSearchL( const TDesC& aText, const TFindItemSearchCase aSearchCase);
00283 
00284 #start_since SINCE_3_1_SDK
00285 
00308         IMPORT_C TInt DoNewSearchL( const TDesC& aText, const TFindItemSearchCase aSearchCase, 
00309                                     const TInt aMinNumbers );
00310 #end_since SINCE_3_1_SDK
00311 
00312     private:
00313         
00322         void AddItemL( const TInt& aStartPos, const TInt& aLength, 
00323                        const TFindItemSearchCase& aType );
00324 
00331         TBool SearchPhoneNumberL( const TDesC& aText);  
00332 
00339         TBool SearchMailAddressL( const TDesC& aText);  
00340 
00347         TBool SearchGenericUriL( const TDesC& aText);
00348 
00360         TBool SearchUrlL( const TDesC& aText, const TBool aFindFixedSchemas);
00361 
00375         TBool ParseUrlL( const TDesC& aType, const TPtrC& aTokenPtr, const TInt aTextOffset );
00376 
00383         TBool IsValidEmailChar( const TChar& charac ) const; // Login part of the e-mail address
00384         TBool IsValidEmailHostChar( const TChar& charac ) const; // Host part of the e-mail address
00385         TBool IsValidPhoneNumberChar( const TChar& charac ) const; // Phone number
00386         TBool IsValidUrlChar( const TChar& charac ) const; // URL
00387 
00391         CFindItemEngine();
00392 
00407         void ConstructL( const TDesC& aText, const TFindItemSearchCase aSearchCase, 
00408                          const TInt aMinNumbers );
00417                 void PerformSearchL( const TDesC& aText , const TFindItemSearchCase aSearchCase );
00418 
00419 
00426                 void ConvertArabicNumbersToWesternNumbers( HBufC* aBuf );
00427 
00431         CFindItemEngine( const CFindItemEngine& );
00435         CFindItemEngine& operator= ( const CFindItemEngine& );
00436 
00437     private:    // Data
00438         // Array of all found items.
00439         CArrayFixFlat<SFoundItem>* iItemArray;
00440                 // Engine's position in the iItemArray and iItemTypeArray.
00441         TInt iPosition;
00442         // Minimum count of numbers in a phone number
00443         TInt iMinNumbers;
00444     };
00445 
00446 // FINDITEMENGINE_H   
00447 #endif
00448             
00449 // End of File

Copyright © Nokia Corporation 2001-2007
Back to top