|
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 "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: Represents the entire xmluiml specific xml and css data. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef hsps_DOM_DOCUMENT_H |
|
21 #define hsps_DOM_DOCUMENT_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <s32strm.h> |
|
26 |
|
27 |
|
28 //FORWARD DECLARATIONS |
|
29 class ChspsDomStringPool; |
|
30 class ChspsDomNode; |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Provides the primary access to the document's data. |
|
35 * |
|
36 * @lib hspsdomdocument.lib |
|
37 * @since S60 5.0 |
|
38 * @ingroup group_hspsdom |
|
39 */ |
|
40 class ChspsDomDocument: public CBase |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 * |
|
47 * @since S60 5.0 |
|
48 */ |
|
49 IMPORT_C static ChspsDomDocument* NewL(); |
|
50 |
|
51 /** |
|
52 * Two-phased stream constructor. |
|
53 * |
|
54 * @since S60 5.0 |
|
55 * @param aStream Source stream. |
|
56 */ |
|
57 IMPORT_C static ChspsDomDocument* NewL( RReadStream& aStream ); |
|
58 |
|
59 /** |
|
60 * Construct ChspsDomDocument from streamed HBufC8. |
|
61 * |
|
62 * @since S60 5.0 |
|
63 * @param aBufStream Source buffer stream. |
|
64 */ |
|
65 IMPORT_C static ChspsDomDocument* NewL( const HBufC8* aBufStream ); |
|
66 |
|
67 /** |
|
68 * Destructor. |
|
69 */ |
|
70 IMPORT_C virtual ~ChspsDomDocument(); |
|
71 |
|
72 public: // New functions |
|
73 /** |
|
74 * Makes a clone of this document. |
|
75 * |
|
76 * @since S60 5.0 |
|
77 * @return Pointer to a document. Caller has the ownership. |
|
78 */ |
|
79 IMPORT_C ChspsDomDocument* CloneL(); |
|
80 |
|
81 /** |
|
82 * Factory method to create node elements, because elements cannot exist outside |
|
83 * the context of a document. |
|
84 * |
|
85 * @since S60 5.0 |
|
86 * @param aName UTF-8 encoded Element name. |
|
87 * @param aNamespace UTF-8 encoded Element namespace. |
|
88 * @return A new ChspsDomNode type instance. Ownership is transferred to caller. |
|
89 */ |
|
90 IMPORT_C ChspsDomNode* CreateElementNSL( const TDesC8& aName, const TDesC8& aNamespace ); |
|
91 |
|
92 /** |
|
93 * Set the root of the document tree. Root node provides primary access to |
|
94 * document data. This class owns root node. |
|
95 * |
|
96 * @since S60 5.0 |
|
97 * @param aRootNode Documents's root node. Document takes ownership. |
|
98 */ |
|
99 IMPORT_C void SetRootNode( ChspsDomNode* aRootNode ); |
|
100 |
|
101 /** |
|
102 * Get the root node of the document. |
|
103 * |
|
104 * @since S60 5.0 |
|
105 * @return Pointer to ChspsDomNode type node. |
|
106 */ |
|
107 IMPORT_C ChspsDomNode* RootNode() const; |
|
108 |
|
109 /** |
|
110 * Get the last node of the document. |
|
111 * |
|
112 * @since S60 5.0 |
|
113 * @return Pointer to ChspsDomNode type node. |
|
114 */ |
|
115 IMPORT_C ChspsDomNode* LastNode() const; |
|
116 |
|
117 /** |
|
118 * Get the size of the document's data. |
|
119 * |
|
120 * @since S60 5.0 |
|
121 * @return Document's data size. |
|
122 */ |
|
123 IMPORT_C TInt Size() const; |
|
124 |
|
125 /** |
|
126 * Get document node count. |
|
127 * |
|
128 * @since S60 5.0 |
|
129 * @return Count of all nodes in a document. |
|
130 */ |
|
131 IMPORT_C TInt DomNodeCount() const; |
|
132 |
|
133 /** |
|
134 * Externalize document's data. |
|
135 * |
|
136 * @since S60 5.0 |
|
137 * @param aStream Output stream. |
|
138 */ |
|
139 IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; |
|
140 |
|
141 /** |
|
142 * Internalize document's data. |
|
143 * |
|
144 * @since S60 5.0 |
|
145 * @param aStream Input stream. |
|
146 */ |
|
147 IMPORT_C void InternalizeL( RReadStream& aStream ); |
|
148 |
|
149 /** |
|
150 * Returns document's data as a streamed buffer. |
|
151 * |
|
152 * @since S60 5.0 |
|
153 * @return Pointer to a new HBufC8 buffer which holds streamed document. |
|
154 * Ownership is transferred to a caller. |
|
155 */ |
|
156 IMPORT_C HBufC8* MarshallL(); |
|
157 |
|
158 /** |
|
159 * Get reference to string pool. |
|
160 * |
|
161 * @since S60 5.0 |
|
162 * @return Reference to string pool implementation. |
|
163 */ |
|
164 IMPORT_C ChspsDomStringPool& StringPool() const; |
|
165 private: |
|
166 |
|
167 /** |
|
168 * C++ default constructor. |
|
169 */ |
|
170 ChspsDomDocument(); |
|
171 |
|
172 /** |
|
173 * By default Symbian 2nd phase constructor is private. |
|
174 */ |
|
175 void ConstructL(); |
|
176 |
|
177 private: // Data |
|
178 //Document owns the root node. |
|
179 ChspsDomNode* iRootNode; |
|
180 |
|
181 //Namespace map stores namespaces used in dom |
|
182 ChspsDomStringPool* iDomStringPool; |
|
183 |
|
184 |
|
185 }; |
|
186 |
|
187 #endif // hsps_DOM_DOCUMENT_H |
|
188 |
|
189 // End of File |