Esempio n. 1
0
// ---------------------------------------------------------------------------
// CPresenceXDM::GetConditionChildNodeL()
// ---------------------------------------------------------------------------
//   
CXdmDocumentNode* CPresenceXDM::GetConditionChildNodeL(const TDesC& aRuleId,
                                     const TDesC& aCondChild, TBool aCreate)
    {
    OPENG_DP(D_OPENG_LIT( " CPresenceXDM::GetConditionChildNodeL()" ) );
    OPENG_DP(D_OPENG_LIT( "      aRuleId = %S, aCondChild = %S, aCreate = %d"),
                                               &aRuleId, &aCondChild, aCreate);
    
    CXdmDocumentNode* conditionNode = GetRuleChildNodeL(aRuleId, KXdmConditions, 
                                                                    aCreate);
    if (!conditionNode)
        return NULL;
    
    RPointerArray<CXdmDocumentNode> nodes;
    CXdmDocumentNode* condChildNode(NULL);


    // Finding condition child node
	conditionNode->Find(aCondChild, nodes);
    OPENG_DP(D_OPENG_LIT( "     GetcondChildNodeL nodeCount = %d"),nodes.Count());
	if(nodes.Count()) // if condition child node exist
	    {
	    condChildNode = nodes[0]; // only one condition child node can exist
	    }
	else if (aCreate) // if asked to create
	    {
	    condChildNode = conditionNode->CreateChileNodeL(aCondChild);
	    }

    nodes.Close();        
    return condChildNode;
    }
Esempio n. 2
0
// ---------------------------------------------------------------------------
// CPresenceXDM::GetAllRulesL()
// ---------------------------------------------------------------------------
//
EXPORT_C void CPresenceXDM::GetAllRulesL(CDesCArray& aRuleIds)
	{
    OPENG_DP(D_OPENG_LIT( "CPresenceXDM::GetAllRulesL" ) );
    CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
    if (!myRootNode)
        return;
    
    RPointerArray<CXdmDocumentNode> nodes;
    CXdmNodeAttribute* idAttribute(NULL);
    
    // Find all rules under root
    if ((myRootNode->Find(KXdmRule, nodes)) == KErrNone)
        { // go through all found rules
        TInt ruleCountInNode = nodes.Count();
        OPENG_DP(D_OPENG_LIT( "     ruleCountInNode = %d" ),ruleCountInNode );
        for (TInt i=0;i<ruleCountInNode;i++)
            { // get the id attribute
            idAttribute = (nodes[i])->Attribute(KXdmId);
            // push it to given discriptor array
            aRuleIds.AppendL(idAttribute->AttributeValue());
            }
        }
    nodes.Close();
    return;
	}
Esempio n. 3
0
void UT_CFCSession::UT_CFCSession_IsFmtAttributeValid2L()
	{
	RPointerArray<CSdpFmtAttributeField>* atts = 
	    new (ELeave) RPointerArray<CSdpFmtAttributeField>(1);
    CleanupStack::PushL(atts);
  
	CSdpFmtAttributeField* fmtatt = CSdpFmtAttributeField::DecodeLC(KInvalid4);
	atts->AppendL(fmtatt);
	
	iFCSession->SetFormatAttributeFieldsL(atts);
	RPointerArray<CSdpFmtAttributeField>& temparray=iFCSession->FormatAttributeFields();

	TInt temp;
	for (TInt aCount=0; aCount < temparray.Count(); aCount++)
    	{
    		if (fmtatt == temparray[ aCount ])
    		{
    			temp=aCount;
    		}
    	}
    EUNIT_ASSERT(iFCSession->IsFmtAttributeValid()==false)
	EUNIT_PRINT(_L( "test is fmtAttributeValid"));
	
	temparray.Close();
	CleanupStack::Pop(fmtatt);//fmtatt
	atts->Close();
	CleanupStack::Pop(atts);//atts
    }
