本文整理汇总了C++中CArrayPtr::ResetAndDestroy方法的典型用法代码示例。如果您正苦于以下问题:C++ CArrayPtr::ResetAndDestroy方法的具体用法?C++ CArrayPtr::ResetAndDestroy怎么用?C++ CArrayPtr::ResetAndDestroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArrayPtr
的用法示例。
在下文中一共展示了CArrayPtr::ResetAndDestroy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrepareAndTakePartialLmksL
// -----------------------------------------------------------------------------
// CTestPosLandmarkDatabase::PrepareAndTakePartialLmks
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmarkDatabase::PrepareAndTakePartialLmksL( CStifItemParser& /*aItem*/ )
{
// Open and initialize DB
CPosLandmarkDatabase* lmkDatabase = CPosLandmarkDatabase::OpenL( KDBUri );
CleanupStack::PushL( lmkDatabase );
// Initialize database
ExecuteAndDeleteLD( lmkDatabase->InitializeL() );
// Partial read params
CPosLmPartialReadParameters* readParams = CPosLmPartialReadParameters::NewLC();
// Set attributes, only name
readParams->SetRequestedAttributes( CPosLandmark::ELandmarkName );
// Set partial read params
lmkDatabase->SetPartialReadParametersL( *readParams );
// Get ids of all the landmarks using an iterator
RArray<TPosLmItemId> idArray;
TPosLmItemId id;
CPosLmItemIterator* iterator = lmkDatabase->LandmarkIteratorL();
CleanupStack::PushL( iterator );
if( iterator->NumOfItemsL() == 0 )
{
iLog->Log(_L("No landmark exists in database, PrepareAndTakePartialLmks fails"));
User::Leave( KErrGeneral );
}
// Iterate through all the landmarks and save ids into array
while( ( id = iterator->NextL()) != KPosLmNullItemId )
{
idArray.Append( id );
}
// Prepare partial landmark
CPosLmOperation* operation = lmkDatabase->PreparePartialLandmarksL( idArray );
CleanupStack::PushL( operation );
operation->ExecuteL();
iLog->Log(_L("operation done"));
// Take partial landmark
CArrayPtr<CPosLandmark>* lmkPtrArray = lmkDatabase->TakePreparedPartialLandmarksL( operation );
iLog->Log(_L("Takeprepared done"));
//CleanupStack::PushL(lmkPtrArray);
iLog->Log(_L("PrepareAndTakePartialLmks succeeds"));
// CleanupStack::Pop(lmkPtrArray);
lmkPtrArray->ResetAndDestroy();
iLog->Log(_L("after reset done"));
CleanupStack::PopAndDestroy( 4, lmkDatabase );
ReleaseLandmarkResources();
return KErrNone;
}
示例2: SetBearerListL
void CDirectPrintPrinterSettingView::SetBearerListL(CAknEnumeratedTextPopupSettingItem* item)
{
TInt err = GetBearerMgr()->GetProtocolNames(iBearerList);
if (!err)
{
CArrayPtr<CAknEnumeratedText>* textArray = item->EnumeratedTextArray();
textArray->ResetAndDestroy();
TInt count = iBearerList.Count();
for (TInt i=0; i<count; i++)
{
CAknEnumeratedText* enumText = new (ELeave) CAknEnumeratedText(i, iBearerList[i].iName.AllocLC());
CleanupStack::Pop();
CleanupStack::PushL(enumText);
textArray->AppendL(enumText);
CleanupStack::Pop();
}
}
}
示例3: LoadListL
//.........这里部分代码省略.........
// item6->ConstructL(isNumberedStyle, 6, KName6, icons, R_DATE_SETTING_PAGE, -1);
// iItemList->SettingItemArray()->AppendL(item6);
// CleanupStack::Pop(item6);
//
//
// /* Time offset setting item */
// CAknTimeOffsetSettingItem* item7 = new (ELeave) CAknTimeOffsetSettingItem(7, iTime);
// CleanupStack::PushL(item7);
// // The same resource id can be used for multiple time offset setting pages.
// item7->ConstructL(isNumberedStyle, 7, KName7, icons, R_TIMEOFFSET_SETTING_PAGE, -1);
// iItemList->SettingItemArray()->AppendL(item7);
// CleanupStack::Pop(item7);
//
//
// /* Ip field setting item */
// CAknIpFieldSettingItem* item8 = new (ELeave) CAknIpFieldSettingItem(8, iIp);
// CleanupStack::PushL(item8);
// // The same resource id can be used for multiple ip field setting pages.
// item8->ConstructL(isNumberedStyle, 8, KName8, icons, R_IPFIELD_SETTING_PAGE, -1);
// iItemList->SettingItemArray()->AppendL(item8);
// CleanupStack::Pop(item8);
//
//
// /* Enumerated text setting item */ 更换频率
CAknEnumeratedTextPopupSettingItem* item9 = new (ELeave) CAknEnumeratedTextPopupSettingItem(EItemFreqency, iEnumText);
CleanupStack::PushL(item9);
// The same resource id can be used for multiple enumerated text setting pages.
text = StringLoader::LoadLC(R_SETTING_FREQUENCY_TITLE);
item9->ConstructL(isNumberedStyle, EItemFreqency, text->Des(), icons, R_ENUMERATEDTEXT_SETTING_PAGE, -1, 0, R_POPUP_SETTING_TEXTS);
CleanupStack::PopAndDestroy();
// Load texts dynamically.
texts = item9->EnumeratedTextArray();
texts->ResetAndDestroy();
// 1 hour
text = StringLoader::LoadLC(R_TEXT_FREQUENCY_ONE_HOUR);
enumText = new (ELeave) CAknEnumeratedText(EFrequencyOneHour, text);
CleanupStack::Pop(text);
CleanupStack::PushL(enumText);
texts->AppendL(enumText);
CleanupStack::Pop(enumText);
// 8 hours
text = StringLoader::LoadLC(R_TEXT_FREQUENCY_EIGHT_HOURS);
enumText = new (ELeave) CAknEnumeratedText(EFrequencyEightHours, text);
CleanupStack::Pop(text);
CleanupStack::PushL(enumText);
texts->AppendL(enumText);
CleanupStack::Pop(enumText);
// 1 day
text = StringLoader::LoadLC(R_TEXT_FREQUENCY_ONE_DAY);
enumText = new (ELeave) CAknEnumeratedText(EFrequencyOneDay, text);
CleanupStack::Pop(text);
CleanupStack::PushL(enumText);
texts->AppendL(enumText);
CleanupStack::Pop(enumText);
// 3 days
text = StringLoader::LoadLC(R_TEXT_FREQUENCY_THREE_DAYS);
enumText = new (ELeave) CAknEnumeratedText(EFrequencyThreeDays, text);
CleanupStack::Pop(text);
CleanupStack::PushL(enumText);
texts->AppendL(enumText);
CleanupStack::Pop(enumText);
// 1 week
text = StringLoader::LoadLC(R_TEXT_FREQUENCY_ONE_WEEK);
enumText = new (ELeave) CAknEnumeratedText(EFrequencyOneWeek, text);
CleanupStack::Pop(text);
示例4: CleanupPtrArray
/**
Static convenience cleanup method copied from CSmlContactsDba
*/
void CDeleteMany::CleanupPtrArray(TAny* aCArrayPtr)
{
CArrayPtr<CContactItem>* array = reinterpret_cast<CArrayPtr<CContactItem>*>(aCArrayPtr);
array->ResetAndDestroy();
delete array;
}