sl@0: /* sl@0: * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include "T_VolumeInfoData.h" sl@0: sl@0: sl@0: // Commands sl@0: _LIT( KCmdNew, "new" ); sl@0: _LIT( KCmdDestructor, "~" ); sl@0: sl@0: CT_VolumeInfoData* CT_VolumeInfoData::NewL() sl@0: /** sl@0: * Two phase constructor sl@0: */ sl@0: { sl@0: CT_VolumeInfoData* ret = new (ELeave) CT_VolumeInfoData(); sl@0: CleanupStack::PushL( ret ); sl@0: ret->ConstructL(); sl@0: CleanupStack::Pop( ret ); sl@0: return ret; sl@0: } sl@0: sl@0: CT_VolumeInfoData::CT_VolumeInfoData() sl@0: : iVolumeInfo(NULL) sl@0: /** sl@0: * Protected constructor. First phase construction sl@0: */ sl@0: { sl@0: } sl@0: sl@0: void CT_VolumeInfoData::ConstructL() sl@0: /** sl@0: * Protected constructor. Second phase construction sl@0: */ sl@0: { sl@0: } sl@0: sl@0: CT_VolumeInfoData::~CT_VolumeInfoData() sl@0: /** sl@0: * Destructor. sl@0: */ sl@0: { sl@0: DoCleanup(); sl@0: } sl@0: sl@0: sl@0: TAny* CT_VolumeInfoData::GetObject() sl@0: /** sl@0: * Return a pointer to the object that the data wraps sl@0: * sl@0: * @return pointer to the object that the data wraps sl@0: */ sl@0: { sl@0: return iVolumeInfo; sl@0: } sl@0: sl@0: void CT_VolumeInfoData::SetObjectL(TAny* aAny) sl@0: { sl@0: DoCleanup(); sl@0: iVolumeInfo = static_cast (aAny); sl@0: } sl@0: sl@0: void CT_VolumeInfoData::DisownObjectL() sl@0: { sl@0: iVolumeInfo = NULL; sl@0: } sl@0: sl@0: inline TCleanupOperation CT_VolumeInfoData::CleanupOperation() sl@0: { sl@0: return CleanupOperation; sl@0: } sl@0: sl@0: void CT_VolumeInfoData::CleanupOperation(TAny* aAny) sl@0: { sl@0: TVolumeInfo* volumeInfo = static_cast(aAny); sl@0: delete volumeInfo; sl@0: } sl@0: sl@0: TBool CT_VolumeInfoData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& /*aSection*/, const TInt /*aAsyncErrorIndex*/ ) sl@0: /** sl@0: * Process a command read from the ini file sl@0: * sl@0: * @param aCommand the command to process sl@0: * @param aSection the entry in the ini file requiring the command to be processed sl@0: * sl@0: * @return ETrue if the command is processed sl@0: */ sl@0: { sl@0: TBool retVal = ETrue; sl@0: sl@0: if ( aCommand == KCmdNew ) sl@0: { sl@0: DoCmdNew(); sl@0: } sl@0: else if ( aCommand == KCmdDestructor ) sl@0: { sl@0: DoCleanup(); sl@0: } sl@0: else sl@0: { sl@0: retVal = EFalse; sl@0: } sl@0: sl@0: return retVal; sl@0: } sl@0: sl@0: void CT_VolumeInfoData::DoCmdNew() sl@0: /** Creates new TVolumeInfo class instance */ sl@0: { sl@0: INFO_PRINTF1( _L( "Create new TVolumeInfo class instance" ) ); sl@0: sl@0: TRAPD( err, iVolumeInfo = new (ELeave) TVolumeInfo() ); sl@0: if ( err!=KErrNone ) sl@0: { sl@0: ERR_PRINTF2( _L( "new error %d" ), err ); sl@0: SetError( err ); sl@0: } sl@0: } sl@0: sl@0: void CT_VolumeInfoData::DoCleanup() sl@0: { sl@0: INFO_PRINTF1( _L( "Delete TVolumeInfo class instance." ) ); sl@0: sl@0: delete iVolumeInfo; sl@0: iVolumeInfo = NULL; sl@0: } sl@0: sl@0: