void ut_remotepartyinfo::TestInternalizeExternalizeEmptyInfoL()
    {
    HBufC8* data = HBufC8::NewLC( 1024 );
    TPtr8 ptr = data->Des();
    RDesWriteStream stream( ptr );
    ExternalizeL( stream, *iInfo );
    
    CCallRemotePartyInfo* info = CCallRemotePartyInfo::NewLC();
    
    RDesReadStream readStream( ptr );
    InternalizeL( readStream, *info );
    
    EUNIT_ASSERT( iInfo->MatchedName().Length() == 0 );
    EUNIT_ASSERT( iInfo->NameFromNetwork().Length() == 0 );
    EUNIT_ASSERT( iInfo->CompanyName().Length() == 0 );
    EUNIT_ASSERT( iInfo->Address().Length() == 0 ); 
    EUNIT_ASSERT( iInfo->CallIndex() == -1 );
    EUNIT_ASSERT( iInfo->RemoteIdentity() == MCallRemotePartyInfo::ERemoteIdentityUnknown );
    EUNIT_ASSERT( iInfo->SATCall() == EFalse );
    
    CleanupStack::PopAndDestroy( info );
    
    
    CleanupStack::PopAndDestroy( data );
    }
Ejemplo n.º 2
0
/**
 * Internalize (non-leaving) the contents of the Alarm Server backup
 * from the backup file.
 */
TInt CASSrvAlarmStore::Internalize(CASSrvAlarmQueue::TStoreOperation aInternalizeOperation)
	{
	TInt error = KErrNone;

	DEBUG_PRINT1(_L("> Alarm Store Internalize ()"));

	// tell Alarm Queue what type of Internalize to perform
	error = ServerWideData().Queue().StartAlarmStoreOperation(aInternalizeOperation);

	if (!error)
		{
		// don't watch for change notifications during Internalize
		iFlags.Set(EIsInternalizing);

		TRAP(error, InternalizeL());

		// tell alarm queue that Internalize is complete
		ServerWideData().Queue().EndAlarmStoreOperation(error);

		// Finished Internalize, Look for notifications again, etc...
		iFlags.Clear(EIsInternalizing);
		}

	DEBUG_PRINT2(_L("< Alarm Store Internalize - error %i"), error);

	return error;
	}
void ut_remotepartyinfo::TestInternalizeExternalizeInfoL()
    {
    _LIT( KMatchedName, "Mr Smith" );
    _LIT( KNameFromNetwork, "John Smith" );
    _LIT( KCompanyName, "Nokia" );
    _LIT( KAddress, "555555" );
    
    iInfo->SetMatchedNameL( KMatchedName );
    iInfo->SetNameFromNetworkL(KNameFromNetwork);
    iInfo->SetCompanyNameL(KCompanyName);
    iInfo->SetAddressL( KAddress );    
    iInfo->SetCallIndex( 2 );
    iInfo->SetRemoteIdentity( MCallRemotePartyInfo::ERemoteIdentityAvailable );
    iInfo->SetSATCall( ETrue );
    
    HBufC8* data = HBufC8::NewLC( 1024 );
    TPtr8 ptr = data->Des();
    
    RDesWriteStream stream( ptr );
    ExternalizeL( stream, *iInfo );
    
    CCallRemotePartyInfo* info = CCallRemotePartyInfo::NewLC();
    RDesReadStream readStream( ptr );
    InternalizeL( readStream, *info );
    
    EUNIT_ASSERT( info->MatchedName().Match( KMatchedName ) == KErrNone );
    EUNIT_ASSERT( info->NameFromNetwork().Match( KNameFromNetwork ) == KErrNone );
    EUNIT_ASSERT( info->CompanyName().Match( KCompanyName ) == KErrNone );
    EUNIT_ASSERT( info->Address().Match( KAddress ) == KErrNone );    
    EUNIT_ASSERT( info->CallIndex() == 2 );
    EUNIT_ASSERT( iInfo->RemoteIdentity() == MCallRemotePartyInfo::ERemoteIdentityAvailable );
    EUNIT_ASSERT( iInfo->SATCall() == ETrue );
    
    CleanupStack::PopAndDestroy( 2, data ); // info, data
    }
