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();
   }
}
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();
}
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);
    }
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
    }
// -----------------------------------------------------------------------------
// 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 );
    }
// -----------------------------------------------------------------------------
// 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();
    }
// -----------------------------------------------------------------------------
// 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 );
	}
// -----------------------------------------------------------------------------
// 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;
	}
// -----------------------------------------------------------------------------
// 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;
	}
// -----------------------------------------------------------------------------
// 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;
	}
// -----------------------------------------------------------------------------
// 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;
    }
/**
 * 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;
}
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);
    }
TInt CJuikIconManagerImpl::FindEmptySlotL()
{
	for ( TInt i = 0; i < iIconArray->Count(); i++ )
		{
			if ( iIconArray->At(i) == NULL ) 
				return i;
		}
	return KErrNotFound;
}
// ------------------------------------------------------------------------------------------------
// 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
	}
示例#16
0
void CDmAdEngine::CompleteCommandsL(CArrayPtr<CDmAdRtNode>& aRtNodes, TInt aStatus)
    {
    TRACE("CDmAdEngine::CompleteCommandsL");
    
    for (TInt i=0; i < aRtNodes.Count(); i++)
        {
        CDmAdRtNode* rtNode = aRtNodes.At(i);
        CompleteCommandsL(*rtNode, aStatus);
        }
    }
void COCSPResponseDecoder::DecodeResponsesL(const TDesC8& aEncoding)
    {
    CArrayPtr<TASN1DecGeneric>* items = DecodeSequenceLC(aEncoding);
    TInt count = items->Count();
    for (TInt index = 0; index < count; ++index)
        {
        DecodeSingleResponseL(items->At(index)->Encoding());
        }

    CleanupStack::PopAndDestroy(items);
    }
void CJuikIconManagerImpl::SetIconsL(TInt aProviderId, CArrayPtr<CGulIcon>& aIcons)
{
	CALLSTACKITEM_N(_CL("CJuikIconManagerImpl"), _CL("SetIconsL"));
	// FIXME: this can be optimized by inlining addiconl functionality
	for ( TInt i=0; i < aIcons.Count(); i++ )
		{
			CGulIcon* icon = aIcons[i];
			aIcons[i] = NULL;
			AddIconL( aProviderId, icon );
		}
}
void CDirectPrintPrinterSettingView::LoadExtendSettingsL()
	{
	CDirectPrintPrintSettings* printSettings = GetBearerMgr()->PrinterSettingsL();
	TInt count = printSettings->iCapabilities.Count();
	for (TInt i=0; i<count; i++)
		{
		switch (printSettings->iCapabilities[i]->iUid)
			{
			case EDirectPrintCapabAP:
				{
				CAknEnumeratedTextPopupSettingItem* item = static_cast<CAknEnumeratedTextPopupSettingItem*>(GetSettingItemL(printSettings->iCapabilities[i]->iTitle));
				CArrayPtr<CAknEnumeratedText>* textArray = item->EnumeratedTextArray();
				TInt count = textArray->Count();

				for (TInt j=0; j<count; j++)
					{
					if (iAccessPointName.Compare((*textArray)[j]->Value()->Des()) == 0)
						{
						CDirectPrintListCapability* capability = static_cast<CDirectPrintListCapability*>(printSettings->iCapabilities[i]);
						capability->iEnumIndex = j;
						capability->iValue = capability->iEnumIDs[j];
						break;
						}
					}
				}
				break;
			case EDirectPrintCapabHost:
				{
				CDirectPrintTextCapability* capability = static_cast<CDirectPrintTextCapability*>(printSettings->iCapabilities[i]);
				capability->iText.Copy(iHost);
				}
				break;
			case EDirectPrintCapabPort:
				{
				printSettings->iCapabilities[i]->iValue = iPort;
				}
				break;
			case EDirectPrintCapabUser:
				{
				CDirectPrintTextCapability* capability = static_cast<CDirectPrintTextCapability*>(printSettings->iCapabilities[i]);
				capability->iText.Copy(iUserName);
				}
				break;
			case EDirectPrintCapabQue:
				{
				CDirectPrintTextCapability* capability = static_cast<CDirectPrintTextCapability*>(printSettings->iCapabilities[i]);
				capability->iText.Copy(iQue);
				}
				break;
			default:
				break;
			}
		}
	}
//********************************************************************************************
void CVersitCardTest::CheckNumberOfSoundPropertiesL(const TDesC& aFileName, const CParserVCard& aParser, TInt aExpectedArrayElementCount, TInt aExpectedPropertyCount)
//
//	Check that the number of SOUND sub-elements are as expected
//
	{
    TheTest.Printf(_L("%S\n"), &aFileName);
    (void) aFileName;
    //
    TBool passedTest = EFalse;
    CArrayPtr<CParserProperty>* properties = aParser.PropertyL(KVersitTokenSOUND, TUid::Uid(KVersitPropertyHBufCUid), EFalse);
    TheTest(properties != NULL);
    if  (properties)
        {
        //
        CleanupStack::PushL(properties);
        const TInt count = properties->Count();
        TheTest(count == aExpectedPropertyCount);
        //
        for(TInt i=0; i<count; i++)
            {
            const CParserProperty* property = properties->At(i);

            // Check that the X-IRMC-N property parameter exists
            const TBool foundParam = property->Param(KSoundExtensionPropertyParameterName) != NULL;
	        TheTest(foundParam);

            // Check property value
            TheTest(property->Value() != NULL);

            CParserPropertyValueHBufC* propertyAsHBufC = static_cast<CParserPropertyValueHBufC*>(property->Value());

            // Check property value as an array
            CParserPropertyValueCDesCArray* valueAsArray = propertyAsHBufC->TreatAsArrayPropertyLC(*property);
            TheTest(valueAsArray->Value() != NULL);
            CDesCArray& array = *valueAsArray->Value();
            //
            const TInt arrayItemCount = array.Count();
            TheTest(arrayItemCount == aExpectedArrayElementCount);
            for(TInt j=0; j<arrayItemCount; j++)
                {
                const TPtrC pValue(array[j]);
                TheTest.Printf(_L("%S\n"), &pValue);
                }
            TheTest.Printf(_L("\n"));
            CleanupStack::PopAndDestroy(valueAsArray);
            //
            passedTest = ETrue;
            }

        CleanupStack::PopAndDestroy(properties);
        }
    TheTest(passedTest);
	}
CArrayPtr<TASN1DecGeneric>* COCSPResponseDecoder::DecodeSequenceLC(const TDesC8& aEncoding,
                                                            const TInt aMinTerms,
                                                            const TInt aMaxTerms)
    {
    CArrayPtr<TASN1DecGeneric>* items = DecodeSequenceLC(aEncoding);
    TInt count = items->Count();
    if (count < aMinTerms || count > aMaxTerms)
        {
        // User::Leave(KErrArgument);
        }

    return items;
    }
void CMainMenuGridContainer::SetIconSizes()
{
#ifdef NAV2_CLIENT_SERIES60_V3
   CArrayPtr<CGulIcon>* icons = 
      iGrid->ItemDrawer()->FormattedCellData()->IconArray();
   if (icons) {
      for (TInt i = 0; i < icons->Count(); i++) {
         AknIconUtils::SetSize((*icons)[i]->Bitmap(), iIconRect.Size(),
                               EAspectRatioPreservedAndUnusedSpaceRemoved);
      }
   }
#endif
}
示例#23
0
CArrayPtr<TASN1DecGeneric>* PKCS7ASN1::DecodeSequenceLC(const TDesC8& aRawData,
															const TInt aMinTerms,
															const TInt aMaxTerms)
	{
	CArrayPtr<TASN1DecGeneric>* items = DecodeSequenceLC(aRawData);
	TInt count = items->Count();
	if(count < aMinTerms || count > aMaxTerms)
		{
		User::Leave(KErrArgument);
		}

	return items;
	}
CArrayPtr<TASN1DecGeneric>* CSTSASN1Sequence::DecodeSequenceLC(TBool aCheckTag,
        const TDesC8& aRawData, TInt aMinTerms)
{
    CArrayPtr<TASN1DecGeneric>* items = DecodeSequenceLC(aCheckTag, aRawData);
    TInt count = items->Count();
    if (count < aMinTerms)
    {
        // not in the range, leave
        User::Leave(KErrArgument);
    }

    return items;
}
// ---------------------------------------------------------------------------
// CAppMngr2ListContainer::DeleteItemSpecificIcons()
// ---------------------------------------------------------------------------
//
void CAppMngr2ListContainer::DeleteItemSpecificIcons( CArrayPtr<CGulIcon>& aIconArray )
    {
    if( iItemSpecificIcons )
        {
        TInt iconArrayCount = aIconArray.Count();
        TInt firstItemSpecificIcon = iconArrayCount - iItemSpecificIcons;
        for( TInt index = firstItemSpecificIcon; index < iconArrayCount; index++ )
            {
            delete aIconArray[ index ];
            }
        aIconArray.Delete( firstItemSpecificIcon, iItemSpecificIcons );
        iItemSpecificIcons = 0;
        }
    }
示例#26
0
void CmsUtils::DecodeDigestAlgorithmsL(RPointerArray<CX509AlgorithmIdentifier>& aDigestAlgorithms, const TDesC8& aRawData)
	{
	CArrayPtr<TASN1DecGeneric>* algsData = PKCS7ASN1::DecodeSequenceLC(aRawData);
	TInt count = algsData->Count();
	CX509AlgorithmIdentifier* alIdent;

	for(TInt item = 0; item < count; item++)
		{
 		alIdent = CX509AlgorithmIdentifier::NewLC(algsData->At(item)->Encoding());
		aDigestAlgorithms.AppendL(alIdent);
		CleanupStack::Pop(alIdent);
		}
	CleanupStack::PopAndDestroy(algsData);			
	}
// -----------------------------------------------------------------------------
// CSIPSettListSIPProfSetTypeListItem::EditItemL
// Called before the pop-up list is shown. Updates it, if there was a 
// non-matching AP UID at the start-up 
// -----------------------------------------------------------------------------
//
void CSIPSettListSIPProfSetTypeListItem::EditItemL( 
    TBool aCalledFromMenu )
    {
    __GSLOGSTRING("CSIPSettListSIPProfSetTypeListItem::EditItemL Start" )
    CArrayPtr<CAknEnumeratedText>* array = EnumeratedTextArray();
    TBool found = EFalse;
    TInt i( 0 );
    for ( i = 0; i < array->Count(); i++ )
        {
        if ( array->At( i )->EnumerationValue() == iEnumValue )
            {
            found = ETrue;
            }
        }

    if ( !found && array->Count() > KErrNone )
        {
        iEnumValue = array->At( 0 )->EnumerationValue();
        }
    
    CAknEnumeratedTextPopupSettingItem::EditItemL( aCalledFromMenu );
    __GSLOGSTRING("CSIPSettListSIPProfSetTypeListItem::EditItemL End" )
    }
void CDirectPrintPrinterSettingView::LoadBearerInfoL()
	{
	TBuf<25> itemTitle;
	CEikonEnv::Static()->ReadResource(itemTitle, R_DIRECTPRINT_PRINTERSETTING_ITEM_BEARER);
	CAknEnumeratedTextPopupSettingItem* item = static_cast<CAknEnumeratedTextPopupSettingItem*>(GetSettingItemL(itemTitle));
	CArrayPtr<CAknEnumeratedText>* textArray = item->EnumeratedTextArray();
	TInt count = textArray->Count();

	for (TInt i=0; i<count; i++)
		{
		if (iBearerName.Compare((*textArray)[i]->Value()->Des()) == 0)
			{
			iBearer = i;
			}
		}
	}
void CDirectPrintPrinterSettingView::LoadItemInfoL(TInt aResouceId, const TDesC& aInfo, TInt& aIndex)
	{
	TBuf<25> itemTitle;
	CEikonEnv::Static()->ReadResource(itemTitle, aResouceId);
	CAknEnumeratedTextPopupSettingItem* item = static_cast<CAknEnumeratedTextPopupSettingItem*>(GetSettingItemL(itemTitle));
	CArrayPtr<CAknEnumeratedText>* textArray = item->EnumeratedTextArray();
	TInt count = textArray->Count();

	for (TInt i=0; i<count; i++)
		{
		if (aInfo.Compare((*textArray)[i]->Value()->Des()) == 0)
			{
			aIndex = i;
			}
		}
	}
示例#30
0
void CMainMenuListContainer::AddItemL(TInt aBitmapId, TInt aMaskId,
                                      TInt aFirstLabelId, TInt aSecondLabelId)
{
    CArrayPtr<CGulIcon>* icons =
        iListBox->ItemDrawer()->FormattedCellData()->IconArray();
    if (!icons) {
        icons = new ( ELeave ) CAknIconArray(3);
        iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
    }
    CleanupStack::PushL(icons);

    CFbsBitmap* bitmap;
    CFbsBitmap* mask;

    AknIconUtils::CreateIconL(bitmap, mask, iView->GetMbmName(),
                              aBitmapId, aMaskId);

    CleanupStack::PushL(bitmap);
    CleanupStack::PushL(mask);

    icons->AppendL(CGulIcon::NewL(bitmap, mask));

    CleanupStack::Pop(mask);
    CleanupStack::Pop(bitmap);
    CleanupStack::Pop(icons);

    HBufC* firstLabel = CEikonEnv::Static()->AllocReadResourceLC(aFirstLabelId);
    HBufC* secondLabel = CEikonEnv::Static()->AllocReadResourceLC(aSecondLabelId);

    HBufC* itemText = HBufC::NewLC(firstLabel->Length() +
                                   secondLabel->Length() + 16);

    itemText->Des().Format(KItem(), (icons->Count() - 1), firstLabel, secondLabel);

    CDesCArray* itemArray =
        static_cast<CDesC16ArrayFlat*>(iListBox->Model()->ItemTextArray());

    itemArray->AppendL(*itemText);

    CleanupStack::PopAndDestroy(itemText);
    CleanupStack::PopAndDestroy(secondLabel);
    CleanupStack::PopAndDestroy(firstLabel);

    iListBox->HandleItemAdditionL();
}