|
1 // Copyright (c) 2005-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 // @internalComponent |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __INIPARSERIMPL_H__ |
|
19 #define __INIPARSERIMPL_H__ |
|
20 |
|
21 #include <e32std.h> |
|
22 #include <f32file.h> |
|
23 #include "IniTemplate.h" |
|
24 #include "inifile.h" |
|
25 |
|
26 namespace BSUL |
|
27 { |
|
28 |
|
29 //typedef for 8 and 16 bit |
|
30 typedef CIniLine<TDesC8,HBufC8,TPtrC8,TPtr8> CIniLine8; |
|
31 typedef CIniLine<TDesC16,HBufC16,TPtrC16,TPtr16> CIniLine16; |
|
32 |
|
33 typedef CIniKey<TDesC8,HBufC8,TPtrC8,CIniLine8,TPtr8,TLex8> CIniKey8; |
|
34 typedef CIniKey<TDesC16,HBufC16,TPtrC16,CIniLine16,TPtr16,TLex16> CIniKey16; |
|
35 |
|
36 typedef CIniSection<TDesC8,HBufC8,TPtrC8,CIniKey8,CIniLine8,TPtr8,TLex8> CIniSection8; |
|
37 typedef CIniSection<TDesC16,HBufC16,TPtrC16,CIniKey16,CIniLine16,TPtr16,TLex16> CIniSection16; |
|
38 |
|
39 typedef CIniSecIterImplX<TDesC8,TPtrC8,CIniSection8,CIniDocument8,CIniKey8> CIniSecIterTmpl8; |
|
40 typedef CIniSecIterImplX<TDesC16,TPtrC16,CIniSection16,CIniDocument16,CIniKey16> CIniSecIterTmpl16; |
|
41 |
|
42 typedef CIniDocumentTmplX<TDesC8,TPtrC8,CIniSection8,TLex8,TPtr8,HBufC8,CIniLine8,CIniKey8> CIniDocumentTmpl8; |
|
43 typedef CIniDocumentTmplX<TDesC16,TPtrC16,CIniSection16,TLex16,TPtr16,HBufC16,CIniLine16,CIniKey16> CIniDocumentTmpl16; |
|
44 |
|
45 typedef TBuf8<6> TPattern8; |
|
46 typedef TBuf16<6> TPattern16; |
|
47 |
|
48 typedef CIniFileImplX<TDesC8,TPtrC8,HBufC8,TLex8,TPtr8,TPattern8,CIniLine8> CIniFileTmpl8; |
|
49 typedef CIniFileImplX<TDesC16,TPtrC16,HBufC16,TLex16,TPtr16,TPattern16,CIniLine16> CIniFileTmpl16; |
|
50 |
|
51 //8 bit light |
|
52 NONSHARABLE_CLASS(CIniFile8Impl): public CBase |
|
53 { |
|
54 public: |
|
55 static CIniFile8Impl* NewL(RFs& aFs,const TDesC& aFileName); |
|
56 ~CIniFile8Impl(){delete iTempImpl;} |
|
57 TInt FindVar(const TDesC8& aSection,const TDesC8& aKey,TPtrC8& aValue); |
|
58 private: |
|
59 CIniFile8Impl(){} |
|
60 void ConstructL(RFs& aFs,const TDesC& aFileName); |
|
61 CIniFileTmpl8* iTempImpl; |
|
62 }; |
|
63 |
|
64 //16 bit light |
|
65 NONSHARABLE_CLASS(CIniFile16Impl): public CBase |
|
66 { |
|
67 public: |
|
68 static CIniFile16Impl* NewL(RFs& aFs,const TDesC& aFileName,TBool aConvert8To16=EFalse); |
|
69 ~CIniFile16Impl(){delete iTempImpl;} |
|
70 TInt FindVar(const TDesC16& aSection,const TDesC16& aKey,TPtrC16& aValue); |
|
71 private: |
|
72 CIniFile16Impl(){} |
|
73 void ConstructL(RFs& aFs,const TDesC& aFileName,TBool aConvert8To16); |
|
74 CIniFileTmpl16* iTempImpl; |
|
75 }; |
|
76 |
|
77 //8 bit |
|
78 NONSHARABLE_CLASS(CIniSecIter8Impl): public CBase |
|
79 { |
|
80 public: |
|
81 static CIniSecIter8Impl* NewL(const TDesC8& aSectionName,const CIniDocument8* aIniDocument); |
|
82 TBool Next(TPtrC8& aKeyName,TPtrC8& aKeyValue); |
|
83 void Reset(); |
|
84 TBool End(){return iTempImpl->End();} |
|
85 ~CIniSecIter8Impl(){delete iTempImpl;} |
|
86 private: |
|
87 CIniSecIter8Impl(){} |
|
88 void ConstructL(const TDesC8& aSectionName,const CIniDocument8* aIniDocument); |
|
89 private: |
|
90 CIniSecIterTmpl8* iTempImpl; |
|
91 }; |
|
92 |
|
93 //16 bit |
|
94 NONSHARABLE_CLASS(CIniSecIter16Impl): public CBase |
|
95 { |
|
96 public: |
|
97 static CIniSecIter16Impl* NewL(const TDesC16& aSectionName,const CIniDocument16* aIniDocument); |
|
98 TBool Next(TPtrC16& aKeyName,TPtrC16& aKeyValue); |
|
99 void Reset(); |
|
100 TBool End(){return iTempImpl->End();} |
|
101 ~CIniSecIter16Impl(){delete iTempImpl;} |
|
102 private: |
|
103 CIniSecIter16Impl(){} |
|
104 void ConstructL(const TDesC16& aSectionName,const CIniDocument16* aIniDocument); |
|
105 private: |
|
106 CIniSecIterTmpl16* iTempImpl; |
|
107 }; |
|
108 |
|
109 //8 bit |
|
110 NONSHARABLE_CLASS(CIniDocument8Impl): public CBase |
|
111 { |
|
112 public: |
|
113 static CIniDocument8Impl* NewL(RFs& aFs,const TDesC& aFileName); |
|
114 ~CIniDocument8Impl(); |
|
115 void FlushL(const TDesC& aFileName); |
|
116 |
|
117 TInt GetSectionList(RArray<TPtrC8>& aSectionList) const; |
|
118 void GetKeyValueL(const TDesC8& aSectionName,const TDesC8& aKeyName,TPtrC8& aKeyValue) const; |
|
119 CIniSection8* SectionL(const TDesC8& aSectionName) const; |
|
120 |
|
121 void AddSectionL(const TDesC8& aSectionName); |
|
122 void RemoveSectionL(const TDesC8& aSectionName); |
|
123 void SetKeyL(const TDesC8& aSectionName,const TDesC8& aKeyName,const TDesC8& aKeyValue); |
|
124 void RemoveKeyL(const TDesC8& aSectionName,const TDesC8& aKeyName); |
|
125 TBool CompareDocs(CIniDocument8Impl& aDoc); |
|
126 private: |
|
127 CIniDocument8Impl(){} |
|
128 void ConstructL(RFs& aFs,const TDesC& aFileName); |
|
129 private: |
|
130 CIniDocumentTmpl8* iTempImpl; |
|
131 |
|
132 }; |
|
133 |
|
134 //16 bit |
|
135 NONSHARABLE_CLASS(CIniDocument16Impl): public CBase |
|
136 { |
|
137 public: |
|
138 static CIniDocument16Impl* NewL(RFs& aFs,const TDesC& aFileName); |
|
139 ~CIniDocument16Impl(); |
|
140 void FlushL(const TDesC& aFileName); |
|
141 |
|
142 TInt GetSectionList(RArray<TPtrC16>& aSectionList) const; |
|
143 void GetKeyValueL(const TDesC16& aSectionName,const TDesC16& aKeyName,TPtrC16& aKeyValue) const; |
|
144 CIniSection16* SectionL(const TDesC16& aSectionName) const; |
|
145 |
|
146 void AddSectionL(const TDesC16& aSectionName); |
|
147 void RemoveSectionL(const TDesC16& aSectionName); |
|
148 void SetKeyL(const TDesC16& aSectionName,const TDesC16& aKeyName,const TDesC16& aKeyValue); |
|
149 void RemoveKeyL(const TDesC16& aSectionName,const TDesC16& aKeyName); |
|
150 TBool CompareDocs(CIniDocument16Impl& aDoc); |
|
151 private: |
|
152 CIniDocument16Impl(){} |
|
153 void ConstructL(RFs& aFs,const TDesC& aFileName); |
|
154 private: |
|
155 CIniDocumentTmpl16* iTempImpl; |
|
156 }; |
|
157 |
|
158 }//namespace BSUL |
|
159 |
|
160 #endif//__INIPARSERIMPL_H__ |