// -----------------------------------------------------------------------------
// CWPWAPBrowserItem::AddL
// -----------------------------------------------------------------------------
//
void CWPWAPBrowserItem::AddL( RPointerArray<MWPWAPItemBase>& aShownItems,
                              RPointerArray<MWPWAPItemBase>& aHiddenItems )
    {
    for( TInt i( iBookmarks.Count()-1 ); i >= 0 ; i-- )
        {
        MWPWAPItemBase* item = iBookmarks[i];

        if( item->ValidateL() )
            {
            // Transfer ownership of iBookmarks[i] to aItems
            iBookmarks[i]->AddL( aShownItems, aHiddenItems );
            }
        else
            {
            // invalid items get deleted
            delete item;
            }
        iBookmarks.Remove( i );
        }

    // Only first browser item is shown to the user.
    if( iFirst )
        {
        User::LeaveIfError( aShownItems.Append( this ) );
        }
    else
        {
        User::LeaveIfError( aHiddenItems.Append( this ) );
        }
    }
// -----------------------------------------------------------------------------
// CSIPProfileRegistryBase::StoreProfileL
// -----------------------------------------------------------------------------
//
void CSIPProfileRegistryBase::StoreArrayL(
	RPointerArray<CSIPConcreteProfile>& aProfiles,
	RPointerArray<CSIPProfile>& aRetProfiles)
	{
	int count = aProfiles.Count();

	for (TInt i = 0; i < count; i++)
		{
		TUint profileId = (aProfiles[0])->Id();
		TInt index = ProfileIndex(profileId);
		
		CSIPProfileCleanupItem* cleanupItem = new (ELeave) CSIPProfileCleanupItem(iITC);
		CleanupStack::PushL(cleanupItem);

		if(index == KErrNotFound) 
			{
			CleanupStack::PushL(TCleanupItem(CrashRevert, cleanupItem));

			cleanupItem->iProfileId = (aProfiles[0])->Id();
			cleanupItem->iConcreteProfile = aProfiles[0];
			aProfiles.Remove(0);

			StoreProfileL(cleanupItem);
			User::LeaveIfError(aRetProfiles.Append(cleanupItem->iManagedProfile));
			}
		else
			{
			CleanupStack::PushL(TCleanupItem(LocalCrashRevert, cleanupItem));

			CSIPProfileItem* item = ProfileItemL(profileId);
			CSIPProfile* managed = NewInstanceL();
			cleanupItem->iManagedProfile = managed;
			managed->SetConcreteProfile(&(item->ConcreteProfile()));
			managed->SetEnabled(item->IsEnabled());
			item->IncrementReferenceCountL(*managed);
			User::LeaveIfError(aRetProfiles.Append(managed));
			CSIPConcreteProfile* profileNotUsed = aProfiles[0];
			aProfiles.Remove(0);
			delete profileNotUsed;
			}
		}
	aProfiles.Reset();

	for (TInt j = 0; j < count; j++)
		{
		CleanupStack::Pop(); //TCleanupItem
		CleanupStack::PopAndDestroy(); //cleanupItem
		}
	}
void CSenLayeredXmlProperties::ElementsL(RPointerArray<CSenElement>& aProps) const
    {
    if ( ipChildProperties )
        {
        ipChildProperties->ElementsL(aProps);
        }
            
    RPointerArray<CSenElement>& elements = ipFragment->AsElement().ElementsL();
    TInt elementCount(elements.Count());
    TInt propsCount(0);
    TBool found;
    for (TInt i=0; i<elementCount; i++)
        {
        found = EFalse;
        propsCount = aProps.Count();
        for (TInt j=0; j<propsCount; j++)
            {
             if ( elements[i]->LocalName() == aProps[j]->LocalName() )
                {
                found = ETrue;
                break;
                }
            }
        if ( !found )
            {
#ifdef EKA2
            aProps.AppendL(elements[i]);
#else
            User::LeaveIfError(aProps.Append(elements[i]));
#endif
            }
        }
    }
