os/security/cryptoservices/certificateandkeymgmt/tasn1/testparameter.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/tasn1/testparameter.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,125 @@
     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 the License "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 +* TestParameter.h: interface for the CTestParameter class.
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +
    1.24 +
    1.25 +/**
    1.26 + @file
    1.27 +*/
    1.28 +
    1.29 +#ifndef __TESTPARAMETER_H__
    1.30 +#define __TESTPARAMETER_H__
    1.31 +
    1.32 +#include <e32base.h>
    1.33 +
    1.34 +const TInt KMaxValueSize = 100;
    1.35 +
    1.36 +class CTestParameter : public CBase  
    1.37 +{
    1.38 +public:
    1.39 +	enum TType
    1.40 +	{
    1.41 +		EInt,
    1.42 +		EString,
    1.43 +		EIntRange,
    1.44 +		ERandom
    1.45 +	};
    1.46 +public:
    1.47 +	virtual ~CTestParameter(){};
    1.48 +
    1.49 +	virtual TType GetType(void) = 0;
    1.50 +	TBool iValid;
    1.51 +protected:
    1.52 +	CTestParameter();
    1.53 +	TInt ConvertHex(const TDes& aValue, TInt &aIntValue);
    1.54 +};
    1.55 +
    1.56 +class CIntTestParameter : public CTestParameter  
    1.57 +{
    1.58 +public:
    1.59 +	static CIntTestParameter* NewL(TDes& aValue);
    1.60 +	static CIntTestParameter* NewLC(TDes& aValue);
    1.61 +	virtual ~CIntTestParameter(){};
    1.62 +
    1.63 +	inline TType GetType(void) { return(EInt);};
    1.64 +	inline TInt Value(void) { return(iValue);}
    1.65 +protected:
    1.66 +	CIntTestParameter(){}
    1.67 +private:
    1.68 +	void Construct(TDes& aValue);
    1.69 +private:
    1.70 +	TInt iValue;
    1.71 +};
    1.72 +
    1.73 +class CIntRangeTestParameter : public CTestParameter  
    1.74 +{
    1.75 +public:
    1.76 +	static CIntRangeTestParameter* NewL(TDes& aValue);
    1.77 +	static CIntRangeTestParameter* NewLC(TDes& aValue);
    1.78 +	virtual ~CIntRangeTestParameter(){};
    1.79 +
    1.80 +	inline TType GetType(void) { return(EIntRange);};
    1.81 +	inline TInt Start(void) { return(iStart);};
    1.82 +	inline TInt Finish(void) { return(iFinish);};
    1.83 +	inline TInt Range(void) { return((iFinish - iStart)+1);};
    1.84 +protected:
    1.85 +	CIntRangeTestParameter(){}
    1.86 +private:
    1.87 +	void Construct(TDes& aValue);
    1.88 +private:
    1.89 +	TInt iStart;
    1.90 +	TInt iFinish;
    1.91 +};
    1.92 +
    1.93 +class CRandomTestParameter : public CTestParameter  
    1.94 +{
    1.95 +public:
    1.96 +	static CRandomTestParameter* NewL(TDes& aValue);
    1.97 +	static CRandomTestParameter* NewLC(TDes& aValue);
    1.98 +	virtual ~CRandomTestParameter(){};
    1.99 +
   1.100 +	inline TType GetType(void) { return(ERandom);};
   1.101 +	inline TInt Interations(void) { return(iInterations);};
   1.102 +protected:
   1.103 +	CRandomTestParameter(){}
   1.104 +private:
   1.105 +	void Construct(TDes& aValue);
   1.106 +private:
   1.107 +	TInt iInterations;
   1.108 +};
   1.109 +
   1.110 +class CStringTestParameter : public CTestParameter  
   1.111 +{
   1.112 +public:
   1.113 +	static CStringTestParameter* NewL(TDes& aValue);
   1.114 +	static CStringTestParameter* NewLC(TDes& aValue);
   1.115 +	virtual ~CStringTestParameter(){};
   1.116 +
   1.117 +	inline TType GetType(void) { return(EString);};
   1.118 +	inline void GetValue(TDes& aValue) { aValue.Copy(iValue);};
   1.119 +protected:
   1.120 +	CStringTestParameter(){}
   1.121 +private:
   1.122 +	void Construct(TDes& aValue);
   1.123 +private:
   1.124 +	TBuf<KMaxValueSize> iValue;
   1.125 +};
   1.126 +
   1.127 +#endif // !defined(AFX_TESTPARAMETER_H__95894347_8529_11D6_AB96_00080214A261__INCLUDED_)
   1.128 +