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 <e32hashtab.h> |
23 #include <e32base.h> |
24 |
|
25 #include "CPsData.h" |
|
26 |
24 |
27 // FORWARD DECLARATION |
25 // FORWARD DECLARATION |
|
26 class CPsData; |
|
27 class CPsQuery; |
|
28 struct TPsMatchLocation; |
28 |
29 |
29 typedef RPointerArray<CPsData> CPSDATA_R_PTR_ARRAY; |
30 typedef RPointerArray<CPsData> CPSDATA_R_PTR_ARRAY; |
30 |
31 |
31 // CLASS DECLARATION |
32 // CLASS DECLARATION |
32 class CPcsAlgorithm2Utils : public CBase |
33 class CPcsAlgorithm2Utils : public CBase |
39 * It merges all the result sets that are there in iSearchResultsArr |
40 * It merges all the result sets that are there in iSearchResultsArr |
40 * into single result set. This is a wrapper funciton implemented that |
41 * into single result set. This is a wrapper funciton implemented that |
41 * works for all type of key board modes |
42 * works for all type of key board modes |
42 */ |
43 */ |
43 static void FormCompleteSearchResultsL(RPointerArray<CPSDATA_R_PTR_ARRAY>& aSearchResultsArr, |
44 static void FormCompleteSearchResultsL(RPointerArray<CPSDATA_R_PTR_ARRAY>& aSearchResultsArr, |
44 RPointerArray<CPsData>& SearchResults); |
45 RPointerArray<CPsData>& aSearchResults); |
45 |
46 |
46 /** |
47 /** |
47 * Customized CompareC |
48 * Customized CompareC |
48 */ |
49 */ |
49 static TInt MyCompareC(const TDesC& aLeft, const TDesC& aRight); |
50 static TInt MyCompareC(const TDesC& aLeft, const TDesC& aRight); |
50 |
51 |
51 /** |
52 /** |
52 * TLinearOrder rule for comparison of data objects |
53 * TLinearOrder rule for comparison of data objects |
53 */ |
54 */ |
54 static TInt CompareDataBySortOrder(const CPsData& aObject1, const CPsData& aObject2); |
55 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); |
55 |
66 |
56 /** |
67 /** |
57 * Trim off all white spaces and special chars |
68 * Trim off all white spaces and special chars |
58 */ |
69 */ |
59 static void MyTrim(TDes& aString); |
70 static void MyTrim(TDes& aString); |
60 |
71 |
61 /** |
72 /** |
62 * Check if the input URI is of contact search in a group template form |
73 * Check if the input URI is of contact search in a group template form |
63 */ |
74 */ |
64 static TBool IsGroupUri(TDesC& aURI); |
75 static TBool IsGroupUri(TDesC& aURI); |
|
76 |
|
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 }; |
65 |
97 |
66 }; |
|
67 |
98 |
68 // CleanupStack helpers for item owning RPointerArrays |
99 // CleanupStack helpers for item owning RPointerArrays |
69 template <class T> |
100 template <class T> |
70 class CleanupResetAndDestroy |
101 class CleanupResetAndDestroy |
71 { |
102 { |