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