Update contrib.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #if (!defined __DATA_WRAPPER_BASE__)
20 #define __DATA_WRAPPER_BASE__
23 #include <datawrapper.h>
24 #define SECS_TO_MS(x) (x*1000000)
26 typedef TBuf<KTEFMaxNameLength> TIniDataName;
28 _LIT(KConsname, "Test Console");
30 #define GETFROMCONFIGOPTIONAL(aType, aSectName, aKeyName, aResult, aLogMessage) \
31 if ( !Get##aType##FromConfig(aSectName, aKeyName, aResult) ) \
33 WARN_PRINTF3(aLogMessage, &aKeyName, aResult); \
36 #define GETFROMCONFIGMANDATORY(aType, aSectName, aKeyName, aResult, aLogMessage, aDataOk) \
37 if ( !Get##aType##FromConfig(aSectName, aKeyName, aResult) ) \
39 ERR_PRINTF2(aLogMessage, &aKeyName); \
40 SetBlockResult(EFail); \
44 #define GETSTRINGFROMCONFIGOPTIONAL(aSectName, aKeyName, aResult, aLogMessage) \
45 if ( !GetStringFromConfig(aSectName, aKeyName, aResult) ) \
47 WARN_PRINTF3(aLogMessage, &aKeyName, &aResult); \
50 #define GETSTRINGFROMCONFIGMANDATORY(aSectName, aKeyName, aResult, aLogMessage, aDataOk) \
51 if ( !GetStringFromConfig(aSectName, aKeyName, aResult) ) \
53 ERR_PRINTF2(aLogMessage, &aKeyName); \
54 SetBlockResult(EFail); \
58 class CDataWrapperBase : public CDataWrapper
69 TBool GetBoolFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TBool& aResult);
70 TBool GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
71 TBool GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult);
72 TBool GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
73 TBool GetUintFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint& aResult);
74 TBool GetPointFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPoint& aResult);
75 TBool GetRectFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRect& aResult);
76 TBool GetSizeFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TSize& aResult);
77 TBool GetEnumFromConfig(const TDesC& aSectName, const TDesC& aKeyName, const TEnumEntryTable* aTable, TInt& aResult);
78 TBool GetOrFromConfig(const TDesC& aSectName, const TDesC& aKeyName, const TEnumEntryTable* aTable, TUint& aResult);
79 TBool GetUint8FromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint8& aResult);
80 void Timedelay(TInt aTimeoutInSecs);
81 virtual void InitialiseL();
82 inline RFs& FileServer();
83 inline CConsoleBase* GetConsoleL();
84 TBool TranslateEnumToString(CDataWrapper& aDataWrapper, const TDesC& aEnum, const TInt aValue, TDesC& aTrasnaltion);
85 TBool TranslateNumberToEnumStringL(CDataWrapper& aDataWrapper, const TDesC& aSection, const TInt aValue, TDes& aTranslation);
86 void PromptMessageL(const TDesC& aMsg,const TInt aDelayMiliSec,TKeyCode& aKeyCode);
87 virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
91 virtual ~CDataWrapperBase();
93 TBool GetCommandStringParameter(const TDesC& aParameterName, const TDesC& aSection, TPtrC& aResult, TText8 *aFileName, TInt aLine, TBool aMandatory);
94 TBool GetCommandIntParameter(const TDesC& aParameterName, const TDesC& aSection, TInt& aResult, TText8 *aFileName, TInt aLine, TBool aMandatory);
95 TBool GetCommandBoolParameter(const TDesC& aParameterName, const TDesC& aSection, TBool& aResult, TText8 *aFileName, TInt aLine, TBool aMandatory);
98 TBool ProcessString(const TDesC& aStr, TUint& aResult, const TEnumEntryTable* aTable);
99 TBool ProcessEntry(const TDesC& aStr, TUint& aResult, const TEnumEntryTable* aTable);
100 TBool ProcessEnumList(CDataWrapper& aDataWrapper, const TDesC& aStr, const TDesC& aEnum, const TUint& aValue, TDes& aTranslation);
101 TBool GetCommandStringParameterL(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult);
103 void DoCmdUtilityPromptMessageL(const TDesC& aSection);
106 // Included ini files
107 RPointerArray<CIniData> iInclude;
108 RPointerArray<HBufC> iBuffer;
113 #include "DataWrapperBase.inl"
115 #endif /* __DATA_WRAPPER_BASE__ */