|
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Class definition to parse the ini file |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @test |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #ifndef __CINIDATA_H__ |
|
25 #define __CINIDATA_H__ |
|
26 |
|
27 #include <e32base.h> |
|
28 |
|
29 class CIniData : public CBase |
|
30 /** |
|
31 * |
|
32 * @publishedPartner |
|
33 * @test |
|
34 * |
|
35 * Defines the interface to acess to ini data file |
|
36 * |
|
37 * The basic functions, FindVar(), SetValue(), AddValue() and WriteToFileL() |
|
38 * Compulsory to call WriteToFileL() after calling any SetValue() or AddValue() |
|
39 */ |
|
40 { |
|
41 public: |
|
42 // Constructor, pass in name of ini file to open |
|
43 // Default search path is 'c:\system\data' on target filesystem |
|
44 // ie. 'NewL(_L("c:\\system\\data\\ttools.ini"))' is equivalent |
|
45 // to 'NewL(_L("ttools.ini"))' |
|
46 static CIniData* NewL(const TDesC& aName, char aDelimiter); |
|
47 virtual ~CIniData(); |
|
48 |
|
49 TBool FindVar(const TDesC& aKeyName, // Key to look for |
|
50 TPtrC& aResult); // Buffer to store value |
|
51 |
|
52 TBool FindVar(const TDesC& aKeyName, // Key to look for |
|
53 TInt& aResult); // Int ref to store result |
|
54 |
|
55 TBool FindVar(const TDesC& aSection, // Section to look under |
|
56 const TDesC& aKeyName, // Key to look for |
|
57 TPtrC& aResult); // Buffer to store result |
|
58 |
|
59 TBool FindVar(const TDesC& aSection, // Section to look under |
|
60 const TDesC& aKeyName, // Key to look for |
|
61 TInt& aResult); // Int ref to store result |
|
62 protected: |
|
63 CIniData(); |
|
64 void ConstructL(const TDesC& aName, char aDelimiter); |
|
65 private: |
|
66 HBufC* iName; |
|
67 HBufC* iToken; |
|
68 TPtr iPtr; |
|
69 char iDelimiter; |
|
70 }; |
|
71 |
|
72 #endif |