os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/src/T_VolumeInfoData.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/src/T_VolumeInfoData.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,143 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#include "T_VolumeInfoData.h"
    1.23 +
    1.24 +
    1.25 +// Commands
    1.26 +_LIT( KCmdNew,               "new" );
    1.27 +_LIT( KCmdDestructor,        "~" );
    1.28 +
    1.29 +CT_VolumeInfoData* CT_VolumeInfoData::NewL()
    1.30 +/**
    1.31 +* Two phase constructor
    1.32 +*/
    1.33 +	{
    1.34 +	CT_VolumeInfoData* ret = new (ELeave) CT_VolumeInfoData();
    1.35 +	CleanupStack::PushL( ret );
    1.36 +	ret->ConstructL();
    1.37 +	CleanupStack::Pop( ret );
    1.38 +	return ret;
    1.39 +	}
    1.40 +
    1.41 +CT_VolumeInfoData::CT_VolumeInfoData()
    1.42 +:	iVolumeInfo(NULL)
    1.43 +/**
    1.44 +* Protected constructor. First phase construction
    1.45 +*/
    1.46 +	{
    1.47 +	}
    1.48 +	
    1.49 +void CT_VolumeInfoData::ConstructL()
    1.50 +/**
    1.51 +* Protected constructor. Second phase construction
    1.52 +*/
    1.53 +	{
    1.54 +	}
    1.55 +	
    1.56 +CT_VolumeInfoData::~CT_VolumeInfoData()
    1.57 +/**
    1.58 +* Destructor.
    1.59 +*/
    1.60 +	{
    1.61 +	DoCleanup();
    1.62 +	}
    1.63 +	
    1.64 +
    1.65 +TAny* CT_VolumeInfoData::GetObject()
    1.66 +/**
    1.67 +* Return a pointer to the object that the data wraps
    1.68 +*
    1.69 +* @return pointer to the object that the data wraps
    1.70 +*/
    1.71 +	{
    1.72 +	return iVolumeInfo;
    1.73 +	}
    1.74 +
    1.75 +void CT_VolumeInfoData::SetObjectL(TAny* aAny)
    1.76 +	{
    1.77 +	DoCleanup();
    1.78 +	iVolumeInfo = static_cast<TVolumeInfo*> (aAny);
    1.79 +	}
    1.80 +	
    1.81 +void CT_VolumeInfoData::DisownObjectL()
    1.82 +	{
    1.83 +	iVolumeInfo = NULL;
    1.84 +	}
    1.85 +	
    1.86 +inline TCleanupOperation CT_VolumeInfoData::CleanupOperation()
    1.87 +	{
    1.88 +	return CleanupOperation;
    1.89 +	}
    1.90 +
    1.91 +void CT_VolumeInfoData::CleanupOperation(TAny* aAny)
    1.92 +	{
    1.93 +	TVolumeInfo* volumeInfo = static_cast<TVolumeInfo*>(aAny);
    1.94 +	delete volumeInfo;
    1.95 +	}
    1.96 +
    1.97 +TBool CT_VolumeInfoData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& /*aSection*/, const TInt /*aAsyncErrorIndex*/ )
    1.98 +/**
    1.99 +* Process a command read from the ini file
   1.100 +*
   1.101 +* @param aCommand	the command to process
   1.102 +* @param aSection		the entry in the ini file requiring the command to be processed
   1.103 +*
   1.104 +* @return ETrue if the command is processed
   1.105 +*/
   1.106 +	{
   1.107 +	TBool retVal = ETrue;
   1.108 +	
   1.109 +	if ( aCommand == KCmdNew )
   1.110 +		{
   1.111 +		DoCmdNew();
   1.112 +		}
   1.113 +	else if ( aCommand == KCmdDestructor )
   1.114 +		{
   1.115 +		DoCleanup();
   1.116 +		}
   1.117 +	else
   1.118 +	    {
   1.119 +	    retVal = EFalse;    
   1.120 +	    }
   1.121 +	
   1.122 +	return retVal;
   1.123 +	}
   1.124 +	
   1.125 +void CT_VolumeInfoData::DoCmdNew()
   1.126 +/** Creates new TVolumeInfo class instance */
   1.127 +	{
   1.128 +	INFO_PRINTF1( _L( "Create new TVolumeInfo class instance" ) );
   1.129 +	
   1.130 +	TRAPD( err, iVolumeInfo = new (ELeave) TVolumeInfo() );
   1.131 +	if ( err!=KErrNone )
   1.132 +		{
   1.133 +		ERR_PRINTF2( _L( "new error %d" ), err );
   1.134 +		SetError( err );
   1.135 +		}
   1.136 +	}
   1.137 +
   1.138 +void CT_VolumeInfoData::DoCleanup()
   1.139 +	{
   1.140 +	INFO_PRINTF1( _L( "Delete TVolumeInfo class instance." ) );
   1.141 +	
   1.142 +	delete iVolumeInfo;
   1.143 +	iVolumeInfo = NULL;
   1.144 +	}
   1.145 +
   1.146 +