os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/src/T_VolumeInfoData.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 #include "T_VolumeInfoData.h"
    20 
    21 
    22 // Commands
    23 _LIT( KCmdNew,               "new" );
    24 _LIT( KCmdDestructor,        "~" );
    25 
    26 CT_VolumeInfoData* CT_VolumeInfoData::NewL()
    27 /**
    28 * Two phase constructor
    29 */
    30 	{
    31 	CT_VolumeInfoData* ret = new (ELeave) CT_VolumeInfoData();
    32 	CleanupStack::PushL( ret );
    33 	ret->ConstructL();
    34 	CleanupStack::Pop( ret );
    35 	return ret;
    36 	}
    37 
    38 CT_VolumeInfoData::CT_VolumeInfoData()
    39 :	iVolumeInfo(NULL)
    40 /**
    41 * Protected constructor. First phase construction
    42 */
    43 	{
    44 	}
    45 	
    46 void CT_VolumeInfoData::ConstructL()
    47 /**
    48 * Protected constructor. Second phase construction
    49 */
    50 	{
    51 	}
    52 	
    53 CT_VolumeInfoData::~CT_VolumeInfoData()
    54 /**
    55 * Destructor.
    56 */
    57 	{
    58 	DoCleanup();
    59 	}
    60 	
    61 
    62 TAny* CT_VolumeInfoData::GetObject()
    63 /**
    64 * Return a pointer to the object that the data wraps
    65 *
    66 * @return pointer to the object that the data wraps
    67 */
    68 	{
    69 	return iVolumeInfo;
    70 	}
    71 
    72 void CT_VolumeInfoData::SetObjectL(TAny* aAny)
    73 	{
    74 	DoCleanup();
    75 	iVolumeInfo = static_cast<TVolumeInfo*> (aAny);
    76 	}
    77 	
    78 void CT_VolumeInfoData::DisownObjectL()
    79 	{
    80 	iVolumeInfo = NULL;
    81 	}
    82 	
    83 inline TCleanupOperation CT_VolumeInfoData::CleanupOperation()
    84 	{
    85 	return CleanupOperation;
    86 	}
    87 
    88 void CT_VolumeInfoData::CleanupOperation(TAny* aAny)
    89 	{
    90 	TVolumeInfo* volumeInfo = static_cast<TVolumeInfo*>(aAny);
    91 	delete volumeInfo;
    92 	}
    93 
    94 TBool CT_VolumeInfoData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& /*aSection*/, const TInt /*aAsyncErrorIndex*/ )
    95 /**
    96 * Process a command read from the ini file
    97 *
    98 * @param aCommand	the command to process
    99 * @param aSection		the entry in the ini file requiring the command to be processed
   100 *
   101 * @return ETrue if the command is processed
   102 */
   103 	{
   104 	TBool retVal = ETrue;
   105 	
   106 	if ( aCommand == KCmdNew )
   107 		{
   108 		DoCmdNew();
   109 		}
   110 	else if ( aCommand == KCmdDestructor )
   111 		{
   112 		DoCleanup();
   113 		}
   114 	else
   115 	    {
   116 	    retVal = EFalse;    
   117 	    }
   118 	
   119 	return retVal;
   120 	}
   121 	
   122 void CT_VolumeInfoData::DoCmdNew()
   123 /** Creates new TVolumeInfo class instance */
   124 	{
   125 	INFO_PRINTF1( _L( "Create new TVolumeInfo class instance" ) );
   126 	
   127 	TRAPD( err, iVolumeInfo = new (ELeave) TVolumeInfo() );
   128 	if ( err!=KErrNone )
   129 		{
   130 		ERR_PRINTF2( _L( "new error %d" ), err );
   131 		SetError( err );
   132 		}
   133 	}
   134 
   135 void CT_VolumeInfoData::DoCleanup()
   136 	{
   137 	INFO_PRINTF1( _L( "Delete TVolumeInfo class instance." ) );
   138 	
   139 	delete iVolumeInfo;
   140 	iVolumeInfo = NULL;
   141 	}
   142 
   143