os/graphics/graphicsapitest/screendriverhaitest/common/inc/datawrapperbase.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicsapitest/screendriverhaitest/common/inc/datawrapperbase.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,96 @@
     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 "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 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef DATA_WRAPPER_BASE_H
    1.23 +#define DATA_WRAPPER_BASE_H
    1.24 +
    1.25 +//	EPOC includes
    1.26 +#include <test/datawrapper.h>
    1.27 +#define SECS_TO_MS(x)  (x*1000000)
    1.28 +
    1.29 +_LIT(KConsname,				"Test Console");
    1.30 +
    1.31 +#define	GETFROMCONFIGOPTIONAL(aType, aSectName, aKeyName, aResult, aLogMessage)	\
    1.32 +	if ( !Get##aType##FromConfig(aSectName, aKeyName, aResult) )	\
    1.33 +		{															\
    1.34 +		WARN_PRINTF3(aLogMessage, &aKeyName, aResult);				\
    1.35 +		}
    1.36 +
    1.37 +#define	GETFROMCONFIGMANDATORY(aType, aSectName, aKeyName, aResult, aLogMessage, aDataOk)	\
    1.38 +	if ( !Get##aType##FromConfig(aSectName, aKeyName, aResult) )	\
    1.39 +		{															\
    1.40 +		ERR_PRINTF2(aLogMessage, &aKeyName);						\
    1.41 +		SetBlockResult(EFail);										\
    1.42 +		aDataOk=EFalse;												\
    1.43 +		}
    1.44 +
    1.45 +#define	GETSTRINGFROMCONFIGOPTIONAL(aSectName, aKeyName, aResult, aLogMessage)	\
    1.46 +	if ( !GetStringFromConfig(aSectName, aKeyName, aResult) )		\
    1.47 +		{															\
    1.48 +		WARN_PRINTF3(aLogMessage, &aKeyName, &aResult);				\
    1.49 +		}
    1.50 +
    1.51 +#define	GETSTRINGFROMCONFIGMANDATORY(aSectName, aKeyName, aResult, aLogMessage, aDataOk)	\
    1.52 +	if ( !GetStringFromConfig(aSectName, aKeyName, aResult) )		\
    1.53 +		{															\
    1.54 +		ERR_PRINTF2(aLogMessage, &aKeyName);						\
    1.55 +		SetBlockResult(EFail);										\
    1.56 +		aDataOk=EFalse;												\
    1.57 +		}
    1.58 +
    1.59 +class CDataWrapperBase : public CDataWrapper
    1.60 +	{
    1.61 +public:
    1.62 +	class TEnumEntryTable
    1.63 +		{
    1.64 +	public:
    1.65 +		const TDesC&	iString;
    1.66 +		TInt			iValue;
    1.67 +		};
    1.68 +
    1.69 +public:
    1.70 +	TBool					GetBoolFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TBool& aResult);
    1.71 +	TBool					GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
    1.72 +	TBool					GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult);
    1.73 +	TBool					GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
    1.74 +	TBool					GetUintFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint& aResult);
    1.75 +	TBool					GetArrayRectFromConfig(const TDesC& aSectName, const TDesC& aKeyName, RPointerArray<HBufC>& aResult);
    1.76 +	TBool					GetEnumFromConfig(const TDesC& aSectName, const TDesC& aKeyName, const TEnumEntryTable* aTable, TInt& aResult);
    1.77 +	TBool 					KeyPress();
    1.78 +	void 					Timedelay(TInt aTimeoutInSecs);
    1.79 +	virtual void			InitialiseL();
    1.80 +	inline RFs&				FileServer() { return iFs; }
    1.81 +	inline CConsoleBase*	GetConsoleL() { return(Console::NewL(KConsname,TSize(KConsFullScreen,KConsFullScreen)));}
    1.82 +
    1.83 +protected:
    1.84 +	CDataWrapperBase();
    1.85 +	virtual ~CDataWrapperBase();
    1.86 +
    1.87 +private:
    1.88 +	TBool	GetCommandStringParameterL(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult);
    1.89 +	TBool 	KeyCheck();
    1.90 +
    1.91 +private:
    1.92 +	// Included ini files
    1.93 +	RPointerArray<CIniData>	iInclude;
    1.94 +	RPointerArray<HBufC>	iBuffer;
    1.95 +	RFs                     iFs;
    1.96 +	RTimer					iTimer;
    1.97 +	};
    1.98 +
    1.99 +#endif // DATA_WRAPPER_BASE_H