|
1 // Copyright (c) 2006-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 // CIniFile Class definitions |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __INIFILE_H__ |
|
19 #define __INIFILE_H__ |
|
20 |
|
21 #include "server.h" |
|
22 |
|
23 class CIniSection : public CBase |
|
24 { |
|
25 friend class CIniFile; |
|
26 public: |
|
27 ~CIniSection(); |
|
28 void AddVariableL(const TDesC& aNewVariable); |
|
29 private: |
|
30 CIniSection(TInt aScreen); |
|
31 void ConstructL(); |
|
32 void ConstructL(const TDesC& aName); |
|
33 TBool FindVar(const TDesC &aVarName, TInt &aResult); |
|
34 TBool FindVar(const TDesC &aVarName, TPtrC &aResult); |
|
35 TBool FindVarName(const TDesC& aVarName, TInt& index); |
|
36 static TPtrC VarName(const TDesC& aVarString); |
|
37 inline TInt Screen() const; |
|
38 inline const TDesC& Name() const; |
|
39 private: |
|
40 TInt iScreen; |
|
41 RBuf iName; |
|
42 CArrayPtrFlat<TDesC>* iPtrArray ; |
|
43 } ; |
|
44 |
|
45 class CIniFile : public CBase, public MWsIniFile |
|
46 { |
|
47 public: |
|
48 static CIniFile* NewL(); |
|
49 ~CIniFile(); |
|
50 TInt NumberOfScreens() const; |
|
51 void FreeData(); |
|
52 |
|
53 public: // from MWsIniFile |
|
54 TBool FindVar(const TDesC &aVarName, TPtrC &aResult); |
|
55 TBool FindVar(const TDesC &aVarName, TInt &aResult); |
|
56 TBool FindVar(const TDesC &aVarName); |
|
57 |
|
58 TBool FindVar( TInt aScreen, const TDesC &aVarName); |
|
59 TBool FindVar( TInt aScreen, const TDesC &aVarName, TInt &aResult); |
|
60 TBool FindVar( TInt aScreen, const TDesC& aVarName, TPtrC &aResult); |
|
61 |
|
62 TBool FindVar(const TDesC& aSection, const TDesC &aVarName); |
|
63 TBool FindVar(const TDesC& aSection, const TDesC &aVarName, TInt &aResult); |
|
64 TBool FindVar(const TDesC& aSection, const TDesC& aVarName, TPtrC &aResult); |
|
65 |
|
66 private: |
|
67 CIniFile(); |
|
68 void ConstructL(); |
|
69 void doConstructL(RFile &aFile); |
|
70 CIniSection * AddOrFindIniSectionL(TPtr& aSectionName); |
|
71 CIniSection * AddOrFindScreenSectionL(TInt aScreen); |
|
72 CIniSection * AddOrFindNamedSectionL(const TDesC& aName); |
|
73 CIniSection * CreateSectionL(TInt aScreen); // utility function |
|
74 CIniSection * CreateSectionL(const TDesC& aSectionName); // utility function |
|
75 CIniSection * FindSection(TInt aScreen); |
|
76 CIniSection * FindSection(const TDesC& aName); |
|
77 private: |
|
78 RPointerArray<CIniSection> iSectionArray; |
|
79 TInt iScreenCount; |
|
80 }; |
|
81 |
|
82 GLREF_D CIniFile * WsIniFile; |
|
83 |
|
84 #endif |