EXPORT_C void CEikHotKeyTable::AddItemL(TInt aCommandId,TInt aKeycode,TInt aModifiers) { TInt pos=0; TInt* pNumber=&iNumberPlain; switch (aModifiers) { case 0: break; case EModifierCtrl: pos=iNumberPlain; pNumber=&iNumberCtrl; break; case (EModifierShift|EModifierCtrl): pos=iNumberPlain+iNumberCtrl; pNumber=&iNumberShiftCtrl; break; default: User::Leave(KErrNotSupported); } SEikHotKey hotKey; hotKey.iCommandId=aCommandId; hotKey.iKeycode=aKeycode; InsertL(pos+*pNumber,hotKey); (*pNumber)++; // after the InsertL succeeds }
CAppSidChecker& RSidCheckerMap::FindSidCheckerL(TUid aAppType) { CAppSidChecker* checker = NULL; CAppSidChecker** checkerPtr = Find(aAppType.iUid); if(checkerPtr) { checker = *checkerPtr; } else { // No CAppSidChecker instance loaded, try to find one checker = CAppSidChecker::CheckerForAppType(aAppType); if(checker) { CleanupStack::PushL(checker); InsertL(aAppType.iUid, checker); CleanupStack::Pop(checker); checker->SetRescanCallBackL(iRescanCallBack); } else { User::Leave(KErrNotFound); } } return *checker; }
TUint CTupleStoreImpl::PutL(TTupleType aTupleType, const TTupleName& aTupleName, const TDesC& aSubName, const TComponentName& aComponent, const TDesC8& aSerializedData, TBBPriority aPriority, TBool aReplace, const TTime& aLeaseExpires, TBool aKeepExisting) { CALLSTACKITEM_N(_CL("CTupleStoreImpl"), _CL("PutL")); if (aTupleName.iModule.iUid == KBBAnyUidValue || aTupleName.iId == KBBAnyId || aComponent.iModule.iUid == KBBAnyUidValue || aComponent.iId == KBBAnyId) User::Leave(KErrArgument); TUint ret; { TAutomaticTransactionHolder ath(*this); TBool exists=SeekNameL(aTupleType, aTupleName, aSubName); if (exists && aKeepExisting) { UpdateL(); iTable.SetColL(ELeaseExpires, aLeaseExpires); MDBStore::PutL(); return 0; } else if (exists && aReplace) { UpdateL(); } else { InsertL(); iTable.SetColL(ETupleType, aTupleType); iTable.SetColL(ENameModule, aTupleName.iModule.iUid); iTable.SetColL(ENameId, aTupleName.iId); iTable.SetColL(ENameSubName1, aSubName); iTable.SetColL(ENameSubName2, aSubName.Left(iSubNameIndexLength)); iTable.SetColL(EPriority, aPriority); iTable.SetColL(EComponentModule, aComponent.iModule.iUid); iTable.SetColL(EComponentId, aComponent.iId); } ret=iTable.ColUint(ETupleId); if (aSerializedData.Length() > 0) { RADbColWriteStream w; w.OpenLA(iTable, EData); w.WriteUint32L(aSerializedData.Length()); w.WriteL(aSerializedData); w.CommitL(); } else { iTable.SetColNullL(EData); } iTable.SetColL(ELeaseExpires, aLeaseExpires); MDBStore::PutL(); } if (aLeaseExpires < iNextExpiry) { TTime now=GetTime(); TTimeIntervalSeconds s; aLeaseExpires.SecondsFrom(now, s); TInt wait=s.Int(); iTimer->Wait(wait); } return ret; }
/** Add a new URI and its associated properties into the storage. @param aUriStream A stream to read the CInetUriImpl object. @param aUriId URI Id value that will be returned to the caller @param aPropId Property Id value that will be returned to the caller */ void CUriListInterface::AddUriL ( RReadStream& aUriStream, TInt& aUriId, TInt& aPropId ) { CInetUriImpl* inetUri = CInetUriImpl::NewL (); CleanupStack::PushL ( inetUri ); inetUri->UnpackL ( aUriStream ); InsertL ( *inetUri ); aUriId = inetUri->UriId (); aPropId = inetUri->Properties().PropId (); CleanupStack::PopAndDestroy ( inetUri ); }
void CMediaMtpDataProvider::GetSupportedFormatL() { iSupportedFormat.Reset(); TInt count = sizeof ( KMediaMtpDataProviderSupportedFormats ) / sizeof( TUint16 ); for ( TInt i = 0; i < count; i++ ) { InsertL( iSupportedFormat, KMediaMtpDataProviderSupportedFormats[i] ); } }
void Bignum::_Deque::InsertR(int i) { _Ary * Node; if (IsEmpty()) { InsertL(i); } else { Node = new _Ary(i,_Tail,_Tail->prev); _Tail->prev->next = Node; _Tail->prev = Node; } }
Label &Label::operator=(const Label & d) { if (this==&d) { return *this; } _Empty(); if (!IsEmpty()) { for (_Ary * loop = d._Head; loop!=d._Tail; loop = loop->next) { InsertL(loop->ch); } } return *this; }
void CMediaMtpDataProvider::GetAllSupportedPropL() { iSupportedPropAll.Reset(); TInt i = 0; TInt count = sizeof( KMmMtpDpSupportedPropMandatoryAll ) / sizeof( TUint16 ); for ( i = 0; i < count; i++ ) InsertL( iSupportedPropAll, KMmMtpDpSupportedPropMandatoryAll[i] ); count = sizeof ( KMmMtpDpSupportedPropAdditionalAll ) / sizeof(TUint16); for ( i = 0; i < count; i++ ) InsertL( iSupportedPropAll, KMmMtpDpSupportedPropAdditionalAll[i] ); count = sizeof ( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof(TUint16); for ( i = 0; i < count; i++ ) InsertL( iSupportedPropAll, KMmMtpDpSupportedPropMandatoryAudio[i] ); count = sizeof ( KMmMtpDpSupportedPropAdditionalAudio ) / sizeof(TUint16); for ( i = 0; i < count; i++ ) InsertL( iSupportedPropAll, KMmMtpDpSupportedPropAdditionalAudio[i] ); count = sizeof ( KMmMtpDpSupportedPropMandatoryWMV ) / sizeof(TUint16); for ( i = 0; i < count; i++ ) InsertL( iSupportedPropAll, KMmMtpDpSupportedPropMandatoryWMV[i] ); count = sizeof ( KMmMtpDpSupportedPropAdditionalWMV ) / sizeof(TUint16); for ( i = 0; i < count; i++ ) InsertL( iSupportedPropAll, KMmMtpDpSupportedPropAdditionalWMV[i] ); }
void Label::InsertR(char ch) { _Ary * Node; if (IsEmpty()) { InsertL(ch); } else { Node = new _Ary(ch,_Tail,_Tail->prev); _Tail->prev->next = Node; _Tail->prev = Node; //_Index++; } }
void CAknInlineTextStore::InsertInlineTextL( CAknPositionedInlineText* aInlineText ) { TInt insertPosition(0); for (TInt ii = Count()-1; ii >= 0; --ii) { if ( At(ii)->DocPos() <= aInlineText->DocPos() ) { insertPosition = ii+1; break; } } InsertL( insertPosition, aInlineText ); }
// ----------------------------------------------------------------------------- // CWPRoot::StartCharacteristicL // ----------------------------------------------------------------------------- // void CWPRoot::StartCharacteristicL( const TDesC& aName ) { FLOG( _L( "[Provisioning] CWPRoot::StartCharacteristicL:" ) ); CWPCharacteristic* newChar = WPElementFactory::CreateCharacteristicLC( aName ); if( iStack.Count() == 0 ) { // Assumes ownership if doesn't leave InsertL( newChar ); } else { CWPCharacteristic* latest = iStack[ iStack.Count()-1 ]; // Assumes ownership if doesn't leave latest->InsertL( newChar ); } CleanupStack::Pop(); // newChar User::LeaveIfError( iStack.Append( newChar ) ); }
// ----------------------------------------------------------------------------- // CWPRoot::StartCharacteristicL // ----------------------------------------------------------------------------- // void CWPRoot::StartCharacteristicL( TInt aType ) { FTRACE(RDebug::Print(_L("[Provisioning] CWPRoot::StartCharacteristicL: aType (%d)"), aType)); CWPCharacteristic* newChar = WPElementFactory::CreateCharacteristicLC( aType ); if( iStack.Count() == 0 ) { // Assumes ownership if doesn't leave InsertL( newChar ); } else { CWPCharacteristic* latest = iStack[ iStack.Count()-1 ]; // Assumes ownership if doesn't leave latest->InsertL( newChar ); } CleanupStack::Pop(); // newChar User::LeaveIfError( iStack.Append( newChar ) ); }
//-------------------------------------------------------------------- //-------------------------------------------------------------------- // void CPosLmNameIndex::UpdateL( TPosLmItemId aLmid, HBufC* aName ) { TInt index = Find( aLmid ); if ( index >= 0 ) { CIndexItem* entry = iArray->At( index ); // if name is exactly same, no need to change anything if ( entry->Name().Compare( *aName ) != 0 ) { DoRemove( index ); InsertL( aLmid, aName ); } else { delete aName; } } else { delete aName; } }
// ----------------------------------------------------------------------------- // CSIPMessage::AddHeaderL // ----------------------------------------------------------------------------- // EXPORT_C void CSIPMessage::AddHeaderL (CSIPHeaderBase* aSIPHeader) { __ASSERT_ALWAYS (aSIPHeader != 0, User::Leave(KErrArgument)); __ASSERT_ALWAYS (!(aSIPHeader->IsExtensionHeader() && SIPHeaderLookup::IsSupported(aSIPHeader->Name())), User::Leave(KErrSipCodecNotAllowed)); // Never add the Content-Length header. Instead store its value. if (IsContentLengthHeader(*aSIPHeader)) { if (iAnnouncedContentLengthSet) { User::Leave(KErrAlreadyExists); } iAnnouncedContentLengthSet = ETrue; iAnnouncedContentLength = (static_cast<CSIPContentLengthHeader*>(aSIPHeader))->Value(); delete aSIPHeader; return; } TInt index = FindHeaderListIndex (*aSIPHeader); if (index == KErrNotFound) // Insert as the head of a new header list. { TSglQue<CSIPHeaderBase> headerList(KSIPHeaderOffset); headerList.AddLast (*aSIPHeader); InsertL (headerList); } else // Try to add to existing header list { if (!aSIPHeader->MoreThanOneAllowed()) { User::Leave(KErrAlreadyExists); } iSIPHeaderListArray[index].AddLast(*aSIPHeader); } }
int Load_file(char* loadFile) { FILE *fpb; MyRecord rec; long lSize; int numOfrecords, i; fpb = fopen (loadFile,"rb"); if (fpb==NULL) { printf("Cannot open binary file\n"); return 0; } // check number of records fseek (fpb , 0 , SEEK_END); lSize = ftell (fpb); rewind (fpb); numOfrecords = (int) lSize/sizeof(rec); if(hashtsize == 0) { hashtsize = primes(numOfrecords/2); hashtable = malloc(hashtsize*(sizeof(pnode))); } for(i = 0; i < hashtsize; i++) { hashtable[i] = NULL; } for (i=0; i<numOfrecords ; i++) { fread(&rec, sizeof(rec), 1, fpb); InsertL(rec, hashtable, hashtsize, start_town); } fclose(fpb); printf("Data file loaded succesfully.\n"); return 1; }
int main (int argc, char** argv) { int a, pop, sum, k; int l, o, c; int fd, val; MyRecord temprec, r; char ch; char phoneno[20]; char town[20]; char min[20], max[20]; char word[20]; l = 0; o = 0; c = 0; char loadFile[20], opFile[20], configFile[20]; /* Diabasma orismatwn */ opterr = 0; while ((a = getopt (argc, argv, "l:o:c:")) != -1) switch (a) { case 'l': strcpy(loadFile, optarg); l = 1; break; case 'o': strcpy(opFile, optarg); o = 1; break; case 'c': strcpy(configFile, optarg); c = 1; break; case '?': if (optopt == 'p' || optopt == 'i' || optopt == 'd') fprintf (stderr, "Option -%c requires an argument.\n", optopt); else if (isprint (optopt)) fprintf (stderr, "Unknown option `-%c'.\n", optopt); else fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt); return 1; default: abort (); } InitializeI(&start_town); /* Xrhsh orismatwn */ if(c == 1) { FILE* con; con = fopen(configFile,"r"); if (con == NULL) { printf("Cannot open configuration file\n"); } else while(!feof(con)) { if(fscanf(con, "%s %d", word, &val) == 2) if(strcmp(word, "Hash_Table_Size") == 0) { hashtsize = val; hashtable = malloc(hashtsize*(sizeof(pnode))); } } } if(l == 1) { Load_file(loadFile); l = 0; } if(o == 1) // An uparxei operation file tote to stdin anakateuthunetai sto arxeio ayto k diabazontai oi entoles kanonika mexri na teleiwsei { if(hashtsize == 0) { hashtsize = primes(DEFAULT_HASH_SIZE); hashtable = malloc(hashtsize*(sizeof(pnode))); } if( access(opFile, F_OK ) != -1 ) { fd = dup(fileno(stdin)); freopen(opFile, "r", stdin); } else printf("Cannot open operation file\n"); } memset(max, '0', 20); memset(min, '0', 20); if(hashtsize == 0) { hashtsize = primes(DEFAULT_HASH_SIZE); hashtable = malloc(hashtsize*(sizeof(pnode))); } if(o == 0) printf("Give input\n"); /* Epanalipsh gia thn eisagwgh entolwn. Diavasma prwtou xarakthra kai elegxos periptwsewn */ while(1) { ch = getchar(); if(ch == 'i') { ReadValue(&temprec); if(SearchL(temprec.phone, hashtable, hashtsize, &r) == 0) InsertL(temprec, hashtable, hashtsize, start_town); else printf("Number %s already exists. Cannot add the same number twice.\n", temprec.phone); //temp_town = start_town; } else if(ch == 'q') { scanf("%10s", phoneno); if(SearchL(phoneno, hashtable, hashtsize, &r) == 1) WriteValue(r); else printf("Number %s not found.\n", phoneno); memset(phoneno, '\0', 20); } else if(ch == 'd') { scanf("%10s", phoneno); DeleteL(phoneno, hashtable, hashtsize, start_town); memset(phoneno, '\0', 20); } else if(ch == 'l') { scanf("%s", loadFile); Load_file(loadFile); } else if(ch == 'e') { FreeIndex(start_town); free(start_town); free(hashtable); return 0; } else if(ch == 'p') { scanf("%s", town); pop = PopulationI(start_town, town); if(pop > 0) printf("%s: %d\n", town, pop); else printf("Town %s not found.\n", town); memset(town, '\0', 20); } else if(ch == 's') { scanf("%s", town); sum = SummaryI(start_town, town); if(sum > 0) printf("%s: %d\n", town, sum); else printf("Town %s not found.\n", town); memset(town, '\0', 20); } else if(ch == 't') { scanf("%d", &k); Top(start_town, k); } else if(ch == 'f') { ch = getchar(); if(ch == 't') { ch = getchar(); if(ch == ' ') { scanf("%s %d", town, &k); TopKSpenders(start_town, town, k); } else if(ch == 's') TopTownSpenders(start_town); } } else if(ch == 'm') { ch = getchar(); if(ch == 'a') { ch = getchar(); if(ch == 'x') { //if(max[0] == '0') Max(start_town); } } else if(ch == 'i') { ch = getchar(); if(ch == 'n') { // if(min[0] == '0') Min(start_town); } } } //scanf("%20s", junk); if(o == 1 && ch == EOF) // An yparxei operation file san orisma kai exei teleiwsei h anagnwsh epanafora tou stdin. { fflush(stdin); dup2(fd, fileno(stdin)); close(fd); clearerr(stdin); o = 0; printf("Operation file finished succesfully.\n"); } fflush(stdin); } return 0; }
// --------------------------------------------------------------------------- // CMediaMtpDataProvider::GetSupportedPropL // // --------------------------------------------------------------------------- // void CMediaMtpDataProvider::GetSupportedPropL() { iSupportedPropAudio.Reset(); iSupportedPropVideo.Reset(); TInt count = 0, i = 0; count = sizeof( KMmMtpDpSupportedPropMandatoryAll ) / sizeof( TUint16 ); for ( i = 0; i < count; i++ ) { InsertL( iSupportedPropAudio, KMmMtpDpSupportedPropMandatoryAll[i] ); InsertL( iSupportedPropVideo, KMmMtpDpSupportedPropMandatoryAll[i] ); } count = sizeof( KMmMtpDpSupportedPropAdditionalAll ) / sizeof( TUint16 ); for ( i = 0; i < count; i++ ) { InsertL( iSupportedPropAudio, KMmMtpDpSupportedPropAdditionalAll[i] ); InsertL( iSupportedPropVideo, KMmMtpDpSupportedPropAdditionalAll[i] ); } for ( TInt j = 0; j < iSupportedFormat.Count(); j++ ) { switch ( iSupportedFormat[j] ) { case EMTPFormatCodeWMA: case EMTPFormatCodeMP3: case EMTPFormatCodeAAC: case EMTPFormatCodeWAV: case EMTPFormatCodeMP4Container: case EMTPFormatCode3GPContainer: { count = sizeof ( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof( TUint16 ); for ( i = 0; i < count; i++ ) { InsertL( iSupportedPropAudio, KMmMtpDpSupportedPropMandatoryAudio[i] ); } count = sizeof ( KMmMtpDpSupportedPropAdditionalAudio ) / sizeof(TUint16); for ( i = 0; i < count; i++ ) { InsertL( iSupportedPropAudio, KMmMtpDpSupportedPropAdditionalAudio[i] ); } } break; case EMTPFormatCodeWMV: case EMTPFormatCodeASF: { count = sizeof ( KMmMtpDpSupportedPropMandatoryWMV ) / sizeof(TUint16); for ( i = 0; i < count; i++ ) { InsertL( iSupportedPropVideo, KMmMtpDpSupportedPropMandatoryWMV[i] ); } count = sizeof ( KMmMtpDpSupportedPropAdditionalWMV ) / sizeof(TUint16); for ( i = 0; i < count; i++ ) { InsertL( iSupportedPropVideo, KMmMtpDpSupportedPropAdditionalWMV[i] ); } } break; default: { // shouldn't happen User::Leave( KErrNotSupported ); } break; } } }
void InsertL( TInt aPos, MJuikControl& aControl, TInt aProportion, TInt aFlags ) { CALLSTACKITEM_N(_CL("CJuikSizer"), _CL("InsertL(MJuikControl")); auto_ptr<CJuikSizerItem> item( new (ELeave) CJuikControlSizerItem(aControl, aProportion, aFlags ) ); InsertL( item.release(), aPos ); }
/** Database event handler. @param aEvent the database event. */ void CContactLocalView::HandleDatabaseEventL(TContactDbObserverEvent aEvent) { // handle Backup / Restore notifications before checking View State switch (aEvent.iType) { case EContactDbObserverEventBackupBeginning: case EContactDbObserverEventRestoreBeginning: #if defined(__VERBOSE_DEBUG__) RDebug::Print(_L("[CNTMODEL] CContactLocalView{ViewPrefs = 0x%08X}::HandleDatabaseEventL -> Backup/Restore Beginning, state = %i\r\n"), iViewPreferences, iState); #endif if (iState == EReady) { SetState(ENotReady); } else { // stop sorting iViewCntMgr->StopSortL(); } return; case EContactDbObserverEventBackupRestoreCompleted: #if defined(__VERBOSE_DEBUG__) RDebug::Print(_L("[CNTMODEL] CContactLocalView{ViewPrefs = 0x%08X}::HandleDatabaseEventL -> Backup/Restore Completed, state = %i, old sort error %i\r\n"), iViewPreferences, iState, iExtension->iError); #endif if (iState == ENotReady && iExtension->iError == KErrNone) { // view was ready before tables were closed SetState(EReady); } else // view was Initializing (sorting) before tables were closed { // re-read database and sort SafeResort(); } return; default: // other events dealt with below break; } if (iState!=EReady) { if (iViewCntMgr->IsICCSynchronised()) { /* * View events are only queued when the ICC has been synchronised. This prevents * duplicate contacts in an ICC view because add events are not queued until the * SIM is fully synchronised. * * See LUD-5EBHZF "ICC contacts view broadcasts add item events after view is * ready" for more detail. */ #if defined(__VERBOSE_DEBUG__) DebugLogNotification(_L("[CNTMODEL] . . . . . Queueing Database Event "), aEvent); #endif iOutstandingEvents.AppendL(aEvent); // The view state is set to ENotReady when a recovery takes place, and also when the tables // are closed, so set ready here. if (iState == ENotReady && (aEvent.iType == EContactDbObserverEventRecover || aEvent.iType == EContactDbObserverEventTablesOpened)) { SetState(EReady); } // view was Initializing (sorting) before recovery or compression started! if (iState == EInitializing && (aEvent.iType == EContactDbObserverEventRecover || aEvent.iType == EContactDbObserverEventCompress)) { // re-read database and sort SafeResort(); } } #if defined(__VERBOSE_DEBUG__) else { DebugLogNotification(_L("[CNTMODEL] . . . . . Discarding Database Event "), aEvent); } #endif } else { TContactViewEvent event; event.iInt = KErrNone; switch(aEvent.iType) { case EContactDbObserverEventGroupChanged: case EContactDbObserverEventContactChanged: case EContactDbObserverEventOwnCardChanged: { if (aEvent.iType == EContactDbObserverEventGroupChanged) { //Groups are a special case the base view may not contain the group //but a sub view may be such a group and need to know its changed event.iEventType=TContactViewEvent::EGroupChanged; event.iContactId=aEvent.iContactId; NotifyObservers(event); } // Remove from old position, and notify. TRAPD(err,event.iInt=RemoveL(aEvent.iContactId)); if (err == KErrNone && event.iInt != KErrNotFound) { event.iEventType=TContactViewEvent::EItemRemoved; event.iContactId=aEvent.iContactId; NotifyObservers(event); } // Insert at new position, and notify. event.iInt=InsertL(aEvent.iContactId); if (event.iInt != KErrNotFound) { event.iEventType=TContactViewEvent::EItemAdded; event.iContactId=aEvent.iContactId; NotifyObservers(event); } break; } case EContactDbObserverEventContactAdded: case EContactDbObserverEventGroupAdded: #if defined(__VERBOSE_DEBUG__) DebugLogNotification(_L("[CNTMODEL] DatabaseEvent -> Contact/Group Added"), aEvent); #endif event.iInt=InsertL(aEvent.iContactId); if (event.iInt != KErrNotFound) { event.iEventType=TContactViewEvent::EItemAdded; event.iContactId=aEvent.iContactId; NotifyObservers(event); } break; case EContactDbObserverEventContactDeleted: if(aEvent.iContactId == KNullContactId) // KNullContactId indicates a bulk delete. { SetState(EInitializing); // Use initializing state to avoid ESortOrderChanged event being sent to observers. SafeResort(); } else { event.iInt=RemoveL(aEvent.iContactId); if (event.iInt != KErrNotFound) { event.iEventType=TContactViewEvent::EItemRemoved; event.iContactId=aEvent.iContactId; NotifyObservers(event); } } break; case EContactDbObserverEventGroupDeleted: case EContactDbObserverEventOwnCardDeleted: event.iInt=RemoveL(aEvent.iContactId); if (event.iInt != KErrNotFound) { event.iEventType=TContactViewEvent::EItemRemoved; event.iContactId=aEvent.iContactId; NotifyObservers(event); } break; case EContactDbObserverEventUnknownChanges: case EContactDbObserverEventCurrentDatabaseChanged: SetState(EInitializing); // Use initializing state to avoid ESortOrderChanged event being sent to observers. SafeResort(); break; case EContactDbObserverEventSortOrderChanged: // event is not currently used SetState(ENotReady); SafeResort(); break; case EContactDbObserverEventTablesClosed: if (iState == EReady) { SetState(ENotReady); } break; case EContactDbObserverEventTablesOpened: // re-read database and sort SafeResort(); break; case EContactDbObserverEventNull: case EContactDbObserverEventUnused: case EContactDbObserverEventRecover: case EContactDbObserverEventCompress: case EContactDbObserverEventRollback: case EContactDbObserverEventTemplateChanged: case EContactDbObserverEventTemplateDeleted: case EContactDbObserverEventTemplateAdded: case EContactDbObserverEventCurrentItemDeleted: case EContactDbObserverEventCurrentItemChanged: case EContactDbObserverEventPreferredTemplateChanged: case EContactDbObserverEventSpeedDialsChanged: case EContactDbObserverEventRestoreBadDatabase: break; // these events should not come here, but be dealt with at the top of HandleDatabaseEventL case EContactDbObserverEventBackupBeginning: case EContactDbObserverEventRestoreBeginning: case EContactDbObserverEventBackupRestoreCompleted: break; default: ASSERT(EFalse); } } }
void CMsvEntryArray::GroupL(TGroupCriterion aGroupCriterion,TMsvSelectionOrdering aOrdering,TBool aDoSort) // // This function works recursively, grouping and sorting the entry selection. The // 'sort' happens at the same time as the 1st 'group', then separate grouped arrays // are grouped indidvidually and then merged together at the end. The order in which // the grouping occurs is determined by the CMsvEntryArray::TGroupCriterion enum // { TMsvSorting sortType=aOrdering.Sorting(); TKeyArrayFixPtr key=MessageSortKey(sortType); if (aGroupCriterion==EStopGrouping) { // if you haven't sorted yet if (aDoSort) { // Subject based sorting requires a special algorithm. Only message entries are treated as other entries normally // do not have a prefix like e.g. "re: " or "fwd: " if(At(0)->iType == KUidMsvMessageEntry && (sortType == EMsvSortByDescription || sortType == EMsvSortByDescriptionReverse)) { SubjectBasedSortL(sortType == EMsvSortByDescriptionReverse,aOrdering.SubjectSkipString()); } else { CMsvEntryArray* temp=CMsvEntryArray::NewLC(iOrigMtmList); TInt count=Count(); if (count) temp->InsertL(0,&(*(this))[0],count); Reset(); const TMsvEntry** entry = &temp->At(0); while (count--) InsertIsqAllowDuplicatesL(*entry++, key); // Sorted ReverseOrder(sortType); CleanupStack::PopAndDestroy(); // temp } if (At(0)->iType == KUidMsvMessageEntry && (sortType == EMsvSortByDetails || sortType == EMsvSortByDetailsReverse)) { DetailBasedSortL(); // Sort blocks of messages with matching details into newest first } } else { // The aDoSort flag is not set, but we still need to do a subject // based sort if this array contains only message entries, and we are // sorting by description. Alternatively, we need to do a date based sort // if this array contains only message entries and we are sorting by detail. // In order to ensure the array contains only message entries, we // check that we have previously grouped the entries by type which would // have put all the message entries together in their own array. if (Count() > 0 && At(0)->iType == KUidMsvMessageEntry && OkToGroup(EGroupByType, aOrdering)) { if (sortType == EMsvSortByDescription || sortType == EMsvSortByDescriptionReverse) { SubjectBasedSortL(sortType == EMsvSortByDescriptionReverse,aOrdering.SubjectSkipString()); } else if (sortType == EMsvSortByDetails || sortType == EMsvSortByDetailsReverse) { DetailBasedSortL(); // Sort blocks of messages with matching details into newest first } } } return; } if (OkToGroup(aGroupCriterion, aOrdering)) { // // Copy contents into temp and then put new grouped contents into 'this' TInt count=Count(); if (count==0) return; // nothing to do here const TInt numberOfArrays=NumberOfArraysToSplitIntoL(aGroupCriterion); if (numberOfArrays<1) // cannot group on this so move on to next grouping { GroupL(TGroupCriterion(aGroupCriterion+1), aOrdering, aDoSort); return; } CMsvEntryArray* temp; if (iActualMtmList) temp = CMsvEntryArray::NewLC(*iActualMtmList); else temp = CMsvEntryArray::NewLC(iOrigMtmList); temp->InsertL(0,&(*(this))[0],count); Reset(); // // create the separate arrays for each group CArrayFixFlat<CMsvEntryArray*>* arrays=new(ELeave) CArrayFixFlat<CMsvEntryArray*>(numberOfArrays); CleanupStack::PushL(arrays); for (TInt ii=0; ii<numberOfArrays; ii++) { if (iActualMtmList) arrays->AppendL(CMsvEntryArray::NewLC(*iActualMtmList)); else arrays->AppendL(CMsvEntryArray::NewLC(iOrigMtmList)); } // // split the selection into the correct group, // sorting aswell if needed and not doing standard folders const TMsvEntry** entry = &temp->At(0); if (!aDoSort || aGroupCriterion==EGroupByStandardFolders) { while (count--) { arrays->At(ArrayId(*entry,aGroupCriterion))->AppendL(*entry); entry++; } } else if (aGroupCriterion==EGroupByType) { TKeyArrayFixPtr folderKey = TKeyArrayFixPtr(_FOFF(TMsvEntry,iDetails),ECmpCollated); while (count--) { if ((*entry)->iType==KUidMsvFolderEntry) arrays->At(ArrayId(*entry, aGroupCriterion))->InsertIsqAllowDuplicatesL(*entry, folderKey); else arrays->At(ArrayId(*entry, aGroupCriterion))->InsertIsqAllowDuplicatesL(*entry, key); entry++; } for (TInt jj=0; jj<numberOfArrays; jj++) { if (arrays->At(jj)->Count() && arrays->At(jj)->At(0)->iType!=KUidMsvFolderEntry) arrays->At(jj)->ReverseOrder(sortType); } aDoSort=EFalse; } else { while (count--) { arrays->At(ArrayId(*entry, aGroupCriterion))->InsertIsqAllowDuplicatesL(*entry, key); // Sorted entry++; } for (TInt jj=0; jj<numberOfArrays; jj++) arrays->At(jj)->ReverseOrder(sortType); aDoSort=EFalse; } // // group further - but check that standard entries and grouped folders are not grouped anymore if (aGroupCriterion==EGroupByStandardFolders) { __ASSERT_DEBUG(numberOfArrays==2, PanicServer(EMsvToManyGroups)); arrays->At(0)->GroupL(TGroupCriterion(aGroupCriterion+1), aOrdering, aDoSort); } else if (aGroupCriterion==EGroupByType) { for (TInt jj=0; jj<numberOfArrays; jj++) if (arrays->At(jj)->Count() && arrays->At(jj)->At(0)->iType!=KUidMsvFolderEntry) arrays->At(jj)->GroupL(TGroupCriterion(aGroupCriterion+1), aOrdering, aDoSort); } else { for (TInt jj=0; jj<numberOfArrays; jj++) arrays->At(jj)->GroupL(TGroupCriterion(aGroupCriterion+1), aOrdering, aDoSort); } // // merge the separate arrays into 'this' for (TInt kk=0; kk<numberOfArrays; kk++) { count=arrays->At(kk)->Count(); if (count) InsertL(0,&(*(arrays->At(kk)))[0],count); } CleanupStack::PopAndDestroy(numberOfArrays+2); // arrays contents + temp + arrays } else // move on to the next grouping GroupL(TGroupCriterion(aGroupCriterion+1), aOrdering, aDoSort); }
//-------------------------------------------------------------------- //-------------------------------------------------------------------- // void CPosLmNameIndex::InsertL( const CPosLandmark& aLandmark ) { TPtrC name; aLandmark.GetLandmarkName( name ); InsertL( aLandmark.LandmarkId(), name ); }
void CTupleStoreImpl::ConstructL() { CALLSTACKITEM_N(_CL("CTupleStoreImpl"), _CL("ConstructL")); iSubNameIndexLength=40; // name: id, tupletype, TInt cols[]={ EDbColUint32, EDbColInt32, //{ Uid, Id, subname1 }, EDbColInt32, EDbColInt32, EDbColText, // priority, EDbColInt8, // { Uid, Id}, EDbColInt32, EDbColInt32, // data LeaseExpires EDbColLongBinary, EDbColDateTime, // subname2 EDbColText, -1 }; TInt col_flags[]={ TDbCol::EAutoIncrement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // the tuple id is added to indices so that data is read in // the order it arrives TInt idxs[]={ ETupleType, ENameModule, ENameId, ENameSubName2, ETupleId, -2, ETupleId, -2, ETupleType, EComponentModule, EComponentId, EPriority, ETupleId, -2, ELeaseExpires, -1 }; MDBStore::ConstructL(cols, idxs, false, _L("TUPLES"), EFalse, col_flags); iTimer=CTimeOut::NewL(*this, CActive::EPriorityIdle); if (SeekIdL(0)) { TInt version=0; iTable.GetL(); // check version and migrate if necessary version=iTable.ColInt32(ENameId); if (version<KVersion) { SwitchIndexL(-1); // no index TBool found=iTable.FirstL(); while (found) { iTable.GetL(); TUint uid_in_table, new_uid; new_uid=uid_in_table=iTable.ColInt(ENameModule); GetBackwardsCompatibleUid(new_uid); if (new_uid != uid_in_table) { UpdateL(); iTable.SetColL(ENameModule, new_uid); MDBStore::PutL(); } found=iTable.NextL(); } } if (version<=KVersionBeforeExpires) { SwitchIndexL(-1); // no index TBool found=iTable.FirstL(); while (found) { iTable.GetL(); TInt tupletype; TTupleName tn; tn.iModule.iUid=iTable.ColInt(ENameModule); tn.iId=iTable.ColInt(ENameId); tupletype=iTable.ColInt(ETupleType); if ( (!(tn == KCLSettingsTuple)) && tupletype!=ETupleSpaceInternal ) { MDBStore::DeleteL(); } found=iTable.NextL(); } } if (version<KVersionBeforeNewUids) { TInt no_idxs[]={ -1 }; iTable.Close(); DeleteIndices(_L("TUPLES")); CC_TRAPD(err, MDBStore::ConstructL(cols, no_idxs, false, _L("TUPLES"), ETrue, col_flags)); iDb.BeginL(); TTransactionHolder th(*this); TBool found=iTable.FirstL(); while (found) { iTable.GetL(); if ( iTable.ColUint(ETupleId) == 0 ) { UpdateL(); iTable.SetColL(ENameId, KVersion); MDBStore::PutL(); } else if (! iTable.IsColNull(ENameSubName1)) { UpdateL(); iTable.SetColL(ENameSubName2, iTable.ColDes(ENameSubName1).Left(iSubNameIndexLength)); MDBStore::PutL(); } found=iTable.NextL(); } iDb.CommitL(); MDBStore::ConstructL(cols, idxs, false, _L("TUPLES"), ETrue, col_flags); } if (version>=KVersionBeforeNewUids) { CleanOldTuplesL(); } SeekIdL(0); UpdateL(); iTable.SetColL(ENameId, KVersion); MDBStore::PutL(); } else { InsertL(); iTable.SetColL(ETupleType, ETupleSpaceInternal); iTable.SetColL(ENameId, KVersion); iTable.SetColL( ELeaseExpires, Time::MaxTTime() ); MDBStore::PutL(); } }
void AddL( MJuikSizer& aSizer, TInt aProportion, TInt aFlags ) { CALLSTACKITEM_N(_CL("CJuikSizer"), _CL("AddL(MJuikSizer")); auto_ptr<CJuikSizerItem> item( new (ELeave) CJuikSizerSizerItem(aSizer, aProportion, aFlags ) ); InsertL( item.release(), EndIndex() ); }
//-------------------------------------------------------------------- //-------------------------------------------------------------------- // void CPosLmNameIndex::InsertL( TPosLmItemId aLmid, const TDesC& aName ) { HBufC* name = aName.AllocLC(); CleanupStack::Pop( name ); InsertL( aLmid, name ); }