/** This function takes ownership of aConfiguration immediately
and therefore SHOULD NOT be called with aConfiguration already on the Cleanup stack.
@param aConfiguration Configuration type to be added to the set of configurations
@param aConfigurations The set of configurations to which the new type should be added
@leave KErrAlreadyExists If the given type already exists in the set of configurations, the function leaves */
void CMtfConfigurationType::SetConfigurationTypeL(CMtfConfigurationType* aConfiguration,
		RPointerArray<CMtfConfigurationType>& aConfigurations)
{
	CleanupStack::PushL(aConfiguration);
	
	TInt error=0;
	TRAP(error, CMtfConfigurationType::FindConfigurationL(aConfiguration->ConfigurationType(),aConfigurations));
	
	if (error==KErrNotFound)
	{
		// this type does not already exist, so add it in
		User::LeaveIfError(aConfigurations.Append(aConfiguration)); 
		
		// the function has taken ownership, so it can pop the object
		CleanupStack::Pop(aConfiguration);
	}
	else if (error==KErrNone)
	{
		User::Leave(KErrAlreadyExists);
	}
	else
	{
		User::Leave(error);
	}
}
Ejemplo n.º 5
0
void UT_CFCSession::UT_CFCSession_PortL(  )
    {
    
    iFCSession->SetPort( KTBCPLocalPort );
	
	HBufC8* aSdptest = KSDPMessage().AllocLC();
	CSdpDocument* sdpDocument = CSdpDocument::DecodeL(*aSdptest);
	CleanupStack::PushL(sdpDocument);
	
    RPointerArray<CSdpFmtAttributeField>* atts = 
        new (ELeave) RPointerArray<CSdpFmtAttributeField>(1);
    
    CleanupStack::PushL(atts);
	CSdpFmtAttributeField* fmtatt = CSdpFmtAttributeField::DecodeLC(KFmtAttribute);
	User::LeaveIfError(atts->Append(fmtatt));
	CleanupStack::Pop(fmtatt);//fmtatt
	
	iFCSession->SetFormatAttributeFieldsL(atts);
	CleanupStack::Pop(atts);//atts
	
	
	iFCSession->UpdateSDPL(*sdpDocument);
	
	EUNIT_ASSERT(iFCSession->Port()==KTBCPLocalPort);
   	EUNIT_ASSERT(iErr==KTBCPLocalPort);
   	   	
	CleanupStack::PopAndDestroy(sdpDocument);
	sdpDocument = NULL;
	
   	CleanupStack::PopAndDestroy(aSdptest);//aSdptest
    }
// -----------------------------------------------------------------------------
// CSIPSupportedHeader::BaseDecodeL
// -----------------------------------------------------------------------------
//
RPointerArray<CSIPHeaderBase> 
CSIPSupportedHeader::BaseDecodeL (const TDesC8& aValue)
	{
	RPointerArray<CSIPHeaderBase> headers;
    CSIPHeaderBase::PushLC(&headers);
	TLex8 lex(aValue);
	lex.SkipSpace();
	if (lex.Remainder().Length() > 0)
		{
		CSIPTokenizer* tokenizer = CSIPTokenizer::NewLC(aValue, ',');
		for (TInt i=0; i < tokenizer->Tokens().Count(); i++)
			{
			CSIPSupportedHeader* header = new(ELeave)CSIPSupportedHeader;
			CleanupStack::PushL(header);
			header->ConstructL(tokenizer->Tokens()[i]);
			User::LeaveIfError (headers.Append(header));
			CleanupStack::Pop(header);
			}
		CleanupStack::PopAndDestroy(tokenizer);
		}
	else
		{
		CSIPSupportedHeader* header = new(ELeave)CSIPSupportedHeader;
		CleanupStack::PushL(header);
		header->ConstructL(KNullDesC8,ETrue);
		headers.AppendL(header);
		CleanupStack::Pop(header);
		}
	CleanupStack::Pop(); // headers 
	return headers;
	}	
