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 the License "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: * TestParameter.h: interface for the CTestParameter class. sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: */ sl@0: sl@0: #ifndef __TESTPARAMETER_H__ sl@0: #define __TESTPARAMETER_H__ sl@0: sl@0: #include sl@0: sl@0: const TInt KMaxValueSize = 100; sl@0: sl@0: class CTestParameter : public CBase sl@0: { sl@0: public: sl@0: enum TType sl@0: { sl@0: EInt, sl@0: EString, sl@0: EIntRange, sl@0: ERandom sl@0: }; sl@0: public: sl@0: virtual ~CTestParameter(){}; sl@0: sl@0: virtual TType GetType(void) = 0; sl@0: TBool iValid; sl@0: protected: sl@0: CTestParameter(); sl@0: TInt ConvertHex(const TDes& aValue, TInt &aIntValue); sl@0: }; sl@0: sl@0: class CIntTestParameter : public CTestParameter sl@0: { sl@0: public: sl@0: static CIntTestParameter* NewL(TDes& aValue); sl@0: static CIntTestParameter* NewLC(TDes& aValue); sl@0: virtual ~CIntTestParameter(){}; sl@0: sl@0: inline TType GetType(void) { return(EInt);}; sl@0: inline TInt Value(void) { return(iValue);} sl@0: protected: sl@0: CIntTestParameter(){} sl@0: private: sl@0: void Construct(TDes& aValue); sl@0: private: sl@0: TInt iValue; sl@0: }; sl@0: sl@0: class CIntRangeTestParameter : public CTestParameter sl@0: { sl@0: public: sl@0: static CIntRangeTestParameter* NewL(TDes& aValue); sl@0: static CIntRangeTestParameter* NewLC(TDes& aValue); sl@0: virtual ~CIntRangeTestParameter(){}; sl@0: sl@0: inline TType GetType(void) { return(EIntRange);}; sl@0: inline TInt Start(void) { return(iStart);}; sl@0: inline TInt Finish(void) { return(iFinish);}; sl@0: inline TInt Range(void) { return((iFinish - iStart)+1);}; sl@0: protected: sl@0: CIntRangeTestParameter(){} sl@0: private: sl@0: void Construct(TDes& aValue); sl@0: private: sl@0: TInt iStart; sl@0: TInt iFinish; sl@0: }; sl@0: sl@0: class CRandomTestParameter : public CTestParameter sl@0: { sl@0: public: sl@0: static CRandomTestParameter* NewL(TDes& aValue); sl@0: static CRandomTestParameter* NewLC(TDes& aValue); sl@0: virtual ~CRandomTestParameter(){}; sl@0: sl@0: inline TType GetType(void) { return(ERandom);}; sl@0: inline TInt Interations(void) { return(iInterations);}; sl@0: protected: sl@0: CRandomTestParameter(){} sl@0: private: sl@0: void Construct(TDes& aValue); sl@0: private: sl@0: TInt iInterations; sl@0: }; sl@0: sl@0: class CStringTestParameter : public CTestParameter sl@0: { sl@0: public: sl@0: static CStringTestParameter* NewL(TDes& aValue); sl@0: static CStringTestParameter* NewLC(TDes& aValue); sl@0: virtual ~CStringTestParameter(){}; sl@0: sl@0: inline TType GetType(void) { return(EString);}; sl@0: inline void GetValue(TDes& aValue) { aValue.Copy(iValue);}; sl@0: protected: sl@0: CStringTestParameter(){} sl@0: private: sl@0: void Construct(TDes& aValue); sl@0: private: sl@0: TBuf iValue; sl@0: }; sl@0: sl@0: #endif // !defined(AFX_TESTPARAMETER_H__95894347_8529_11D6_AB96_00080214A261__INCLUDED_) sl@0: