• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • DOM
  • Range
Public Types | Public Member Functions | Protected Attributes
DOM::Range Class Reference

#include <dom2_range.h>

List of all members.

Public Types

enum  CompareHow { START_TO_START = 0, START_TO_END = 1, END_TO_END = 2, END_TO_START = 3 }

Public Member Functions

 Range ()
 Range (const Document rootContainer)
 Range (const Range &other)
 Range (const Node startContainer, const long startOffset, const Node endContainer, const long endOffset)
 Range (RangeImpl *i)
 ~Range ()
bool boundaryPointsValid ()
DocumentFragment cloneContents ()
Range cloneRange ()
void collapse (bool toStart)
bool collapsed () const
Node commonAncestorContainer ()
short compareBoundaryPoints (CompareHow how, const Range &sourceRange)
DocumentFragment createContextualFragment (const DOMString &html)
void deleteContents ()
void detach ()
Node endContainer () const
long endOffset () const
DocumentFragment extractContents ()
RangeImpl * handle () const
void insertNode (const Node &newNode)
bool isDetached () const
bool isNull () const
Range & operator= (const Range &other)
void selectNode (const Node &refNode)
void selectNodeContents (const Node &refNode)
void setEnd (const Node &refNode, long offset)
void setEndAfter (const Node &refNode)
void setEndBefore (const Node &refNode)
void setStart (const Node &refNode, long offset)
void setStartAfter (const Node &refNode)
void setStartBefore (const Node &refNode)
Node startContainer () const
long startOffset () const
void surroundContents (const Node &newParent)
DOMString toHTML ()
DOMString toString ()

Protected Attributes

RangeImpl * impl

Detailed Description

Definition at line 79 of file dom2_range.h.


Member Enumeration Documentation

enum DOM::Range::CompareHow
Enumerator:
START_TO_START 
START_TO_END 
END_TO_END 
END_TO_START 

Definition at line 281 of file dom2_range.h.


Constructor & Destructor Documentation

Range::Range ( )

Definition at line 54 of file dom2_range.cpp.

Range::Range ( const Document  rootContainer)

Definition at line 60 of file dom2_range.cpp.

Range::Range ( const Range &  other)

Definition at line 71 of file dom2_range.cpp.

Range::Range ( const Node  startContainer,
const long  startOffset,
const Node  endContainer,
const long  endOffset 
)

Definition at line 77 of file dom2_range.cpp.

Range::~Range ( )

Definition at line 108 of file dom2_range.cpp.

Range::Range ( RangeImpl *  i)

Definition at line 92 of file dom2_range.cpp.


Member Function Documentation

bool Range::boundaryPointsValid ( )

not part of the DOM

Compare the boundary-points of a range.

Return true if the startContainer is before the endContainer, or if they are equal. Return false if the startContainer is after the endContainer.

Definition at line 282 of file dom2_range.cpp.

DocumentFragment Range::cloneContents ( )

Duplicates the contents of a range.

Returns:
A DocumentFragment containing contents equivalent to those of this range.
Exceptions:
DOMExceptionHIERARCHY_REQUEST_ERR: Raised if a DocumentType node would be extracted into the new DocumentFragment.

Definition at line 311 of file dom2_range.cpp.

Range Range::cloneRange ( )

Produces a new range whose end-points are equal to the end-points of the range.

Returns:
The duplicated range.

Definition at line 342 of file dom2_range.cpp.

void Range::collapse ( bool  toStart)

Collapse a range onto one of its end-points.

Parameters:
toStartIf true, collapses the Range onto its start; if false, collapses it onto its end.
Returns:

Definition at line 241 of file dom2_range.cpp.

bool Range::collapsed ( ) const

true if the range is collapsed

Definition at line 158 of file dom2_range.cpp.

Node Range::commonAncestorContainer ( )

Gets the common ancestor container of the range's two end-points.

Also sets it.

Definition at line 169 of file dom2_range.cpp.

short Range::compareBoundaryPoints ( CompareHow  how,
const Range &  sourceRange 
)

Compare the end-points of two ranges in a document.