Ejemplo n.º 7
0
// -----------------------------------------------------------------------------
// RDRMRightsClient::URIFileToArrayL
// Converts the given file into an array.
// -----------------------------------------------------------------------------
//
void RDRMRightsClient::URIFileToArrayL( RFs& aFs,
                                       const TDesC& aFile,
                                       RPointerArray< HBufC8 >& aList )
    {
    DRMLOG( _L( "RDRMRightsClient::URIFileToArrayL" ) );
    RFileReadStream stream;
    TUint16 size = 0;
    TPtr8 data( NULL, 0, 0 );

    User::LeaveIfError( stream.Open( aFs, aFile, EFileRead | EFileStream ) );
    CleanupClosePushL( stream );

    size = stream.ReadUint16L();
    while( size > 0 )
        {
        HBufC8* tmp = HBufC8::NewLC( size );
        data.Set( tmp->Des() );
        stream.ReadL( data, size );
        User::LeaveIfError( aList.Append( tmp ) );
        CleanupStack::Pop(); // tmp
        size = stream.ReadUint16L();
        }

    // All read, return.

    CleanupStack::PopAndDestroy(); // stream
    }
Ejemplo n.º 8
0
/**
 * Method to fetch all the URLs associated with the Authentication app
 * @param aAuthAppId The ID of the Authentication app
 * @param aArray [out] The array to be updated with URLs
 */
void CSmfCredMgrDbUser::readUrlL(const TDesC& aAuthAppId,
                                 RPointerArray<HBufC>& aArray)
{
    TInt err(KErrNone);

    RSqlStatement sqlReadStatement;
    TInt paramIndex(KErrNone);

    err = sqlReadStatement.Prepare(iDataBase, KSmfDbReadURL);
    __ASSERT_DEBUG( (err >= KErrNone), User::Invariant());
    paramIndex = sqlReadStatement.ParameterIndex(_L(":iID"));
    err = sqlReadStatement.BindText(paramIndex, aAuthAppId);
    __ASSERT_DEBUG( (err >= KErrNone), User::Invariant());

    while ((err = sqlReadStatement.Next()) == KSqlAtRow)
    {
        //sometimes sqlStmt.Next returns KSqlAtRow even if no row is present
        if (!sqlReadStatement.IsNull(0))
        {
            TBuf<KMaxBufSize> urlBuf;
            HBufC* buf = HBufC::NewL(KMaxBufSize);
            sqlReadStatement.ColumnText(0, urlBuf);
            buf->Des().Copy(urlBuf);
            aArray.Append(buf);
        }
        else
        {
            __ASSERT_DEBUG( 0, User::Invariant());
        }
    }
    sqlReadStatement.Close();
}
Ejemplo n.º 9
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/ 
void CScheduleDB::ReadDbItemsL(RPointerArray<CMsgStored>& aItemArray)
{
	aItemArray.ResetAndDestroy();// first reset the array
	
	TFileName QueryBuffer;
	QueryBuffer.Copy(_L("SELECT * FROM "));// just get all columns & rows
	QueryBuffer.Append(KtxtItemlist2);
		
	RDbView Myview;
	Myview.Prepare(iItemsDatabase,TDbQuery(QueryBuffer));
	CleanupClosePushL(Myview);
	Myview.EvaluateAll();
	Myview.FirstL();
	
	while(Myview.AtRow()) // Just delete one instance of the message           
	{	
		Myview.GetL();		
		
		CMsgStored* NewItem = new(ELeave)CMsgStored();	
		aItemArray.Append(NewItem);
		
		NewItem->iIndex = Myview.ColInt32(1);
		NewItem->iMessage = Myview.ColDes(2).AllocL();
				
		Myview.NextL();
	} 
	
	CleanupStack::PopAndDestroy(1); // Myview
}
Ejemplo n.º 10
0
/*
-------------------------------------------------------------------------------

    Class: COomTestHarness

    Method: GetTestCases

    Description: GetTestCases is used to inquire test cases 
    from the test module. Because this test module has hard coded test cases
    (i.e cases are not read from file), paramter aConfigFile is not used.

    This function loops through all cases defined in Cases() function and 
    adds corresponding items to aTestCases array.

    Parameters: const TFileName&  : in: Configuration file name. Not used                                                       
                RPointerArray<TTestCaseInfo>& aTestCases: out: 
                      Array of TestCases.
    
    Return Values: KErrNone: No error

    Errors/Exceptions: Function leaves if any memory allocation operation fails

    Status: Proposal
    
-------------------------------------------------------------------------------
*/      
TInt COomTestHarness::GetTestCasesL( const TFileName& /*aConfig*/, 
                                 RPointerArray<TTestCaseInfo>& aTestCases )
    {
    // Loop through all test cases and create new
    // TTestCaseInfo items and append items to aTestCase array    
    for( TInt i = 0; Case(i).iMethod != NULL; i++ )
        {
        // Allocate new TTestCaseInfo from heap for a testcase definition.
        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
    
        // PushL TTestCaseInfo to CleanupStack.    
        CleanupStack::PushL( newCase );

        // Set number for the testcase.
        // When the testcase is run, this comes as a parameter to RunTestCaseL.
        newCase->iCaseNumber = i;

        // Set title for the test case. This is shown in UI to user.
        newCase->iTitle.Copy( Case(i).iCaseName );

        // Append TTestCaseInfo to the testcase array. After appended 
        // successfully the TTestCaseInfo object is owned (and freed) 
        // by the TestServer. 
        User::LeaveIfError(aTestCases.Append ( newCase ) );
        
        // Pop TTestCaseInfo from the CleanupStack.
        CleanupStack::Pop( newCase );
        }

    return KErrNone;

    }
