• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

dom_node.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of the DOM implementation for KDE.
00003  *
00004  * Copyright 1999 Lars Knoll (knoll@kde.org)
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public License
00017  * along with this library; see the file COPYING.LIB.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  *
00021  * This file includes excerpts from the Document Object Model (DOM)
00022  * Level 1 Specification (Recommendation)
00023  * http://www.w3.org/TR/REC-DOM-Level-1/
00024  * Copyright © World Wide Web Consortium , (Massachusetts Institute of
00025  * Technology , Institut National de Recherche en Informatique et en
00026  * Automatique , Keio University ). All Rights Reserved.
00027  *
00028  */
00029 #ifndef _DOM_Node_h_
00030 #define _DOM_Node_h_
00031 
00032 #include <khtml_export.h>
00033 #include <QtCore/QString>
00034 
00035 class QRect;
00036 
00037 namespace KJS {
00038     class HTMLDocument;
00039     class Window;
00040 }
00041 namespace DOM {
00042 
00043 class Node;
00044 class DOMString;
00045 class NodeImpl;
00046 class NamedNodeMapImpl;
00047 class EventListener;
00048 class Event;
00049 
00062 class KHTML_EXPORT NamedNodeMap
00063 {
00064 public:
00065     NamedNodeMap();
00066     NamedNodeMap(const NamedNodeMap &other);
00067 
00068     NamedNodeMap & operator = (const NamedNodeMap &other);
00069 
00070     ~NamedNodeMap();
00071 
00077     unsigned long length() const;
00078 
00089     Node getNamedItem ( const DOMString &name ) const;
00090 
00123     Node setNamedItem ( const Node &arg );
00124 
00140     Node removeNamedItem ( const DOMString &name );
00141 
00154     Node item ( unsigned long index ) const;
00155 
00169     Node getNamedItemNS( const DOMString &namespaceURI,
00170                          const DOMString &localName ) const;
00171 
00196     Node setNamedItemNS( const Node &arg );
00197 
00222     Node removeNamedItemNS( const DOMString &namespaceURI,
00223                             const DOMString &localName );
00224 
00229     NamedNodeMapImpl *handle() const { return impl; }
00230     bool isNull() const { return !impl; }
00231 
00232 protected:
00233     NamedNodeMap( NamedNodeMapImpl *i);
00234     NamedNodeMapImpl *impl;
00235 
00236     friend class Node;
00237     friend class DocumentType;
00238     friend class NodeImpl;
00239 };
00240 
00241 class NamedNodeMap;
00242 class NodeList;
00243 class Document;
00244 class DOMString;
00245 class StyleSheet;
00246 
00247 class NodeImpl;
00248 
00270 class KHTML_EXPORT Node
00271 {
00272     friend class NamedNodeMap;
00273     friend class NodeList;
00274     friend class HTMLCollection;
00275     friend class StyleSheet;
00276 
00277 public:
00278     Node() : impl(0) {}
00279     Node(const Node &other);
00280 
00284     Node( NodeImpl *_impl);
00285 
00286     Node & operator = (const Node &other);
00287 
00288     bool operator == (const Node &other) const;
00289 
00290     bool operator != (const Node &other) const;
00291 
00292     virtual ~Node();
00381     enum NodeType {
00382         ELEMENT_NODE = 1,
00383         ATTRIBUTE_NODE = 2,
00384         TEXT_NODE = 3,
00385         CDATA_SECTION_NODE = 4,
00386         ENTITY_REFERENCE_NODE = 5,
00387         ENTITY_NODE = 6,
00388         PROCESSING_INSTRUCTION_NODE = 7,
00389         COMMENT_NODE = 8,
00390         DOCUMENT_NODE = 9,
00391         DOCUMENT_TYPE_NODE = 10,
00392         DOCUMENT_FRAGMENT_NODE = 11,
00393         NOTATION_NODE = 12
00394     };
00395 
00401     DOMString nodeName() const;
00402 
00413     DOMString nodeValue() const;
00414 
00421     void setNodeValue( const DOMString & );
00422 
00428     unsigned short nodeType() const;
00429 
00438     Node parentNode() const;
00439 
00453     NodeList childNodes() const;
00454 
00460     Node firstChild() const;
00461 
00467     Node lastChild() const;
00468 
00474     Node previousSibling() const;
00475 
00481     Node nextSibling() const;
00482 
00489     NamedNodeMap attributes() const;
00490 
00498     Document ownerDocument() const;
00499 
00534     Node insertBefore ( const Node &newChild, const Node &refChild );
00535 
00564     Node replaceChild ( const Node &newChild, const Node &oldChild );
00565 
00581     Node removeChild ( const Node &oldChild );
00582 
00609     Node appendChild ( const Node &newChild );
00610 
00619     bool hasChildNodes (  );
00620 
00641     Node cloneNode ( bool deep );
00642 
00660     void normalize (  );
00661 
00679     bool isSupported( const DOMString &feature,
00680                       const DOMString &version ) const;
00681 
00698     DOMString namespaceURI(  ) const;
00699 
00715     DOMString prefix(  ) const;
00716 
00734     void setPrefix(const DOMString &prefix );
00735 
00744     DOMString localName(  ) const;
00745 
00751     bool hasAttributes (  );
00752 
00781     void addEventListener(const DOMString &type,
00782               EventListener *listener,
00783               const bool useCapture);
00784 
00810     void removeEventListener(const DOMString &type,
00811                  EventListener *listener,
00812                  bool useCapture);
00813 
00837     bool dispatchEvent(const Event &evt);
00838 
00856     DOMString textContent() const;
00857         
00864     void setTextContent(const DOMString& text);
00865     
00874     enum DocumentPosition {
00875     DOCUMENT_POSITION_DISCONNECTED = 0x01,
00876     DOCUMENT_POSITION_PRECEDING    = 0x02,
00877     DOCUMENT_POSITION_FOLLOWING    = 0x04,
00878     DOCUMENT_POSITION_CONTAINS     = 0x08,
00879     DOCUMENT_POSITION_CONTAINED_BY = 0x10,
00880     DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
00881     };
00882     
00898     unsigned compareDocumentPosition(const DOM::Node& other);
00899 
00905     quint32 elementId() const;
00906 
00919     bool isNull() const { return !impl; }
00920 
00924     NodeImpl *handle() const { return impl; }
00925 
00929     unsigned long index() const;
00930     KDE_DEPRECATED QString toHTML();
00931     void applyChanges();
00935     KDE_DEPRECATED void getCursor(int offset, int &_x, int &_y, int &height);
00940     QRect getRect();
00941 
00942 protected:
00943     NodeImpl *impl;
00944 };
00945 
00946 
00947 class NodeListImpl;
00948 
00958 class KHTML_EXPORT NodeList
00959 {
00960     friend class Element;
00961     friend class Node;
00962     friend class Document;
00963     friend class HTMLDocument;
00964     friend class KJS::HTMLDocument;
00965     friend class KJS::Window;
00966 
00967 public:
00968     NodeList();
00969     NodeList(const NodeList &other);
00970 
00971     NodeList & operator = (const NodeList &other);
00972 
00973     ~NodeList();
00974 
00980     unsigned long length() const;
00981 
00994     Node item ( unsigned long index ) const;
00995 
01000     NodeListImpl *handle() const { return impl; }
01001     bool isNull() const { return !impl; }
01002 
01003 protected:
01004     NodeList(const NodeListImpl *i);
01005     NodeListImpl *impl;
01006 };
01007 
01008 
01009 
01014 typedef unsigned long long DOMTimeStamp;
01015 
01016 
01017 } //namespace
01018 #endif

KHTML

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal