|
1 /* |
|
2 * Copyright (c) 2002 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CXMLOBSERVER_H |
|
21 #define __CXMLOBSERVER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 //#include <eikenv.h> |
|
26 #include <badesca.h> |
|
27 #include <txtetext.h> |
|
28 #include "CXMLAttributes.h" |
|
29 #include <xml/MXMLContentHandler.h> |
|
30 #include <xml/MWBXMLContentHandler.h> |
|
31 |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Help class for CXMLReader. |
|
37 * @lib XMLInterface.dll |
|
38 * @since ?Series60_version |
|
39 */ |
|
40 class CXMLObserver : public CBase |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 */ |
|
47 static CXMLObserver* NewL(); |
|
48 |
|
49 static CXMLObserver* NewLC(); |
|
50 |
|
51 /** |
|
52 * Destructor. |
|
53 */ |
|
54 ~CXMLObserver(); |
|
55 |
|
56 public: // New functions |
|
57 |
|
58 /** |
|
59 * Registers content handler |
|
60 * @since ?Series60_version |
|
61 * @param aContentHandler: The ContentHandler to use. |
|
62 * @return none. |
|
63 */ |
|
64 inline void SetContentHandler(MXMLContentHandler* aContentHandler){iContentHandler = aContentHandler;} |
|
65 |
|
66 /** |
|
67 * Registers a binary content handler |
|
68 * @since ?Series60_version |
|
69 * @param aContentHandler: The ContentHandler to use. |
|
70 * @return none. |
|
71 */ |
|
72 inline void SetContentHandler(MWBXMLContentHandler* aContentHandler){iBinaryContentHandler = aContentHandler;} |
|
73 |
|
74 /** |
|
75 * Gets content handler |
|
76 * @since ?Series60_version |
|
77 * @param none. |
|
78 * @return ContentHandler. |
|
79 */ |
|
80 inline MXMLContentHandler* GetContentHandler(){return iContentHandler;} |
|
81 |
|
82 /** |
|
83 * Gets binary content handler |
|
84 * @since ?Series60_version |
|
85 * @param none. |
|
86 * @return ContentHandler. |
|
87 */ |
|
88 inline MWBXMLContentHandler* GetBinaryContentHandler(){return iBinaryContentHandler;} |
|
89 |
|
90 |
|
91 /** |
|
92 * Gets current attribute list |
|
93 * @since ?Series60_version |
|
94 * @return pointer to current attribute list |
|
95 */ |
|
96 inline CXMLAttributes* GetAttributes(){return iAttributes;} |
|
97 |
|
98 /** |
|
99 * Get current element |
|
100 * @since ?Series60_version |
|
101 * @return Current element |
|
102 */ |
|
103 TPtrC GetElement() const; |
|
104 |
|
105 /** |
|
106 * Set current element |
|
107 * @since ?Series60_version |
|
108 * @param Current element |
|
109 * @return none. |
|
110 */ |
|
111 void SetElementL(const TPtrC &aName); |
|
112 |
|
113 /** |
|
114 * Remove current element |
|
115 * @since ?Series60_version |
|
116 * @return none |
|
117 */ |
|
118 void RemoveElement(); |
|
119 |
|
120 /** |
|
121 * Set element URI |
|
122 * @since ?Series60_version |
|
123 * @param aURI: the URI. |
|
124 * @param aNSextension: namespace extension mapped to aURI. |
|
125 * @return none |
|
126 */ |
|
127 void SetURIL(const TPtrC &aURI, const TPtrC &aNSextension); |
|
128 |
|
129 /** |
|
130 * Get element URI |
|
131 * @since ?Series60_version |
|
132 * @param aNSextension: namespace extension mapped to aURI. |
|
133 * @return the URI. |
|
134 */ |
|
135 TPtrC GetURI(const TPtrC &aNSextension) const; |
|
136 |
|
137 /** |
|
138 * ResetURI, reset URI list |
|
139 * @since ?Series60_version |
|
140 * @return none. |
|
141 */ |
|
142 void ResetURI(); |
|
143 |
|
144 |
|
145 private: |
|
146 /** |
|
147 * C++ default constructor. |
|
148 */ |
|
149 CXMLObserver(); |
|
150 |
|
151 void ConstructL(); |
|
152 |
|
153 public: // Data |
|
154 // Keeps current attribute name |
|
155 TPtrC* iCurrentAttribute; |
|
156 |
|
157 private: // Data |
|
158 // Parser CallBacks |
|
159 MXMLContentHandler* iContentHandler; |
|
160 // Binary call backs |
|
161 MWBXMLContentHandler* iBinaryContentHandler; |
|
162 // Current attribute list |
|
163 CXMLAttributes* iAttributes; |
|
164 // Keeps track of elements (needed for binary parsing) |
|
165 CDesCArraySeg* iDescElements; |
|
166 |
|
167 // Keep track off namespace extensions and URIs. |
|
168 CDesCArraySeg* iNSextensions; |
|
169 CDesCArraySeg* iURIs; |
|
170 }; |
|
171 |
|
172 #endif // __CXMLOBSERVER_H |
|
173 |
|
174 // End of File |