72 void RemoveFromCacheL(TInt aItemId); |
72 void RemoveFromCacheL(TInt aItemId); |
73 |
73 |
74 /** |
74 /** |
75 * Removes all data elements from the cache |
75 * Removes all data elements from the cache |
76 */ |
76 */ |
77 void RemoveAllFromCacheL(); |
77 void RemoveAllFromCache(); |
78 |
78 |
79 /** |
79 /** |
80 * Sets data fields to the cache |
80 * Sets data fields to the cache |
81 */ |
81 */ |
82 void SetDataFields(RArray<TInt>& aDataFields); |
82 void SetDataFields(RArray<TInt>& aDataFields); |
123 /** |
123 /** |
124 * Resort data according to the new sortorder |
124 * Resort data according to the new sortorder |
125 */ |
125 */ |
126 void ResortdataInPoolsL(); |
126 void ResortdataInPoolsL(); |
127 |
127 |
|
128 /** |
|
129 * Get data index of the first name field |
|
130 */ |
|
131 TInt GetFirstNameIndex() const; |
|
132 |
|
133 /** |
|
134 * Get data index of the last name field |
|
135 */ |
|
136 TInt GetLastNameIndex() const; |
|
137 |
128 private: |
138 private: |
129 |
139 |
130 /** |
140 /** |
131 * Constructor |
141 * Constructor |
132 */ |
142 */ |
133 CPcsCache(); |
143 CPcsCache(); |
134 |
144 |
135 /** |
145 /** |
136 * Second phase constructor |
146 * Second phase constructor |
137 */ |
147 */ |
138 void ConstructL(CPcsAlgorithm2* aAlgorithm, TDesC& aURI, |
148 void ConstructL(CPcsAlgorithm2* aAlgorithm, const TDesC& aURI, |
139 CPcsKeyMap& aKeyMap, TUint8 aUriId); |
149 CPcsKeyMap& aKeyMap, TUint8 aUriId); |
140 |
150 |
141 /** |
151 /** |
142 * Utility function to add a contact to the pool |
152 * Utility function to add a contact to the pool |
143 */ |
153 */ |
144 void AddToPoolL(TInt& aInfo, CPsData& data); |
154 void AddToPoolL(TUint64& aPoolMap, CPsData& aData); |
145 |
155 |
146 /** |
156 /** |
147 * Utility function |
157 * Utility function |
148 */ |
158 */ |
149 void SetPoolMap(TInt& aPoolMap, TInt aPoolId); |
159 void SetPoolMap(TUint64& aPoolMap, TInt aArrayIndex); |
150 |
160 |
151 /** |
161 /** |
152 * Utility function |
162 * Utility function |
153 */ |
163 */ |
154 TBool GetPoolMap(TInt& aPoolMap, TInt arrayIndex); |
164 TBool GetPoolMap(TUint64& aPoolMap, TInt aArrayIndex); |
155 |
165 |
|
166 /** |
|
167 * Gets all the first characters of the words in the data field according |
|
168 * to which the contact should be inserted into cache. |
|
169 */ |
|
170 void GetFirstCharsForDataL( const TDesC& aData, RArray<TChar>& aFirstChars ) const; |
|
171 |
|
172 /** |
|
173 * Gets all the pool IDs matching the given characters. If there are two predictive |
|
174 * keyboards available, then pool IDs are given according to both keyboards. |
|
175 */ |
|
176 void GetPoolIdsForCharsL( const RArray<TChar>& aChars, RArray<TInt>& aPoolIds ) const; |
|
177 |
156 /** |
178 /** |
157 * Utility function |
179 * Utility function |
158 */ |
180 */ |
159 void ComputeIndexOrder(); |
181 void ComputeIndexOrder(); |
160 private: |
182 private: |
163 |
185 |
164 /* |
186 /* |
165 * Array of key maps |
187 * Array of key maps |
166 */ |
188 */ |
167 typedef RPointerArray<CPcsPoolElement> R_PTR_ARRAY; |
189 typedef RPointerArray<CPcsPoolElement> R_PTR_ARRAY; |
168 RPointerArray<R_PTR_ARRAY> keyArr; |
190 RPointerArray<R_PTR_ARRAY> iKeyArr; |
169 |
191 |
170 /* |
192 /* |
171 * Hashmaps to remember the location of a contact in the pools |
193 * Hashmaps to remember the location of a contact in the pools |
172 */ |
194 */ |
173 RHashMap<TInt, TInt> cacheInfo; |
195 RHashMap<TInt, TUint64> iCacheInfo; |
174 |
196 |
175 /* |
197 /* |
176 * Master pool of all contacts in this cache |
198 * Master pool of all contacts in this cache |
177 */ |
199 */ |
178 RPointerArray<CPsData> masterPool; |
200 RPointerArray<CPsData> iMasterPool; |
179 |
201 |
180 /* |
202 /* |
181 * Master pool backup of all contacts in this cache when sortorder changed |
203 * Master pool backup of all contacts in this cache when sortorder changed |
182 */ |
204 */ |
183 RPointerArray<CPsData> masterPoolBackup; |
205 RPointerArray<CPsData> iMasterPoolBackup; |
184 |
206 |
185 /* |
207 /* |
186 * Not owned |
208 * Not owned |
187 */ |
209 */ |
188 CPcsKeyMap* keyMap; |
210 CPcsKeyMap* iKeyMap; |
189 |
211 |
190 /** |
212 /** |
191 * Owned. Refer to the database URI this cache is for. |
213 * Owned. Refer to the database URI this cache is for. |
192 */ |
214 */ |
193 HBufC* iURI; |
215 HBufC* iURI; |