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

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

xerces added

Line 
1/*
2 * Copyright 1999-2002,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Id: DOM_CharacterData.hpp,v 1.5 2004/09/08 13:55:42 peiyongz Exp $
19 */
20
21#ifndef DOM_CharacterData_HEADER_GUARD_
22#define DOM_CharacterData_HEADER_GUARD_
23
24#include <xercesc/util/XercesDefs.hpp>
25#include "DOM_Node.hpp"
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29
30class CharacterDataImpl;
31
32/**
33 * The <code>DOM_CharacterData</code> interface extends Node with a set  of
34 * methods for accessing character data in the DOM.
35 *
36 * For clarity this set is defined here rather than on each class that uses
37 * these methods. No DOM objects correspond directly to
38 * <code>CharacterData</code>, though <code>Text</code> and others do inherit
39 * the interface from it. All <code>offset</code>s in this interface start
40 * from 0, and index in terms of Unicode 16 bit storage units.
41 */
42class DEPRECATED_DOM_EXPORT DOM_CharacterData: public DOM_Node {
43
44private:
45
46public:
47  /** @name Constructors and assignment operator */
48  //@{
49  /**
50    * Default constructor for DOM_CharacterData.  While there can be
51    * no actual DOM nodes of type CharacterData, the C++ objects
52    * function more like reference variables, and instances of
53    * <code>DOM_CharacterData</code> can exist.  They will be null when created
54    * by this constructor, and can then be assigned to refer to Text
55    * or CDATASection nodes.
56    */
57    DOM_CharacterData();
58
59  /**
60    * Copy constructor
61    *
62    * @param other The object to be copied
63    */
64    DOM_CharacterData(const DOM_CharacterData &other);
65  /**
66    * Assignment operator
67    *
68    * @param other The object to be copied
69    */
70    DOM_CharacterData & operator = (const DOM_CharacterData &other);
71
72    /**
73      * Assignment operator.  This overloaded variant is provided for
74      *   the sole purpose of setting a DOM_Node reference variable to
75      *   zero.  Nulling out a reference variable in this way will decrement
76      *   the reference count on the underlying Node object that the variable
77      *   formerly referenced.  This effect is normally obtained when reference
78      *   variable goes out of scope, but zeroing them can be useful for
79      *   global instances, or for local instances that will remain in scope
80      *   for an extended time,  when the storage belonging to the underlying
81      *   node needs to be reclaimed.
82      *
83      * @param val   Only a value of 0, or null, is allowed.
84      */
85    DOM_CharacterData & operator = (const DOM_NullPtr *val);
86
87    //@}
88    /** @name Destructor. */
89    //@{
90         /**
91          * Destructor for DOM_CharacterData.  The object being destroyed
92      * is the reference to the Character Data node, not the character
93      * data itself.
94          */
95    ~DOM_CharacterData();
96
97
98    //@}
99
100    /** @name Getter functions. */
101    //@{
102  /**
103   * Returns the character data of the node that implements this interface.
104   *
105   * The DOM implementation may not put arbitrary limits on the amount of data that
106   * may be stored in a  <code>CharacterData</code> node. However,
107   * implementation limits may  mean that the entirety of a node's data may
108   * not fit into a single <code>DOMString</code>. In such cases, the user
109   * may call <code>substringData</code> to retrieve the data in
110   * appropriately sized pieces.
111   * @exception DOMException
112   *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
113   * @exception DOMException
114   *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than
115   *   fit in a <code>DOMString</code> variable on the implementation
116   *   platform.
117   */
118  DOMString          getData() const;
119  /**
120   * Returns the number of characters that are available through <code>data</code> and
121   * the <code>substringData</code> method below.
122   *
123   * This may have the value
124   * zero, i.e., <code>CharacterData</code> nodes may be empty.
125   */
126  unsigned int       getLength() const;
127  /**
128   * Extracts a range of data from the node.
129   *
130   * @param offset Start offset of substring to extract.
131   * @param count The number of characters to extract.
132   * @return The specified substring. If the sum of <code>offset</code> and
133   *   <code>count</code> exceeds the <code>length</code>, then all
134   *   characters to the end of the data are returned.
135   * @exception DOMException
136   *   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
137   *   than the number of characters in <code>data</code>, or if the
138   *   specified <code>count</code> is negative.
139   *   <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does not
140   *   fit into a <code>DOMString</code>.
141   */
142  DOMString          substringData(unsigned int offset,
143                                   unsigned int count) const;
144    //@}
145    /** @name Functions that set or change data. */
146    //@{
147  /**
148   * Append the string to the end of the character data of the node.
149   *
150   * Upon success, <code>data</code> provides access to the concatenation of
151   * <code>data</code> and the <code>DOMString</code> specified.
152   * @param arg The <code>DOMString</code> to append.
153   * @exception DOMException
154   *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
155   */
156  void               appendData(const DOMString &arg);
157  /**
158   * Insert a string at the specified character offset.
159   *
160   * @param offset The character offset at which to insert.
161   * @param arg The <code>DOMString</code> to insert.
162   * @exception DOMException
163   *   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
164   *   than the number of characters in <code>data</code>.
165   *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
166   */
167  void               insertData(unsigned int offset, const  DOMString &arg);
168  /**
169   * Remove a range of characters from the node.
170   *
171   * Upon success,
172   * <code>data</code> and <code>length</code> reflect the change.
173   * @param offset The offset from which to remove characters.
174   * @param count The number of characters to delete. If the sum of
175   *   <code>offset</code> and <code>count</code> exceeds <code>length</code>
176   *   then all characters from <code>offset</code> to the end of the data
177   *   are deleted.
178   * @exception DOMException
179   *   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
180   *   than the number of characters in <code>data</code>, or if the
181   *   specified <code>count</code> is negative.
182   *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
183   */
184  void               deleteData(unsigned int offset,
185                                unsigned int count);
186  /**
187   * Replace the characters starting at the specified character offset with
188   * the specified string.
189   *
190   * @param offset The offset from which to start replacing.
191   * @param count The number of characters to replace. If the sum of
192   *   <code>offset</code> and <code>count</code> exceeds <code>length</code>
193   *   , then all characters to the end of the data are replaced (i.e., the
194   *   effect is the same as a <code>remove</code> method call with the same
195   *   range, followed by an <code>append</code> method invocation).
196   * @param arg The <code>DOMString</code> with which the range must be
197   *   replaced.
198   * @exception DOMException
199   *   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
200   *   than the number of characters in <code>data</code>, or if the
201   *   specified <code>count</code> is negative.
202   *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
203   */
204  void               replaceData(unsigned int offset,
205                                 unsigned int count,
206                                 const DOMString &arg);
207
208  /**
209   * Sets the character data of the node that implements this interface.
210   *
211   * @param data The <code>DOMString</code> to set.
212   */
213  void               setData(const DOMString &data);
214  //@}
215
216protected:
217    DOM_CharacterData(CharacterDataImpl *impl);
218
219};
220
221XERCES_CPP_NAMESPACE_END
222
223#endif
224
225
Note: See TracBrowser for help on using the repository browser.