本文整理汇总了C++中CArrayPtr::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ CArrayPtr::Count方法的具体用法?C++ CArrayPtr::Count怎么用?C++ CArrayPtr::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArrayPtr
的用法示例。
在下文中一共展示了CArrayPtr::Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
示例3: DecodeOCSPResponseL
void COCSPResponseDecoder::DecodeOCSPResponseL(const TDesC8& aEncoding)
{
CArrayPtr<TASN1DecGeneric>* items = DecodeSequenceLC(aEncoding, 1, 2);
// Use integer decoding for enumerated
TASN1DecInteger decInt;
TInt status = decInt.DecodeDERShortL(*items->At(0));
if (status == ESuccessfulEncoding)
{
if (items->Count() != 2)
{
User::Leave(OCSP::EMalformedResponse);
}
// Check tag on second part is [0]
// We ignore any other parts in the sequence after that
TASN1DecGeneric& responseBytesDec = *items->At(1);
if (responseBytesDec.Tag() != KResponseBytesTag)
{
User::Leave(OCSP::EMalformedResponse);
}
// It's OK, so decode the response bytes object therein
DecodeResponseBytesL(responseBytesDec.GetContentDER());
}
else
{
if (items->Count() != 1)
{
User::Leave(KErrArgument);
}
switch (status)
{
case EMalformedRequestEncoding:
User::Leave(OCSP::EMalformedRequest);
case EInternalErrorEncoding:
User::Leave(OCSP::EServerInternalError);
break;
case ETryLaterEncoding:
User::Leave(OCSP::ETryLater);
break;
case ESigRequiredEncoding:
User::Leave(OCSP::ESignatureRequired);
break;
case EUnauthorisedEncoding:
User::Leave(OCSP::EClientUnauthorised);
break;
default:
User::Leave(OCSP::EMalformedResponse);
}
}
CleanupStack::PopAndDestroy(items);
}
示例4: DecodeResponseExtensionL
void COCSPResponseDecoder::DecodeResponseExtensionL(const TDesC8& aEncoding)
{
CArrayPtr<TASN1DecGeneric>* items = DecodeSequenceLC(aEncoding, 2, 3);
// Get oid
TASN1DecGeneric& oid = *items->At(0);
if (oid.Tag() != EASN1ObjectIdentifier)
{
User::Leave(OCSP::EMalformedResponse);
}
TASN1DecObjectIdentifier oidDec;
HBufC* oidVal = oidDec.DecodeDERL(oid);
CleanupStack::PushL(oidVal);
TBool critical = EFalse; // Default value of critical flag
if (items->Count() == 3)
{
// The critical flag is specified - what does it say?
TASN1DecBoolean decBool;
critical = decBool.DecodeDERL(*items->At(1));
}
TASN1DecGeneric& extnVal = items->Count() == 3 ? *items->At(2) : *items->At(1);
if (extnVal.Tag() != EASN1OctetString)
{
User::Leave(OCSP::EMalformedResponse);
}
// Check oid to decide what to do
if (*oidVal == KOCSPOidNonce)
{
iResponse->iNonce.Set(extnVal.GetContentDER());
}
else if (*oidVal == KOCSPOidArchiveCutoff)
{
TASN1DecGeneralizedTime decGT;
TInt pos = 0;
iResponse->iArchiveCutoff = new (ELeave) TTime(decGT.DecodeDERL(extnVal.GetContentDER(), pos));
}
else if (critical)
{
// Didn't understand extension, and it was critical! Erk!
User::Leave(OCSP::EUnknownCriticalExtension);
}
CleanupStack::PopAndDestroy(2, items); // oidVal, items
}
示例5: EditItemL
// -----------------------------------------------------------------------------
// CSIPSettListSIPProfSetADestListItem::EditItemL
// Called before the pop-up list is shown. Updates it, if there was a
// non-matching destination UID at the start-up
// -----------------------------------------------------------------------------
//
void CSIPSettListSIPProfSetDestListItem::EditItemL(
TBool aCalledFromMenu )
{
__GSLOGSTRING("CSIPSettListSIPProfSetDestListItem::EditItemL" )
// Set backup value.
iBackupValue = iEnumValue;
if ( iEnumValue == KUnknownAPUID )
{
// destination was not found, create list for user to change the
// destination.
// The destination will be anyway changed; no matter does the user
// press Cancel or not..(Chosen destination will be the first one
// on the list, if user presses Cancel)
CArrayPtr<CAknEnumeratedText>* textArray = NULL;
CArrayPtr<HBufC>* nullTextArray = NULL;
InitializeListL( textArray, nullTextArray );
if ( textArray->Count() > KErrNone )
{
// There might be situation that no destinationss exist.
iEnumValue = textArray->At( KErrNone )->EnumerationValue();
}
SetEnumeratedTextArrays( textArray, nullTextArray );
HandleTextArrayUpdateL();
}
CAknEnumeratedTextPopupSettingItem::EditItemL( aCalledFromMenu );
}
示例6: CompleteConstructionL
// -----------------------------------------------------------------------------
// CSIPSettListSIPProfSetDestListItem::CompleteConstructionL
// Fetches and changes the lists after the construction is completed
// -----------------------------------------------------------------------------
//
void CSIPSettListSIPProfSetDestListItem::CompleteConstructionL()
{
__GSLOGSTRING("CSIPSettListSIPProfSetDestListItem::CompleteConstructionL" )
CArrayPtr<CAknEnumeratedText>* textArray = NULL;
CArrayPtr<HBufC>* nullTextArray = NULL;
CAknEnumeratedTextPopupSettingItem::CompleteConstructionL();
// Read the AP list
InitializeListL( textArray, nullTextArray );
// Check that we are pointing to an actual thing, otherwise
// we need to modify this
if ( textArray->Count() > KErrNone && !ValueMatches( textArray ) )
{
// Should display text 'None' when the AP is not found
textArray->ResetAndDestroy();
iEnumValue = KUnknownAPUID;
}
// Set new text arrays
SetEnumeratedTextArrays( textArray, nullTextArray );
// Update the lists internally
HandleTextArrayUpdateL();
}
示例7: DecodeL
// -----------------------------------------------------------------------------
// CCMSEncapsulatedContentInfo::DecodeL
// Decrypts raw data to this instance
// -----------------------------------------------------------------------------
void CCMSEncapsulatedContentInfo::DecodeL( const TDesC8& aRawData )
{
CArrayPtr<TASN1DecGeneric>* itemsData = DecodeSequenceLC( aRawData,
KMinNumberOfSubModules,
KMaxNumberOfSubModules );
// we would not get this far if there is not atleast one
// decoding attribute type
TASN1DecObjectIdentifier decOid;
HBufC* oid = decOid.DecodeDERL( *itemsData->At( 0 ) );
delete iContentType;
iContentType = oid;
// decoding possible content
HBufC8* contDesc = NULL;
if( itemsData->Count() > 1 )
{
TASN1DecGeneric taggedContent( *itemsData->At( 1 ) );
if( taggedContent.Tag() != KContentTag )
{
User::Leave( KErrArgument );
}
TASN1DecOctetString content;
TInt pos = 0;
contDesc = content.DecodeDERL( taggedContent.GetContentDER(), pos );
}
delete iContent;
iContent = contDesc;
CleanupStack::PopAndDestroy( itemsData );
}
示例8: new
// -----------------------------------------------------------------------------
// CCMSX509GeneralNames::SetGeneralNamesL
// GeneralNames setter
// -----------------------------------------------------------------------------
EXPORT_C void CCMSX509GeneralNames::SetGeneralNamesL(
const CArrayPtr< CCMSX509GeneralName >& aGeneralNames )
{
TInt nameCount = aGeneralNames.Count();
if( nameCount == 0 )
{
User::Leave ( KErrArgument );
}
CArrayPtr< CCMSX509GeneralName >* names =
new( ELeave ) CArrayPtrFlat< CCMSX509GeneralName >( nameCount );
CleanupStack::PushL( names );
for( TInt i = 0; i < nameCount; i++ )
{
CCMSX509GeneralName* origName = aGeneralNames[ i ];
CCMSX509GeneralName* name =
CCMSX509GeneralName::NewL( origName->Tag(), origName->Data() );
CleanupStack::PushL( name );
names->AppendL( name );
}
CleanupStack::Pop( nameCount ); // names
CleanupStack::Pop( names );
if( iGeneralNames )
{
iGeneralNames->ResetAndDestroy();
delete iGeneralNames;
}
iGeneralNames = names;
}
示例9: DecodeSequenceLC
// -----------------------------------------------------------------------------
// CCMSX509GeneralNames::DecodeL
// Decrypts raw data to this instance
// -----------------------------------------------------------------------------
void CCMSX509GeneralNames::DecodeL( const TDesC8& aRawData )
{
CArrayPtr< TASN1DecGeneric >* nameData =
DecodeSequenceLC( aRawData );
TInt nameCount = nameData->Count();
if( nameCount == 0 )
{
User::Leave( KErrArgument );
}
CArrayPtr< CCMSX509GeneralName >* names =
new( ELeave ) CArrayPtrFlat< CCMSX509GeneralName >( nameCount );
CleanupStack::PushL( names );
for( TInt i = 0; i < nameCount; i++ )
{
CCMSX509GeneralName* name = CCMSX509GeneralName::NewL( );
CleanupStack::PushL( name );
name->DecodeL( nameData->At( i )->Encoding() );
names->AppendL( name );
}
CleanupStack::Pop( nameCount ); // names
CleanupStack::Pop( names );
CleanupStack::PopAndDestroy( nameData );
if( iGeneralNames )
{
iGeneralNames->ResetAndDestroy();
delete iGeneralNames;
}
iGeneralNames = names;
}
示例10: ResetL
// -----------------------------------------------------------------------------
// CNSmlNotepadDatabase::ResetL
// -----------------------------------------------------------------------------
//
TInt CNSmlNotepadDatabase::ResetL()
{
_NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ResetL(): begin");
TInt err(KErrNone);
CArrayPtr<CNpdItem>* arrNpdItem = NULL;
// Fetch all the available notes from the db
arrNpdItem = FetchItemsLC();
// Delete the Notes
for( TInt count = 0; count < arrNpdItem->Count(); count++ )
{
CCalEntry* entryTobeDeleted(NULL);
entryTobeDeleted = iEntryView->FetchL( arrNpdItem->At(count)->Key() );
if(entryTobeDeleted)
{
CleanupStack::PushL(entryTobeDeleted);
iEntryView->DeleteL(*entryTobeDeleted);
CleanupStack::Pop(entryTobeDeleted);
}
delete entryTobeDeleted;
entryTobeDeleted = NULL;
}
CleanupStack::PopAndDestroy(arrNpdItem);
_NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ResetL(): begin");
return err;
}
示例11: new
// -----------------------------------------------------------------------------
// CCMSAuthenticatedData::DecodeAttributesL
// Decodes an array of attributes
// -----------------------------------------------------------------------------
CArrayPtrFlat< CCMSAttribute >* CCMSAuthenticatedData::DecodeAttributesL(
TASN1DecGeneric* aAttributesDec ) // generic decoder for the sequence
{
TASN1DecSequence sequenceDecoder;
CArrayPtr< TASN1DecGeneric >* attributes =
sequenceDecoder.DecodeDERLC( *aAttributesDec );
TInt attributeCount = attributes->Count();
if( attributeCount < 1 )
{
User::Leave( KErrArgument );
}
CArrayPtrFlat< CCMSAttribute >* retVal =
new( ELeave ) CArrayPtrFlat< CCMSAttribute >( attributeCount );
CleanupStack::PushL( retVal );
for( TInt i = 0; i < attributeCount; i++ )
{
CCMSAttribute* attribute = CCMSAttribute::NewLC();
attribute->DecodeL( attributes->At( i )->Encoding() );
retVal->AppendL( attribute );
// attribute is left in cleanup stack, as retVal has not been pushed
// with ResetAndDestroyPushL
}
CleanupStack::Pop( attributeCount ); // all attributes
CleanupStack::Pop( retVal );
CleanupStack::PopAndDestroy( attributes );
return retVal;
}
示例12: CreateHandleArray
/**
* Creates an item handle array from the paased landmarks
* @param aJniEnv A reference to the JNI environment
* @param aLandmarks The landmarks from which the handles are created
* @return Java integer array. Ownership is transferred to the caller
*/
jintArray CreateHandleArray(JNIEnv& aJniEnv,
const CArrayPtr<CLAPILandmark>& aLandmarks)
{
JELOG2(EJavaLocation);
TInt count = aLandmarks.Count();
jintArray handles = aJniEnv.NewIntArray(count);
if (handles && count > 0)
{
jint* elems = aJniEnv.GetIntArrayElements(handles, NULL);
if (!elems)
{
return NULL; // Error
}
// Make handles from the native side peer objects
for (TInt i = 0; i < count; i++)
{
elems[i] = reinterpret_cast<jint>(aLandmarks[i]);
}
// Elemenet must be released since it is local
aJniEnv.ReleaseIntArrayElements(handles, elems, 0);
}
return handles;
}
示例13: DecodeBasicOCSPResponseL
void COCSPResponseDecoder::DecodeBasicOCSPResponseL(const TDesC8& aEncoding)
{
CArrayPtr<TASN1DecGeneric>* items = DecodeSequenceLC(aEncoding, 3, 4);
// First, the ResponseData object
DecodeResponseDataL(items->At(0)->Encoding());
// Continue, with the AlgorithmIdentifier
iResponse->iSigningAlgorithm = CX509SigningAlgorithmIdentifier::NewL(items->At(1)->Encoding());
// Now move on to the signature
TASN1DecBitString encBS;
iResponse->iSignature = encBS.ExtractOctetStringL(*items->At(2));
// And finally, the certs (if they're there)
if (items->Count() == 4)
{
// Check explicit tag [0]
TASN1DecGeneric& certsDec = *items->At(3);
if (certsDec.Tag() != KCertificatesTag)
{
User::Leave(OCSP::EMalformedResponse);
}
// It's OK, so decode the response bytes object therein
DecodeCertificatesL(certsDec.GetContentDER());
}
CleanupStack::PopAndDestroy(items);
}
示例14: FindEmptySlotL
TInt CJuikIconManagerImpl::FindEmptySlotL()
{
for ( TInt i = 0; i < iIconArray->Count(); i++ )
{
if ( iIconArray->At(i) == NULL )
return i;
}
return KErrNotFound;
}
示例15: MergeL
// ------------------------------------------------------------------------------------------------
// CNSmlDataModBase::MergeL
// Merges data from old item to new item.
// ------------------------------------------------------------------------------------------------
void CNSmlDataModBase::MergeL( TDes8& aNewItem, const TDesC8& aOldItem,TBool aFieldLevel )
{
TBool modified( EFalse );
CVersitParser* newItemParser = ChildCreateParserLC();
RDesReadStream newStream( aNewItem );
CleanupClosePushL( newStream );
newItemParser->InternalizeL( newStream );
CVersitParser* oldItemParser = ChildCreateParserLC();
RDesReadStream oldStream( aOldItem );
CleanupClosePushL( oldStream );
oldItemParser->InternalizeL( oldStream );
// Now we're ready to start analysis
CArrayPtr<CVersitParser>* newEntities = newItemParser->ArrayOfEntities( EFalse );
CArrayPtr<CVersitParser>* oldEntities = oldItemParser->ArrayOfEntities( ETrue );
if( newEntities && oldEntities )
{
CleanupPtrArrayPushL( oldEntities );
for( TInt i = 0; ( i < newEntities->Count() ) && ( i < oldEntities->Count() ); i++ )
{
MergeEntityL( newEntities->At( i ), oldEntities->At( i ), modified, aFieldLevel );
}
CleanupStack::PopAndDestroy(); // oldEntities
}
else
{
MergeEntityL( newItemParser, oldItemParser, modified, aFieldLevel );
}
// Only update if anything was modified in process
if ( modified )
{
aNewItem.Zero();
RDesWriteStream dws( aNewItem );
CleanupClosePushL( dws );
newItemParser->ExternalizeL( dws );
dws.CommitL();
CleanupStack::PopAndDestroy(); // dws
}
CleanupStack::PopAndDestroy( 4 ); // oldStream, oldItemParser, newStream, newItemParser
}