source: NonGTP/Xerces/xerces/include/xercesc/dom/DOMCharacterData.hpp @ 358

Revision 358, 8.8 KB checked in by bittner, 19 years ago (diff)

xerces added

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