messagingfw/msgtestfw/Framework/src/CMtfTestActionNamePair.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18 */
       
    19 	
       
    20 #include "CMtfTestActionNamePair.h"
       
    21 
       
    22 CMtfTestActionNamePair* CMtfTestActionNamePair::NewL(const TDesC& aName, 
       
    23 		ActionNewL aFunctionPointer)
       
    24 {
       
    25 	CMtfTestActionNamePair* self =  new (ELeave) CMtfTestActionNamePair();
       
    26 	CleanupStack::PushL(self);
       
    27 	self->ConstructL(aName,aFunctionPointer);
       
    28 	CleanupStack::Pop(self);
       
    29 	return self;
       
    30 }
       
    31 
       
    32 CMtfTestActionNamePair::~CMtfTestActionNamePair()
       
    33 {
       
    34 	delete iName;
       
    35 }
       
    36 
       
    37 /** Creates a new test action object. The specific derived test action class instance is
       
    38 created. Ownership of aActionParameters is taken at the end. */
       
    39 CMtfTestAction* CMtfTestActionNamePair::CreateTestActionL(CMtfTestCase& aTestCase,
       
    40 		CMtfTestActionParameters* aActionParameters) const
       
    41 {
       
    42 	return (*iFunctionPointer)(aTestCase,aActionParameters);
       
    43 }
       
    44 		
       
    45 void CMtfTestActionNamePair::ConstructL(const TDesC& aName,
       
    46 		ActionNewL aFunctionPointer)
       
    47 {
       
    48 	iName = aName.AllocL();
       
    49 	iFunctionPointer = aFunctionPointer;
       
    50 }
       
    51 
       
    52 const TDesC& CMtfTestActionNamePair::Name() const
       
    53 {
       
    54 	// iName is guaranteed not to be NULL
       
    55 	return *iName;
       
    56 }