diff -r e30d4a1b8bad -r c26cc2a7c548 phoneengine/PhoneCntFinder/ContactService/inc/cphcntcontactmatchstrategy.h --- a/phoneengine/PhoneCntFinder/ContactService/inc/cphcntcontactmatchstrategy.h Wed Sep 15 12:12:21 2010 +0300 +++ b/phoneengine/PhoneCntFinder/ContactService/inc/cphcntcontactmatchstrategy.h Wed Oct 13 14:31:22 2010 +0300 @@ -20,18 +20,28 @@ #define CPHCNTCONTACTMATCHSTRATEGY_H #include +#include #include +#include // KBestMatchingPhoneNumbers #include "mphcntcontactmatchstrategy.h" #include "mphcntcontactstoreeventobserver.h" +#include "MPhCntContactManager.h" + class CVPbkContactManager; class MVPbkContactFindObserver; class CVPbkPhoneNumberMatchStrategy; +class CRepository; class CVPbkContactStoreUriArray; class CPhCntContactStoreUris; class CCntRawPhoneNumberExtractor; +// Digit count used to match CS number. +const TInt KPhCntMatchMin = 7; +const TInt KPhCntMatchMax = 11; +const TInt KPhCntMatchDefault = KBestMatchingPhoneNumbers; + /** * Strategy for matcing CS contacts. * @@ -40,7 +50,7 @@ */ NONSHARABLE_CLASS( CPhCntContactMatchStrategy ) : public CBase, - public MPhCntContactMatchStrategy, + public MPhCntContactMatchStrategy, private MPhCntContactStoreEventObserver { public: @@ -52,14 +62,13 @@ * @param aContactManager Contact manager. * @param aUriArray Array of contact store URI's used. * @param aObserver Observer for finding contacts. - * @param aMatchFlags A bitset of flags for matching strategy. Has zero or - * more CVPbkPhoneNumberMatchStrategy::TVPbkPhoneNumberMatchFlags flags set. + * @param aRemoveDuplicatesStrategy Contact dupe removal strategy */ static CPhCntContactMatchStrategy* NewL( CVPbkContactManager& aContactManager, CPhCntContactStoreUris& aContactStoreUris, MVPbkContactFindObserver& aObserver, - TUint32 aMatchFlags ); + MPhCntContactManager::TDuplicateRemovalStrategy aRemoveDuplicatesStrategy ); /** * Destructor. @@ -78,8 +87,8 @@ */ void FindMatchesL( const TDesC& aPhoneNumber ); -private: - +private: + /** * Creates contact match strategy with given numbers * of digits. @@ -89,19 +98,6 @@ */ TInt CreateContactMatchStrategy(); -// From base class MCenRepNotifyHandlerCallback - - /** - * From base class MCenRepNotifyHandlerCallback - * This callback method is used to notify the client about - * changes for string value keys, i.e. key type is EStringKey. - * - * @param aId Id of the key that has changed. - * @param aNewValue The new value of the key. - */ - void HandleNotifyString( TUint32 aId, const TDesC16& aNewValue ); - - // From base class MPhCntContactStoreEventObserver /** @@ -116,12 +112,11 @@ * Method to ease unit testing. Creates the actual instance of iMatchStrategy. */ virtual TInt DoCreateMatchStrategy(); - + /** - * Makes the actual matching request using number - * Declared virtual to ease unit testing. + * Removes postfix from aNumber */ - virtual void DoMatchL( const TDesC& aNumber ); + TDesC* RemoveExtraCharactersLC( const TDesC& aNumber ); protected: @@ -129,10 +124,26 @@ CVPbkContactManager& aContactManager, CPhCntContactStoreUris& aContactStoreUris, MVPbkContactFindObserver& aObserver, - TUint32 aMatchFlags ); + MPhCntContactManager::TDuplicateRemovalStrategy aRemoveDuplicatesStrategy ); void ConstructL(); + TUint32 FillMatchFlags() const; + + virtual TInt ReadMatchDigitsValueL(); + + /** + * Makes the actual matching request using number + * Declared virtual to ease unit testing. + */ + virtual void DoMatchL( const TDesC& aNumber ); + + /** + * Enables to inject match strategy to ease unit testing + */ + void SetVPbkPhoneNumberMatchStrategy( + CVPbkPhoneNumberMatchStrategy* aMatchStrategy ); + private: // data /** @@ -140,7 +151,7 @@ * Own. */ CVPbkPhoneNumberMatchStrategy* iMatchStrategy; - + /** * Contact manager is needed with match strategy. * Not own. @@ -167,24 +178,19 @@ CVPbkContactStoreUriArray* iUriArray; /** + * Number of digits used with matching. + */ + TInt iNumberOfDigits; + + /** * Number extractor. * Own. */ CCntRawPhoneNumberExtractor* iNumberExtractor; - -protected: // data - - /** - * A bitset of matching strategy flags. Changed from - * CVPbkPhoneNumberMatchStrategy::TVPbkPhoneNumberMatchFlags enum to TUint32 - * in order to support multiple flags, as in - * CVPbkPhoneNumberMatchStrategy::TConfig. - * - * Protected because a unit test class derives from this class. - */ - TUint32 iMatchFlags; - + + MPhCntContactManager::TDuplicateRemovalStrategy iRemoveDuplicatesStrategy; + }; +#endif // CPHCNTCONTACTMATCHSTRATEGY_H -#endif // CPHCNTCONTACTMATCHSTRATEGY_H