// ---------------------------------------------------------------------------
// CDevCertKeyStoreServer::ListL()
// ---------------------------------------------------------------------------
//
void CDevCertKeyStoreServer::ListL(const TCTKeyAttributeFilter& aFilter,
							  RPointerArray<CDevTokenKeyInfo>& aKeys)
    {
    ASSERT(iMessage);

    // Check the calling process has ReadUserData capability
    if (!KListSecurityPolicy.CheckPolicy(*iMessage))
        {
        User::Leave(KErrPermissionDenied);
        }

    TInt count = iKeyDataManager->Count();

    for (TInt i = 0; i < count; ++i)
        {
        const CDevCertKeyData* data = (*iKeyDataManager)[i];
        CDevTokenKeyInfo* info = iKeyDataManager->ReadKeyInfoLC(*data);
        if (KeyMatchesFilterL(*info, aFilter))
            {
            User::LeaveIfError(aKeys.Append(info));
            CleanupStack::Pop(info);
            }
        else
            {
            CleanupStack::PopAndDestroy(info);
            }
        }
    }
Ejemplo n.º 12
0
// ----------------------------------------------------------
// CSimplePresenceList::GetDocuments
// ----------------------------------------------------------
//
void CSimplePresenceList::GetDocuments( RPointerArray<MSimpleDocument>& aDocs )
    {
    aDocs.Reset();
    TInt size = iDocuments.Count();
    for ( TInt i = 0; i<size ; i++ )
        {
        (void)aDocs.Append( iDocuments[i] );
        }    
    }
Ejemplo n.º 13
0
// ----------------------------------------------------------
// CSimplePresenceList::GetSubLists
// ----------------------------------------------------------
//
void CSimplePresenceList::GetSubLists( RPointerArray<MSimplePresenceList>& aLists )
    {
    aLists.Reset();
    TInt size = iPresList.Count();
    for ( TInt i = 0; i<size ; i++ )
        {
        (void)aLists.Append( iPresList[i] );
        }     
    }
Ejemplo n.º 14
0
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
void CaSqlQueryCreator::CreateTouchQueryL(
        RPointerArray<CCaSqlQuery>& aSqlQuery, RSqlDatabase& aSqlDb, 
        TBool aRemovable )
    {
    DEBUG(("_CA_:CASqlQueryCreator::CreateTouchQueryL"));

    CCaSqlQuery* query = CCaSqlQuery::NewLC( aSqlDb );
    query->SetQueryL( KSQLInsertToLaunch );
    aSqlQuery.Append( query );
    CleanupStack::Pop( query );
    if( aRemovable )
        {
        query = CCaSqlQuery::NewLC( aSqlDb );
        query->SetQueryL( KSQLUpdateEntryUsedFlag );
        aSqlQuery.Append( query );
        CleanupStack::Pop( query );
        }
    }
Ejemplo n.º 15
0
int CAfStorageClient::activities(RPointerArray<CAfEntry> &dst, int /*limit*/)
{
    if (lastMethodCalled == CAfStorageClient::SaveActivityMethod && CAfStorageClient::lastCallEntry) {
        dst.Append(CAfStorageClient::lastCallEntry);
        CAfStorageClient::lastCallEntry =0;
    }
    lastMethodCalled = CAfStorageClient::ActivitiesMethod;
    return CAfStorageClient::expectedReturnCode;
}
Ejemplo n.º 16
0
int CAfStorageClient::applicationActivities(RPointerArray<CAfEntry> &dst, const CAfEntry &entry)
{
    if (lastMethodCalled == CAfStorageClient::SaveActivityMethod && CAfStorageClient::lastCallEntry) {
        dst.Append(CAfStorageClient::lastCallEntry);
        CAfStorageClient::lastCallEntry =0;
    }
    lastMethodCalled = CAfStorageClient::ApplicationActivitiesMethod;
    updateLastEntry(entry);
    return CAfStorageClient::expectedReturnCode;
}
// -----------------------------------------------------------------------------
// UpnpAVCPEngine::ParsePathToElementsL
// -----------------------------------------------------------------------------
//   
void ParsePathToElementsL(TPtr8 aPath, RPointerArray<TPtrC8>& aArray ) 
	{
	TChar delimiter('/');
	RemoveSlashes(aPath);

	TPtrC8 ptr(aPath);
    TInt i = 0;

	while(KErrNotFound != ptr.Locate(delimiter))
	    {	
	    aArray.Append( new (ELeave)TPtrC8() );
		aArray[i]->Set(ptr.Left((ptr.Locate(delimiter))));
    	ptr.Set(ptr.Right(ptr.Length() - (ptr.Locate(delimiter) + 1)) ); 
	    i++;
	    }
	    
	aArray.Append( new (ELeave) TPtrC8() );
   	aArray[i]->Set(ptr);    		
	}
// ----------------------------------------------------------------------------
// CSIPSubscriptionStateHeader::BaseDecodeL
// ----------------------------------------------------------------------------
//
RPointerArray<CSIPHeaderBase> 
CSIPSubscriptionStateHeader::BaseDecodeL(const TDesC8& aValue)
    {
	CSIPSubscriptionStateHeader* header = DecodeL(aValue);
    CleanupStack::PushL(header);
	RPointerArray<CSIPHeaderBase> headerArray;
	User::LeaveIfError (headerArray.Append(header));
	CleanupStack::Pop(header);
	return headerArray;
    }
void CMultiThreadTestApp::AddEntryL(CCalEntryView& aView, const TInt aNumToAdd)
	{
	// Add Entries for Test
	RTest test(KTestName);
	test.Next(_L("Adding entries"));

	
	TBuf<50> summary;
	TBuf<50> location;
	TBuf<50> description;


	RPointerArray<CCalEntry> entriesToStore;
	CleanupResetAndDestroyPushL(entriesToStore);
	
	for (TInt index = 0; index < aNumToAdd; ++index)
		{
		CCalEntry* entry;
		HBufC8*    guid = HBufC8::NewL(255);
		TPtr8      uidP = guid->Des();
		
		RandomText8(uidP);
		
		if( (index %2) == 0 )
			{
			entry = CreateCalEntryL(CCalEntry::ETodo, guid);
			}
		else
			{
			entry = CreateCalEntryL(CCalEntry::EAppt, guid);
			}
	
		TInt err = entriesToStore.Append(entry);
		test(err == KErrNone);
		
		SetEntryStartAndEndTimeL(entry);
				
		RandomText(summary);
		entry->SetSummaryL(summary);
		
		RandomText(location);
		entry->SetLocationL(location);
		
		RandomText(description);
		entry->SetDescriptionL(description);
		}

	TInt entriesStored(0);
	aView.StoreL(entriesToStore, entriesStored); //temp
	test(entriesStored == aNumToAdd);
	test.Close();
	
	CleanupStack::PopAndDestroy(&entriesToStore);
	}
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();
    }
Ejemplo n.º 21
0
// -----------------------------------------------------------------------------
// RDRMRightsClient::FileToListL
// Converts the given file into an array.
// -----------------------------------------------------------------------------
//
void RDRMRightsClient::FileToListL( RFs& aFs,
                                   const TDesC& aFileName,
                                   RPointerArray< CDRMPermission >& aList )
    {
    DRMLOG( _L( "RDRMRightsClient::FileToListL" ) );
    TInt error = KErrNone;

    // Temporary storage.
    CDRMPermission* tmpObject;

    // To access the file data.
    RFileReadStream fileStream;

    // How many objects there is in the file.
    TInt size = 0;

    // Temporary counter.
    TInt count = 0;


    // Open the file.
    User::LeaveIfError( fileStream.Open( aFs, aFileName, EFileRead | EFileStream ) );
    CleanupClosePushL( fileStream );

    size = fileStream.ReadInt32L();

    while( count < size )
        {
        // Allocate a new RO.
        tmpObject = CDRMPermission::NewL();

        // Read the object.
        TRAP( error, tmpObject->InternalizeL( fileStream ) );

        if ( !error )
            {
            // Add the object into the list.
            error = aList.Append( tmpObject );
            }

        if ( error )
            {
            delete tmpObject;
            User::Leave( error );
            }

        // Now tmpObject is under responsibility of aList.
        ++count;
        }

    // All done.
    CleanupStack::PopAndDestroy(); // fileStream
    }
Ejemplo n.º 22
0
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
void CaSqlQueryCreator::CreateCustomSortQueryL(
        const RArray<TInt>& aEntryIds,
        RPointerArray<CCaSqlQuery>& aSqlQuery,
        RSqlDatabase& aSqlDb )
    {
    for( TInt i = 0; i < aEntryIds.Count(); i++ )
        {
        CCaSqlQuery* query = CCaSqlQuery::NewLC( aSqlDb );
        query->SetQueryL( KSQLUpdatePositionInGroup );
        aSqlQuery.Append( query );
        CleanupStack::Pop( query );
        }
    }
Ejemplo n.º 23
0
/**
 *   Return array of string parameters i.e. key=a1,a2,a3 returns array which contains
 *   String a1, a2 and a3.
 *   @return ret - EFalse if can't get a String parameter from Config file.  ETrue if KErrNone
 */
TBool CDataWrapperBase::GetArrayFromConfig(const TDesC& aSectName, const TDesC& aKeyName, RPointerArray<HBufC>& aResult)
	{
	TBool	ret=EFalse;
	TPtrC completeArray;
	
	TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, completeArray));
	if ( err != KErrNone )
		{
		ret=EFalse;
		}

    TLex16 lex(completeArray); // Here we have the array as a string i.e. "a1,a2,a3"
    TBuf<256> buf;
    TChar chr;
    
    while(!lex.Eos())
        {
        chr = lex.Get();
        // Check if there was a list separator
        if (chr == ',')
            {
            HBufC* param = buf.AllocLC();
            buf.Zero();
            aResult.Append(param);
            CleanupStack::Pop(param); // pointer to buf is stored in RPointerArray
            }
        // If not separator character we can store the character into array
        else
            {
            buf.Append(chr);
            }
        }
    // Remember to put last token into array (,a3)
    HBufC* param = buf.AllocLC();
    aResult.Append(param);
    CleanupStack::Pop(param);
    
    return ret;
	}
