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