author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:15:33 +0300 | |
branch | RCL_3 |
changeset 85 | 38bb213f60ba |
parent 74 | 6b5524b4f673 |
permissions | -rw-r--r-- |
63 | 1 |
/* |
2 |
* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Identifies a contact in cache pools |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#ifndef C_PCS_ALGORITHM_2_MULTI_SEARCH_HELPER |
|
19 |
#define C_PCS_ALGORITHM_2_MULTI_SEARCH_HELPER |
|
20 |
||
21 |
// SYSTEM INCLUDES |
|
22 |
#include <e32cmn.h> |
|
23 |
#include <e32math.h> |
|
24 |
||
25 |
// USER INCLUDES |
|
26 |
#include "CPsData.h" |
|
27 |
#include "CPcsCache.h" |
|
28 |
#include "CPcsKeyMap.h" |
|
29 |
#include "CPsQuery.h" |
|
30 |
#include "CPcsAlgorithm2.h" |
|
31 |
#include "CPcsDebug.h" |
|
32 |
#include "CPcsKeyMap.h" |
|
33 |
#include "CPsQueryItem.h" |
|
34 |
#include "CPcsPoolElement.h" |
|
35 |
#include "CWords.h" |
|
36 |
#include "CPcsAlgorithm2FilterHelper.h" |
|
37 |
||
38 |
// FORWARD DECLARATION |
|
39 |
class CPcsAlgorithm2; |
|
40 |
class CPsData; |
|
41 |
class CPsQuery; |
|
42 |
class TMultiSearchMap; |
|
43 |
||
44 |
#define MAX_DATA_FIELDS 8 |
|
45 |
||
46 |
// CLASS DECLARATION |
|
47 |
class CPcsAlgorithm2MultiSearchHelper : public CBase |
|
48 |
{ |
|
49 |
public: |
|
50 |
||
51 |
/** |
|
52 |
* Two phase construction |
|
53 |
*/ |
|
54 |
static CPcsAlgorithm2MultiSearchHelper* NewL(CPcsAlgorithm2* aAlgorithm); |
|
55 |
||
56 |
/** |
|
57 |
* Destructor |
|
58 |
*/ |
|
59 |
virtual ~CPcsAlgorithm2MultiSearchHelper(); |
|
60 |
||
61 |
private: |
|
62 |
||
63 |
/** |
|
64 |
* Filter subset results for multi query mode. |
|
65 |
*/ |
|
66 |
void FilterResultsMultiL(CPcsAlgorithm2FilterHelper* aAlgorithmFilterHelper, |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
67 |
RPointerArray<CPcsPoolElement>& searchSet, |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
68 |
RPointerArray<CPsQuery>& searchQuery, TUint8 aFilteredDataMatch, |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
69 |
TBool isGroupSearch, RArray<TInt>& aContactsInGroup, |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
70 |
TInt keyboardMode); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
71 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
72 |
/** |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
73 |
* Convert the search query to a string. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
74 |
* If the mode is ITU-T, character is converted to numeric. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
75 |
* If the mode is Qwerty, character is retained as is. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
76 |
*/ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
77 |
void ExtractQueryL(CPsQuery& aPsQuery, TDes& aOutput); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
78 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
79 |
/** |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
80 |
* Convert the input search query to a string. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
81 |
* Mode is referred in the CPsQuery. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
82 |
* If the mode is ITU-T, character is converted to numeric. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
83 |
* If the mode is Qwerty, character is retained as is. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
84 |
*/ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
85 |
void ExtractQueryL(TDesC& aInput, CPsQuery& aPsQuery, TDes& aOutput); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
86 |
/** |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
87 |
* Converts the input data to the key board mode specified by the query. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
88 |
* Mode is referred in the CPsQuery. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
89 |
* If the mode is ITU-T, data is converted to numeric. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
90 |
* If the mode is Qwerty, data is retained as is. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
91 |
*/ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
92 |
void ConvertdDataToKeyBoardModeL(CPsQuery* aQuery, TPtrC aInputData, |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
93 |
TBuf<KPsQueryMaxLen>& aOutputData); |
63 | 94 |
|
95 |
public: |
|
96 |
||
97 |
/** |
|
98 |
* Search Function for multi query |
|
99 |
* Initials search feature |
|
100 |
*/ |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
101 |
void SearchMultiL(const CPsSettings& aSettings, RPointerArray<CPsQuery>& aQuery, |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
102 |
TBool isGroupSearch, RArray<TInt>& aContactsInGroup, |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
103 |
RPointerArray<CPsData>& searchResults, |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
104 |
RPointerArray<CPsPattern>& searchSeqs, TInt keyboardMode); |
63 | 105 |
|
106 |
/** |
|
107 |
* Funtion to Search matching sequences for multi query |
|
108 |
*/ |
|
109 |
void SearchMatchSeqMultiL(RPointerArray<CPsQuery>& aPsQuery, |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
110 |
TDesC& aData, RPointerArray<TDesC>& aMatchSet, |
63 | 111 |
RArray<TPsMatchLocation>& aMatchLocation); |
112 |
||
113 |
private: |
|
114 |
||
115 |
/** |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
116 |
* Constructs a bit pattern using the required/supported data fields |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
117 |
* For example, 6, 4 and 27 are supported fields <-- 00000111 |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
118 |
* 6 and 4 are required fields <-- 00000011 |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
119 |
* Bit pattern returned is 00000011. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
120 |
*/ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
121 |
TUint8 FilterDataFieldsL(RArray<TInt>& aRequiredDataFields, |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
122 |
RArray<TInt>& aSupportedDataFields); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
123 |
/** |
63 | 124 |
* Set the bits corresponding to word matches |
125 |
* |
|
126 |
* @param aIndex Index of data element |
|
127 |
* @param aPosition Word matched for predictive search |
|
128 |
*/ |
|
129 |
void SetWordMap(TInt aIndex, TInt aPosition); |
|
130 |
||
131 |
/** |
|
132 |
* Checks if data at data index and word at word index |
|
133 |
* is matched for predictive search |
|
134 |
* |
|
135 |
* @param aDataIndex Index of data element |
|
136 |
* @param aWordIndex Word index |
|
137 |
* @return TRUE if word matched else FALSE |
|
138 |
*/ |
|
139 |
TBool IsWordMatch(TInt aDataIndex, TInt aWordIndex); |
|
140 |
||
141 |
/** |
|
142 |
* Resets iWordMatches member variable |
|
143 |
*/ |
|
144 |
void ClearWordMatches(); |
|
145 |
||
146 |
public: |
|
147 |
||
148 |
/** |
|
149 |
* Utility function that counts no of bit set in 32 bit number |
|
150 |
*/ |
|
151 |
TInt BitsSet32(TUint32 aData); |
|
152 |
||
153 |
/** |
|
154 |
* Utility function to split the query into multiple queries |
|
155 |
*/ |
|
156 |
RPointerArray<CPsQuery> MultiQueryL(CPsQuery& aQuery); |
|
157 |
||
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
158 |
/** |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
159 |
* Convert the search query (multiple) to a list |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
160 |
*/ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
161 |
void ConvertQueryToListL(RPointerArray<CPsQuery>& aSearchQuery, |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
162 |
RPointerArray<HBufC>& aQueryList); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
163 |
|
63 | 164 |
private: |
165 |
||
166 |
/** |
|
167 |
* Constructor |
|
168 |
*/ |
|
169 |
CPcsAlgorithm2MultiSearchHelper(); |
|
170 |
||
171 |
/** |
|
172 |
* 2nd phase construtor |
|
173 |
*/ |
|
174 |
void ConstructL(CPcsAlgorithm2* aAlgorithm); |
|
175 |
||
176 |
private: |
|
177 |
||
178 |
/** |
|
179 |
* Pointer to algorithm instance. Not owned. |
|
180 |
*/ |
|
181 |
CPcsAlgorithm2* iAlgorithm; |
|
182 |
||
183 |
/** |
|
184 |
* Pointer to key map instance. Not owned. |
|
185 |
*/ |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
186 |
CPcsKeyMap* keyMap; |
63 | 187 |
|
188 |
/** |
|
189 |
* Array of result sets from different data stores. |
|
190 |
*/ |
|
191 |
typedef RPointerArray<CPsData> CPSDATA_R_PTR_ARRAY; |
|
192 |
RPointerArray<CPSDATA_R_PTR_ARRAY> iMultiSearchResultsArr; |
|
193 |
||
194 |
/** |
|
195 |
* Array of word macthes. |
|
196 |
*/ |
|
197 |
TUint8 iWordMatches[MAX_DATA_FIELDS]; |
|
198 |
}; |
|
199 |
||
200 |
#endif // C_PCS_ALGORITHM_2_MULTI_SEARCH_HELPER |