本文整理汇总了C++中CDesCArray::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ CDesCArray::Delete方法的具体用法?C++ CDesCArray::Delete怎么用?C++ CDesCArray::Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDesCArray
的用法示例。
在下文中一共展示了CDesCArray::Delete方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteItemL
void CMainMenuGridContainer::DeleteItemL(TInt aIndex)
{
CArrayPtr<CGulIcon>* icons =
iGrid->ItemDrawer()->FormattedCellData()->IconArray();
if (icons && aIndex >= 0 && aIndex < icons->Count()) {
//Delete item if index is valid.
_LIT(KItem, "%d\t\t0");
TBuf<8> buf;
MDesCArray* array = iGrid->Model()->ItemTextArray();
CDesCArray* cArray = (CDesCArray*)array;
//Remove icon and items.
icons->Delete(aIndex);
cArray->Delete(aIndex, (cArray->Count() - aIndex));
iGrid->HandleItemRemovalL();
//Re-add the items behind, needed since we changed the indexes.
for (TInt i = aIndex; i < icons->Count(); i++) {
buf.Format(KItem, i);
cArray->AppendL(buf);
}
//Inform list box that data was added.
iGrid->HandleItemAdditionL();
SetGridGraphicStyleL();
}
}
示例2: ListDatabasesL
// ---------------------------------------------------------
// 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.
}
示例3: DeleteSelectedListBoxItemsL
/**
* Delete the selected item or items from the list box.
*/
void CSettingList::DeleteSelectedListBoxItemsL( CEikTextListBox* aListBox )
{
CAknFilteredTextListBoxModel* model =
static_cast< CAknFilteredTextListBoxModel *> ( aListBox->Model() );
if ( model->NumberOfItems() == 0 )
return;
RArray< TInt >* orderedSelectedIndices = GetSelectedListBoxItemsLC( aListBox );
if ( !orderedSelectedIndices )
return;
// Delete selected items from bottom up so indices don't change on us
CDesCArray* itemArray = static_cast< CDesCArray* > ( model->ItemTextArray() );
TInt currentItem = 0;
for ( TInt idx = orderedSelectedIndices->Count(); idx-- > 0; )
{
currentItem = ( *orderedSelectedIndices )[ idx ];
itemArray->Delete ( currentItem );
}
// dispose the array resources
CleanupStack::PopAndDestroy();
// dispose the array pointer
CleanupStack::PopAndDestroy( orderedSelectedIndices );
// refresh listbox's cursor now that items are deleted
AknListBoxUtils::HandleItemRemovalAndPositionHighlightL(
aListBox, currentItem, ETrue );
}
示例4: LandmarkStoresL
// ---------------------------------------------------------------------------
// CLAPILandmarkStoreManager::LandmarkStoresL
// ---------------------------------------------------------------------------
//
CDesCArray* CLAPILandmarkStoreManager::LandmarkStoresL()
{
JELOG2(EJavaLocation);
// List landmark databases but remove the default store from the array
CDesCArray* stores = iLmDbManager->ListDatabasesLC();
HBufC* defaultDbName = iLmDbManager->DefaultDatabaseUriLC();
// Remove the default database from the store names array. External stores
// are also removed because this API does not support other than stores
// which are located in the file system of the device
TInt count = stores->Count();
for (TInt i = 0; i < count; i++)
{
TPtrC storeUri = stores->MdcaPoint(i);
if (defaultDbName->CompareF(storeUri) == 0 || storeUri.FindF(
KLAPIDefaultProtocol) == KErrNotFound)
{
stores->Delete(i);
break;
}
}
CleanupStack::PopAndDestroy(defaultDbName);
CleanupStack::Pop(stores);
return stores;
}
示例5: AddItemL
void CMainMenuGridContainer::AddItemL(TInt aBitmapId, TInt aMaskId,
TInt aIndex)
{
CArrayPtr<CGulIcon>* icons =
iGrid->ItemDrawer()->FormattedCellData()->IconArray();
if (!icons) {
icons = new ( ELeave ) CAknIconArray(9);
iGrid->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
}
CleanupStack::PushL(icons);
CFbsBitmap* bitmap;
CFbsBitmap* mask;
#ifdef NAV2_CLIENT_SERIES60_V3
AknIconUtils::CreateIconL(bitmap, mask, iView->GetMbmName(),
aBitmapId, aMaskId);
AknIconUtils::SetSize(bitmap, iIconRect.Size(),
EAspectRatioPreservedAndUnusedSpaceRemoved);
#else
bitmap = iEikonEnv->CreateBitmapL(iView->GetMbmName(), aBitmapId);
mask = iEikonEnv->CreateBitmapL(iView->GetMbmName(), aMaskId);
#endif
CleanupStack::PushL(bitmap);
CleanupStack::PushL(mask);
if (aIndex >= 0 && aIndex < icons->Count()) {
icons->InsertL(aIndex, CGulIcon::NewL(bitmap, mask));
} else {
icons->AppendL(CGulIcon::NewL(bitmap, mask));
}
CleanupStack::Pop(mask);
CleanupStack::Pop(bitmap);
CleanupStack::Pop(icons);
_LIT(KItem, "%d\t\t0");
TBuf<8> buf;
MDesCArray* array = iGrid->Model()->ItemTextArray();
CDesCArray* cArray = (CDesCArray*)array;
if (aIndex >= 0 && aIndex < icons->Count()) {
buf.Format(KItem, aIndex);
cArray->InsertL(aIndex, buf);
aIndex++;
//We need to delete and re-index the array since we inserted
//a new icon in the icon array.
cArray->Delete(aIndex, icons->Count() - aIndex);
for (TInt i = aIndex; i < icons->Count(); i++) {
buf.Format(KItem, i);
cArray->AppendL(buf);
}
} else {
buf.Format(KItem, (icons->Count() - 1));
cArray->AppendL(buf);
}
//Inform list box that data was added.
iGrid->HandleItemAdditionL();
}
示例6: TestFindingL
void TestFindingL(CContactDatabase& aDb)
{
test.Next(_L("Test FindLC"));
syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrLocked);
syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrLocked);
CContactItemFieldDef* fieldDef=new(ELeave) CContactItemFieldDef;
CleanupStack::PushL(fieldDef);
fieldDef->AppendL(KUidContactFieldFamilyName);
TRAPD(err,TestFindL(aDb, KGivenEditName, fieldDef, test) );
test(err==KErrLocked);
CleanupStack::PopAndDestroy(fieldDef);
CContactItemFieldDef* fieldDef2=new(ELeave) CContactItemFieldDef;
CleanupStack::PushL(fieldDef2);
fieldDef2->AppendL(KUidContactFieldPhoneNumber);
TRAP(err, TestFindL(aDb, KTelephoneNum, fieldDef2, test) );
test(err==KErrLocked);
CleanupStack::PopAndDestroy(fieldDef2);
test.Next(_L("Test FindInTextDefL"));
TCallBack callBack(findWordSplitterL);
CContactTextDef* textDef=CContactTextDef::NewLC();
textDef->AppendL(TContactTextDefItem(KUidContactFieldFamilyName));
CDesCArray* desArray = new(ELeave) CDesCArrayFlat(5);
desArray->AppendL(_L("e"));
CContactIdArray* arr = NULL;
TRAP(err,arr = TestFindInTextDefL(aDb,*desArray,textDef, callBack, test) );
// test(err==KErrLocked);
desArray->Delete(0);
delete desArray;
//FIX
delete arr;
CleanupStack::PopAndDestroy(textDef);
test.Next(_L("Test FindInTextDefL2"));
TCallBack callBack2(findWordSplitterL);
CContactTextDef* textDef2=CContactTextDef::NewLC();
textDef2->AppendL(TContactTextDefItem(KUidContactFieldFamilyName));
textDef2->AppendL(TContactTextDefItem(KUidContactFieldUrl));
CDesCArray* desArray2 = new(ELeave) CDesCArrayFlat(5);
desArray2->AppendL(_L("e"));
TRAP(err,arr = TestFindInTextDefL(aDb,*desArray2,textDef2, callBack2, test) );
// test(err==KErrLocked);
desArray2->Delete(0);
delete desArray2;
//FIX
delete arr;
CleanupStack::PopAndDestroy(textDef2);
}
示例7: TestFindInTextDefLC
void TestFindInTextDefLC(CContactDatabase& aDb, TContactItemId aIccId, TContactItemId aNonIccId)
{
test.Next(_L("Test FindInTextDefLC"));
// Successful find of icc entry
syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrNone);
syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
TCallBack callBack(findWordSplitterL);
CContactTextDef* textDef=CContactTextDef::NewLC();
textDef->AppendL(TContactTextDefItem(KUidContactFieldFamilyName));
CDesCArray* desArray = new(ELeave) CDesCArrayFlat(5);
desArray->AppendL(_L("icc"));
syncChecker->ResetMethodCallCountsL();
CContactIdArray* array = aDb.FindInTextDefLC(*desArray,textDef,callBack);
//test(syncChecker->ValidateMethodCallCountL() == 3);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aIccId);
CleanupStack::PopAndDestroy(array);
array=NULL;
test.Next(_L("Test searching when ICC locked"));
// Unsuccessful find of icc entry because icc locked
syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrLocked);
syncChecker->ResetMethodCallCountsL();
TRAPD(err,array = aDb.FindInTextDefLC(*desArray,textDef,callBack));
test(syncChecker->ValidateMethodCallCountL() == 1);
test(err==KErrLocked);
test(array==NULL);
desArray->Delete(0);
delete desArray;
// successful find of non-icc entry, even though icc locked
CDesCArray* desArray2 = new(ELeave) CDesCArrayFlat(5);
desArray2->AppendL(_L("non-icc"));
syncChecker->ResetMethodCallCountsL();
array = aDb.FindInTextDefLC(*desArray2,textDef,callBack);
test(syncChecker->ValidateMethodCallCountL() == 0);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aNonIccId);
// both the icc and non-icc entry should match the search criteria, but only the
// non-icc entry should be returned since icc is locked
SetNameField(aDb,aIccId,KNonIccName);
syncChecker->ResetMethodCallCountsL();
TRAP(err,array = aDb.FindInTextDefLC(*desArray2,textDef,callBack));
test(syncChecker->ValidateMethodCallCountL() == 1);
test(err==KErrLocked);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aNonIccId);
desArray2->Delete(0);
delete desArray2;
SetNameField(aDb,aIccId,KIccName);
CleanupStack::PopAndDestroy(2,textDef); // array, textDef
}
示例8: Update
void CPluginsList::Update()
{
CDesCArray* itemArray = static_cast< CDesCArray* > ( iListBox->Model()->ItemTextArray() );
if (itemArray->Count()>0){itemArray->Delete(0,itemArray->Count());}
iListBox->HandleItemAdditionL();
TInt i=0;
for (i=0; i<((CPluginsListView*)iCommandObserver)->iPlugins->Count(); i++)
{
TBuf<255> Buf;
CreateListBoxItemL(Buf,((CPluginsListView*)iCommandObserver)->iPlugins->At(i).iName,((CPluginsListView*)iCommandObserver)->iPlugins->At(i).iDescription);
AddListBoxItemL(iListBox,Buf);
}
}
示例9: CheckCodeViewStringsL
// -----------------------------------------------------------------------------
// CSecModUIModel::CheckCodeViewStringsL(MDesCArray& aItemArray)
// -----------------------------------------------------------------------------
//
void CSecModUIModel::CheckCodeViewStringsL(MDesCArray& aItemArray)
{
LOG_ENTERFN("CSecModUIModel::CheckCodeViewStringsL()");
InitAuthObjectsL();
ListAuthObjectsL();
if (0 >= iAOArray.Count())
{
// Handle error
}
else if (1 == iAOArray.Count())
{
// Only PIN-G exists, let's remove "signing codes" from the list
CDesCArray* itemArray = STATIC_CAST(CDesCArray*, &aItemArray);
itemArray->Delete(1); // signing code is in the second position
}
示例10: ChangeItemSubtitle
void CMainView::ChangeItemSubtitle(TInt aIndex,TDes16& aText)
{
TInt b=iMain->ListBox()->Model()->NumberOfItems();
TBuf<255> prev = iMain->ListBox()->Model()->ItemText(aIndex);
TChar a = '\t';
TInt pos = prev.LocateReverse(a);
if (pos != KErrNotFound)
{
TInt replace_length = prev.Length() - pos;
prev.Delete(pos+1, replace_length);
prev.Insert(pos+1, aText);
}
CDesCArray* itemArray = static_cast<CDesCArray*> (iMain->ListBox()->Model()->ItemTextArray());
itemArray->Delete(aIndex);
itemArray->InsertL(aIndex,prev);
iMain->ListBox()->DrawNow();
}
示例11: PreLayoutDynInitL
void CTcSettingsDialog::PreLayoutDynInitL()
{
CEikChoiceList* iapList =
reinterpret_cast< CEikChoiceList* >( Control( ECtrlIAPName ) );
CDesCArray* names = iapList->DesCArray();
names->Delete( 0 ); // delete dummy item from array
TInt count = iIAPManager->MdcaCount();
for( TInt i = 0; i < count; i++ )
{
TBuf< KCommsDbSvrMaxFieldLength > name16;
name16.Copy( iIAPManager->MdcaPoint( i ) );
names->AppendL( name16 );
if( (TInt)iIAPManager->Id( i ) == iSettings.iIAPId )
{
iapList->SetCurrentItem( i );
}
}
SetChoiceListCurrentItem( ECtrlConnection, iSettings.iBearerType );
TBuf<40> remoteAddrText;
iSettings.iTCPRemoteAddr.Output( remoteAddrText );
SetEdwinTextL(ECtrlRemoteAddr, &remoteAddrText);
SetNumberEditorValue( ECtrlTcpPort, iSettings.iTCPPort );
SetChoiceListCurrentItem( ECtrlCSYName, iSettings.iCSYName );
SetChoiceListCurrentItem( ECtrlCommPort, iSettings.iCommPort );
SetNumberEditorValue( ECtrlBaudrate, iSettings.iBaudrate );
TInt autoconnect( 1 );
if( !iSettings.iAutoConnect )
{
autoconnect = 0; // no autoconnect
}
SetChoiceListCurrentItem( ECtrlAutoConnect, autoconnect );
}
示例12: RefreshDeviceListL
// ---------------------------------------------------------
// CBTUiDeviceContainer::RefreshDeviceListL
// This function will refresh only the changed parts of the
// screen, if any.
// ---------------------------------------------------------
void CBTUiDeviceContainer::RefreshDeviceListL(const RDeviceArray* aDeviceArray,TInt selectedItem)
{
TRACE_FUNC_ENTRY
MDesCArray* itemTextArray = iDeviceList->Model()->ItemTextArray();
CDesCArray* itemArray = (CDesCArray*) itemTextArray;
TBool removal=EFalse;
TBool addition=EFalse;
TInt previouslySelected=CurrentItemIndex();
TBTDeviceName listItem;
TInt deviceCount = aDeviceArray->Count();
TInt i = 0;
for( ; i < deviceCount; i++)
{
TBTDevice device = *(*aDeviceArray)[i];
CreateListItemL(device, listItem);
if(itemArray->Count()<=i)
{
itemArray->AppendL(listItem);
addition=ETrue;
}
else
if(listItem != (*itemArray)[i] )
{
itemArray->Delete(i);
itemArray->InsertL(i,listItem);
removal=ETrue;
addition=ETrue;
}
}
if(itemArray->Count()-i>=0)
{
itemArray->Delete(i,itemArray->Count()-i);
removal=ETrue;
}
if(removal)
iDeviceList->HandleItemRemovalL();
if(addition)
iDeviceList->HandleItemAdditionL();
if(deviceCount >0 )
iDeviceList->SetCurrentItemIndex( Max(selectedItem,0 )) ;
else
{
HBufC* devEmptyText = NULL;
if(iGroup ==EGroupPaired)
{
devEmptyText=iCoeEnv->AllocReadResourceLC( R_BT_NO_PAIRED_DEVICES);
}
else
{
devEmptyText=iCoeEnv->AllocReadResourceLC( R_BT_NO_BLOCKED_DEVICES);
}
iDeviceList->View()->SetListEmptyTextL(*devEmptyText );
CleanupStack::PopAndDestroy(devEmptyText);
}
if(addition | removal | previouslySelected!=selectedItem)
iDeviceList->DrawDeferred();
TRACE_FUNC_EXIT
}