predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2Utils.h
branchRCL_3
changeset 58 d4f567ce2e7c
parent 21 b3431bff8c19
child 64 c1e8ba0c2b16
--- a/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2Utils.h	Thu Jul 15 18:22:55 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2Utils.h	Thu Aug 19 09:41:07 2010 +0300
@@ -20,11 +20,12 @@
 
 // INCLUDE FILES
 
-#include <e32hashtab.h>
-
-#include "CPsData.h"
+#include <e32base.h>
 
 // FORWARD DECLARATION
+class CPsData;
+class CPsQuery;
+struct TPsMatchLocation;
 
 typedef RPointerArray<CPsData> CPSDATA_R_PTR_ARRAY;
 
@@ -41,10 +42,10 @@
      * works for all type of key board modes
      */
     static void FormCompleteSearchResultsL(RPointerArray<CPSDATA_R_PTR_ARRAY>& aSearchResultsArr,
-                                           RPointerArray<CPsData>& SearchResults);
+                                           RPointerArray<CPsData>& aSearchResults);
 
     /**
-     * Customized CompareC         
+     * Customized CompareC
      */
     static TInt MyCompareC(const TDesC& aLeft, const TDesC& aRight);
 
@@ -54,6 +55,16 @@
     static TInt CompareDataBySortOrder(const CPsData& aObject1, const CPsData& aObject2);
 
     /**
+     * TIdentityRelation rule for comparing descriptors case-sensitively.
+     */
+    static TBool CompareExact(const TDesC& aFirst, const TDesC& aSecond);
+
+    /**
+     * TLinearOrder rule for comparing queries by length
+     */
+    static TInt CompareLength(const CPsQuery& aFirst, const CPsQuery& aSecond);
+
+    /**
      * Trim off all white spaces and special chars
      */
     static void MyTrim(TDes& aString);
@@ -62,8 +73,28 @@
      * Check if the input URI is of contact search in a group template form
      */
     static TBool IsGroupUri(TDesC& aURI);
+    
+    /**
+     * Constructs a bit pattern using the required/supported data fields
+     * For example, 6, 4 and 27 are supported fields <-- 00000111
+     *              6 and 4 are required fields      <-- 00000011
+     * Bit pattern returned is 00000011.
+     */
+    static TUint8 FilterDataFieldsL(const RArray<TInt>& aRequiredDataFields,
+                                    const RArray<TInt>& aSupportedDataFields);
+    
+    /**
+     * Create upper-case match sequence buffer from matching part and append it to
+     * array unless there's equal sequence already present.
+     */
+    static void AppendMatchToSeqL( RPointerArray<TDesC>& aMatchSeq, const TDesC& aMatch );
+    
+    /**
+     * Check if two match location items have overlapping indices.
+     */
+    static TBool MatchesOverlap( const TPsMatchLocation& aFirst, const TPsMatchLocation& aSecond );
+    };
 
-    };
 
 // CleanupStack helpers for item owning RPointerArrays
 template <class T>