Ejemplo n.º 4
0
void THighscoreHolder::RestoreL(const CStreamStore& aStore, TStreamId aStreamId)
{
	RStoreReadStream stream;
	stream.OpenLC(aStore, aStreamId);
	InternalizeL(stream);
	CleanupStack::PopAndDestroy();
}
Ejemplo n.º 5
0
EXPORT_C void CImSSmtpSettings::RestoreL( CMsvStore& aMessageStore )
	{
	RMsvReadStream in;
	in.OpenLC( aMessageStore, KUidMsvServiceEntry ); // pushes 'in' to the stack
	InternalizeL(in);
	CleanupStack::PopAndDestroy();
	}
Ejemplo n.º 6
0
void CRTPermGrantMessage::ConstructL(const TDesC8& aBuf)
    {
    RDesReadStream stream(aBuf);
    CleanupClosePushL (stream);
    InternalizeL (stream);
    CleanupStack::PopAndDestroy (&stream);
    }
void CCFContextSubscriptionImpl::ConstructL( RReadStream& aStream )
{
    FUNC_LOG;

    ConstructL();
    InternalizeL( aStream );
}
Ejemplo n.º 8
0
void CCompound::RestoreL()
	{
	RStoreReadStream stream;
	stream.OpenLC(iStore,iId);
	InternalizeL(stream);
	CleanupStack::PopAndDestroy();
	}
Ejemplo n.º 9
0
void CCompound::RestoreL(CStreamStore& aStore,TStreamId anId)
{
    RStoreReadStream instream;
    instream.OpenLC(aStore,anId);
    InternalizeL(instream);
    // Cleanup the stream object.
    CleanupStack::PopAndDestroy();
}
Ejemplo n.º 10
0
/** Restores the object to the specified message store.

The function can leave with the standard stream leave codes.

@param aStore Store to which to write
*/
EXPORT_C void TImEmailTransformingInfo::RestoreL( CMsvStore& aStore )
	{
	RMsvReadStream in;
	in.OpenLC( aStore, KUidMsgFileTransformingInfo ); // pushes 'in' to the stack
	InternalizeL(in);
	in.Close();// make sure we close the stream
	CleanupStack::PopAndDestroy();
	}
Ejemplo n.º 11
0
// -----------------------------------------------------------------------------
// CWPPushMessage::RestoreL
// -----------------------------------------------------------------------------
//
EXPORT_C void CWPPushMessage::RestoreL( CMsvStore& aStore )
    {
    RMsvReadStream stream;
    stream.OpenLC( aStore, TUid::Uid( KProvisioningMessageStreamUid ) );
    InternalizeL( stream );
    CleanupStack::PopAndDestroy(); // stream

    ParseHeaderL();
    }
Ejemplo n.º 12
0
EXPORT_C void CImOffLineArrayStore::RestoreL(const CMsvStore& aMessageStore )
	{
	if (aMessageStore.IsPresentL(KUidImQueuedOperationList))
		{
		RMsvReadStream in;
		in.OpenLC( aMessageStore, KUidImQueuedOperationList ); // pushes 'in' to the stack
		InternalizeL(in);
		CleanupStack::PopAndDestroy();
		}
	}
void CNcdNodeContentInfoProxy::ConstructL()
    {
    DLTRACEIN((""));
    // Register the interface
    MNcdNodeContentInfo* interface( this );
    AddInterfaceL( 
        CCatalogsInterfaceIdentifier::NewL( interface, this, MNcdNodeContentInfo::KInterfaceUid ) );
    
    InternalizeL();
    }
Ejemplo n.º 14
0
void CNcdNodeFolderProxy::OperationComplete( 
    MNcdLoadNodeOperation& /*aOperation*/, TInt aError )
    {
    DLTRACEIN(( "Error: %d", aError ));
    
    if ( aError == KErrNone || aError == KNcdErrorSomeCatalogsFailedToLoad )
        {
        // update proxy's status from the server
        TRAP_IGNORE( InternalizeL() );
        }
    }
Ejemplo n.º 15
0
// ----------------------------------------------------------------------------
// Helper funciton to create descriptor array from buffer
// ----------------------------------------------------------------------------
//
EXPORT_C void MPXUser::CreateFromBufferL(
    const CBufBase &aBuf,
    CDesCArray*& aArray)
    {
    delete aArray;
    aArray = NULL;
    RBufReadStream rs(aBuf);
    CleanupClosePushL(rs);
    InternalizeL(aArray, rs);
    CleanupStack::PopAndDestroy(&rs);
    }
