本文整理汇总了C++中TArray::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ TArray::Count方法的具体用法?C++ TArray::Count怎么用?C++ TArray::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TArray
的用法示例。
在下文中一共展示了TArray::Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConstructL
void CPostProcessorInfo::ConstructL(const TDesC& aManufacturer,
const TDesC& aIdentifier,
const TArray<TUncompressedVideoFormat>& aSupportedFormats,
const TArray<TUint32>& aSupportedCombinations,
const TArray<TScaleFactor>& aSupportedScaleFactors,
const TDesC8& aImplementationSpecificInfo)
{
iManufacturer = aManufacturer.AllocL();
iIdentifier = aIdentifier.AllocL();
iImplementationSpecificInfo = aImplementationSpecificInfo.AllocL();
TInt i=0;
TInt supportedFormatsCount = aSupportedFormats.Count();
for (i=0; i<supportedFormatsCount; i++)
{
User::LeaveIfError(iSupportedFormats.Append(aSupportedFormats[i]));
}
TInt supportedCombinationsCount = aSupportedCombinations.Count();
for (i=0; i<supportedCombinationsCount; i++)
{
User::LeaveIfError(iSupportedCombinations.Append(aSupportedCombinations[i]));
}
TInt supportedScaleFactors = aSupportedScaleFactors.Count();
for (i=0; i<supportedScaleFactors; i++)
{
User::LeaveIfError(iSupportedScaleFactors.Append(aSupportedScaleFactors[i]));
}
}
示例2: FindAllL
// ----------------------------------------------------------------------------------------------------------
// Find the items matching the media specifications
// ----------------------------------------------------------------------------------------------------------
//
void CTestCollectionPlugin::FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs)
{
LOG1(_L("CTestCollectionPlugin::FindAllL"));
const TDesC& title = aCriteria.ValueText( KMPXMediaGeneralTitle );
if(title == _L("CollectionPluginTest0128") ||
title == _L("CollectionPluginTest0129") )
{
// Return exact copy
CMPXMedia* media = CMPXMedia::NewL();
(*media) = aCriteria;
CleanupStack::PushL( media );
media->SetTObjectValueL<TInt>(KMPXMediaGeneralSize, aAttrs.Count());
iObs->HandleFindAll(media, KErrNone);
CleanupStack::PopAndDestroy( media );
}
else if(title == _L("CollectionPluginTest0130") )
{
// Return error
CMPXMedia* media = CMPXMedia::NewL();
(*media) = aCriteria;
CleanupStack::PushL( media );
media->SetTObjectValueL<TInt>(KMPXMediaGeneralSize, aAttrs.Count());
iObs->HandleFindAll(media, KErrArgument);
CleanupStack::PopAndDestroy( media );
}
else
{
User::Panic(_L("CTestCollectionPlugin::FindAllL panic"), 1); // magic number
}
}
示例3: MakeSortingItemsL
// -----------------------------------------------------------------------------
// MakeSortingItemsL
// Add/Make items to sorting item array and undefined items to
// undefined item array
// -----------------------------------------------------------------------------
//
void MakeSortingItemsL( RArray<TCLFSortingItem>& aSortingItemArray,
RPointerArray<MCLFItem>& aUndefinedItemArray,
const TArray<MCLFItem*>& aItemArray,
const TArray<TCLFFieldId> aSortFields,
TCLFItemDataType aSortingDataType )
{
const TInt sortingFieldsCount( aSortFields.Count() );
const TInt count( aItemArray.Count() );
for( TInt i = 0 ; i < count ; ++i )
{
MCLFItem* seItem = aItemArray[i];
TCLFSortingItem sortingItem;
TInt fieldIdIndex( -1 );
TInt error( KErrNone );
do
{
++fieldIdIndex;
TCLFFieldId fieldId( aSortFields[fieldIdIndex] );
switch( aSortingDataType )
{
case ECLFItemDataTypeDesC:
{
error = seItem->GetField( fieldId, sortingItem.iData );
break;
}
case ECLFItemDataTypeTInt32:
{
error = seItem->GetField( fieldId, sortingItem.iIntData );
break;
}
case ECLFItemDataTypeTTime:
default:
{
error = seItem->GetField( fieldId, sortingItem.iTimeData );
break;
}
}
} while( ( error != KErrNone ) &&
( fieldIdIndex < ( sortingFieldsCount - 1 ) ) );
if( error == KErrNone )
{
sortingItem.iItem = seItem;
aSortingItemArray.AppendL( sortingItem );
}
else
{ // field not found -> undefined item
aUndefinedItemArray.AppendL( seItem );
}
}
}
示例4: HandleModelUpdateL
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//
void CMnrpNaviControl::HandleModelUpdateL()
{
TArray< CMnrpNaviModel::CListItem* > items = iModel->ListItemsL();
const TInt KGranularity = 8;
CDesCArraySeg* array = new (ELeave) CDesCArraySeg( KGranularity );
CleanupStack::PushL( array );
_LIT( KItemFormat, "%S\t%S\t\t" );
for ( TInt i = 0; i < items.Count(); i++ )
{
CMnrpNaviModel::CListItem* item = items[i];
const TInt KNumTabsAndOther = 10;
HBufC* text = HBufC::NewLC(
item->Header().Length() + item->Value().Length() + KNumTabsAndOther);
text->Des().Format( KItemFormat, &(item->Header()), &(item->Value()) );
array->AppendL( *text );
CleanupStack::PopAndDestroy( text );
}
CleanupStack::Pop( array );
CTextListBoxModel* model = iListBox->Model();
model->SetItemTextArray( array );
model->SetOwnershipType( ELbmOwnsItemArray );
iListBox->HandleItemAdditionL();
}
示例5: CombineFilterL
// ---------------------------------------------------------------------------
// CXIMPContextEventFilter::CombineFilterL()
// ---------------------------------------------------------------------------
//
void CXIMPContextEventFilter::CombineFilterL(
const TArray< CXIMPContextEventFilter* >& aFilters )
{
const TInt filterCount = aFilters.Count();
CArrayFix< TInt32 >* combinedEvents = new (ELeave) CArrayFixFlat< TInt32 >( KXIMPEventListGranurality );
CleanupStack::PushL( combinedEvents );
for( TInt ix = 0; ix < filterCount; ix++ )
{
const CXIMPContextEventFilter* sourceFilter = aFilters[ ix ];
if( sourceFilter->iAcceptedEvents )
{
CopyUniqueEventsL( sourceFilter->iAcceptedEvents->Array(),
*combinedEvents );
}
else
{
//Set all accepted
delete combinedEvents;
combinedEvents = NULL;
break;
}
}
delete iAcceptedEvents;
iAcceptedEvents = combinedEvents;
CleanupStack::Pop(); //combinedEvents
}
示例6: ConstructL
// -----------------------------------------------------------------------------
// CTelephonyAudioRoutingProxy::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CTelephonyAudioRoutingProxy::ConstructL()
{
TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingProxy[%x]::ConstructL"),this);
User::LeaveIfError(iSession.ConnectL(*this, iObserver));
// Make sure session is set up with default values from server for its local variables:
iSession.GetDefaultValuesL();
CTelephonyAudioRouting::TAudioOutput audioOutput = Output();
// Get stored values for audio output and array and store values in local variables:
TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t CTelephonyAudioRoutingProxy::ConstructL, current iAudioOutput retrieved from server: %d"), audioOutput);
TArray<CTelephonyAudioRouting::TAudioOutput> availableOutputArray = AvailableOutputs();
TInt count = availableOutputArray.Count();
TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t ConstructL: Count = %d "), count);
for(TInt i = 0; i < count; i++)
{
TELAUDRTNG_RDEBUG1(_L("[TELAUDRTNG]\t ConstructL: availableOutputs[i] = %d "),availableOutputArray[i]);
}
iSession.NotifyIfOutputChanged();
iSession.NotifyIfAvailableOutputsChanged();
}
示例7: AddAttrbuteL
// ----------------------------------------------------------------------------------------------------------
// Add specify attribute to Media
// ----------------------------------------------------------------------------------------------------------
//
void CTestCollectionPlugin::AddAttrbuteL(CMPXMedia& aMedia,
const TInt aId,
const TDesC& aTitle,
const TDesC& aUri,
const TArray<TMPXAttribute>& aAttrs)
{
TInt attrCnt = aAttrs.Count();
for(TInt i = 0; i < attrCnt; i++)
{
if(aAttrs[i].ContentId() == KMPXMediaIdGeneral)
{
TInt attrId = aAttrs[i].AttributeId();
if(attrId & EMPXMediaGeneralId)
{
aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aId);
}
if(attrId & EMPXMediaGeneralTitle)
{
aMedia.SetTextValueL(KMPXMediaGeneralTitle, aTitle);
}
if(attrId & EMPXMediaGeneralUri)
{
aMedia.SetTextValueL(KMPXMediaGeneralUri, aUri);
}
}
}
}
示例8: GetAlertForTestL
void T_MProfile::GetAlertForTestL()
{
__UHEAP_MARK;
TArray<TContactItemId> array = iProfile->AlertForL();
__UHEAP_MARKEND;
EUNIT_ASSERT( array.Count() == 0 );
}
示例9: AppendItemsToArrayL
// -----------------------------------------------------------------------------
// AppendItemsArrayL
// -----------------------------------------------------------------------------
//
void AppendItemsToArrayL( const TArray<MCLFItem*>& aSourceArray,
RPointerArray<MCLFItem>& aDestArray )
{
for( TInt i = aSourceArray.Count() - 1; i >=0; i--)
{
aDestArray.AppendL( aSourceArray[ i ] );
}
}
示例10: AppendSortingItemsToArrayReverseL
// -----------------------------------------------------------------------------
// AppendSortingItemsArrayReverseL
// -----------------------------------------------------------------------------
//
void AppendSortingItemsToArrayReverseL(
const TArray<TCLFSortingItem>& aSourceArray,
RPointerArray<MCLFItem>& aDestArray )
{
for( TInt i = aSourceArray.Count() - 1 ; i > -1 ; --i )
{
aDestArray.AppendL( aSourceArray[i].iItem );
}
}
示例11: AppendSortingItemsToArrayL
// -----------------------------------------------------------------------------
// AppendSortingItemsArrayL
// -----------------------------------------------------------------------------
//
void AppendSortingItemsToArrayL( const TArray<TCLFSortingItem>& aSourceArray,
RPointerArray<MCLFItem>& aDestArray )
{
const TInt count( aSourceArray.Count() );
for( TInt i = 0 ; i < count ; ++i )
{
aDestArray.AppendL( aSourceArray[i].iItem );
}
}
示例12: ExternalizeL
// ----------------------------------------------------------------------------
// Externalize an array of itemids to stream
// ----------------------------------------------------------------------------
//
EXPORT_C void MPXUser::ExternalizeL(const TArray<TMPXItemId>& aArray, RWriteStream& aStream)
{
TInt n=aArray.Count();
aStream.WriteInt32L(n);
for (TInt i=0;i<n;++i)
{
aStream.WriteUint32L(aArray[i].iId1);
aStream.WriteUint32L(aArray[i].iId2);
}
}
示例13: testReadAny
LOCAL_C void testReadAny(const TArray<TBufC<0x20> > anArray)
//
// Test with fixed length arrays.
//
{
test(anArray.Count()==KMaxStrings);
for (TInt i=0;i<KMaxStrings;i++)
test(anArray[i]==(*strSorted[i]));
}
示例14: GetPresetNamesL
// -----------------------------------------------------------------------------
// CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetNamesL
// Gets list of preset names available.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
void CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetNamesL(
CDesCArray& aPresetNames)
{
LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetNamesL +");
TArray< TEfEnvironmentalReverbUtilityPreset > presetNames =
iEmptyEnvironmentalReverbUtility->Presets();
TInt presetCount = presetNames.Count();
for (TInt i = 0; i < presetCount; i++)
{
aPresetNames.AppendL(presetNames[ i ].iPresetName);
}
LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetNamesL -");
}
示例15: AddAttributePlaybackFwTestL
// ----------------------------------------------------------------------------------------------------------
// Add specify attribute to Media specific for Playback framework
// test cases
// ----------------------------------------------------------------------------------------------------------
//
void CTestCollectionPlugin::AddAttributePlaybackFwTestL(CMPXMedia& aMedia,
const TInt aId,
const TArray<TMPXAttribute>& aAttrs)
{
TInt attrCnt = aAttrs.Count();
for(TInt i = 0; i < attrCnt; i++)
{
TInt attrId = aAttrs[i].AttributeId();
if(aAttrs[i].ContentId() == KMPXMediaIdGeneral)
{
if(attrId & EMPXMediaGeneralType)
{
AddAttributeGeneralTypeL(aMedia, aId);
}
if(attrId & EMPXMediaGeneralCategory)
{
AddAttributeGeneralCategoryL(aMedia, aId);
}
if(attrId & EMPXMediaGeneralDuration)
{
AddAttributeGeneralDurationL(aMedia, aId);
}
if(attrId & EMPXMediaGeneralLastPlaybackPosition)
{
AddAttributeGeneralLastPlaybackPositionL(aMedia, aId);
}
}
else if(aAttrs[i].ContentId() == KMPXMediaIdMusic)
{
if(attrId & EMPXMediaMusicArtist)
{
AddAttributeMusicArtistL(aMedia, aId);
}
}
else if(aAttrs[i].ContentId() == KMPXMediaIdDrm)
{
if(attrId & EMPXMediaDrmType)
{
AddAttributeDrmTypeL(aMedia, aId);
}
if(attrId & EMPXMediaDrmProtected)
{
AddAttributeDrmProtectedL(aMedia, aId);
}
if(attrId & EMPXMediaDrmRightsStatus)
{
AddAttributeDrmRightsStatusL(aMedia, aId);
}
}
}
}