// --------------------------------------------------------- // CPosLmLocalDatabaseManager::SynchronizeRegistryL // // (other items were commented in a header). // --------------------------------------------------------- // void CPosLmLocalDatabaseManager::SynchronizeRegistryL() { RPointerArray<HPosLmDatabaseInfo> databaseInfoArray(KPosDbListGranularity); CleanupStack::PushL(TCleanupItem(CleanupRPointerArray, &databaseInfoArray)); // list URIs CDesCArray* dbUriArray = ListDatabasesLC(); // list registered databases Session().ListDatabasesL(databaseInfoArray, KFileProtocol); // unregister database which cannot be found on disk for (TInt i = databaseInfoArray.Count() - 1; i >= 0; i--) { TInt index; TPtrC registeredUri = databaseInfoArray[i]->DatabaseUri(); if (dbUriArray->Find(registeredUri, index) != 0) { // unregister database User::LeaveIfError(Session().UnregisterDatabase(registeredUri, DatabaseDrive(registeredUri))); } } CleanupStack::PopAndDestroy(2, &databaseInfoArray); // dbUriArray }
// --------------------------------------------------------- // CPosLmLocalDatabaseManager::ListDatabasesL // // (other items were commented in a header). // --------------------------------------------------------- // void CPosLmLocalDatabaseManager::ListDatabasesL( RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray) { // list URIs CDesCArray* dbUriArray = ListDatabasesLC(); // list registered databases Session().ListDatabasesL(aDatabaseInfoArray, KFileProtocol); // delete from URI list those databases that are registered for (TInt i = aDatabaseInfoArray.Count() - 1; i >= 0; i--) { TInt index; if (dbUriArray->Find(aDatabaseInfoArray[i]->DatabaseUri(), index) == 0) { dbUriArray->Delete(index); } } // for each remaining URI in the list, fill in database info // and add to list TInt count = dbUriArray->Count(); for (TInt i = 0; i < count; i++) { HPosLmDatabaseInfo* info = HPosLmDatabaseInfo::NewLC((*dbUriArray)[i]); aDatabaseInfoArray.AppendL(info); CleanupStack::Pop(info); // transfer of ownership to array } CleanupStack::PopAndDestroy(dbUriArray); // database drive, database media and default flag // will be filled in by database management provider. }
void X509CertNameParser::CompareAndAddNameL( const TDesC& aProposal, CDesCArray& aNameArray ) { TInt pos = 0; // This is needed only for calling Find(). // Append to array, if aProposal don't already exist in the array. if ( aNameArray.Find( aProposal, pos, ECmpNormal ) ) { aNameArray.AppendL( aProposal ); } }
// ----------------------------------------------------------------------------- // CPosLmMultiDbSearch::CloseDbsNotToSearch // // (other items were commented in a header). // ----------------------------------------------------------------------------- // void CPosLmMultiDbSearch::CloseDbsNotToSearch(const CDesCArray& aDatabaseList) { // Close any dbs not in databaseList for (TInt i = 0; i < iSearchItems.Count(); i++) { HBufC* searchItemUri = iSearchItems[i]->iDbUriPtr; // Does uri exist in databaseList? TInt pos; TInt foundUri = aDatabaseList.Find(*searchItemUri, pos, ECmpNormal); if (foundUri != 0) { CPosLmMultiDbSearchItem* item = iSearchItems[i]; iSearchItems.Remove(i); delete item; i--; } } }