Ejemplo n.º 16
0
void CNcdRootNodeProxy::OperationComplete( MNcdLoadNodeOperation& /*aOperation*/,
                                           TInt aError )
    {
    DLTRACEIN((""));
    // Should all the error code checks be removed and always internalize root node?
    if( aError == KErrNone || aError == KNcdErrorSomeCatalogsFailedToLoad || 
        aError == KErrCancel )
        {
        // Because operation went ok. Update the node data.
        TRAP_IGNORE( InternalizeL() );
        }
    DLTRACEOUT((""));
    }
Ejemplo n.º 17
0
void CNcdNodeProxy::ConstructL( )
    {
    DLTRACEIN(("this-ptr as MNcdNode: %X", static_cast<MNcdNode*>( this )));

    // Register the interfaces of this object
    MNcdNode* node( this );
    AddInterfaceL( 
        CCatalogsInterfaceIdentifier::NewL( node, this, MNcdNode::KInterfaceUid ) );

    // Make sure that at least some values are inserted to the link descriptors.
    // So, the references returned from functions of this class will contain at
    // least something.
    iTimestamp = KNullDesC().AllocL();
    iCatalogSourceName = KNullDesC().AllocL(); 
    iExpiredTime = 0;

    // Get the data from the server side.
    // It may be possible that actually not much is received
    // because the node may be in uninitialized state.
    // But at least the namespace and id information should be gotten.
    TRAPD( trapError, InternalizeL() );    

    // This node can not exist if the identifier data is not set.
    // So, if node identifier is not set this should leave and
    // prevent the creation of the node.
    if ( iNodeIdentifier == NULL )
        {
        User::LeaveIfError( trapError );
        }
    
    // Also make sure that parent identifier is set at least to empty value
    if ( iParentIdentifier == NULL )
        {
        // If we have to set the parent identifier here, it means that
        // the node link was not set yet. 
        // If node link was set, then the parent id was also set to correct value. 
        // And, then this value should not be set here.
        iParentIdentifier = CNcdNodeIdentifier::NewL();        
        }
        
    if ( iRealParentIdentifier == NULL ) 
        {
        iRealParentIdentifier = CNcdNodeIdentifier::NewL();
        }

    DLTRACEOUT((""));
    }
Ejemplo n.º 18
0
EXPORT_C void CHeaderFooter::RestoreL(const CStreamStore& aStore,TStreamId aStreamId,MPictureFactory* aFactory)
/** Restores this object and all associated components from a stream store. 

Components include fields and pictures.

@param aStore Stream store from which to restore the CHeaderFooter. 
@param aStreamId ID of the stream containing the external representation of 
the CHeaderFooter object. 
@param aFactory Picture factory. Must be supplied if the header or footer contains 
pictures which should be restored. */
	{
	// retrieve the headstream from the store
	RStoreReadStream stream;
	stream.OpenLC(aStore,aStreamId);
	// internalize the headstream, then fetch the components from their own streams
	InternalizeL(stream);
	CleanupStack::PopAndDestroy(); // stream
	RestoreComponentsL(aStore,aFactory);
	}
Ejemplo n.º 19
0
// -----------------------------------------------------------------------------
// CDRMHelperServer::RestoreL().
// This function restore internal list from data file
// -----------------------------------------------------------------------------
//
void CDRMHelperServer::RestoreL()
    {
#ifdef _DRM_TESTING
    WriteL(_L8("RestoreL"));
#endif

    TInt err = 0;
    RFileReadStream file;

    RFile test;
    err = test.Open( iFs , DataFileL(iFs).FullName() , EFileRead );
    if ( !err )
        {
        CleanupClosePushL(test);
        TInt size = 0;
        err = test.Size(size);
        User::LeaveIfError(err);
        CleanupStack::PopAndDestroy(&test); //test
        if (size == 0)
            {
            StoreL();
            }
        }
    else if ( err == KErrNotFound )
        {
        StoreL();
        }
    else
        {
        User::Leave(err);
        }

    User::LeaveIfError(file.Open( iFs , DataFileL(iFs).FullName() , EFileRead ));
    file.PushL();
    InternalizeL(file);
    CleanupStack::PopAndDestroy(&file); //file

#ifdef _DRM_TESTING
    WriteL(_L8("RestoreL->End"));
#endif
    }
