27 #include "xml/dom_docimpl.h"
28 #include "xml/dom2_rangeimpl.h"
46 return DOMString(
"BAD_BOUNDARYPOINTS_ERR" );
48 return DOMString(
"INVALID_NODE_TYPE_ERR" );
50 return DOMString(
"(unknown exception code)" );
77 Range::Range(
const Node startContainer,
const long startOffset,
const Node endContainer,
const long endOffset)
83 if (!startContainer.
handle()->document() ||
84 startContainer.
handle()->document() != endContainer.
handle()->document()) {
118 int exceptioncode = 0;
119 NodeImpl *r =
impl->startContainer(exceptioncode);
120 throwException(exceptioncode);
129 int exceptioncode = 0;
130 long r =
impl->startOffset(exceptioncode);
131 throwException(exceptioncode);
141 int exceptioncode = 0;
142 NodeImpl *r =
impl->endContainer(exceptioncode);
143 throwException(exceptioncode);
152 int exceptioncode = 0;
153 long r =
impl->endOffset(exceptioncode);
154 throwException(exceptioncode);
163 int exceptioncode = 0;
164 bool r =
impl->collapsed(exceptioncode);
165 throwException(exceptioncode);
174 int exceptioncode = 0;
175 NodeImpl *r =
impl->commonAncestorContainer(exceptioncode);
176 throwException(exceptioncode);
185 int exceptioncode = 0;
186 impl->setStart(refNode.
handle(),offset,exceptioncode);
187 throwException(exceptioncode);
195 int exceptioncode = 0;
196 impl->setEnd(refNode.
handle(),offset,exceptioncode);
197 throwException(exceptioncode);
206 int exceptioncode = 0;
207 impl->setStartBefore(refNode.
handle(),exceptioncode);
208 throwException(exceptioncode);
216 int exceptioncode = 0;
217 impl->setStartAfter(refNode.
handle(),exceptioncode);
218 throwException(exceptioncode);
226 int exceptioncode = 0;
227 impl->setEndBefore(refNode.
handle(),exceptioncode);
228 throwException(exceptioncode);
236 int exceptioncode = 0;
237 impl->setEndAfter(refNode.
handle(),exceptioncode);
238 throwException(exceptioncode);
246 int exceptioncode = 0;
247 impl->collapse(toStart,exceptioncode);
248 throwException(exceptioncode);
256 int exceptioncode = 0;
257 impl->selectNode(refNode.
handle(),exceptioncode);
258 throwException(exceptioncode);
266 int exceptioncode = 0;
267 impl->selectNodeContents(refNode.
handle(),exceptioncode);
268 throwException(exceptioncode);
276 int exceptioncode = 0;
277 short r =
impl->compareBoundaryPoints(how,sourceRange.
handle(),exceptioncode);
278 throwException(exceptioncode);
287 return impl->boundaryPointsValid();
295 int exceptioncode = 0;
296 impl->deleteContents(exceptioncode);
297 throwException(exceptioncode);
305 int exceptioncode = 0;
306 DocumentFragmentImpl *r =
impl->extractContents(exceptioncode);
307 throwException(exceptioncode);
316 int exceptioncode = 0;
317 DocumentFragmentImpl *r =
impl->cloneContents(exceptioncode);
318 throwException(exceptioncode);
327 int exceptioncode = 0;
328 impl->insertNode(newNode.
handle(),exceptioncode);
329 throwException(exceptioncode);
337 int exceptioncode = 0;
338 impl->surroundContents(newParent.
handle(),exceptioncode);
339 throwException(exceptioncode);
347 int exceptioncode = 0;
349 throwException(exceptioncode);
358 int exceptioncode = 0;
360 throwException(exceptioncode);
369 int exceptioncode = 0;
371 throwException(exceptioncode);
380 int exceptioncode = 0;
382 throwException(exceptioncode);
392 int exceptioncode = 0;
393 impl->detach(exceptioncode);
394 throwException(exceptioncode);
402 return impl->isDetached();
415 void Range::throwException(
int exceptioncode)
const