cryptoservices/certificateandkeymgmt/tasn1/testparameter.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     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 the License "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 * TestParameter.h: interface for the CTestParameter class.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @file
       
    26 */
       
    27 
       
    28 #ifndef __TESTPARAMETER_H__
       
    29 #define __TESTPARAMETER_H__
       
    30 
       
    31 #include <e32base.h>
       
    32 
       
    33 const TInt KMaxValueSize = 100;
       
    34 
       
    35 class CTestParameter : public CBase  
       
    36 {
       
    37 public:
       
    38 	enum TType
       
    39 	{
       
    40 		EInt,
       
    41 		EString,
       
    42 		EIntRange,
       
    43 		ERandom
       
    44 	};
       
    45 public:
       
    46 	virtual ~CTestParameter(){};
       
    47 
       
    48 	virtual TType GetType(void) = 0;
       
    49 	TBool iValid;
       
    50 protected:
       
    51 	CTestParameter();
       
    52 	TInt ConvertHex(const TDes& aValue, TInt &aIntValue);
       
    53 };
       
    54 
       
    55 class CIntTestParameter : public CTestParameter  
       
    56 {
       
    57 public:
       
    58 	static CIntTestParameter* NewL(TDes& aValue);
       
    59 	static CIntTestParameter* NewLC(TDes& aValue);
       
    60 	virtual ~CIntTestParameter(){};
       
    61 
       
    62 	inline TType GetType(void) { return(EInt);};
       
    63 	inline TInt Value(void) { return(iValue);}
       
    64 protected:
       
    65 	CIntTestParameter(){}
       
    66 private:
       
    67 	void Construct(TDes& aValue);
       
    68 private:
       
    69 	TInt iValue;
       
    70 };
       
    71 
       
    72 class CIntRangeTestParameter : public CTestParameter  
       
    73 {
       
    74 public:
       
    75 	static CIntRangeTestParameter* NewL(TDes& aValue);
       
    76 	static CIntRangeTestParameter* NewLC(TDes& aValue);
       
    77 	virtual ~CIntRangeTestParameter(){};
       
    78 
       
    79 	inline TType GetType(void) { return(EIntRange);};
       
    80 	inline TInt Start(void) { return(iStart);};
       
    81 	inline TInt Finish(void) { return(iFinish);};
       
    82 	inline TInt Range(void) { return((iFinish - iStart)+1);};
       
    83 protected:
       
    84 	CIntRangeTestParameter(){}
       
    85 private:
       
    86 	void Construct(TDes& aValue);
       
    87 private:
       
    88 	TInt iStart;
       
    89 	TInt iFinish;
       
    90 };
       
    91 
       
    92 class CRandomTestParameter : public CTestParameter  
       
    93 {
       
    94 public:
       
    95 	static CRandomTestParameter* NewL(TDes& aValue);
       
    96 	static CRandomTestParameter* NewLC(TDes& aValue);
       
    97 	virtual ~CRandomTestParameter(){};
       
    98 
       
    99 	inline TType GetType(void) { return(ERandom);};
       
   100 	inline TInt Interations(void) { return(iInterations);};
       
   101 protected:
       
   102 	CRandomTestParameter(){}
       
   103 private:
       
   104 	void Construct(TDes& aValue);
       
   105 private:
       
   106 	TInt iInterations;
       
   107 };
       
   108 
       
   109 class CStringTestParameter : public CTestParameter  
       
   110 {
       
   111 public:
       
   112 	static CStringTestParameter* NewL(TDes& aValue);
       
   113 	static CStringTestParameter* NewLC(TDes& aValue);
       
   114 	virtual ~CStringTestParameter(){};
       
   115 
       
   116 	inline TType GetType(void) { return(EString);};
       
   117 	inline void GetValue(TDes& aValue) { aValue.Copy(iValue);};
       
   118 protected:
       
   119 	CStringTestParameter(){}
       
   120 private:
       
   121 	void Construct(TDes& aValue);
       
   122 private:
       
   123 	TBuf<KMaxValueSize> iValue;
       
   124 };
       
   125 
       
   126 #endif // !defined(AFX_TESTPARAMETER_H__95894347_8529_11D6_AB96_00080214A261__INCLUDED_)