telephonyserverplugins/simtsy/testconfigfileparser/inc/testconfigfileparser.h
author hgs
Wed, 25 Aug 2010 14:35:42 +0100
changeset 64 b34bb05ac869
permissions -rw-r--r--
201031_04
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
64
b34bb05ac869 201031_04
hgs
parents:
diff changeset
     1
/*
b34bb05ac869 201031_04
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
b34bb05ac869 201031_04
hgs
parents:
diff changeset
     3
* All rights reserved.
b34bb05ac869 201031_04
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b34bb05ac869 201031_04
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b34bb05ac869 201031_04
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b34bb05ac869 201031_04
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b34bb05ac869 201031_04
hgs
parents:
diff changeset
     8
*
b34bb05ac869 201031_04
hgs
parents:
diff changeset
     9
* Initial Contributors:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    11
*
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    12
* Contributors:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    13
*
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    14
* Description: 
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    15
*
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    16
*/
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    17
/**
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    18
 * @file testscripts.h Defines classes for reading a configuration file
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    19
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    20
 * @note Configuration File Format:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    21
 * 
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    22
 * [Defaults]
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    23
 * defaults= another_config_file.txt
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    24
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    25
 * [SectionName]
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    26
 * variable= value
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    27
 * variable2= value2
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    28
 * variable= value3
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    29
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    30
 * [SectionName2]
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    31
 * variable= value
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    32
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    33
 * endscript
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    34
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    35
 * 
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    36
 * @note Explanation:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    37
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    38
 * A configuration file is made up of a number of "sections", each of which can contain a number of "items" (name, value combination).
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    39
 * 
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    40
 * "Sections" must have a name and be surrounded by square backets, e.g.:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    41
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    42
 *      [SectionName]
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    43
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    44
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    45
 * Each "item" consists of consists of a name, followed by an equals sign, followed by blank space, followed by the value to assign to that variable.
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    46
 * 
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    47
 * The value can be of any length, contain whitespace and span multiple lines. The value ends when the next item or section is found. E.g:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    48
 * 
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    49
 * Simple Item:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    50
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    51
 *      variable= value
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    52
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    53
 * Two items on one line:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    54
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    55
 *      variable= value variable2= value2
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    56
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    57
 * Multi-line item:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    58
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    59
 *      variable= This variable
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    60
 *      spans multiple
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    61
 *      lines
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    62
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    63
 * 
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    64
 * @note Parsing stops at End-Of-File or if the tag "endscript" (without the quotes) appears in the file.
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    65
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    66
 * @note A section may take some default values from another section or config file
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    67
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    68
 * To specify default values for all sections, add a section at the start of the config file called [Defaults], e.g.:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    69
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    70
 *      [Defaults]
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    71
 *      sc= +447785016005
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    72
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    73
 * To read default values from another config file, add an item with name "defaults" and value is the name of the file. E.g.:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    74
 *
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    75
 *      defaults= another_config_file.txt
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    76
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    77
 */
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    78
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    79
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    80
#ifndef __TEST_CONFIG_FILE_PARSER_H__
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    81
#define __TEST_CONFIG_FILE_PARSER_H__
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    82
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    83
#include <e32std.h>
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    84
#include <e32base.h>
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    85
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    86
class CTestConfigSection;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    87
class CTestConfigItem;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    88
class RFs;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    89
class TParse;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    90
class RFile;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    91
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    92
_LIT(KScriptPanic, "TEST-SCRIPT");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    93
_LIT(KScriptPathSep,"\\");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    94
_LIT8(KScriptSectionStart, "[");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    95
_LIT8(KScriptSectionEnd, "]");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    96
_LIT8(KScriptCRLF, "\r\n");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    97
_LIT8(KScriptCRLF8, "\r\n");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    98
_LIT8(KScriptLF, "\n");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
    99
