source: NonGTP/Xerces/xercesc/dom/deprecated/DOM_CharacterData.hpp @ 188

Revision 188, 10.6 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
1/*
2 * The Apache Software License, Version 1.1
3 *
4 * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
5 * reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in
16 *    the documentation and/or other materials provided with the
17 *    distribution.
18 *
19 * 3. The end-user documentation included with the redistribution,
20 *    if any, must include the following acknowledgment:
21 *       "This product includes software developed by the
22 *        Apache Software Foundation (http://www.apache.org/)."
23 *    Alternately, this acknowledgment may appear in the software itself,
24 *    if and wherever such third-party acknowledgments normally appear.
25 *
26 * 4. The names "Xerces" and "Apache Software Foundation" must
27 *    not be used to endorse or promote products derived from this
28 *    software without prior written permission. For written
29 *    permission, please contact apache\@apache.org.
30 *
31 * 5. Products derived from this software may not be called "Apache",
32 *    nor may "Apache" appear in their name, without prior written
33 *    permission of the Apache Software Foundation.
34 *
35 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 * SUCH DAMAGE.
47 * ====================================================================
48 *
49 * This software consists of voluntary contributions made by many
50 * individuals on behalf of the Apache Software Foundation, and was
51 * originally based on software copyright (c) 1999, International
52 * Business Machines, Inc., http://www.ibm.com .  For more information
53 * on the Apache Software Foundation, please see
54 * <http://www.apache.org/>.
55 */
56
57/*
58 * $Id: DOM_CharacterData.hpp,v 1.3 2002/11/04 15:04:44 tng Exp $
59 */
60
61#ifndef DOM_CharacterData_HEADER_GUARD_
62#define DOM_CharacterData_HEADER_GUARD_
63
64#include <xercesc/util/XercesDefs.hpp>
65#include "DOM_Node.hpp"
66
67XERCES_CPP_NAMESPACE_BEGIN
68
69
70class CharacterDataImpl;
71
72/**
73 * The <code>DOM_CharacterData</code> interface extends Node with a set  of
74 * methods for accessing character data in the DOM.
75 *
76 * For clarity this set is defined here rather than on each class that uses
77 * these methods. No DOM objects correspond directly to
78 * <code>CharacterData</code>, though <code>Text</code> and others do inherit
79 * the interface from it. All <code>offset</code>s in this interface start
80 * from 0, and index in terms of Unicode 16 bit storage units.
81 */
82class CDOM_EXPORT DOM_CharacterData: public DOM_Node {
83
84private:
85
86public:
87  /** @name Constructors and assignment operator */
88  //@{
89  /**
90    * Default constructor for DOM_CharacterData.  While there can be
91    * no actual DOM nodes of type CharacterData, the C++ objects
92    * function more like reference variables, and instances of
93    * <code>DOM_CharacterData</code> can exist.  They will be null when created
94    * by this constructor, and can then be assigned to refer to Text
95    * or CDATASection nodes.
96    */
97    DOM_CharacterData();
98
99  /**
100    * Copy constructor
101    *
102    * @param other The object to be copied
103    */
104    DOM_CharacterData(const DOM_CharacterData &other);
105  /**
106    * Assignment operator
107    *
108    * @param other The object to be copied
109    */
110    DOM_CharacterData & operator = (const DOM_CharacterData &other);
111
112    /**
113      * Assignment operator.  This overloaded variant is provided for
114      *   the sole purpose of setting a DOM_Node reference variable to
115      *   zero.  Nulling out a reference variable in this way will decrement
116      *   the reference count on the underlying Node object that the variable
117      *   formerly referenced.  This effect is normally obtained when reference
118      *   variable goes out of scope, but zeroing them can be useful for
119      *   global instances, or for local instances that will remain in scope
120      *   for an extended time,  when the storage belonging to the underlying
121      *   node needs to be reclaimed.
122      *
123      * @param val   Only a value of 0, or null, is allowed.
124      */
125    DOM_CharacterData & operator = (const DOM_NullPtr *val);
126
127    //@}
128    /** @name Destructor. */
129    //@{
130         /**
131          * Destructor for DOM_CharacterData.  The object being destroyed
132      * is the reference to the Character Data node, not the character
133      * data itself.
134          */
135    ~DOM_CharacterData();
136
137
138    //@}
139
140    /** @name Getter functions. */
141    //@{
142  /**
143   * Returns the character data of the node that implements this interface.
144   *
145   * The DOM implementation may not put arbitrary limits on the amount of data that
146   * may be stored in a  <code>CharacterData</code> node. However,
147   * implementation limits may  mean that the entirety of a node's data may
148   * not fit into a single <code>DOMString</code>. In such cases, the user
149   * may call <code>substringData</code> to retrieve the data in
150   * appropriately sized pieces.
151   * @exception DOMException
152   *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
153   * @exception DOMException
154   *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than
155   *   fit in a <code>DOMString</code> variable on the implementation
156   *   platform.
157   */
158  DOMString          getData() const;
159  /**
160   * Returns the number of characters that are available through <code>data</code> and
161   * the <code>substringData</code> method below.
162   *
163   * This may have the value
164   * zero, i.e., <code>CharacterData</code> nodes may be empty.
165   */
166  unsigned int       getLength() const;
167  /**
168   * Extracts a range of data from the node.
169   *
170   * @param offset Start offset of substring to extract.
171   * @param count The number of characters to extract.
172   * @return The specified substring. If the sum of <code>offset</code> and
173   *   <code>count</code> exceeds the <code>length</code>, then all
174   *   characters to the end of the data are returned.
175   * @exception DOMException
176   *   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
177   *   than the number of characters in <code>data</code>, or if the
178   *   specified <code>count</code> is negative.
179   *   <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does not
180   *   fit into a <code>DOMString</code>.
181   */
182  DOMString          substringData(unsigned int offset,
183                                   unsigned int count) const;
184    //@}
185    /** @name Functions that set or change data. */
186    //@{
187  /**
188   * Append the string to the end of the character data of the node.
189   *
190   * Upon success, <code>data</code> provides access to the concatenation of
191   * <code>data</code> and the <code>DOMString</code> specified.
192   * @param arg The <code>DOMString</code> to append.
193   * @exception DOMException
194   *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
195   */
196  void               appendData(const DOMString &arg);
197  /**
198   * Insert a string at the specified character offset.
199   *
200   * @param offset The character offset at which to insert.
201   * @param arg The <code>DOMString</code> to insert.
202   * @exception DOMException
203   *   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
204   *   than the number of characters in <code>data</code>.
205   *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
206   */
207  void               insertData(unsigned int offset, const  DOMString &arg);
208  /**
209   * Remove a range of characters from the node.
210   *
211   * Upon success,
212   * <code>data</code> and <code>length</code> reflect the change.
213   * @param offset The offset from which to remove characters.
214   * @param count The number of characters to delete. If the sum of
215   *   <code>offset</code> and <code>count</code> exceeds <code>length</code>
216   *   then all characters from <code>offset</code> to the end of the data
217   *   are deleted.
218   * @exception DOMException
219   *   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
220   *   than the number of characters in <code>data</code>, or if the
221   *   specified <code>count</code> is negative.
222   *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
223   */
224  void               deleteData(unsigned int offset,
225                                unsigned int count);
226  /**
227   * Replace the characters starting at the specified character offset with
228   * the specified string.
229   *
230   * @param offset The offset from which to start replacing.
231   * @param count The number of characters to replace. If the sum of
232   *   <code>offset</code> and <code>count</code> exceeds <code>length</code>
233   *   , then all characters to the end of the data are replaced (i.e., the
234   *   effect is the same as a <code>remove</code> method call with the same
235   *   range, followed by an <code>append</code> method invocation).
236   * @param arg The <code>DOMString</code> with which the range must be
237   *   replaced.
238   * @exception DOMException
239   *   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
240   *   than the number of characters in <code>data</code>, or if the
241   *   specified <code>count</code> is negative.
242   *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
243   */
244  void               replaceData(unsigned int offset,
245                                 unsigned int count,
246                                 const DOMString &arg);
247
248  /**
249   * Sets the character data of the node that implements this interface.
250   *
251   * @param data The <code>DOMString</code> to set.
252   */
253  void               setData(const DOMString &data);
254  //@}
255
256protected:
257    DOM_CharacterData(CharacterDataImpl *impl);
258
259};
260
261XERCES_CPP_NAMESPACE_END
262
263#endif
264
265
Note: See TracBrowser for help on using the repository browser.