Esempio n. 4
0
// ---------------------------------------------------------------------------
// CPresenceXDM::IsRuleExistInt()
// ---------------------------------------------------------------------------
//	
CXdmDocumentNode* CPresenceXDM::IsRuleExistInt(const TDesC& aRuleId)
    {
	OPENG_DP(D_OPENG_LIT( " CPresenceXDM::IsRuleExistInt(%S)" ),&aRuleId );
    CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
    if (!myRootNode)
        return NULL;
    
    RPointerArray<CXdmDocumentNode> nodes;
    CXdmDocumentNode* desiredNode(NULL);
    CXdmNodeAttribute* idAttribute(NULL);
    
    // Find all rules under  root Node
    if ((myRootNode->Find(KXdmRule, nodes)) == KErrNone)
        { // go through all found rules
        TInt ruleCountInNode = nodes.Count();
        OPENG_DP(D_OPENG_LIT( "     ruleCountInNode = %d" ),ruleCountInNode );
        for (TInt k=0;k<ruleCountInNode;k++)
            { // get the id attribute
            idAttribute = (nodes[k])->Attribute(KXdmId);
            // match it with given attr
            if (idAttribute->AttributeValue() == aRuleId)
                {
                desiredNode = nodes[k];
                break;
                }
            }
        }
    nodes.Close();
    return desiredNode;        
    }
void FmBkupEnginePrivate::ResetAndDestroyArchives( TAny* aPtr )
    {
    RPointerArray< CMMCScBkupArchiveInfo >* archive = 
        static_cast< RPointerArray< CMMCScBkupArchiveInfo >* >( aPtr );
    archive->ResetAndDestroy();
    archive->Close();
    }
	void UpdateListBoxL()
    {
		iSettingItemArray->ResetAndDestroy();
		
		RPointerArray<MSettingFactory> activated;

		for (TInt ordinal = 0; ordinal < iItemDefs.Count(); ordinal++)
			{
				TItemDef def = iItemDefs[ ordinal ];

				MSettingFactory* factory = def.iFactory;
				
				if ( activated.Find( factory) == KErrNotFound )
					{
						factory->ActivateL();
						activated.AppendL( factory );
					}

				CAknSettingItem* item = factory->CreateItemL( def.iIdentifier, ordinal );
				iSettingItemArray->InsertL( ordinal, item );
				//item->SetParentListBox( iListbox );
			}
		
		activated.Close();

		iSettingItemArray->RecalculateVisibleIndicesL();
		// Calling HandleItemAdditional redraws whole list.
		iListbox->HandleItemAdditionL();
 		iListbox->UpdateScrollBarsL();
    }
// ---------------------------------------------------------------------------
// TPresCondIdentityMany::AddIdentitiesInManyExceptL()
// ---------------------------------------------------------------------------
//
EXPORT_C TInt TPresCondIdentityMany::AddIdentitiesInManyExceptL(const TDesC& aRuleID,
        const CDesCArray& aIds, const TDesC& aDomain)
{
    OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::AddIdentitiesInManyExceptL()" ) );
    OPENG_DP(D_OPENG_LIT( "     aRuleID:%S,aDomain:%S"),
             &aRuleID, &aDomain);

    TInt ret(KErrNotFound);

    RPointerArray<CXdmDocumentNode> nodes;
    CXdmDocumentNode* exceptNode(NULL);
    CXdmNodeAttribute* idattr(NULL);

    CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
    TInt entitiesCount = aIds.MdcaCount();
    if(manyNode!=NULL)
    {
        for (TInt i = 0; i<entitiesCount; i++)
        {
            // if id doesnt exists in except
            if (!(IsIdentityExistsInManyExceptL(aRuleID, aIds.MdcaPoint(i), aDomain)))
            {
                exceptNode = manyNode->CreateChileNodeL(KXdmExcept);
                idattr = exceptNode->CreateAttributeL(KXdmId);
                idattr->SetAttributeValueL(aIds.MdcaPoint(i));
                ret = KErrNone;
            }
        }
        ret = KErrNone;
    }

    OPENG_DP(D_OPENG_LIT( "     return: %d"),ret);
    nodes.Close();
    return ret;
}
	void RemoveContainerL()
	{
		if ( iContainer )
			{
				AppUi()->RemoveFromViewStack( *this, iContainer );
			}

		RPointerArray<MSettingFactory> deactivated;		
		for (TInt ordinal = 0; ordinal < iItemDefs.Count(); ordinal++)
			{
				TItemDef def = iItemDefs[ ordinal ];

				MSettingFactory* factory = def.iFactory;
				
				if ( deactivated.Find( factory) == KErrNotFound )
					{
						factory->DeactivateL();
						deactivated.AppendL( factory );
					}
			}
		deactivated.Close();


		delete iListbox;
		iListbox = NULL;
		
		if ( iSettingItemArray )
			iSettingItemArray->ResetAndDestroy();
		delete iSettingItemArray;
		iSettingItemArray = NULL;
		
		delete iContainer;
		iContainer = NULL;
	}
