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