// -----------------------------------------------------------------------------
// CIAUpdateBGFirstTimeHandler::ReadDataL
//
// -----------------------------------------------------------------------------
//
void CIAUpdateBGFirstTimeHandler::ReadDataL()
	{
	RFile file;
    TInt err = file.Open( iFsSession, iPath, EFileRead|EFileShareAny );
    if ( err == KErrNotFound )
    	{
    	iAgreementAccepted = EFalse;
	    iAutomaticUpdateChecksAsked = EFalse; 
    	}
    else
        {
        User::LeaveIfError( err );
        CleanupClosePushL( file );
    
        RFileReadStream stream( file, 0 );
        CleanupClosePushL( stream );
        InternalizeL( stream );
        CleanupStack::PopAndDestroy( &stream );	
        CleanupStack::PopAndDestroy( &file );
        }
	}
// ---------------------------------------------------------------------------
// Sets display bqckground items
// ---------------------------------------------------------------------------
//    
void CAlfSrvDisplaySubSession::SetBackgroundItemsL( const RMessage2& aMessage )
    {
    CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session());
    
    // Parse parameters
    HBufC8* buffer = HBufC8::NewLC(aMessage.GetDesLength(1));
    TPtr8 ptr = buffer->Des();
    aMessage.Read(1, ptr);

    RArray<TAlfDisplayBackgroundItem> array;
    CleanupClosePushL( array );
    InternalizeL(*buffer, array);

    // Store value for this client
    iBackgroundItems.Reset();
    for(TInt i = 0; i < array.Count(); ++i)
        {
        TAlfDisplayBackgroundItem alfItem = array[i];
        THuiDisplayBackgroundItem* huiItem = (THuiDisplayBackgroundItem*)&alfItem;
        iBackgroundItems.Append(*huiItem);
        }

    CleanupStack::PopAndDestroy( &array );

    // Reset full background to none
    iDisplayClearBackground = CHuiDisplay::EClearNone;

    // Update value if the client is on focus
    if ( session.IsFocused() )
        {        
        // Set use background items
        Display().SetBackgroundItemsL(iBackgroundItems);    
        }
    
    CleanupStack::PopAndDestroy( buffer );
    
    // Complete
    aMessage.Complete( KErrNone );    
    }
// -----------------------------------------------------------------------------
// CIAUpdatePendingNodesFile::ReadDataL
//
// -----------------------------------------------------------------------------
//
EXPORT_C TBool CIAUpdatePendingNodesFile::ReadDataL()
	{
    IAUPDATE_TRACE("[IAUPDATE] CIAUpdatePendingNodesFile::ReadDataL begin");
    
	RFile file;
    TInt err( file.Open( iFsSession, iPath, EFileRead ) );
    User::LeaveIfError( err );
    	
    CleanupClosePushL( file );
    
    RFileReadStream stream( file, 0 );
    CleanupClosePushL( stream );

    InternalizeL( stream );

    CleanupStack::PopAndDestroy( &stream );
    CleanupStack::PopAndDestroy( &file );

    IAUPDATE_TRACE("[IAUPDATE] CIAUpdatePendingNodesFile::ReadDataL end");
    
    return ETrue;
	}
Ejemplo n.º 23
0
EXPORT_C void CPrintSetup::RestoreL(const CStreamStore& aStore,TStreamId aStreamId,const MFieldFileNameInfo* aFileNameInfo,const MFieldNumPagesInfo* aNumPagesInfo,MPictureFactory* aFactory)
/** Restores a CPrintSetup object, including its components from a stream store.

@param aStore Store from which to restore the CPrintSetup object 
@param aStreamId ID of the stream containing the external representation of 
the CPrintSetup object 
@param aFileNameInfo An optional object implementing the MFieldFileNameInfo 
interface. This provides the file name for insertion into a field in the header 
or footer.
@param aNumPagesInfo An optional object implementing the MFieldNumPagesInfo 
interface. This provides the total number of pages for insertion into a field 
in the header or footer.
@param aFactory Picture factory. Must be supplied if the header or footer contains 
pictures which should be restored. */
	{
	// retrieve the headstream from the store
	RStoreReadStream stream;
	stream.OpenLC(aStore,aStreamId);
	// internalize the headstream, then fetch the components from their own streams
	InternalizeL(stream);
	CleanupStack::PopAndDestroy(); // stream
	RestoreComponentsL(aStore,aFileNameInfo,aNumPagesInfo,aFactory);
	}