// -----------------------------------------------------------------------------
// CCalenExporterTest::ExportVCalTestL
// Test exporting ICAL
// -----------------------------------------------------------------------------
//    
void CCalenExporterTest::ExportVCalTestL()
    {
    //uid
    _LIT8( KTestUid, "123544");
    
    //entry
    CCalEntry* entry = NULL;
    
    entry = CCalEntry::NewL(CCalEntry::EEvent, KTestUid().AllocL(), CCalEntry::EMethodNone, 0 );
    CleanupStack::PushL( entry );
    
    CBufFlat* buf = CBufFlat::NewL( 100 );
    CleanupStack::PushL(buf);
    
    RBufWriteStream writeStream;
    writeStream.Open(*buf);
    CleanupClosePushL(writeStream);
    
    
    RPointerArray<CCalEntry> array;
    array.Append( entry );
    
    //should not leave
    EUNIT_ASSERT_NO_LEAVE( iCalenExporter->ExportVCalL( array, writeStream) );
    
    array.Append( entry );
    
    //should leave with KErrNotSupported
    EUNIT_ASSERT_SPECIFIC_LEAVE( iCalenExporter->ExportVCalL( array, writeStream), KErrNotSupported );
    
    array.Close();
    
    CleanupStack::PopAndDestroy(&writeStream);
    CleanupStack::PopAndDestroy(buf);
    
    
    CleanupStack::PopAndDestroy( entry );
    }
void CIdWsfDsQueryResponse::GetAllServicesL(
        RPointerArray<CIdWsfServiceInstance>& aDest )
    {
    // Return all CIdWsfServiceInstance's
    for (TInt i = 0; i < iResourceOfferings.Count(); i++)
        {
        RPointerArray<CIdWsfServiceInstance>& services =
            iResourceOfferings[i]->ServicesL();
        for (TInt j = 0; j < services.Count(); j++)
            {
            User::LeaveIfError(aDest.Append(services[j]));
            }
        }
    }
TInt CSenPropertiesElement::ValueTokensL(const TDesC8& aDelimiter,
                                         RPointerArray<TPtrC8>& aTokens)
    {
    TPtrC8 content = this->Content();
    TInt delim = content.Find(aDelimiter);
    while ( delim != KErrNotFound )
        {
        TPtrC8* piece = new (ELeave) TPtrC8();
        piece->Set(content.Mid(0,delim));
        aTokens.Append(piece);
        
        content.Set(content.Mid(delim+aDelimiter.Length(),
                                content.Length()-(delim+aDelimiter.Length())));

        delim = content.Find(aDelimiter);
        }

    if(!(this->Content()!=KNullDesC8 && content==KNullDesC8))
        {
        // If this property does NOT zero-length content
        // and the "last" (or first) token is KNullDesC8
        // it means that the string ends with delimiter;
        // Therefore, KNullDesC8 must NOT be added as a
        // result of "tailing delimiter".

        // Add all other tokens here; even KNullDesC8
        // gets added, if it is eiher first or 
        TPtrC8* token = new (ELeave) TPtrC8();
        token->Set(content);
        aTokens.Append(token);
        }    
    if (aTokens.Count() == 0)
        {
        return KErrNotFound;
        }
    return KErrNone;
    }
Ejemplo n.º 27
0
void CDrmFileContainer::ListAllContentL(RPointerArray <CDrmFileContent>& aContentArray)
	{
	TInt i;
	// add content from this container
	for(i = 0; i < iContents.Count(); i++)
		{
		User::LeaveIfError(aContentArray.Append(iContents[i]));		
		}
		
	// traverse embedded containers
	for(i = 0; i < iContainers.Count(); i++)
		{
		iContainers[i]->ListAllContentL(aContentArray);
		}
	}