Parameters:
how
sourceRange
Returns:
-1, 0 or 1 depending on whether the corresponding end-point of the Range is before, equal to, or after the corresponding end-point of sourceRange .
Exceptions:
DOMExceptionWRONG_DOCUMENT_ERR: Raised if the two Ranges are not in the same document or document fragment.

Definition at line 271 of file dom2_range.cpp.

DocumentFragment Range::createContextualFragment ( const DOMString &  html)

Definition at line 375 of file dom2_range.cpp.

void Range::deleteContents ( )

Removes the contents of a range from the containing document or document fragment without returning a reference to the removed content.

Returns:
Exceptions:
DOMExceptionNO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of the range is read-only or any of the nodes that contain any of the content of the range are read-only.

Definition at line 290 of file dom2_range.cpp.

void Range::detach ( )

Called to indicate that the range is no longer in use and that the implementation may relinquish any resources associated with this range.

Subsequent calls to any methods or attribute getters on this range will result in a DOMException being thrown with an error code of INVALID_STATE_ERR.

Definition at line 387 of file dom2_range.cpp.

Node Range::endContainer ( ) const

Node within which the range ends.

Definition at line 136 of file dom2_range.cpp.

long Range::endOffset ( ) const

Offset within the ending node of the range.

Definition at line 147 of file dom2_range.cpp.

DocumentFragment Range::extractContents ( )

Moves the contents of a range from the containing document or document fragment to a new DocumentFragment.

Returns:
A DocumentFragment containing the extracted contents.
Exceptions:
DOMExceptionNO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of the range is read-only or any of the nodes which contain any of the content of the range are read-only.

HIERARCHY_REQUEST_ERR: Raised if a DocumentType node would be extracted into the new DocumentFragment.

Definition at line 300 of file dom2_range.cpp.

RangeImpl * Range::handle ( ) const

not part of the DOM

Definition at line 405 of file dom2_range.cpp.

void Range::insertNode ( const Node &  newNode)

Inserts a node into the document or document fragment at the start of the range.

Parameters:
newNodeThe node to insert at the start of the range
Returns:
Exceptions:
DOMExceptionNO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of the start of the range is read-only.

WRONG_DOCUMENT_ERR: Raised if newNode and the container of the start of the Range were not created from the same document.

HIERARCHY_REQUEST_ERR: Raised if the container of the start of the Range is of a type that does not allow children of the type of newNode or if newNode is an ancestor of the container .

Exceptions:
RangeExceptionINVALID_NODE_TYPE_ERR: Raised if node is an Attr, Entity, Notation, DocumentFragment, or Document node.

Definition at line 322 of file dom2_range.cpp.

bool Range::isDetached ( ) const

not part of the DOM true if the range is detached

Definition at line 397 of file dom2_range.cpp.

bool Range::isNull ( ) const

Definition at line 410 of file dom2_range.cpp.

Range & Range::operator= ( const Range &  other)

Definition at line 98 of file dom2_range.cpp.

void Range::selectNode ( const Node &  refNode)

Select a node and its contents.

Parameters:
refNodeThe node to select.
Returns:
Exceptions:
RangeExceptionINVALID_NODE_TYPE_ERR: Raised if an ancestor of refNode is an Attr, Entity, Notation or DocumentType node or if refNode is a Document, DocumentFragment, Attr, Entity, or Notation node.

Definition at line 251 of file dom2_range.cpp.

void Range::selectNodeContents ( const Node &  refNode)

Select the contents within a node.

Parameters:
refNodeNode to select from
Returns:
Exceptions:
RangeExceptionINVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor of refNode is an Attr, Entity, Notation or DocumentType node.

Definition at line 261 of file dom2_range.cpp.

void Range::setEnd ( const Node &  refNode,
long  offset 
)

Sets the attributes describing the end of a range.

Parameters:
refNodeThe refNode value. This parameter must be different from null .
offsetThe endOffset value.
Returns:
Exceptions:
RangeExceptionNULL_NODE_ERR: Raised if refNode is null .

INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor of refNode is an Attr, Entity, Notation, or DocumentType node.

Definition at line 190 of file dom2_range.cpp.

