|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This file contains the header file of the CWidgetBackupRegistryXml class. |
|
15 * |
|
16 * This class processes persistent registry data in XML. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef WIDGETBACKUPREGISTRYXML_H |
|
22 #define WIDGETBACKUPREGISTRYXML_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <libxml2_tree.h> |
|
26 #include "WidgetRegistryConstants.h" |
|
27 #include "WidgetPropertyValue.h" |
|
28 |
|
29 class RFs; |
|
30 /** |
|
31 * CWidgetBackupRegistryXml |
|
32 * @since 5.0 |
|
33 */ |
|
34 class CWidgetBackupRegistryXml: public CBase |
|
35 { |
|
36 public: |
|
37 |
|
38 /** |
|
39 * Two-phased constructor. |
|
40 */ |
|
41 // static CWidgetBackupRegistryXml* NewL(); |
|
42 static CWidgetBackupRegistryXml* NewL(); |
|
43 |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 virtual ~CWidgetBackupRegistryXml(); |
|
48 |
|
49 protected: |
|
50 |
|
51 /** |
|
52 * C++ default constructor. |
|
53 */ |
|
54 CWidgetBackupRegistryXml(); |
|
55 |
|
56 /** |
|
57 * Symbian 2nd phase constructor |
|
58 */ |
|
59 void ConstructL(); |
|
60 |
|
61 public: |
|
62 |
|
63 /** |
|
64 * Traverse to the next Node |
|
65 * |
|
66 * @param aNode: current node |
|
67 * @since 5.0 |
|
68 * @return next node |
|
69 */ |
|
70 xmlNode* TraverseNextNode( xmlNode* aNode ); |
|
71 |
|
72 /** |
|
73 * Convert a string in some encoding to UCS2. |
|
74 * |
|
75 * @param aEncoding encoding number |
|
76 * @param aUnicodeSizeMultiplier how many input bytes per unicode char |
|
77 * @param aInBuf input data |
|
78 * @param aOutBuf output data, allocated and returned to caller |
|
79 * @param aFileSession |
|
80 * @since 5.0 |
|
81 * @return void |
|
82 */ |
|
83 void ToUnicodeL( TInt aEncoding, |
|
84 TInt aUnicodeSizeMultiplier, |
|
85 TPtrC8 aInBuf, HBufC16** aOutBuf, |
|
86 RFs& aFileSession ); |
|
87 |
|
88 /** |
|
89 * Convert a string to some encoding from UCS2. |
|
90 * |
|
91 * @param aEncoding encoding number |
|
92 * @param aUnicodeSizeMultiplier how many input bytes per unicode char |
|
93 * @param aInBuf input data |
|
94 * @param aOutBuf output data, allocated and returned to caller |
|
95 * @param aFileSession |
|
96 * @since 5.0 |
|
97 * @return void |
|
98 */ |
|
99 void FromUnicodeL( TInt aEncoding, |
|
100 TInt aUnicodeSizeMultiplier, |
|
101 TPtrC16 aInBuf, HBufC8** aOutBuf, |
|
102 RFs& aFileSession ); |
|
103 |
|
104 |
|
105 /** |
|
106 * Utility to bundle extraction of XML text content |
|
107 * |
|
108 * @param aEncoding input buffer encoding |
|
109 * @param aUnicodeSizeMultiplier how many bytes of input make one unicode char |
|
110 * @param aInBuf input data in encoding |
|
111 * @param aOutBuf malloc'ed output buf, caller takes ownership |
|
112 * @param aFileSession CCnvCharacterSetConverter requires it |
|
113 * @since 5.0 |
|
114 * @return void |
|
115 */ |
|
116 void GetContentL( RFs& aFileSession, |
|
117 xmlDocPtr aDoc, |
|
118 xmlNode* aNode, |
|
119 HBufC** aContent ); |
|
120 |
|
121 /** |
|
122 * Utility to extract XML content as a string |
|
123 * |
|
124 * @param aFileSession CCnvCharacterSetConverter requires it |
|
125 * @param aDoc |
|
126 * @param aNode |
|
127 * @param aContent |
|
128 * @since 5.0 |
|
129 * @return void |
|
130 */ |
|
131 void GetTextContentAsStringL( RFs& aFileSession, |
|
132 xmlDocPtr aDoc, |
|
133 xmlNode* aNode, |
|
134 HBufC** aContent ); |
|
135 |
|
136 void GetSubtreeAsStringL (RFs& aFileSession, xmlDocPtr aDoc, xmlNode* aNode, HBufC** aBuf, TInt& aLen); |
|
137 |
|
138 xmlChar* EncodeStringL(xmlDocPtr aDoc, xmlChar* aStringToConvert); |
|
139 HBufC* EncodeStringL(xmlDocPtr aDoc, TPtrC aStringToConvert, RFs& aFileSession); |
|
140 |
|
141 TInt EncodedStringLength(TPtrC8 aStringToConvert); |
|
142 |
|
143 TInt GetPropertyId( |
|
144 const TDesC& aKeyName ); |
|
145 |
|
146 const TPtrC& XmlPropertyName( TInt aPropertyId ); |
|
147 |
|
148 class TWidgetProperty |
|
149 { |
|
150 public: |
|
151 TInt id; // the TWidgetPropertyId for this name |
|
152 TPtrC name; |
|
153 TWidgetPropertyType type; // the type if valid |
|
154 TInt flags; |
|
155 }; |
|
156 |
|
157 // Table describing registry entries for XML processing. Used by |
|
158 // parser and generator. |
|
159 |
|
160 RArray<TWidgetProperty> iProperties; |
|
161 }; |
|
162 |
|
163 #endif // WIDGETREGISTRYXML_H |