Ejemplo n.º 28
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/ 
void CScheduleDB::ReadDbItemsL(RPointerArray<CMsgSched>& aItemArray)
{
	aItemArray.ResetAndDestroy();// first reset the array
	
	TFileName QueryBuffer;
	QueryBuffer.Copy(_L("SELECT * FROM "));// just get all columns & rows
	QueryBuffer.Append(KtxtItemlist);
		
	RDbView Myview;
	Myview.Prepare(iItemsDatabase,TDbQuery(QueryBuffer));
	CleanupClosePushL(Myview);
	Myview.EvaluateAll();
	Myview.FirstL();
	
	while(Myview.AtRow()) // Just delete one instance of the message           
	{	
		Myview.GetL();		
		
		CMsgSched* NewItem = new(ELeave)CMsgSched();	
		aItemArray.Append(NewItem);
		
		NewItem->iIndex  = Myview.ColInt32(1);
        NewItem->iTime   = Myview.ColTime(5);
        NewItem->iRepeat = Myview.ColInt32(6);
        
        if(Myview.ColInt32(2) > 50)
        	NewItem->iUnicode = ETrue;
        else
        	NewItem->iUnicode = EFalse;
        
        NewItem->iNunmber = Myview.ColDes(3).AllocL();
		NewItem->iMessage = Myview.ColDes(4).AllocL();
		
		if(Myview.ColInt32(7) > 50)
		  	NewItem->iEnabled = ETrue;
		else
			NewItem->iEnabled = EFalse;

		if(Myview.ColInt32(8) > 50)
		  	NewItem->iFlashSMS = ETrue;
		else
			NewItem->iFlashSMS = EFalse;
				
		Myview.NextL();
	} 
	
	CleanupStack::PopAndDestroy(1); // Myview
}
// -----------------------------------------------------------------------------
// CSIPClientDiscoveryReceiver::HandleClientNotFoundL
// -----------------------------------------------------------------------------
//
void CSIPClientDiscoveryReceiver::HandleClientNotFoundL()
    {
    TIpcArgs tmpITCArgs;
    tmpITCArgs.Set(ESIPCRIpcArgReqId, &iIdsPckg);

    HBufC8* content = HBufC8::NewLC(iSizesPckg().iContentBufSize);
    TPtr8 contentPtr(content->Des());
    tmpITCArgs.Set(ESIPCRIpcArgSipMessageContent, &contentPtr);

    HBufC8* responseBuf = HBufC8::NewLC(iSizesPckg().iHeaderBufSize);
    TPtr8 responsePtr(responseBuf->Des());
    tmpITCArgs.Set(ESIPCRIpcArgSipResponse, &responsePtr);

    TInt err = iITC.Receive(tmpITCArgs);
    if (err != KErrNone) 
        {
        User::Leave(err);
        }
       
    CSIPResponse* response =  
        iSerializer.InternalizeSIPResponseL(*responseBuf);                              
    CleanupStack::PopAndDestroy(responseBuf);
    CleanupStack::PushL(response);
    
    RPointerArray<CSIPHeaderBase> headers;
    CSIPHeaderBase::PushLC(&headers);
    
    const RPointerArray<CSIPHeaderBase>& responseHeaders = 
        response->AllHeadersL();
    
    for (TInt i=0; i < responseHeaders.Count(); i++)
        {
        CSIPHeaderBase* header = responseHeaders[i];
        User::LeaveIfError(headers.Append(header));
        response->RemoveHeader(header);
        }       
    
    iObserver.ClientNotFoundL(iIdsPckg(),
                              response->ResponseCode(),
                              response->ReasonPhrase(),
                              headers,
                              content);

    CleanupStack::Pop(1); // headers
    CleanupStack::PopAndDestroy(response);
    CleanupStack::Pop(content);
    }
Ejemplo n.º 30
0
// ----------------------------------------------------------------------------
// 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;
	}