88 RPointerArray<CPcsPoolElement> *keyMap = new (ELeave) RPointerArray<CPcsPoolElement>(1); |
88 RPointerArray<CPcsPoolElement> *keyMap = new (ELeave) RPointerArray<CPcsPoolElement>(1); |
89 iKeyArr.InsertL(keyMap,i); |
89 iKeyArr.InsertL(keyMap,i); |
90 } |
90 } |
91 |
91 |
92 // Adaptive Grid map |
92 // Adaptive Grid map |
93 iAdaptiveGridMap = CPcsAdaptiveGrid::NewL( ); |
93 if ( iURI->Compare( KVPbkDefaultCntDbURI ) == 0 |
|
94 || iURI->Compare( KVPbkSimGlobalAdnURI ) == 0 |
|
95 || iURI->Compare( KVPbkSimGlobalFdnURI ) == 0 |
|
96 || iURI->Compare( KVPbkSimGlobalSdnURI ) == 0 |
|
97 || iURI->Compare( KVPbkDefaultGrpDbURI ) == 0 ) |
|
98 { |
|
99 iAdaptiveGridMap = CPcsAdaptiveGrid::NewL(); |
|
100 } |
94 |
101 |
95 PRINT ( _L("End CPcsCache::ConstructL") ); |
102 PRINT ( _L("End CPcsCache::ConstructL") ); |
96 } |
103 } |
97 |
104 |
98 // ---------------------------------------------------------------------------- |
105 // ---------------------------------------------------------------------------- |
215 TPtrC16 ptr = words->MdcaPoint(i); |
222 TPtrC16 ptr = words->MdcaPoint(i); |
216 PRINT5 ( _L("CPcsCache::AddToPoolL: Data[%d]=\"%S\", word=\"%S\", firstChar='%c', Match=%d" ), |
223 PRINT5 ( _L("CPcsCache::AddToPoolL: Data[%d]=\"%S\", word=\"%S\", firstChar='%c', Match=%d" ), |
217 dataIndex, &*dataStr, &(ptr), (TUint) firstChar, aData.IsDataMatch(dataIndex) ); |
224 dataIndex, &*dataStr, &(ptr), (TUint) firstChar, aData.IsDataMatch(dataIndex) ); |
218 #endif // _DEBUG |
225 #endif // _DEBUG |
219 |
226 |
220 // Set the 1st char of the word for the Adaptive Grid or |
227 if ( iAdaptiveGridMap ) |
221 // increment the reference counter |
228 { |
222 TUint selector = GridItemSelector( dataIndex, unnamed ); |
229 // Set the 1st char of the word for the Adaptive Grid or |
223 iAdaptiveGridMap->IncrementRefCounterL( firstChar, selector ); |
230 // increment the reference counter |
|
231 TUint selector = GridItemSelector( dataIndex, unnamed ); |
|
232 iAdaptiveGridMap->IncrementRefCounterL( firstChar, selector ); |
|
233 } |
224 } |
234 } |
225 |
235 |
226 CleanupStack::PopAndDestroy(words); |
236 CleanupStack::PopAndDestroy(words); |
227 } |
237 } |
228 |
238 |
381 #ifdef _DEBUG |
391 #ifdef _DEBUG |
382 PRINT2 ( _L("CPcsCache::RemoveFromCacheL: iURI=\"%S\", iUriId=%d"), &*iURI, iUriId ); |
392 PRINT2 ( _L("CPcsCache::RemoveFromCacheL: iURI=\"%S\", iUriId=%d"), &*iURI, iUriId ); |
383 TPtrC16 ptr = words->MdcaPoint(i); |
393 TPtrC16 ptr = words->MdcaPoint(i); |
384 PRINT5 ( _L("CPcsCache::RemoveFromCacheL: Data[%d]=\"%S\", word=\"%S\", firstChar='%c', Match=%d" ), |
394 PRINT5 ( _L("CPcsCache::RemoveFromCacheL: Data[%d]=\"%S\", word=\"%S\", firstChar='%c', Match=%d" ), |
385 dataIndex, &*dataStr, &(ptr), (TUint) firstChar, data->IsDataMatch(dataIndex) ); |
395 dataIndex, &*dataStr, &(ptr), (TUint) firstChar, data->IsDataMatch(dataIndex) ); |
386 #endif // _DEBUG |
396 #endif // _DEBUG |
387 |
|
388 // Decrement the reference counter of the 1st char of the word for the Adaptive Grid or |
397 // Decrement the reference counter of the 1st char of the word for the Adaptive Grid or |
389 // delete the Adaptive Grid item if there are no references to it anymore |
398 // delete the Adaptive Grid item if there are no references to it anymore |
390 TUint selector = GridItemSelector( dataIndex, unnamed ); |
399 TUint selector = GridItemSelector( dataIndex, unnamed ); |
391 iAdaptiveGridMap->DecrementRefCounter( firstChar, selector ); |
400 iAdaptiveGridMap->DecrementRefCounter( firstChar, selector ); |
392 } |
401 } |
393 |
|
394 CleanupStack::PopAndDestroy( words ); |
402 CleanupStack::PopAndDestroy( words ); |
395 } |
403 } |
396 } |
404 } |
397 } |
405 } |
398 |
406 |
418 } |
426 } |
419 |
427 |
420 iMasterPool.ResetAndDestroy(); |
428 iMasterPool.ResetAndDestroy(); |
421 iCacheInfo.Close(); |
429 iCacheInfo.Close(); |
422 |
430 |
423 delete iAdaptiveGridMap; |
431 if ( iAdaptiveGridMap ) |
424 iAdaptiveGridMap = NULL; |
432 { |
|
433 iAdaptiveGridMap->Reset(); |
|
434 } |
425 |
435 |
426 PRINT ( _L("End CPcsCache::RemoveAllFromCache") ); |
436 PRINT ( _L("End CPcsCache::RemoveAllFromCache") ); |
427 } |
437 } |
428 |
438 |
429 // --------------------------------------------------------------------- |
439 // --------------------------------------------------------------------- |
432 // --------------------------------------------------------------------- |
442 // --------------------------------------------------------------------- |
433 void CPcsCache::GetAdaptiveGridL( const TBool aCompanyName, TDes& aAdaptiveGrid ) |
443 void CPcsCache::GetAdaptiveGridL( const TBool aCompanyName, TDes& aAdaptiveGrid ) |
434 { |
444 { |
435 PRINT ( _L("Enter CPcsCache::GetAdaptiveGridL") ); |
445 PRINT ( _L("Enter CPcsCache::GetAdaptiveGridL") ); |
436 |
446 |
437 iAdaptiveGridMap->GetAdaptiveGrid( aCompanyName, aAdaptiveGrid ); |
447 if ( iAdaptiveGridMap ) |
|
448 { |
|
449 iAdaptiveGridMap->GetAdaptiveGrid( aCompanyName, aAdaptiveGrid ); |
|
450 } |
438 |
451 |
439 PRINT ( _L("End CPcsCache::GetAdaptiveGridL") ); |
452 PRINT ( _L("End CPcsCache::GetAdaptiveGridL") ); |
440 } |
453 } |
441 |
454 |
442 // --------------------------------------------------------------------- |
455 // --------------------------------------------------------------------- |
648 { |
661 { |
649 iKeyArr[i]->ResetAndDestroy(); |
662 iKeyArr[i]->ResetAndDestroy(); |
650 } |
663 } |
651 iMasterPool.Reset(); |
664 iMasterPool.Reset(); |
652 iCacheInfo.Close(); |
665 iCacheInfo.Close(); |
653 |
666 if ( iAdaptiveGridMap ) |
|
667 { |
|
668 iAdaptiveGridMap->Reset(); |
|
669 } |
|
670 |
654 // Now add data again from the iMasterPoolBackup |
671 // Now add data again from the iMasterPoolBackup |
655 for (TInt i = 0; i < iMasterPoolBackup.Count(); i++ ) |
672 for (TInt i = 0; i < iMasterPoolBackup.Count(); i++ ) |
656 { |
673 { |
657 CPsData* temp = iMasterPoolBackup[i]; |
674 CPsData* temp = iMasterPoolBackup[i]; |
658 AddToCacheL( *temp ); |
675 AddToCacheL( *temp ); |