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.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* TestParameter.h: interface for the CTestParameter class.
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
sl@0
    21
sl@0
    22
/**
sl@0
    23
 @file
sl@0
    24
*/
sl@0
    25
sl@0
    26
#ifndef __TESTPARAMETER_H__
sl@0
    27
#define __TESTPARAMETER_H__
sl@0
    28
sl@0
    29
#include <e32base.h>
sl@0
    30
sl@0
    31
const TInt KMaxValueSize = 100;
sl@0
    32
sl@0
    33
class CTestParameter : public CBase  
sl@0
    34
{
sl@0
    35
public:
sl@0
    36
	enum TType
sl@0
    37
	{
sl@0
    38
		EInt,
sl@0
    39
		EString,
sl@0
    40
		EIntRange,
sl@0
    41
		ERandom
sl@0
    42
	};
sl@0
    43
public:
sl@0
    44
	virtual ~CTestParameter(){};
sl@0
    45
sl@0
    46
	virtual TType GetType(void) = 0;
sl@0
    47
	TBool iValid;
sl@0
    48
protected:
sl@0
    49
	CTestParameter();
sl@0
    50
	TInt ConvertHex(const TDes& aValue, TInt &aIntValue);
sl@0
    51
};
sl@0
    52
sl@0
    53
class CIntTestParameter : public CTestParameter  
sl@0
    54
{
sl@0
    55
public:
sl@0
    56
	static CIntTestParameter* NewL(TDes& aValue);
sl@0
    57
	static CIntTestParameter* NewLC(TDes& aValue);
sl@0
    58
	virtual ~CIntTestParameter(){};
sl@0
    59
sl@0
    60
	inline TType GetType(void) { return(EInt);};
sl@0
    61
	inline TInt Value(void) { return(iValue);}
sl@0
    62
protected:
sl@0
    63
	CIntTestParameter(){}
sl@0
    64
private:
sl@0
    65
	void Construct(TDes& aValue);
sl@0
    66
private:
sl@0
    67
	TInt iValue;
sl@0
    68
};
sl@0
    69
sl@0
    70
class CIntRangeTestParameter : public CTestParameter  
sl@0
    71
{
sl@0
    72
public:
sl@0
    73
	static CIntRangeTestParameter* NewL(TDes& aValue);
sl@0
    74
	static CIntRangeTestParameter* NewLC(TDes& aValue);
sl@0
    75
	virtual ~CIntRangeTestParameter(){};
sl@0
    76
sl@0
    77
	inline TType GetType(void) { return(EIntRange);};
sl@0
    78
	inline TInt Start(void) { return(iStart);};
sl@0
    79
	inline TInt Finish(void) { return(iFinish);};
sl@0
    80
	inline TInt Range(void) { return((iFinish - iStart)+1);};
sl@0
    81
protected:
sl@0
    82
	CIntRangeTestParameter(){}
sl@0
    83
private:
sl@0
    84
	void Construct(TDes& aValue);
sl@0
    85
private:
sl@0
    86
	TInt iStart;
sl@0
    87
	TInt iFinish;
sl@0
    88
};
sl@0
    89
sl@0
    90
class CRandomTestParameter : public CTestParameter  
sl@0
    91
{
sl@0
    92
public:
sl@0
    93
	static CRandomTestParameter* NewL(TDes& aValue);
sl@0
    94
	static CRandomTestParameter* NewLC(TDes& aValue);
sl@0
    95
	virtual ~CRandomTestParameter(){};
sl@0
    96
sl@0
    97
	inline TType GetType(void) { return(ERandom);};
sl@0
    98
	inline TInt Interations(void) { return(iInterations);};
sl@0
    99
protected:
sl@0
   100
	CRandomTestParameter(){}
sl@0
   101
private:
sl@0
   102
	void Construct(TDes& aValue);
sl@0
   103
private:
sl@0
   104
	TInt iInterations;
sl@0
   105
};
sl@0
   106
sl@0
   107
class CStringTestParameter : public CTestParameter  
sl@0
   108
{
sl@0
   109
public:
sl@0
   110
	static CStringTestParameter* NewL(TDes& aValue);
sl@0
   111
	static CStringTestParameter* NewLC(TDes& aValue);
sl@0
   112
	virtual ~CStringTestParameter(){};
sl@0
   113
sl@0
   114
	inline TType GetType(void) { return(EString);};
sl@0
   115
	inline void GetValue(TDes& aValue) { aValue.Copy(iValue);};
sl@0
   116
protected:
sl@0
   117
	CStringTestParameter(){}
sl@0
   118
private:
sl@0
   119
	void Construct(TDes& aValue);
sl@0
   120
private:
sl@0
   121
	TBuf<KMaxValueSize> iValue;
sl@0
   122
};
sl@0
   123
sl@0
   124
#endif // !defined(AFX_TESTPARAMETER_H__95894347_8529_11D6_AB96_00080214A261__INCLUDED_)
sl@0
   125