testexecmdw/tef/tef/utils/inc/dataaccess.h
branchRCL_3
changeset 3 9397a16b6eb8
parent 1 6edeef394eb7
equal deleted inserted replaced
1:6edeef394eb7 3:9397a16b6eb8
     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 DataAccess.h
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __DATA_ACCESS_H__
       
    23 #define __DATA_ACCESS_H__
       
    24 
       
    25 #include <test/testexecutestepbase.h>
       
    26 
       
    27 #include <test/datawrapper.h>
       
    28 
       
    29 class MDataAccess
       
    30 /**
       
    31  * @internalComponent
       
    32  * @test
       
    33  *
       
    34  * Data access interface
       
    35  */
       
    36 	{
       
    37 public:
       
    38 	/**
       
    39 	 * Read a boolean value from the configuration file.
       
    40 	 *
       
    41 	 * @param	aSectName - Section name in the config file
       
    42 	 * @param	aKeyName - text name for the value in the config file
       
    43 	 * @param	aResult - value found in config file. ETrue is represented by the case insensitive string "true"
       
    44 	 *
       
    45 	 * @return	ETrue if the section/key name was found
       
    46 	 */
       
    47 	virtual TBool			GetBoolFromConfig(const TDesC&  aSectName, const TDesC& aKeyName, TBool& aResult) =0;
       
    48 
       
    49 	/**
       
    50 	 * Read an integer value from the configuration file.
       
    51 	 *
       
    52 	 * @param	aSectName - Section name in the config file
       
    53 	 * @param	aKeyName - text name for the value in the config file
       
    54 	 * @param	aResult - value found in config file. ETrue is represented by the case insensitive string "true"
       
    55 	 *
       
    56 	 * @return	ETrue if the section/key name was found
       
    57 	 */
       
    58 	virtual TBool			GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult) =0;
       
    59 
       
    60 	/**
       
    61 	 * Read a string value from the configuration file.
       
    62 	 *
       
    63 	 * @param	aSectName - Section name in the config file
       
    64 	 * @param	aKeyName - text name for the value in the config file
       
    65 	 * @param	aResult - value found in config file. ETrue is represented by the case insensitive string "true"
       
    66 	 *
       
    67 	 * @return	ETrue if the section/key name was found
       
    68 	 */
       
    69 	virtual TBool			GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult) =0;
       
    70 
       
    71 	/**
       
    72 	 * Read a hexidecimal value from the configuration file.
       
    73 	 *
       
    74 	 * @param	aSectName - Section name in the config file
       
    75 	 * @param	aKeyName - text name for the value in the config file
       
    76 	 * @param	aResult - value found in config file. ETrue is represented by the case insensitive string "true"
       
    77 	 *
       
    78 	 * @return	ETrue if the section/key name was found
       
    79 	 */
       
    80 	virtual TBool			GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult) =0;
       
    81 
       
    82 	/**
       
    83 	 * Write an integer value to the configuration file.
       
    84 	 *
       
    85 	 * @param	aSectName - Section name in the config file
       
    86 	 * @param	aKeyName - text name for the value in the config file
       
    87 	 * @param	aValue - value to write into the config file.
       
    88 	 *
       
    89 	 * @return	ETrue if successful
       
    90 	 */
       
    91 	virtual TBool			WriteIntToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TInt& aValue) =0;
       
    92 
       
    93 	/**
       
    94 	 * Write a string value to the configuration file.
       
    95 	 *
       
    96 	 * @param	aSectName - Section name in the config file
       
    97 	 * @param	aKeyName - text name for the value in the config file
       
    98 	 * @param	aValue - value to write into the config file.
       
    99 	 *
       
   100 	 * @return	ETrue if successful
       
   101 	 */
       
   102 	virtual TBool			WriteStringToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TPtrC& aValue) =0;
       
   103 
       
   104 	/**
       
   105 	 * Write a boolean value to the configuration file.
       
   106 	 *
       
   107 	 * @param	aSectName - Section name in the config file
       
   108 	 * @param	aKeyName - text name for the value in the config file
       
   109 	 * @param	aValue - value to write into the config file.
       
   110 	 *
       
   111 	 * @return	ETrue if successful
       
   112 	 */
       
   113 	virtual TBool			WriteBoolToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TBool& aValue) =0;
       
   114 
       
   115 	/**
       
   116 	 * Write a hexidecimal value to the configuration file.
       
   117 	 *
       
   118 	 * @param	aSectName - Section name in the config file
       
   119 	 * @param	aKeyName - text name for the value in the config file
       
   120 	 * @param	aValue - value to write into the config file.
       
   121 	 *
       
   122 	 * @return	ETrue if successful
       
   123 	 */
       
   124 	virtual TBool			WriteHexToConfig(const TDesC&  aSectName, const TDesC& aKeyName, const TInt& aValue) =0;
       
   125 
       
   126 	/**
       
   127 	 * Updates the data to the shared data name passed either in Copy Mode/Append Mode
       
   128 	 *
       
   129 	 * @param	aShareName - global shared memory name
       
   130 	 * @param	aSharedDataVal - data to write
       
   131 	 * @param	aModeCopy - copy or append data
       
   132 	 *
       
   133 	 * @leave	system wide error
       
   134 	 */
       
   135 	virtual void			WriteSharedDataL(const TDesC& aShareName, TDesC& aSharedDataVal, TModeCopy aModeCopy) =0;
       
   136 
       
   137 	/**
       
   138 	 * Read data from the shared data name passed
       
   139 	 *
       
   140 	 * @param	aShareName - global shared memory name
       
   141 	 * @param	aSharedDataVal - data read
       
   142 	 *
       
   143 	 * @leave	system wide error
       
   144 	 */
       
   145 	virtual void			ReadSharedDataL(const TDesC& aShareName, TDes& aSharedDataVal) =0;
       
   146 
       
   147 	/**
       
   148 	 * Read name of data dictionary entry from configuration file and return the data wrapper
       
   149 	 *
       
   150 	 * @param	aSectionName - section in configuration file to read name of dictionary entry
       
   151 	 *
       
   152 	 * @leave	KErrBadName - name not found in configuration file
       
   153 	 * @leave	KErrNotFound - entry not found in dictinary
       
   154 	 *
       
   155 	 * @return	Data wrapper for the object
       
   156 	 */
       
   157 	virtual CDataWrapper*	GetDataWrapperL(const TDesC& aSectionName) =0;
       
   158 
       
   159 	/**
       
   160 	 * Read name of data dictionary entry from configuration file and return the data wrapper
       
   161 	 *
       
   162 	 * @param	aSectionName - section in configuration file to read name of dictionary entry
       
   163 	 *
       
   164 	 * @leave	KErrBadName - name not found in configuration file
       
   165 	 * @leave	KErrNotFound - entry not found in dictinary
       
   166 	 *
       
   167 	 * @return	The object stored in the data wrapper
       
   168 	 */
       
   169 	virtual TAny*			GetDataObjectL(const TDesC& aSectionName) =0;
       
   170 
       
   171 	/**
       
   172 	 * Read name of data dictionary entry from configuration file set the data wrappers object
       
   173 	 *
       
   174 	 * @param	aSectionName - section in configuration file to read name of dictionary entry
       
   175 	 * @param	aObject - object to set in the data wrapper
       
   176 	 *
       
   177 	 * @leave	KErrBadName - name not found in configuration file
       
   178 	 * @leave	KErrNotFound - entry not found in dictinary
       
   179 	 */
       
   180 	virtual void			SetDataObjectL(const TDesC& aSectionName, TAny* aObject) =0;
       
   181 
       
   182 	/**
       
   183 	 * Get the logger
       
   184 	 *
       
   185 	 * @see		CTestExecuteLogger
       
   186 	 *
       
   187 	 * @return	the logger
       
   188 	 */
       
   189 	virtual CTestExecuteLogger&	Logger() =0;
       
   190 	};
       
   191 
       
   192 #endif // __DATA_ACCESS_H__