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 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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #if !defined(__INIPARSER_H__)
20 #define __INIPARSER_H__
25 _LIT(KUseSystemDrive, "$:");
27 class CIniData : public CBase
33 * Defines the interface to acess to ini data file
35 * The basic functions, FindVar(), SetValue(), AddValue() and WriteToFileL()
36 * Compulsory to call WriteToFileL() after calling any SetValue() or AddValue()
40 // Constructor, pass in name of ini file to open
41 // Default search path is 'c:\system\data' on target filesystem
42 // ie. 'NewL(_L("c:\\system\\data\\ttools.ini"))' is equivalent
43 // to 'NewL(_L("ttools.ini"))'
44 IMPORT_C static CIniData* NewL(const TDesC& aName);
45 IMPORT_C virtual ~CIniData();
47 IMPORT_C TBool FindVar(const TDesC &aKeyName, // Key to look for
48 TPtrC &aResult); // Buffer to store value
50 IMPORT_C TBool FindVar(const TDesC &aKeyName, // Key to look for
51 TInt &aResult); // Int ref to store result
53 IMPORT_C TBool FindVar(const TDesC &aSection, // Section to look under
54 const TDesC &aKeyName, // Key to look for
55 TPtrC &aResult); // Buffer to store result
57 IMPORT_C TBool FindVar(const TDesC &aSection, // Section to look under
58 const TDesC &aKeyName, // Key to look for
59 TInt &aResult); // Int ref to store result
61 IMPORT_C TInt SetValue(const TDesC& aKeyName,// Key to look for
62 const TDesC& aValue); // aValue being modified
63 IMPORT_C TInt SetValue(const TDesC& aSection, // Section to look under
64 const TDesC& aKeyName, // Key to look for
65 const TDesC& aValue); // aValue being modified
66 IMPORT_C TInt AddValue(const TDesC& aSection, // Section to look under
67 const TDesC& aKeyName, // Key to look for
68 const TDesC& aValue); // aValue being modified
69 IMPORT_C TInt AddValue(const TDesC& aKeyName, // Key to look for
70 const TDesC& aValue); // aValue being modified
71 IMPORT_C void WriteToFileL();
72 // Overloaded NewL() added to recieve optional system drive letter from the user
73 // And expand ${SYSDRIVE} variable. Else, the variable expands to RFs::GetSystemDrive()
74 IMPORT_C static CIniData* NewL(const TDesC& aName, const TDesC& aSysDrive);
77 IMPORT_C CIniData(const TDesC& aSysDrive);
78 IMPORT_C void ConstructL(const TDesC& aName);
80 IMPORT_C TBool FindVar(const TDesC &aSection, // Section to look under
81 const TDesC &aKeyName, // Key to look for
82 TInt64 &aResult); // Int64 ref to store result
85 void UpdateVariablesL();
86 TBool FindVar(const TDesC &aSectName,const TDesC &aKeyName,TPtrC &aResult, TPtr& aIniDataPtr);
92 TPtr iPtrExpandedVars;
93 TDriveName iDefaultSysDrive;