// ---------------------------------------------------------------------------
// TPresCondIdentityMany::GetManyIdentityElementsL()
// ---------------------------------------------------------------------------
//
EXPORT_C TInt TPresCondIdentityMany::GetManyIdentityElementsL(const TDesC& aRuleID,
        CDesCArray& aDomains)
{
    OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::GetManyIdentityElementsL()" ) );
    OPENG_DP(D_OPENG_LIT( "     aRuleID = %S" ),&aRuleID);

    __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));

    CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID,
                                     KXdmIdentity, EFalse);
    if(identityNode==NULL)
        return 0;

    RPointerArray<CXdmDocumentNode> nodes;
    CXdmNodeAttribute* domainAttr(NULL);

    // finding 'many' nodes
    TInt err = identityNode->Find(KXdmMany, nodes);

    // extracting entities from id nodes
    TInt manyCountInNode = nodes.Count();

    OPENG_DP(D_OPENG_LIT( "     manyCountInNode = %d" ),manyCountInNode);

    for (TInt i=0; i<manyCountInNode; i++)
    {   // get the domain attribute
        domainAttr = (nodes[i])->Attribute(KXdmDomain);
        if(domainAttr)
            // push it to given discriptor array
            aDomains.AppendL(domainAttr->AttributeValue());
    }

    nodes.Close();
    return manyCountInNode;
}
Esempio n. 10
0
// ---------------------------------------------------------------------------
// CPresenceXDM::DeleteEmptyRules()
// ---------------------------------------------------------------------------
//    
EXPORT_C void CPresenceXDM::DeleteEmptyRulesL()
    {
	OPENG_DP(D_OPENG_LIT( "CPresenceXDM::DeleteEmptyRules" ));
    CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
    if (!myRootNode)
        return; // return if no rule exists
        
    RPointerArray<CXdmDocumentNode> nodes;

    // Find all rules under  root Node
    if ((myRootNode->Find(KXdmRule, nodes)) == KErrNone)
        { // go through all found rules
        TInt ruleCountInNode = nodes.Count();
        OPENG_DP(D_OPENG_LIT( "     ruleCountInNode = %d" ),ruleCountInNode );
        
        for (TInt i=0;i<ruleCountInNode;i++)
            {
            if ( ((nodes[i])->NodeCount()) == 0)// if rule is empty
                {
                iPresDocument->RemoveFromModelL(nodes[i]);
                OPENG_DP(D_OPENG_LIT( "     delete at i = %d" ), i);
                }
            }
        }
    nodes.Close();
    }
void CNSmlDummyDataProvider_Test::DoSupportedServerFiltersL()
    {
    RPointerArray< CSyncMLFilter > filterArray;
    filterArray = iCNSmlDummyDataProvider->DoSupportedServerFiltersL();
    filterArray.ResetAndDestroy();
    filterArray.Close();
    }
// ---------------------------------------------------------------------------
// TPresCondValidity::GetValidityNode()
// ---------------------------------------------------------------------------
//    
CXdmDocumentNode* TPresCondValidity::GetValidityNodeL(const TDesC& aRuleID, 
                                                        TBool aCreate)
    {
    OPENG_DP(D_OPENG_LIT( " TPresCondValidity::GetValidityNodeL()" ) );
    OPENG_DP(D_OPENG_LIT( "     GetValidityNodeL aRuleID = %S, aCreate = %d"),
                                                            &aRuleID, aCreate);
    
    __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));                                                        
    
    CXdmDocumentNode* conditionNode = iPresXDM->GetRuleChildNodeL(aRuleID, 
                                                    KXdmConditions, aCreate);
    if (conditionNode==NULL)
        return conditionNode;

    RPointerArray<CXdmDocumentNode> nodes;
    CXdmDocumentNode* validityNode(NULL);

    // Finding sphere node
	conditionNode->Find(KXdmValidity, nodes);
    OPENG_DP(D_OPENG_LIT( "     GetValidityNodeL nodeCount = %d"),nodes.Count());
	if(nodes.Count()) // if identity node exist
	    {
	    validityNode = nodes[0]; // only one sphere node can exist
	    }
	else if (aCreate) // if asked to create
	    {
	    validityNode = conditionNode->CreateChileNodeL(KXdmValidity);
	    }

    nodes.Close();        
    return validityNode;   
    }
