diff -r 6b5524b4f673 -r 38bb213f60ba predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2.h --- a/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2.h Wed Sep 15 11:56:55 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2.h Wed Oct 13 14:15:33 2010 +0300 @@ -54,7 +54,8 @@ // CLASS DECLARATION class CPcsAlgorithm2 : public CPcsPlugin, public MDataStoreObserver, -public MStoreListObserver +public MStoreListObserver, +public MFindStringConverter { public: @@ -79,7 +80,7 @@ void PerformSearchL(const CPsSettings& aPcsSettings, CPsQuery& aCondition, RPointerArray& aData, - RPointerArray& aPattern); + RPointerArray& aPattern); /** * Search Function for input string @@ -87,15 +88,15 @@ void SearchInputL(CPsQuery& aSearchQuery, TDesC& aSearchData, RPointerArray& aMatchSet, - RArray& aMatchLocation ); + RArray& aMatchLocation ); /** * Performs search on a input string, and return result also as a string */ void SearchMatchStringL( CPsQuery& aSearchQuery, - TDesC& aSearchData, - TDes& aMatch ); + TDesC& aSearchData, + TDes& aMatch ); /** * Returns ETrue if this language is supported @@ -117,6 +118,12 @@ */ void ChangeSortOrderL(TDesC& aURI, RArray& aSortOrder); + /** + * Get the Adaptive Grid for one or more URIs + */ + void GetAdaptiveGridL( const MDesCArray& aURIs, + const TBool aCompanyName, + TDes& aAdaptiveGrid ); // -------------------------------------------------------------------- @@ -127,29 +134,22 @@ /** * Add a contact to the cache */ - void AddData( TDesC& aDataStore, CPsData* aData ); + void AddData ( TDesC& aDataStore, CPsData* aData); /** - * Remove a contact from the cache based on contact id + * Remove a contact from the cache based on contact id */ - void RemoveData( TDesC& aDataStore, TInt aItemId ); + void RemoveData ( TDesC& aDataStore, TInt aItemId ); /** * Removes all the contacts from a particular datastore */ - void RemoveAll( TDesC& aDataStore ); + void RemoveAll ( TDesC& aDataStore); /** * Updates the caching status for a particular datastore */ void UpdateCachingStatus(TDesC& aDataStore, TInt aStatus); - - /** - * Get the Adaptive Grid for one or more URIs - */ - void GetAdaptiveGridL( const MDesCArray& aURIs, - const TBool aCompanyName, - TDes& aAdaptiveGrid ); // -------------------------------------------------------------------- @@ -160,12 +160,12 @@ /** * This method is called whenever any new store has been added */ - void AddDataStore( TDesC& aDataStore ); + void AddDataStore ( TDesC& aDataStore); /** * This method is called whenever a data store is removed */ - void RemoveDataStore( TDesC& aDataStore ); + void RemoveDataStore ( TDesC& aDataStore); // -------------------------------------------------------------------- @@ -174,7 +174,7 @@ /** * Returns the array index of cache (in iPcsCache) for a datastore */ - TInt GetCacheIndex(const TDesC& aDataStore); + TInt GetCacheIndex(TDesC& aDataStore); /** * Return the cache instance at a specific array index @@ -190,14 +190,8 @@ inline CPcsKeyMap* GetKeyMap() { return iKeyMap; - } + }; - inline CFindUtilChineseECE* FindUtilECE() - { - return iFindUtilECE; - } - - void ReconstructCacheDataL(); private: @@ -221,54 +215,48 @@ void DefinePropertyL( TPcsInternalKeyCacheStatus aPsKey ); /** - * Remove leading and trailing spaces of search query + * Replace occurance of "0" in ITU-T mode with space */ - void RemoveSpacesL( CPsQuery& aQuery ); - - /** - * Replace occurances of "0" in predictive mode with space - * if those are on the same button - */ - TBool ReplaceZeroWithSpaceL( CPsQuery& aQuery ); + TBool ReplaceZeroWithSpaceL(CPsQuery& aQuery); /** * Search function helper */ - void DoSearchL( const CPsSettings& aPcsSettings, - CPsQuery& aCondition, - RPointerArray& aSearchResults, - RPointerArray& aSearchSeqs ); + void DoSearchL(const CPsSettings& aPcsSettings, + CPsQuery& aCondition, + RPointerArray& searchResults, + RPointerArray& searchSeqs ); /** * Search function helper */ - void DoSearchInputL( CPsQuery& aQuery, - const TDesC& aData, - RPointerArray& aSearchSeqs, - RArray& aMatchLocation ); + void DoSearchInputL(CPsQuery& aQuery, + TDesC& aData, + RPointerArray& searchSeqs, + RArray& aMatchLocation ); /** * Returns the index corresponding a URI in iDataStoreUri */ - TInt FindStoreUri( const TDesC& aDataStoreUri ); + TInt FindStoreUri ( TDesC& aDataStoreUri ); /** * Function to return all cached content */ - void GetAllContentsL( const CPsSettings& aPcsSettings, - RPointerArray& aSearchResults ); + void GetAllContentsL(const CPsSettings& aPcsSettings, + RPointerArray& searchResults ); /** * Checks if search is on groups - * Return ETrue if there is a valid group URI + * Return ETrue if there is a valid group URI */ - TBool IsGroupSearchL( CPsSettings& aSettings, - RArray& aGroupIdArray ); + TBool IsGroupSearchL ( CPsSettings& aSettings, + RArray& aGroupIdArray ); /** * Utility function to replace groups uri with that of contacts uri */ - void ReplaceGroupsUriL( CPsSettings& aSettings ); + void ReplaceGroupsUriL ( CPsSettings& aSettings ); /** * Filters the search results array for groups @@ -278,8 +266,8 @@ /** * Get the list of contact ids that belong to a group. - */ - void GetContactsInGroupL( TInt aGroupId, + */ + void GetContactsInGroupL ( TInt aGroupId, RArray& aGroupContactIds ); /** @@ -287,30 +275,31 @@ * @param aURI - The data store URI for which sort order is required * @param aSortOrder - The persisted sort order from the cenrep */ - void ReadSortOrderFromCenRepL( const TDesC& aURI, + void ReadSortOrderFromCenRepL ( TDesC& aURI, RArray& aSortOrder ); /** Write sort order for a data store to the central repository * @param aURI - The data store URI for which sort order is to be persisted * @param aSortOrder - The sort order to be persisted */ - void WriteSortOrderToCenRepL( const TDesC& aURI, - RArray& aSortOrder ); + void WriteSortOrderToCenRepL ( TDesC& aURI, + RArray& aSortOrder ); /** * Utility function that sets the caching error value - */ - void SetCachingError( const TDesC& aDataStore, TInt aError ); + */ + void SetCachingError ( TDesC& aDataStore, + TInt aError ); /** - * Write the content required by client + * Write the content required by client */ - CPsClientData* WriteClientDataL( CPsData& aPsData ); + CPsClientData* WriteClientDataL ( CPsData& aPsData ); /** * Function to return data base URI for an internal identifier - */ - const TDesC& GetUriForIdL( TUint8 aUriId ); + */ + TDesC& GetUriForIdL( TUint8 aUriId ); /** * Inform clients about update happened on the cache @@ -327,18 +316,45 @@ */ static TInt DoLaunchPluginsL(TAny* aPtr); +public: + + inline TInt GetFirstNameIndex() + { + return iFirstNameIndex; + } + + inline TInt GetLastNameIndex() + { + return iLastNameIndex; + } + + inline CFindUtilChineseECE* FindUtilECE() + { + return iFindUtilECE; + } + + inline CFindUtil* FindUtil() + { + return iFindUtil; + } + + void ReconstructCacheDataL(); + +public: // From MFindStringConverter + void Converter(const TDesC& aSourStr, TDes& aDestStr); + private: /** * Instance of contacts cache * Own */ - RPointerArray iPcsCache; + RPointerArray iPcsCache; /** * Keeps the count of caches */ - TUint8 iCacheCount; + TUint8 iCacheCount; /** * Instance of key map @@ -371,6 +387,13 @@ // Own: Find util used to match contacts and construct character grid CFindUtilChineseECE* iFindUtilECE; + // Own: Find util used to match contacts and construct character grid + CFindUtil* iFindUtil; + + // keep the index for Firstname and Lastname + TInt iFirstNameIndex; + TInt iLastNameIndex; + /** * plugin laucher, make the plugin instantiation async */