epoc32/include/test/datawrapper.h
branchSymbian3
changeset 4 837f303aceeb
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
       
     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 "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * @file
       
    16 * This contains DataWrapper.h
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef __DATA_WRAPPER_H__
       
    22 #define __DATA_WRAPPER_H__
       
    23 
       
    24 #include <e32def.h>
       
    25 #include <e32cmn.h>
       
    26 
       
    27 #include <test/datadictionary.h>
       
    28 #include <test/dataaccess.h>
       
    29 #include <test/tefresult.h>
       
    30 #include <test/activecallback.h>
       
    31 #include <test/testblockcontroller.h>
       
    32 #include <test/blockitems.h>
       
    33 
       
    34 
       
    35 class CDataWrapper : public CBase, public MActiveCallback, public MDataAccess, public MTEFResult
       
    36 /**
       
    37  * @publishedPartner
       
    38  * @test
       
    39  *
       
    40  * @see		CBase
       
    41  * @see		MActiveCallback
       
    42  * @see		MDataAccess
       
    43  * @see		MTEFResult
       
    44  *
       
    45  * Wrapper for an object in the data dictionary
       
    46  */
       
    47 	{
       
    48 public:
       
    49 	IMPORT_C virtual				~CDataWrapper();
       
    50 
       
    51 	/**
       
    52 	 * Execute a command on the object
       
    53 	 *
       
    54 	 * @param	aCommand - command to execute
       
    55 	 * @param	aSection - section with data for command
       
    56 	 * @param	aAsyncErrorIndex - command index
       
    57 	 *
       
    58 	 * @see		TTEFFunction
       
    59 	 * @see		TTEFSectionName
       
    60 	 *
       
    61 	 * @leave	system wide error
       
    62 	 *
       
    63 	 * @return	ETrue if the command is processed, EFalse if not
       
    64 	 */
       
    65 	IMPORT_C virtual TBool			DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex) = 0;
       
    66 
       
    67 	/**
       
    68 	 * Get the object that the wrapper contains
       
    69 	 *
       
    70 	 * @return	The object that the wrapper contains. NULL if it does not contain one.
       
    71 	 */
       
    72 	virtual TAny*					GetObject() = 0;
       
    73 
       
    74 	inline virtual TCleanupOperation	CleanupOperation();
       
    75 	inline virtual void					SetObjectL(TAny* aObject);
       
    76 	inline virtual void					DisownObjectL();
       
    77 	IMPORT_C void						SetTestBlockController(CTestBlockController* aTestBlockController);
       
    78 	IMPORT_C void						SetDataDictionary(CDataDictionary* aDataDictionary);
       
    79 	inline virtual void					InitialiseL();
       
    80 
       
    81 	inline void						IncOutstanding();
       
    82 	inline void						DecOutstanding();
       
    83 	inline TBool					Outstanding();
       
    84 
       
    85 	// MDataAccess implementation
       
    86 	IMPORT_C virtual TBool			GetBoolFromConfig(const TDesC&  aSectName, const TDesC& aKeyName, TBool& aResult);
       
    87 	IMPORT_C virtual TBool			GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
       
    88 	IMPORT_C virtual TBool			GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult);
       
    89 	IMPORT_C virtual TBool			GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
       
    90 	IMPORT_C virtual TBool			WriteBoolToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TBool& aValue);
       
    91 	IMPORT_C virtual TBool			WriteIntToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TInt& aValue);
       
    92 	IMPORT_C virtual TBool			WriteStringToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TPtrC& aValue);
       
    93 	IMPORT_C virtual TBool			WriteHexToConfig(const TDesC&  aSectName, const TDesC& aKeyName, const TInt& aValue);
       
    94 	IMPORT_C virtual void			ReadSharedDataL(const TDesC& aShareName, TDes& aSharedDataVal);
       
    95 	IMPORT_C virtual void			WriteSharedDataL(const TDesC& aShareName, TDesC& aSharedDataVal, TModeCopy aModeCopy = ESetText);
       
    96 	IMPORT_C virtual CDataWrapper*	GetDataWrapperL(const TDesC& aSectionName);
       
    97 	IMPORT_C virtual TAny*			GetDataObjectL(const TDesC& aSectionName);
       
    98 	IMPORT_C virtual void			SetDataObjectL(const TDesC& aSectionName, TAny* aObject);
       
    99 	IMPORT_C virtual CTestExecuteLogger&	Logger();
       
   100 
       
   101 	// MActiveCallback implementation
       
   102 	IMPORT_C virtual void			RunL(CActive* aActive, TInt aIndex);
       
   103 	IMPORT_C virtual void			DoCancel(CActive* aActive, TInt aIndex);
       
   104 
       
   105 	// MTEFResult implementation
       
   106 	IMPORT_C virtual void			SetError(const TInt aError);
       
   107 	IMPORT_C virtual void			SetAsyncError(const TInt aIndex, const TInt aError);
       
   108 	IMPORT_C virtual void			SetBlockResult(const TVerdict aResult);
       
   109 	IMPORT_C virtual TVerdict		BlockResult();
       
   110 
       
   111 protected:
       
   112 	IMPORT_C CDataWrapper();
       
   113 
       
   114 private:
       
   115 	CDataDictionary*		iDataDictionary;
       
   116 	CTestBlockController*	iTestBlockController;
       
   117 	TInt					iOutstanding;
       
   118 	};
       
   119 
       
   120 #include <test/datawrapper.inl>
       
   121 
       
   122 #endif // __DATA_WRAPPER_H__