// ----------------------------------------------------------
// CSimplePresenceList::ResetAndDestroy
// ----------------------------------------------------------
//
void CSimplePresenceList::ResetAndDestroy( TAny* aPtrArray )
    {
    RPointerArray<CBodyPart>* array =
    	static_cast<RPointerArray<CBodyPart>*>( aPtrArray );
    array->ResetAndDestroy();
    array->Close();	
    }    
void CTzUserData::CleanupPointerArray(TAny* aArray)
    {
    RPointerArray<CTzId>* array = static_cast<RPointerArray<CTzId>* >(aArray);
    if (array)
        {
        array->ResetAndDestroy();
        array->Close();
        }
    }
LOCAL_D void ResetAndDestroyTzIdArray(TAny* aPtr)
	{
	RPointerArray<CTzId>* ids = static_cast<RPointerArray<CTzId>*>(aPtr);
	if (ids)
		{
		ids->ResetAndDestroy();
		ids->Close();
		}
	}
// -----------------------------------------------------------------------------
// CSvgTimeContainer::UserPlay
// Called to handle user/client generated play event
// -----------------------------------------------------------------------------
//
void CSvgTimeContainer::UserPlay()
    {

    
    if ( !iTimer )
        {
        // Check whether this time container has a parent
        // then we do not have to create the timer
        if ( !iIsParentTcPresent )
            {
            // Obtain the post order list of media elements 
             RPointerArray<CSvgElementImpl> lMediaEleList;
            lMediaEleList.Reset(); 
            
            CSvgElementImpl *handle = (CSvgElementImpl *)(iOwnerDoc->RootElement());
            
            //Parse postorderr only if there are media elements
            if(iTcTimedEntities.Count() > 1 )
            {
              iOwnerDoc->ParsePostOrderMediaElements( handle, lMediaEleList );    
            }
            
            
            // Rearrange as per Post order
            RearrangeTimedEntityList( lMediaEleList );
            
            // Done with the list
            lMediaEleList.Close();  
            
            TRAPD( lTimerCreateErr, iTimer = CSvgTimer::NewL( this ) );
            
            if ( lTimerCreateErr != KErrNone )
                {
                // Error Processing
                return;
                }
            
            iTimer->SetStartTime();
            
            // the current home time needs to be updated.
            if ( iOwnerDoc && iCurrentTime != 0 )
                {
                iCurrentTime = 0;
                iCurrentTick.iParentTcTick = 0;
                iCurrentTick.iRealTimeTick = 0;
                TSvgTimerEvent timeEvent( iCurrentTime );
                iOwnerDoc->Reset( &timeEvent );
                }            

            if ( !iTimer->IsActive() )
                {
                iTimer->After( 1000 );
                }           
            }
        }
    }
// ---------------------------------------------------------------------------
// TPresCondIdentityMany::RemoveIdentityFromManyExceptL()
// ---------------------------------------------------------------------------
//
EXPORT_C TInt TPresCondIdentityMany::RemoveIdentityFromManyExceptL(
    const TDesC& aRuleID, const TDesC& aId, const TDesC& aDomain)
{
    OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::RemoveIdentityFromManyExceptL()" ) );
    OPENG_DP(D_OPENG_LIT( "     aRuleID:%S,aDomain:%S,aId:%S"),
             &aRuleID, &aDomain, &aId);

    __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));

    TInt ret(KErrNotFound);

    RPointerArray<CXdmDocumentNode> nodes;
    CXdmNodeAttribute* attrId(NULL);


    CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
    if(manyNode!=NULL)
    {
        TInt err = manyNode->Find(KXdmExcept, nodes);
        TInt exceptNodeCount = nodes.Count();

        //go through all except nodes
        for (TInt i=0; i<exceptNodeCount; i++)
        {
            attrId = (nodes[i])->Attribute(KXdmId);

            // for now we are supposing that except has only 1 id
            if(attrId!=NULL)
            {
                if (aId==(attrId->AttributeValue()))
                {
                    OPENG_DP(D_OPENG_LIT( "     RemoveFromModelL: i=%d" ),i);
                    iPresXDM->RemoveFromModelL(attrId);

                    //if except node is empty after this
                    if( (nodes[i])->AttributeCount() == 0)
                    {
                        // remove except node also
                        iPresXDM->RemoveFromModelL(nodes[i]);
                    }
                    ret = KErrNone;
                    break;
                }
            }
            attrId = NULL;
        }
    }

    OPENG_DP(D_OPENG_LIT( "     return: %d"),ret);
    nodes.Close();
    return ret;
}
	void CBURTestStepBackup::BackupPublicDataL()
		/**
		@internalComponent
		@released
		*/
		{
		_LIT(KPublic, "Backup Public Data...");
		Log(LOG_LEVEL2, KPublic);
		RPointerArray<CSBGenericDataType> array;
		TRAP_IGNORE(GeneratePublicTransferTypesL(array));
		TRAP_IGNORE(DoPublicBackupL(array));
		array.ResetAndDestroy();
		array.Close();
		}