// -----------------------------------------------------------------------------
// CIAUpdateBGControllerFile::ReadControllerDataL
//
// -----------------------------------------------------------------------------
//
TBool CIAUpdateBGControllerFile::ReadControllerDataL()
    {
    RFile file;
    TInt err = file.Open( iFsSession, iPath, EFileRead );
    if ( err == KErrNotFound )
    	{
    	// File did not exist. 
    	// So, nothing to do here anymore.
    	return EFalse;
    	}
    User::LeaveIfError( err );
    	
    CleanupClosePushL( file );
    
    RFileReadStream stream( file, 0 );
    CleanupClosePushL( stream );

    InternalizeL( stream );

    CleanupStack::PopAndDestroy( &stream );
    CleanupStack::PopAndDestroy( &file );

    return ETrue;
    }
/**
Constructs the object through read stream.

@param aReadStream A read stream containing BIC data
*/
void CCmdPersistHalAttributes::ConstructL(RReadStream& aReadStream)
	{
	InternalizeL(aReadStream);
	}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//
void CPosLmNameIndex::LoadL()
    {
    // Skip index loading for empty databases
    TInt numLandmarks = PosLmServerUtility::TotalLandmarkCountL( iDbAccess );
    if ( numLandmarks == 0 )
        {
        iTimeStamp.UniversalTime();
        iStatus = KErrNone;
        return;
        }
    
    RDbTable table;
    TInt err = table.Open( iDatabase, KPosLmIndexTable, RDbRowSet::EReadOnly );
    if ( err )
        {
        LOG("NameIndex::LoadL: index table not found"); 
        User::Leave( err );
        }
    CleanupClosePushL( table );

    table.FirstL();
    if ( table.AtEnd() )
        {
        LOG("NameIndex::LoadL: index not found"); 
        User::Leave( KErrNotFound  );
        }

    table.GetL();

    // verify that index is valid for current language
    if ( !table.IsColNull( EPosLmIncLanguageCol ) )
        {
        TLanguage lang = (TLanguage) table.ColInt32( EPosLmIncLanguageCol );
        if ( User::Language() != lang ) 
            {
            LOG2("NameIndex::LoadL: index not valid, lang %d, current lang %d", 
                lang, User::Language() );
            User::Leave( KErrCorrupt );
            }
        }
    else
        {
        LOG("NameIndex::LoadL: index lang not found"); 
        User::Leave( KErrCorrupt );
        }

    // read the index
    if ( !table.IsColNull( EPosLmIncIndexDataCol ) )
        {
        RDbColReadStream readStream;
        readStream.OpenL( table, EPosLmIncIndexDataCol );
        CleanupClosePushL( readStream );
        InternalizeL( readStream );
        CleanupStack::PopAndDestroy( &readStream );

        // basic check for the index
        if ( Count() != numLandmarks )
            {
            LOG2("NameIndex::LoadL: index not valid, count %d, landmarks in db %d", 
                Count(), numLandmarks );
            User::Leave( KErrCorrupt );
            }
        }
    else
        {
        LOG("NameIndex::LoadL: index data not found"); 
        User::Leave( KErrCorrupt );
        }

    // read the time stamp
    iTimeStamp.UniversalTime();
    if ( !table.IsColNull( EPosLmIncTimestampCol ) )
        {
        iTimeStamp = table.ColTime( EPosLmIncTimestampCol );
        }
    else
        {
        LOG("NameIndex::LoadL: index timestamp not found"); 
        User::Leave( KErrCorrupt );
        }

    CleanupStack::PopAndDestroy ( &table );

    // index is valid
    iStatus = KErrNone;
    }
void CCellTowerDataSimulation::ConstructL() {
	iTimer = CCustomTimer::NewL(this);
	
	InternalizeL();	
}
Ejemplo n.º 28
0
/**
Constructs the object through read stream.
@param aReadStream A read stream containing BIC data
*/
void CCmdPublishSwp::ConstructL(RReadStream& aReadStream)
	{
	InternalizeL(aReadStream);
	ValidateL();
	}
Ejemplo n.º 29
0
// ---------------------------------------------------------------------------
// CSearchKeysEventImp::ConstructL()
// ---------------------------------------------------------------------------
//
void CSearchKeysEventImp::ConstructL( RReadStream& aStream )
    {
    iInfoArray = new ( ELeave) RSearchKeyInfoImpArray;
    InternalizeL( aStream );
    }
// -----------------------------------------------------------------------------
// CHttpCacheEntry::Internalize
//
// -----------------------------------------------------------------------------
//
TInt CHttpCacheEntry::Internalize( RReadStream& aReadStream, const TDesC& aDirectory )
    {
    TRAPD( err, InternalizeL( aReadStream, aDirectory ) );
    return err;
    }