1 | #ifndef DOMCharacterData_HEADER_GUARD_ |
---|
2 | #define DOMCharacterData_HEADER_GUARD_ |
---|
3 | |
---|
4 | /* |
---|
5 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
6 | * contributor license agreements. See the NOTICE file distributed with |
---|
7 | * this work for additional information regarding copyright ownership. |
---|
8 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
9 | * (the "License"); you may not use this file except in compliance with |
---|
10 | * the License. You may obtain a copy of the License at |
---|
11 | * |
---|
12 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
13 | * |
---|
14 | * Unless required by applicable law or agreed to in writing, software |
---|
15 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
17 | * See the License for the specific language governing permissions and |
---|
18 | * limitations under the License. |
---|
19 | */ |
---|
20 | |
---|
21 | /* |
---|
22 | * $Id: DOMCharacterData.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
23 | */ |
---|
24 | |
---|
25 | #include <xercesc/util/XercesDefs.hpp> |
---|
26 | #include <xercesc/dom/DOMNode.hpp> |
---|
27 | |
---|
28 | XERCES_CPP_NAMESPACE_BEGIN |
---|
29 | |
---|
30 | |
---|
31 | /** |
---|
32 | * The <code>DOMCharacterData</code> interface extends DOMNode with a set of |
---|
33 | * attributes and methods for accessing character data in the DOM. For |
---|
34 | * clarity this set is defined here rather than on each object that uses |
---|
35 | * these attributes and methods. No DOM objects correspond directly to |
---|
36 | * <code>DOMCharacterData</code>, though <code>DOMText</code> and others do |
---|
37 | * inherit the interface from it. All <code>offsets</code> in this interface |
---|
38 | * start from <code>0</code>. |
---|
39 | * <p>As explained in the DOM spec, text strings in |
---|
40 | * the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In |
---|
41 | * the following, the term 16-bit units is used whenever necessary to |
---|
42 | * indicate that indexing on DOMCharacterData is done in 16-bit units. |
---|
43 | * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>. |
---|
44 | * @since DOM Level 1 |
---|
45 | */ |
---|
46 | class CDOM_EXPORT DOMCharacterData: public DOMNode { |
---|
47 | protected: |
---|
48 | // ----------------------------------------------------------------------- |
---|
49 | // Hidden constructors |
---|
50 | // ----------------------------------------------------------------------- |
---|
51 | /** @name Hidden constructors */ |
---|
52 | //@{ |
---|
53 | DOMCharacterData() {} |
---|
54 | DOMCharacterData(const DOMCharacterData &other) : DOMNode(other) {} |
---|
55 | //@} |
---|
56 | |
---|
57 | private: |
---|
58 | // ----------------------------------------------------------------------- |
---|
59 | // Unimplemented constructors and operators |
---|
60 | // ----------------------------------------------------------------------- |
---|
61 | /** @name Unimplemented operators */ |
---|
62 | //@{ |
---|
63 | DOMCharacterData & operator = (const DOMCharacterData &); |
---|
64 | //@} |
---|
65 | |
---|
66 | public: |
---|
67 | // ----------------------------------------------------------------------- |
---|
68 | // All constructors are hidden, just the destructor is available |
---|
69 | // ----------------------------------------------------------------------- |
---|
70 | /** @name Destructor */ |
---|
71 | //@{ |
---|
72 | /** |
---|
73 | * Destructor |
---|
74 | * |
---|
75 | */ |
---|
76 | virtual ~DOMCharacterData() {}; |
---|
77 | //@} |
---|
78 | |
---|
79 | // ----------------------------------------------------------------------- |
---|
80 | // Virtual DOMCharacterData interface |
---|
81 | // ----------------------------------------------------------------------- |
---|
82 | /** @name Functions introduced in DOM Level 1 */ |
---|
83 | //@{ |
---|
84 | // ----------------------------------------------------------------------- |
---|
85 | // Getter methods |
---|
86 | // ----------------------------------------------------------------------- |
---|
87 | /** |
---|
88 | * Returns the character data of the node that implements this interface. |
---|
89 | * |
---|
90 | * The DOM implementation may not put arbitrary limits on the amount of data that |
---|
91 | * may be stored in a <code>DOMCharacterData</code> node. However, |
---|
92 | * implementation limits may mean that the entirety of a node's data may |
---|
93 | * not fit into a single <code>XMLCh* String</code>. In such cases, the user |
---|
94 | * may call <code>substringData</code> to retrieve the data in |
---|
95 | * appropriately sized pieces. |
---|
96 | * @exception DOMException |
---|
97 | * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. |
---|
98 | * @since DOM Level 1 |
---|
99 | */ |
---|
100 | virtual const XMLCh * getData() const = 0; |
---|
101 | |
---|
102 | /** |
---|
103 | * Returns the number of characters that are available through <code>data</code> and |
---|
104 | * the <code>substringData</code> method below. |
---|
105 | * |
---|
106 | * This may have the value |
---|
107 | * zero, i.e., <code>CharacterData</code> nodes may be empty. |
---|
108 | * @since DOM Level 1 |
---|
109 | */ |
---|
110 | virtual XMLSize_t getLength() const = 0; |
---|
111 | |
---|
112 | /** |
---|
113 | * Extracts a range of data from the node. |
---|
114 | * |
---|
115 | * @param offset Start offset of substring to extract. |
---|
116 | * @param count The number of characters to extract. |
---|
117 | * @return The specified substring. If the sum of <code>offset</code> and |
---|
118 | * <code>count</code> exceeds the <code>length</code>, then all |
---|
119 | * characters to the end of the data are returned. |
---|
120 | * @exception DOMException |
---|
121 | * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater |
---|
122 | * than the number of characters in <code>data</code>, or if the |
---|
123 | * specified <code>count</code> is negative. |
---|
124 | * @since DOM Level 1 |
---|
125 | */ |
---|
126 | virtual const XMLCh * substringData(XMLSize_t offset, |
---|
127 | XMLSize_t count) const = 0; |
---|
128 | |
---|
129 | // ----------------------------------------------------------------------- |
---|
130 | // String methods |
---|
131 | // ----------------------------------------------------------------------- |
---|
132 | /** |
---|
133 | * Append the string to the end of the character data of the node. |
---|
134 | * |
---|
135 | * Upon success, <code>data</code> provides access to the concatenation of |
---|
136 | * <code>data</code> and the <code>XMLCh* String</code> specified. |
---|
137 | * @param arg The <code>XMLCh* String</code> to append. |
---|
138 | * @exception DOMException |
---|
139 | * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. |
---|
140 | * @since DOM Level 1 |
---|
141 | */ |
---|
142 | virtual void appendData(const XMLCh *arg) = 0; |
---|
143 | |
---|
144 | /** |
---|
145 | * Insert a string at the specified character offset. |
---|
146 | * |
---|
147 | * @param offset The character offset at which to insert. |
---|
148 | * @param arg The <code>XMLCh* String</code> to insert. |
---|
149 | * @exception DOMException |
---|
150 | * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater |
---|
151 | * than the number of characters in <code>data</code>. |
---|
152 | * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. |
---|
153 | * @since DOM Level 1 |
---|
154 | */ |
---|
155 | virtual void insertData(XMLSize_t offset, const XMLCh *arg) = 0; |
---|
156 | |
---|
157 | /** |
---|
158 | * Remove a range of characters from the node. |
---|
159 | * |
---|
160 | * Upon success, |
---|
161 | * <code>data</code> and <code>length</code> reflect the change. |
---|
162 | * @param offset The offset from which to remove characters. |
---|
163 | * @param count The number of characters to delete. If the sum of |
---|
164 | * <code>offset</code> and <code>count</code> exceeds <code>length</code> |
---|
165 | * then all characters from <code>offset</code> to the end of the data |
---|
166 | * are deleted. |
---|
167 | * @exception DOMException |
---|
168 | * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater |
---|
169 | * than the number of characters in <code>data</code>, or if the |
---|
170 | * specified <code>count</code> is negative. |
---|
171 | * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. |
---|
172 | * @since DOM Level 1 |
---|
173 | */ |
---|
174 | virtual void deleteData(XMLSize_t offset, |
---|
175 | XMLSize_t count) = 0; |
---|
176 | |
---|
177 | /** |
---|
178 | * Replace the characters starting at the specified character offset with |
---|
179 | * the specified string. |
---|
180 | * |
---|
181 | * @param offset The offset from which to start replacing. |
---|
182 | * @param count The number of characters to replace. If the sum of |
---|
183 | * <code>offset</code> and <code>count</code> exceeds <code>length</code> |
---|
184 | * , then all characters to the end of the data are replaced (i.e., the |
---|
185 | * effect is the same as a <code>remove</code> method call with the same |
---|
186 | * range, followed by an <code>append</code> method invocation). |
---|
187 | * @param arg The <code>XMLCh* String</code> with which the range must be |
---|
188 | * replaced. |
---|
189 | * @exception DOMException |
---|
190 | * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater |
---|
191 | * than the number of characters in <code>data</code>, or if the |
---|
192 | * specified <code>count</code> is negative. |
---|
193 | * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. |
---|
194 | * @since DOM Level 1 |
---|
195 | */ |
---|
196 | virtual void replaceData(XMLSize_t offset, |
---|
197 | XMLSize_t count, |
---|
198 | const XMLCh *arg) = 0; |
---|
199 | |
---|
200 | /** |
---|
201 | * Sets the character data of the node that implements this interface. |
---|
202 | * |
---|
203 | * @param data The <code>XMLCh* String</code> to set. |
---|
204 | * @since DOM Level 1 |
---|
205 | */ |
---|
206 | virtual void setData(const XMLCh *data) = 0; |
---|
207 | //@} |
---|
208 | |
---|
209 | }; |
---|
210 | |
---|
211 | XERCES_CPP_NAMESPACE_END |
---|
212 | |
---|
213 | #endif |
---|
214 | |
---|