Esempio n. 19
0
void UT_CFCSession::UT_CFCSession_IsFmtAttributeValidL()
	{
    RPointerArray<CSdpFmtAttributeField>* atts = 
        new (ELeave) RPointerArray<CSdpFmtAttributeField>(1);
    CleanupStack::PushL(atts);
	CSdpFmtAttributeField* fmtatt = CSdpFmtAttributeField::DecodeLC(KFmtAttribute);
	atts->AppendL(fmtatt);
	CleanupStack::Pop(fmtatt);//fmtatt
	iFCSession->SetFormatAttributeFieldsL(atts);
	EUNIT_ASSERT(iFCSession->IsFmtAttributeValid()==true)
	EUNIT_PRINT(_L( "test is fmtAttributeValid"));
	
	atts->ResetAndDestroy();
	atts->Close();
	CleanupStack::Pop(atts);//atts
	}
/**
Store the entry in the calendar file
@param aCalEntryView Pointer to the CCalEntryView
@param aCalEntry Pointer to CCalEntry
*/
void CTestCalInterimApiSuiteStepBase::StoreCalendarEntryL(CCalEntryView* aCalEntryView, CCalEntry* aCalEntry)
	{
	RPointerArray<CCalEntry>	entriesStored;
	CleanupStack::PushL(TCleanupItem(ResetAndDestroyEntryArray, &entriesStored));
	entriesStored.AppendL(aCalEntry);
	TInt	numOfEntries(0);
	aCalEntryView->StoreL(entriesStored, numOfEntries);

	if( entriesStored.Count() != numOfEntries )
		{
		ERR_PRINTF1(KErrEntryNotStored);
		SetTestStepResult(EFail);
		}
	CleanupStack::Pop(&entriesStored);
	entriesStored.Close();
	}
// -----------------------------------------------------------------------------
// CSvgTimeContainer::AddTimedEntityL
// Add a timed entity to the time container.
// -----------------------------------------------------------------------------
//
void CSvgTimeContainer::AddTimedEntityL( 
    MSvgTimedEntityInterface* aTimedEntity )
    {
    if ( !aTimedEntity )
        {
        User::Leave( KErrArgument );
        }
    
    // check to see if entity is already in list and simply return
    TInt lTimedEntityListCnt = iTcTimedEntities.Count();
    for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
        {
        if ( (iTcTimedEntities[ lItemIndex ]).iTimedEntity == aTimedEntity )
            {
            return;
            }
        }
   
    TSvgTimedEntityListItem lListItem;
    lListItem.iTimedEntity = aTimedEntity;

    //Media State initially Idle
    lListItem.iMediaState = ESvgMediaIdle;
    
    //User state initially is running
    lListItem.iUserState =ESvgUserRunning ;
    
    // Sync State is Playing
    lListItem.iIsSyncPaused = EFalse;

    // Append to Timed Entity List
    iTcTimedEntities.AppendL( lListItem );
    
    // Obtain the post order list of media elements 
     RPointerArray<CSvgElementImpl> lMediaEleList;
    lMediaEleList.Reset(); 
    
    CSvgElementImpl *handle = (CSvgElementImpl *)(iOwnerDoc->RootElement());
    iOwnerDoc->ParsePostOrderMediaElements( handle, lMediaEleList );
    
    // Rearrange as per Post order
    RearrangeTimedEntityList( lMediaEleList );
    
    // Done with the list
    lMediaEleList.Close();  
    }