void Range::setEndAfter ( const Node &  refNode)

Sets the end of a range to be after a node.

Parameters:
refNodeRange ends after refNode .
Returns:
Exceptions:
RangeExceptionINVALID_NODE_TYPE_ERR: Raised if an ancestor of refNode is an Attr, Entity, Notation or DocumentType node or if refNode is a Document, DocumentFragment, Attr, Entity, or Notation node.

Definition at line 231 of file dom2_range.cpp.

void Range::setEndBefore ( const Node &  refNode)

Sets the end position to be before a node.

Parameters:
refNodeRange ends before refNode
Returns:
Exceptions:
RangeExceptionINVALID_NODE_TYPE_ERR: Raised if an ancestor of refNode is an Attr, Entity, Notation, or DocumentType node or if refNode is a Document, DocumentFragment, Attr, Entity, or Notation node.

Definition at line 221 of file dom2_range.cpp.

void Range::setStart ( const Node &  refNode,
long  offset 
)

Sets the attributes describing the start of the range.

Parameters:
refNodeThe refNode value. This parameter must be different from null .
offsetThe startOffset value.
Returns:
Exceptions:
RangeExceptionNULL_NODE_ERR: Raised if refNode is null .

INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor of refNode is an Attr, Entity, Notation, or DocumentType node.

If an offset is out-of-bounds, should it just be fixed up or should an exception be raised.

Definition at line 180 of file dom2_range.cpp.

void Range::setStartAfter ( const Node &  refNode)

Sets the start position to be after a node.

Parameters:
refNodeRange starts after refNode
Returns:
Exceptions:
RangeExceptionINVALID_NODE_TYPE_ERR: Raised if an ancestor of refNode is an Attr, Entity, Notation, or DocumentType node or if refNode is a Document, DocumentFragment, Attr, Entity, or Notation node.

Definition at line 211 of file dom2_range.cpp.

void Range::setStartBefore ( const Node &  refNode)

Sets the start position to be before a node.

Parameters:
refNodeRange starts before refNode
Returns:
Exceptions:
RangeExceptionINVALID_NODE_TYPE_ERR: Raised if an ancestor of refNode is an Attr, Entity, Notation, or DocumentType node or if refNode is a Document, DocumentFragment, Attr, Entity, or Notation node.

Definition at line 200 of file dom2_range.cpp.

Node Range::startContainer ( ) const

Node within which the range begins.

Definition at line 113 of file dom2_range.cpp.

long Range::startOffset ( ) const

Offset within the starting node of the range.

Definition at line 124 of file dom2_range.cpp.

void Range::surroundContents ( const Node &  newParent)

Reparents the contents of the range to the given node and inserts the node at the position of the start of the range.

Parameters:
newParentThe node to surround the contents with.
Returns:
Exceptions:
DOMExceptionNO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of either end-point of the range is read-only.

WRONG_DOCUMENT_ERR: Raised if newParent and the container of the start of the Range were not created from the same document.

HIERARCHY_REQUEST_ERR: Raised if the container of the start of the Range is of a type that does not allow children of the type of newParent or if newParent is an ancestor of the container or if node would end up with a child node of a type not allowed by the type of node .

Exceptions:
RangeExceptionBAD_ENDPOINTS_ERR: Raised if the range partially selects a non-text node.

INVALID_NODE_TYPE_ERR: Raised if node is an Attr, Entity, DocumentType, Notation, Document, or DocumentFragment node.

Definition at line 332 of file dom2_range.cpp.

DOMString Range::toHTML ( )

Not part of DOM

Definition at line 365 of file dom2_range.cpp.

DOMString Range::toString ( )

Returns the contents of a range as a string.

Returns:
The contents of the range.

Definition at line 353 of file dom2_range.cpp.


Member Data Documentation

RangeImpl* DOM::Range::impl
protected

Definition at line 476 of file dom2_range.h.


The documentation for this class was generated from the following files:
  • dom2_range.h
  • dom2_range.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Jul 23 2013 20:44:47 by doxygen 1.8.1.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

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

kdelibs-4.10.5 API Reference

Skip menu "kdelibs-4.10.5 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal