18 #ifndef C_PCS_ALGORITHM_2_UTILS |
18 #ifndef C_PCS_ALGORITHM_2_UTILS |
19 #define C_PCS_ALGORITHM_2_UTILS |
19 #define C_PCS_ALGORITHM_2_UTILS |
20 |
20 |
21 // INCLUDE FILES |
21 // INCLUDE FILES |
22 |
22 |
23 #include <e32base.h> |
23 #include <e32hashtab.h> |
|
24 |
|
25 #include "CPsData.h" |
24 |
26 |
25 // FORWARD DECLARATION |
27 // FORWARD DECLARATION |
26 class CPsData; |
|
27 class CPsQuery; |
|
28 struct TPsMatchLocation; |
|
29 |
28 |
30 typedef RPointerArray<CPsData> CPSDATA_R_PTR_ARRAY; |
29 typedef RPointerArray<CPsData> CPSDATA_R_PTR_ARRAY; |
31 |
30 |
32 // CLASS DECLARATION |
31 // CLASS DECLARATION |
33 class CPcsAlgorithm2Utils : public CBase |
32 class CPcsAlgorithm2Utils : public CBase |
40 * It merges all the result sets that are there in iSearchResultsArr |
39 * It merges all the result sets that are there in iSearchResultsArr |
41 * into single result set. This is a wrapper funciton implemented that |
40 * into single result set. This is a wrapper funciton implemented that |
42 * works for all type of key board modes |
41 * works for all type of key board modes |
43 */ |
42 */ |
44 static void FormCompleteSearchResultsL(RPointerArray<CPSDATA_R_PTR_ARRAY>& aSearchResultsArr, |
43 static void FormCompleteSearchResultsL(RPointerArray<CPSDATA_R_PTR_ARRAY>& aSearchResultsArr, |
45 RPointerArray<CPsData>& aSearchResults); |
44 RPointerArray<CPsData>& SearchResults); |
46 |
45 |
47 /** |
46 /** |
48 * Customized CompareC |
47 * Customized CompareC |
49 */ |
48 */ |
50 static TInt MyCompareC(const TDesC& aLeft, const TDesC& aRight); |
49 static TInt MyCompareC(const TDesC& aLeft, const TDesC& aRight); |
51 |
50 |
52 /** |
51 /** |
53 * TLinearOrder rule for comparison of data objects |
52 * TLinearOrder rule for comparison of data objects |
54 */ |
53 */ |
55 static TInt CompareDataBySortOrderL(const CPsData& aObject1, const CPsData& aObject2); |
54 static TInt CompareDataBySortOrder(const CPsData& aObject1, const CPsData& aObject2); |
56 |
|
57 /** |
|
58 * TIdentityRelation rule for comparing descriptors case-sensitively. |
|
59 */ |
|
60 static TBool CompareExact(const TDesC& aFirst, const TDesC& aSecond); |
|
61 |
|
62 /** |
|
63 * TLinearOrder rule for comparing queries by length |
|
64 */ |
|
65 static TInt CompareLength(const CPsQuery& aFirst, const CPsQuery& aSecond); |
|
66 |
55 |
67 /** |
56 /** |
68 * Trim off all white spaces and special chars |
57 * Trim off all white spaces and special chars |
69 */ |
58 */ |
70 static void MyTrim(TDes& aString); |
59 static void MyTrim(TDes& aString); |
71 |
60 |
72 /** |
61 /** |
73 * Check if the input URI is of contact search in a group template form |
62 * Check if the input URI is of contact search in a group template form |
74 */ |
63 */ |
75 static TBool IsGroupUri(TDesC& aURI); |
64 static TBool IsGroupUri(TDesC& aURI); |
76 |
65 |
77 /** |
|
78 * Constructs a bit pattern using the required/supported data fields |
|
79 * For example, 6, 4 and 27 are supported fields <-- 00000111 |
|
80 * 6 and 4 are required fields <-- 00000011 |
|
81 * Bit pattern returned is 00000011. |
|
82 */ |
|
83 static TUint8 FilterDataFieldsL(const RArray<TInt>& aRequiredDataFields, |
|
84 const RArray<TInt>& aSupportedDataFields); |
|
85 |
|
86 /** |
|
87 * Create upper-case match sequence buffer from matching part and append it to |
|
88 * array unless there's equal sequence already present. |
|
89 */ |
|
90 static void AppendMatchToSeqL( RPointerArray<TDesC>& aMatchSeq, const TDesC& aMatch ); |
|
91 |
|
92 /** |
|
93 * Check if two match location items have overlapping indices. |
|
94 */ |
|
95 static TBool MatchesOverlap( const TPsMatchLocation& aFirst, const TPsMatchLocation& aSecond ); |
|
96 }; |
66 }; |
97 |
|
98 |
67 |
99 // CleanupStack helpers for item owning RPointerArrays |
68 // CleanupStack helpers for item owning RPointerArrays |
100 template <class T> |
69 template <class T> |
101 class CleanupResetAndDestroy |
70 class CleanupResetAndDestroy |
102 { |
71 { |