// ----------------------------------------------------------------------------
// CSIPRequireHeader::DecodeL
// ----------------------------------------------------------------------------
//
EXPORT_C RPointerArray<CSIPRequireHeader> 
CSIPRequireHeader::DecodeL (const TDesC8& aValue)
	{
	RPointerArray<CSIPHeaderBase> headers = BaseDecodeL(aValue);
	CSIPHeaderBase::PushLC(&headers);
	RPointerArray<CSIPRequireHeader> requireHeaders;
	CleanupClosePushL(requireHeaders);
	TInt count = headers.Count();
	for (TInt i=0; i<count; i++)
		{
		CSIPRequireHeader* header = static_cast<CSIPRequireHeader*>(headers[i]);
		User::LeaveIfError(requireHeaders.Append(header));
		}
	CleanupStack::Pop(2); // requireHeaders, headers
	headers.Close();
	return requireHeaders;
	}
EXPORT_C void CUnifiedCertStore::List(RMPointerArray<CCTCertInfo>& aCertInfos,
									  const CCertAttributeFilter& aFilter, 
									  const TDesC8& aIssuer, 
									  TRequestStatus& aStatus)
	{
	RPointerArray<const TDesC8> array;
	if (array.Append(&aIssuer) != KErrNone)
		{
		TRequestStatus* status = &aStatus;
		User::RequestComplete(status, KErrNoMemory);
		}
	else
		{
		List(aCertInfos, aFilter, array, aStatus);
		array.Close();
		}
	}
// -----------------------------------------------------------------------------
// CSIPSecurityVerifyHeader::DecodeL
// -----------------------------------------------------------------------------
//
EXPORT_C RPointerArray<CSIPSecurityVerifyHeader> 
CSIPSecurityVerifyHeader::DecodeL (const TDesC8& aValue)
	{
    RPointerArray<CSIPHeaderBase> baseheaders = BaseDecodeL(aValue);
    CSIPHeaderBase::PushLC(&baseheaders);
    RPointerArray<CSIPSecurityVerifyHeader> verifyHeaders;
    CleanupClosePushL(verifyHeaders);
    TInt count = baseheaders.Count();
    for (TInt i=0; i < count; i++)
		{
		CSIPSecurityVerifyHeader* header = 
            static_cast<CSIPSecurityVerifyHeader*>(baseheaders[i]);
		verifyHeaders.AppendL(header);
		}
    CleanupStack::Pop(2); //verifyHeaders, baseheaders
    baseheaders.Close();
    return verifyHeaders;
	}
// -----------------------------------------------------------------------------
// CSIPSecurityClientHeader::DecodeL
// -----------------------------------------------------------------------------
//
EXPORT_C RPointerArray<CSIPSecurityClientHeader> 
CSIPSecurityClientHeader::DecodeL (const TDesC8& aValue)
	{
    RPointerArray<CSIPHeaderBase> baseheaders = BaseDecodeL(aValue);
    CSIPHeaderBase::PushLC(&baseheaders);
    RPointerArray<CSIPSecurityClientHeader> clientHeaders;
    CleanupClosePushL(clientHeaders);
    TInt count = baseheaders.Count();
    for (TInt i=0; i < count; i++)
		{
		CSIPSecurityClientHeader* header = 
            static_cast<CSIPSecurityClientHeader*>(baseheaders[i]);
		User::LeaveIfError (clientHeaders.Append(header));
		}
    CleanupStack::Pop(2); //clientHeaders, baseheaders
    baseheaders.Close();
    return clientHeaders;
	}
/*
Print out current tree content
*/
void CLeafDirTree::DumpTreeContentL() const
	{
	RPointerArray<CLeafDirTreeNode>* nodeStack = new(ELeave) RPointerArray<CLeafDirTreeNode>(4);
	RFs fs;
	
    TInt nRes = fs.Connect();
    User::LeaveIfError(nRes);

	const TUint32 debugRegister = DebugRegister();
	fs.SetDebugRegister(debugRegister|KFSYS);
	if (iRoot != NULL)
		{
		nodeStack->Insert(iRoot, 0);
		while(nodeStack->Count() > 0)
			{
			CLeafDirTreeNode* current = (*nodeStack)[0];
			if (current->Parent() != NULL)
				{
				__PRINT3(_L("(\"%S\") -> \"%S\" : (%d)\n"), &current->Parent()->Path(), &current->Path(), current->StartClusterNum());
				}
			else
				{
				__PRINT2(_L("\"%S\" : (%d)\n"), &current->Path(), current->StartClusterNum());				
				}

			nodeStack->Remove(0);
			
			TInt currentCount = current->Children().Count();
			if (currentCount > 0)
				{
				RPointerArray<CLeafDirTreeNode> children = current->Children();
				for (TInt i = 0; i < currentCount; i++)
					{
					nodeStack->Insert(children[i], 0);
					}
				}
			}
		}

	fs.SetDebugRegister(debugRegister);
	fs.Close();
	nodeStack->Close();
	delete nodeStack;
	}
void CBadRRule::CheckInstancesL(RArray<TTime> &insTimes)
{
	RPointerArray<CCalInstance> instanceArray ;

	TCalTime startTime ;
	TCalTime endTime ;	
	startTime.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 1, 10, 1, 0, 0))) ;
	endTime.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 30, 10, 5, 0, 0))) ;		
	
	CalCommon::TCalTimeRange timeRange(startTime, endTime);
	
	CCalInstanceView &insView = iTestLib->SynCGetInstanceViewL();	
	
	insView.FindInstanceL(instanceArray, CalCommon::EIncludeAll, timeRange);		
	
	TInt count = instanceArray.Count() ;
	TInt count1 = insTimes.Count() ;
	
	test(count == count1) ;
	TInt i, j ;
	
	for(i = 0; i < count1; i++)
		{
		for(j = 0; j < count; j++)
			{
			if (instanceArray[j] == NULL)
				{
				continue ;
				}
			TTime t1 = instanceArray[j]->Time().TimeUtcL() ;		
			TDateTime d1 = t1.DateTime() ;	
			if (insTimes[i] == t1)
				{
				delete instanceArray[j] ;
				instanceArray[j] = NULL ;
				break ;
				}			
			}
			test(j < count) ;		
		}
	
	instanceArray.Close() ;		
}
Esempio n. 28
0
// -----------------------------------------------------------------------------
// MceSip::ToContactHeaderL
// -----------------------------------------------------------------------------
//
CSIPContactHeader* MceSip::ToContactHeaderL( const TDesC8& aContact )
    {
    CSIPContactHeader* contact = NULL;
    
    RPointerArray< CSIPContactHeader > contacts = CSIPContactHeader::DecodeL( aContact );
    if ( contacts.Count() > 0 )
        {
        contact = contacts[0]; 
        contacts.Remove(0);
        contacts.ResetAndDestroy();
        }
    else
        {
        contacts.Close();
        User::Leave( KErrNotFound );
        }
        
    return contact;
    
    }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
TInt CEmailMailbox::GetFoldersL( RFolderArray& aFolders ) const
    {
    TFSMailMsgId rootId = TFSMailMsgId();
    RPointerArray<CFSMailFolder> folders;
    CleanupResetAndDestroyPushL( folders );
    iPlugin->ListFoldersL( FsMailboxId(), rootId, folders );
    TInt res( folders.Count() );
    for ( TInt i = 0; i < res; i++ )
        {
        const CFSMailFolder* fsfolder = folders[i];
        const TEntryId id = fsfolder->GetFolderId().Id();
        const TFolderId folderId( id, iMailboxId );
        CEmailFolder* folder = CEmailFolder::NewLC( iPluginData, folderId, folders[i] );
        aFolders.AppendL( folder );
        CleanupStack::Pop( folder );
        }
    CleanupStack::Pop( &folders );
    folders.Close(); // close but don't delete folders because they are
                     // owned by CEmailFolder
    return res;
    }
void UT_CIceCheckPrioritizer::UT_CICECheckPrioritizer_PrioritizeChecksL()
    {
    CNATFWCandidate* candidate1 = CNATFWCandidate::NewLC();
    CNATFWCandidate* candidate2 = CNATFWCandidate::NewLC();
    CNATFWCandidatePair* pair = CNATFWCandidatePair::NewLC( 
        *candidate1, *candidate2 );

    CNATFWCandidatePair* pair2 = CNATFWCandidatePair::NewLC( *pair );
    
    RPointerArray<CNATFWCandidatePair> checks;
    checks.Append( pair );
    checks.Append( pair2 );
    iPrioritizer->PrioritizePairs( checks, EIceRoleControlling );

    CleanupStack::PopAndDestroy( pair2 );
    CleanupStack::PopAndDestroy( pair );
    CleanupStack::PopAndDestroy( candidate2 );
    CleanupStack::PopAndDestroy( candidate1 );
    
    checks.Close();
    }