• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdehtml
 

tdehtml

  • tdehtml
  • dom
dom_text.cpp
1
23#include "dom/dom_exception.h"
24#include "dom/dom_text.h"
25#include "xml/dom_textimpl.h"
26
27using namespace DOM;
28
29CharacterData::CharacterData() : Node()
30{
31}
32
33CharacterData::CharacterData(const CharacterData &other) : Node(other)
34{
35}
36
37CharacterData &CharacterData::operator = (const Node &other)
38{
39 NodeImpl* ohandle = other.handle();
40 if ( impl != ohandle ) {
41 if (!ohandle ||
42 ( ohandle->nodeType() != CDATA_SECTION_NODE &&
43 ohandle->nodeType() != TEXT_NODE &&
44 ohandle->nodeType() != COMMENT_NODE )) {
45 if ( impl ) impl->deref();
46 impl = 0;
47 } else {
48 Node::operator =(other);
49 }
50 }
51 return *this;
52}
53
54CharacterData &CharacterData::operator = (const CharacterData &other)
55{
56 Node::operator =(other);
57 return *this;
58}
59
60CharacterData::~CharacterData()
61{
62}
63
64DOMString CharacterData::data() const
65{
66 if(!impl) return DOMString();
67 return ((CharacterDataImpl *)impl)->data();
68}
69
70void CharacterData::setData( const DOMString &str )
71{
72 if (!impl)
73 return; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
74
75 int exceptioncode = 0;
76 ((CharacterDataImpl *)impl)->setData(str, exceptioncode);
77 if ( exceptioncode )
78 throw DOMException( exceptioncode );
79 return;
80}
81
82unsigned long CharacterData::length() const
83{
84 if ( impl )
85 return ((CharacterDataImpl *)impl)->length();
86 return 0;
87}
88
89DOMString CharacterData::substringData( const unsigned long offset, const unsigned long count )
90{
91 if (!impl)
92 return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
93
94 int exceptioncode = 0;
95 DOMString str = ((CharacterDataImpl *)impl)->substringData(offset, count, exceptioncode);
96 if ( exceptioncode )
97 throw DOMException( exceptioncode );
98 return str;
99}
100
101void CharacterData::appendData( const DOMString &arg )
102{
103 if (!impl)
104 return; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
105
106 int exceptioncode = 0;
107 ((CharacterDataImpl *)impl)->appendData(arg, exceptioncode);
108 if ( exceptioncode )
109 throw DOMException( exceptioncode );
110}
111
112void CharacterData::insertData( const unsigned long offset, const DOMString &arg )
113{
114 if (!impl)
115 return; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
116
117 int exceptioncode = 0;
118 ((CharacterDataImpl *)impl)->insertData(offset, arg, exceptioncode);
119 if ( exceptioncode )
120 throw DOMException( exceptioncode );
121}
122
123void CharacterData::deleteData( const unsigned long offset, const unsigned long count )
124{
125 if (!impl)
126 return; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
127
128 int exceptioncode = 0;
129 ((CharacterDataImpl *)impl)->deleteData(offset, count, exceptioncode);
130 if ( exceptioncode )
131 throw DOMException( exceptioncode );
132}
133
134void CharacterData::replaceData( const unsigned long offset, const unsigned long count, const DOMString &arg )
135{
136 if (!impl)
137 return; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
138
139 int exceptioncode = 0;
140 ((CharacterDataImpl *)impl)->replaceData(offset, count, arg, exceptioncode);
141 if ( exceptioncode )
142 throw DOMException( exceptioncode );
143}
144
145CharacterData::CharacterData(CharacterDataImpl *i) : Node(i)
146{
147}
148
149// ---------------------------------------------------------------------------
150
151Comment::Comment() : CharacterData()
152{
153}
154
155Comment::Comment(const Comment &other) : CharacterData(other)
156{
157}
158
159Comment &Comment::operator = (const Node &other)
160{
161 NodeImpl* ohandle = other.handle();
162 if ( impl != ohandle ) {
163 if (!ohandle || ohandle->nodeType() != COMMENT_NODE) {
164 if ( impl ) impl->deref();
165 impl = 0;
166 } else {
167 Node::operator =(other);
168 }
169 }
170 return *this;
171}
172
173Comment &Comment::operator = (const Comment &other)
174{
175 CharacterData::operator =(other);
176 return *this;
177}
178
179Comment::~Comment()
180{
181}
182
183Comment::Comment(CommentImpl *i) : CharacterData(i)
184{
185}
186
187// ----------------------------------------------------------------------------
188
189Text::Text()
190{
191}
192
193Text::Text(const Text &other) : CharacterData(other)
194{
195}
196
197Text &Text::operator = (const Node &other)
198{
199 NodeImpl* ohandle = other.handle();
200 if ( impl != ohandle ) {
201 if (!ohandle ||
202 (ohandle->nodeType() != TEXT_NODE &&
203 ohandle->nodeType() != CDATA_SECTION_NODE)) {
204 if ( impl ) impl->deref();
205 impl = 0;
206 } else {
207 Node::operator =(other);
208 }
209 }
210 return *this;
211}
212
213Text &Text::operator = (const Text &other)
214{
215 Node::operator =(other);
216 return *this;
217}
218
219Text::~Text()
220{
221}
222
223Text Text::splitText( const unsigned long offset )
224{
225 if (!impl)
226 return 0; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
227
228 int exceptioncode = 0;
229 TextImpl *newText = static_cast<TextImpl *>(impl)->splitText(offset, exceptioncode );
230 if ( exceptioncode )
231 throw DOMException( exceptioncode );
232 return newText;
233}
234
235Text::Text(TextImpl *i) : CharacterData(i)
236{
237}
DOM::CharacterData
The CharacterData interface extends Node with a set of attributes and methods for accessing character...
Definition: dom_text.h:50
DOM::CharacterData::appendData
void appendData(const DOMString &arg)
Append the string to the end of the character data of the node.
Definition: dom_text.cpp:101
DOM::CharacterData::deleteData
void deleteData(const unsigned long offset, const unsigned long count)
Remove a range of characters from the node.
Definition: dom_text.cpp:123
DOM::CharacterData::substringData
DOMString substringData(const unsigned long offset, const unsigned long count)
Extracts a range of data from the node.
Definition: dom_text.cpp:89
DOM::CharacterData::setData
void setData(const DOMString &)
see data
Definition: dom_text.cpp:70
DOM::CharacterData::replaceData
void replaceData(const unsigned long offset, const unsigned long count, const DOMString &arg)
Replace the characters starting at the specified character offset with the specified string.
Definition: dom_text.cpp:134
DOM::CharacterData::data
DOMString data() const
The character data of the node that implements this interface.
Definition: dom_text.cpp:64
DOM::CharacterData::insertData
void insertData(const unsigned long offset, const DOMString &arg)
Insert a string at the specified character offset.
Definition: dom_text.cpp:112
DOM::CharacterData::length
unsigned long length() const
The number of characters that are available through data and the substringData method below.
Definition: dom_text.cpp:82
DOM::Comment
This represents the content of a comment, i.e., all the characters between the starting ' <!...
Definition: dom_text.h:224
DOM::DOMException
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
Definition: dom_exception.h:58
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:275
DOM::Text
The Text interface represents the textual content (termed character data in XML) of an Element or At...
Definition: dom_text.h:270
DOM::Text::splitText
Text splitText(const unsigned long offset)
Breaks this Text node into two Text nodes at the specified offset, keeping both in the tree as siblin...
Definition: dom_text.cpp:223
DOM
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...
Definition: design.h:57

tdehtml

Skip menu "tdehtml"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdehtml

Skip menu "tdehtml"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdehtml by doxygen 1.9.4
This website is maintained by Timothy Pearson.