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,
|
|
67 |
RPointerArray<CPcsPoolElement>& aSearchSet,
|
|
68 |
RPointerArray<CPsQuery>& aSearchQuery,
|
|
69 |
TUint8 aFilteredDataMatch,
|
|
70 |
TBool aIsGroupSearch,
|
|
71 |
const RArray<TInt>& aContactsInGroup);
|
|
72 |
|
|
73 |
public:
|
|
74 |
|
|
75 |
/**
|
|
76 |
* Search Function for multi query
|
|
77 |
* Initials search feature
|
|
78 |
*/
|
|
79 |
void SearchMultiL(const CPsSettings& aSettings,
|
|
80 |
RPointerArray<CPsQuery>& aQuery,
|
|
81 |
TBool aIsGroupSearch,
|
|
82 |
const RArray<TInt>& aContactsInGroup,
|
|
83 |
RPointerArray<CPsData>& aSearchResults,
|
|
84 |
RPointerArray<CPsPattern>& aSearchSeqs);
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Funtion to Search matching sequences for multi query
|
|
88 |
*/
|
|
89 |
void SearchMatchSeqMultiL(RPointerArray<CPsQuery>& aPsQuery,
|
|
90 |
const TDesC& aData,
|
|
91 |
RPointerArray<TDesC>& aMatchSet,
|
|
92 |
RArray<TPsMatchLocation>& aMatchLocation);
|
|
93 |
|
|
94 |
private:
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Set the bits corresponding to word matches
|
|
98 |
*
|
|
99 |
* @param aIndex Index of data element
|
|
100 |
* @param aPosition Word matched for predictive search
|
|
101 |
*/
|
|
102 |
void SetWordMap(TInt aIndex, TInt aPosition);
|
|
103 |
|
|
104 |
/**
|
|
105 |
* Checks if data at data index and word at word index
|
|
106 |
* is matched for predictive search
|
|
107 |
*
|
|
108 |
* @param aDataIndex Index of data element
|
|
109 |
* @param aWordIndex Word index
|
|
110 |
* @return TRUE if word matched else FALSE
|
|
111 |
*/
|
|
112 |
TBool IsWordMatch(TInt aDataIndex, TInt aWordIndex);
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Resets iWordMatches member variable
|
|
116 |
*/
|
|
117 |
void ClearWordMatches();
|
|
118 |
|
|
119 |
public:
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Utility function that counts no of bit set in 32 bit number
|
|
123 |
*/
|
|
124 |
TInt BitsSet32(TUint32 aData);
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Utility function to split the query into multiple queries
|
|
128 |
*/
|
|
129 |
RPointerArray<CPsQuery> MultiQueryL(CPsQuery& aQuery);
|
|
130 |
|
|
131 |
private:
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Constructor
|
|
135 |
*/
|
|
136 |
CPcsAlgorithm2MultiSearchHelper();
|
|
137 |
|
|
138 |
/**
|
|
139 |
* 2nd phase construtor
|
|
140 |
*/
|
|
141 |
void ConstructL(CPcsAlgorithm2* aAlgorithm);
|
|
142 |
|
|
143 |
private:
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Pointer to algorithm instance. Not owned.
|
|
147 |
*/
|
|
148 |
CPcsAlgorithm2* iAlgorithm;
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Pointer to key map instance. Not owned.
|
|
152 |
*/
|
|
153 |
CPcsKeyMap* iKeyMap;
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Array of result sets from different data stores.
|
|
157 |
*/
|
|
158 |
typedef RPointerArray<CPsData> CPSDATA_R_PTR_ARRAY;
|
|
159 |
RPointerArray<CPSDATA_R_PTR_ARRAY> iMultiSearchResultsArr;
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Array of word macthes.
|
|
163 |
*/
|
|
164 |
TUint8 iWordMatches[MAX_DATA_FIELDS];
|
|
165 |
|
|
166 |
/**
|
|
167 |
* Counter of the matched contacts
|
|
168 |
*/
|
|
169 |
TInt iMaxCount;
|
|
170 |
};
|
|
171 |
|
|
172 |
#endif // C_PCS_ALGORITHM_2_MULTI_SEARCH_HELPER
|