source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/dom/deprecated/DOM_Text.hpp @ 2674

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