_LIT8(KScriptCR, "\r");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   100
_LIT8(KScriptItemEnd, "=");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   101
_LIT8(KScriptItemEnd8, "=");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   102
_LIT8(KScriptSpace8, " ");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   103
_LIT8(KScriptDefaults, "Defaults");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   104
_LIT8(KScriptDefault1, "Def");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   105
_LIT8(KScriptDefault2, "Default");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   106
_LIT8(KScriptCommentStart, "#");
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   107
const TInt KScriptLFChar = '\n';
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   108
const TInt KScriptCRChar = '\r';
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   109
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   110
class CTestConfig : public CBase
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   111
/**
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   112
 * @internalComponent
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   113
 * @deprecated
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   114
 */
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   115
	{
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   116
	public:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   117
		IMPORT_C static CTestConfig* NewLC(RFs& aFs, const TDesC& aComponent, const TDesC& aScriptFile);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   118
		IMPORT_C static CTestConfig* NewLC(RFs& aFs, const TDesC& aComponent);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   119
		IMPORT_C ~CTestConfig();
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   120
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   121
		IMPORT_C const TDesC8& ItemValue(const TDesC8& aSection, const TDesC8& aItem, const TDesC8& aDefault) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   122
		IMPORT_C TInt ItemValue(const TDesC8& aSection, const TDesC8& aItem, const TInt aDefault) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   123
		
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   124
		IMPORT_C void ReadScriptL(const TDesC& aScript);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   125
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   126
		inline const RPointerArray<CTestConfigSection>& Sections() const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   127
		inline RPointerArray<CTestConfigSection>& Sections();
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   128
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   129
		IMPORT_C const CTestConfigSection* Section(const TDesC8& aSectionName) const; //return NULL if section not found
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   130
		IMPORT_C CTestConfigSection* Section(const TDesC8& aSectionName); //return NULL if section not found
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   131
		inline const CTestConfigSection& operator[](TInt aIndex) const {return *iSections[aIndex];}
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   132
		inline CTestConfigSection& operator[](TInt aIndex) {return *iSections[aIndex];}
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   133
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   134
		IMPORT_C static TInt CountElements(const TDesC8& aInput, TChar aDelimiter);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   135
		IMPORT_C static TInt GetElement(const TDesC8& aInput, TChar aDelimiter, TInt aIndex, TInt& aOutput);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   136
		IMPORT_C static TInt GetElement(const TDesC8& aInput, TChar aDelimiter, TInt aIndex, TPtrC8& aOutput, TBool aTrimOutput = ETrue);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   137
		IMPORT_C static TPtrC8 Trim(const TDesC8& aInput);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   138
		IMPORT_C static TPtrC8 TrimLeft(const TDesC8& aInput);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   139
		IMPORT_C static TPtrC8 TrimRight(const TDesC8& aInput);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   140
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   141
		IMPORT_C static HBufC8* ReplaceLC(const TDesC8& aOld, const TDesC8& aNew, const TDesC8& aOldString);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   142
		IMPORT_C static TInt ResolveFile(RFs& aFs, const TDesC& aComponent, const TDesC& aFileName, TParse& aParseOut);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   143
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   144
		IMPORT_C void WriteFileL(const TDesC& aFileName);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   145
		IMPORT_C TBool operator==(const CTestConfig& aFile) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   146
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   147
		IMPORT_C void AddSectionL(CTestConfigSection& aSection);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   148
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   149
	protected:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   150
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   151
		CTestConfig(RFs& aFs);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   152
		void ConstructL(const TDesC& aComponent);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   153
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   154
		TPtrC8 ParseValue(const TDesC8& aText, const TLex8& aInput, TInt aCurrentItemStart) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   155
		void ParseAndSetItemValueL(const TDesC8& aText, const TLex8& aInput, TInt aCurrentItemStart, CTestConfigItem*& arCurrentItem);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   156
		void CopyInDefaultsL(CTestConfigSection& aSection, const TDesC& aDefaultFile);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   157
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   158
		HBufC8* ReadFileL(const TDesC& aFile) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   159
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   160
		TBool IsDefaultSection(const TDesC8& aSectionName) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   161
		static TInt GetNextElement(TLex8& aInput, TChar aDelimiter, TPtrC8& aOutput);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   162
		TBool IsNewSection(const TDesC8& aSource, const TLex8& aInput) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   163
		TBool IsNewItem(const TDesC8& aSource, const TLex8& aLex, TPtrC8& aItem, TInt& aStartOfValue) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   164
		TBool IsNewComment(const TDesC8& aSource, const TLex8& aLex) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   165
		TBool IsAtStartOfNewLine(const TDesC8& aSource, const TLex8& aLex, TBool aIgnoreSpaces) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   166
		void SkipToNextLine(TLex8& aInput) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   167
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   168
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   169
	protected:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   170
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   171
		RFs& iFs;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   172
		HBufC* iComponent;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   173
		RPointerArray<CTestConfigSection> iSections;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   174
	};
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   175
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   176
class CTestConfigSection : public CBase
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   177
/**
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   178
 * @internalComponent
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   179
 * @deprecated
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   180
 */
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   181
	{
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   182
	friend class CTestConfig;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   183
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   184
	public:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   185
		IMPORT_C static CTestConfigSection* NewLC(const TDesC8& aSectionName);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   186
		IMPORT_C static CTestConfigSection* NewLC(const TDesC8& aSectionName, CTestConfigSection& aDefaults);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   187
		IMPORT_C ~CTestConfigSection();
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   188
		
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   189
		inline const TDesC8& SectionName() const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   190
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   191
		IMPORT_C const CTestConfigItem* Item(const TDesC8& aItemTag) const; //return NULL if the item does not exist
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   192
		IMPORT_C CTestConfigItem* Item(const TDesC8& aItemTag); //return NULL if the item does not exist
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   193
		IMPORT_C const CTestConfigItem* Item(const TDesC8& aItemTag,TInt aIndex) const; //return NULL if the item does not exist
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   194
		IMPORT_C CTestConfigItem* Item(const TDesC8& aItemTag,TInt aIndex); //return NULL if the item does not exist
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   195
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   196
		IMPORT_C const TDesC8& ItemValue(const TDesC8& aItemTag, const TDesC8& aDefault) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   197
		IMPORT_C TInt ItemValue(const TDesC8& aItemTag, TInt aDefault) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   198
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   199
		IMPORT_C CTestConfigItem& AddItemL(const TDesC8& aItemTag, const TDesC8& aValue);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   200
		IMPORT_C void DeleteItemsL(const TDesC8& aItem);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   201
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   202
		inline const RPointerArray<CTestConfigItem>& Items() const {return iItems;}
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   203
		inline RPointerArray<CTestConfigItem>& Items() {return iItems;}
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   204
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   205
		IMPORT_C TInt ItemCount(const TDesC8& aItemTag) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   206
		IMPORT_C void ItemsL(RPointerArray<CTestConfigItem>& aArray, const TDesC8& aItemTag);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   207
		IMPORT_C void ItemsL(RPointerArray<const CTestConfigItem>& aArray, const TDesC8& aItemTag) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   208
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   209
		inline const CTestConfigItem& operator[](TInt aIndex) const  {return *iItems[aIndex];}
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   210
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   211
		inline void SetDefaultsL(const CTestConfigSection& aDefaults);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   212
		inline CTestConfigSection* Defaults() const {return iDefaults;}
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   213
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   214
		IMPORT_C CTestConfigSection* CopyLC() const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   215
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   216
		void WriteL(RFile& aFile) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   217
		TBool operator==(const CTestConfigSection& aFile) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   218
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   219
	private:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   220
		void ConstructL(const TDesC8& aSectionName);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   221
		CTestConfigSection();
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   222
		RPointerArray<CTestConfigItem> iItems;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   223
		HBufC8* iSectionName;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   224
		CTestConfigSection* iDefaults;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   225
	};
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   226
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   227
class CTestConfigItem : public CBase
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   228
/**
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   229
 * @internalComponent
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   230
 * @deprecated
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   231
 */
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   232
	{
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   233
	friend class CTestConfigSection;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   234
	friend class CTestConfig;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   235
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   236
	public:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   237
		IMPORT_C static CTestConfigItem* NewLC(CTestConfigSection& aParent, const TDesC8& aItem, const TDesC8& aValue);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   238
		inline CTestConfigItem* CopyLC() const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   239
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   240
		IMPORT_C ~CTestConfigItem();
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   241
		inline const TDesC8& Item() const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   242
		inline const TDesC8& Value() const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   243
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   244
		void WriteL(RFile& aFile) const;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   245
		TBool operator==(const CTestConfigItem& aItem) const {return Item() == aItem.Item() && Value() == aItem.Value();}
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   246
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   247
	public:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   248
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   249
		CTestConfigSection& iParent;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   250
		
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   251
	private:
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   252
		CTestConfigItem(CTestConfigSection& aParent);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   253
		void ConstructL(const TDesC8& aItem, const TDesC8& aValue);
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   254
		HBufC8* iItem;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   255
		HBufC8* iValue;
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   256
	};
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   257
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   258
#include "testconfigfileparser.inl"
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   259
b34bb05ac869 201031_04
hgs
parents:
diff changeset
   260
#endif