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

Revision 358, 5.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_Text.hpp,v 1.5 2004/09/08 13:55:43 peiyongz Exp $
19 */
20
21#ifndef DOM_Text_HEADER_GUARD_
22#define DOM_Text_HEADER_GUARD_
23
24#include <xercesc/util/XercesDefs.hpp>
25#include "DOM_CharacterData.hpp"
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29
30class TextImpl;
31
32
33/**
34 * The <code>Text</code> interface represents the textual content (termed
35 * character  data in XML) of an <code>Element</code> or <code>Attr</code>.
36 * If there is no markup inside an element's content, the text is contained
37 * in a single object implementing the <code>Text</code> interface that is
38 * the only child of the element. If there is markup, it is parsed into a
39 * list of elements and <code>Text</code> nodes that form the list of
40 * children of the element.
41 * <p>When a document is first made available via the DOM, there is  only one
42 * <code>Text</code> node for each block of text. Users may create  adjacent
43 * <code>Text</code> nodes that represent the  contents of a given element
44 * without any intervening markup, but should be aware that there is no way
45 * to represent the separations between these nodes in XML, so they
46 * will not (in general) persist between DOM editing sessions. The
47 * <code>normalize()</code> method on <code>Element</code> merges any such
48 * adjacent <code>Text</code> objects into a single node for each block of
49 * text; this is  recommended before employing operations that depend on a
50 * particular document structure, such as navigation with
51 * <code>XPointers.</code>
52 */
53class DEPRECATED_DOM_EXPORT DOM_Text: public DOM_CharacterData {
54
55    public:
56    /** @name Constructors and assignment operator */
57    //@{
58    /**
59      * Default constructor for DOM_Text.  The resulting object does not
60      * refer to an actual Text node; it will compare == to 0, and is similar
61      * to a null object reference variable in Java.  It may subsequently be
62      * assigned to refer to an actual comment node.
63      *
64      */
65    DOM_Text();
66
67    /**
68      * Copy constructor.  Creates a new <code>DOM_Text</code> that refers to the
69      * same underlying node as the original.  See also DOM_Node::clone(),
70      * which will copy the actual Text node, rather than just creating a new
71      * reference to the original node.
72      *
73      * @param other The object to be copied.
74      */
75    DOM_Text(const DOM_Text &other);
76
77    /**
78      * Assignment operator.
79      *
80      * @param other The object to be copied.
81      */
82    DOM_Text & operator = (const DOM_Text &other);
83
84    /**
85      * Assignment operator.  This overloaded variant is provided for
86      *   the sole purpose of setting a DOM_Node reference variable to
87      *   zero.  Nulling out a reference variable in this way will decrement
88      *   the reference count on the underlying Node object that the variable
89      *   formerly referenced.  This effect is normally obtained when reference
90      *   variable goes out of scope, but zeroing them can be useful for
91      *   global instances, or for local instances that will remain in scope
92      *   for an extended time,  when the storage belonging to the underlying
93      *   node needs to be reclaimed.
94      *
95      * @param val  Only a value of 0, or null, is allowed.
96      */
97    DOM_Text & operator = (const DOM_NullPtr *val);
98
99    //@}
100    /** @name Destructor. */
101    //@{
102         /**
103          * Destructor for DOM_Text. The object being destroyed is the reference
104      * object, not the underlying Comment node itself.
105          *
106          */
107    ~DOM_Text();
108
109    //@}
110    /** @name Functions to modify the Text node. */
111    //@{
112
113    /**
114     * Breaks this node into two nodes at the specified
115     * offset, keeping both in the tree as siblings.
116     *
117     * This node then only
118     * contains all the content up to the <code>offset</code> point. And a new
119     * node of the same nodeType, which is inserted as the next sibling of this
120     * node, contains all the content at and after the <code>offset</code>
121     * point. When the <code>offset</code> is equal to the lenght of this node,
122     * the new node has no data.
123     * @param offset The offset at which to split, starting from 0.
124     * @return The new <code>Text</code> node.
125     * @exception DOMException
126     *   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
127     *   than the number of characters in <code>data</code>.
128     *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
129     */
130    DOM_Text splitText(unsigned int offset);
131
132    //@}
133    /** @name Non-standard (not defined by the DOM specification) functions. */
134    //@{
135
136    /**
137     *
138     * Return true if this node contains ignorable whitespaces only.
139     * @return True if this node contains ignorable whitespaces only.
140     */
141    bool isIgnorableWhitespace();
142
143    //@}
144
145protected:
146    DOM_Text(TextImpl *);
147
148    friend class DOM_Document;
149    friend class RangeImpl;
150
151
152
153};
154
155XERCES_CPP_NAMESPACE_END
156
157#endif
158
159
Note: See TracBrowser for help on using the repository browser.