khtml Library API Documentation

dom_node.h

00001 /*
00002  * This file is part of the DOM implementation for KDE.
00003  *
00004  * (C) 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., 59 Temple Place - Suite 330,
00019  * Boston, MA 02111-1307, 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  * $Id: dom_node.h,v 1.28.2.1 2003/05/18 12:34:37 mueller Exp $
00029  */
00030 #ifndef _DOM_Node_h_
00031 #define _DOM_Node_h_
00032 
00033 #include <qstring.h>
00034 
00035 class QRect;
00036 
00037 namespace KJS {
00038     class HTMLDocument;
00039 }
00040 namespace DOM {
00041 
00042 class Node;
00043 class DOMString;
00044 class NodeImpl;
00045 class NamedNodeMapImpl;
00046 class EventListener;
00047 class Event;
00048 
00061 class NamedNodeMap
00062 {
00063 public:
00064     NamedNodeMap();
00065     NamedNodeMap(const NamedNodeMap &other);
00066 
00067     NamedNodeMap & operator = (const NamedNodeMap &other);
00068 
00069     ~NamedNodeMap();
00070 
00076     unsigned long length() const;
00077 
00088     Node getNamedItem ( const DOMString &name ) const;
00089 
00122     Node setNamedItem ( const Node &arg );
00123 
00139     Node removeNamedItem ( const DOMString &name );
00140 
00153     Node item ( unsigned long index ) const;
00154 
00168     Node getNamedItemNS( const DOMString &namespaceURI,
00169                          const DOMString &localName ) const;
00170 
00195     Node setNamedItemNS( const Node &arg );
00196 
00221     Node removeNamedItemNS( const DOMString &namespaceURI,
00222                             const DOMString &localName );
00223 
00228     NamedNodeMapImpl *handle() const throw();
00229     bool isNull() const throw();
00230 
00231 protected:
00232     NamedNodeMap( NamedNodeMapImpl *i);
00233     NamedNodeMapImpl *impl;
00234 
00235     friend class Node;
00236     friend class DocumentType;
00237     friend class NodeImpl;
00238 };
00239 
00240 class NamedNodeMap;
00241 class NodeList;
00242 class Document;
00243 class DOMString;
00244 class StyleSheet;
00245 
00246 class NodeImpl;
00247 
00269 class Node
00270 {
00271     friend class NamedNodeMap;
00272     friend class NodeList;
00273     friend class HTMLCollection;
00274     friend class StyleSheet;
00275 
00276 public:
00277     Node();
00278     Node(const Node &other);
00279 
00283     Node( NodeImpl *_impl);
00284 
00285     Node & operator = (const Node &other);
00286 
00287     bool operator == (const Node &other);
00288 
00289     bool operator != (const Node &other);
00290 
00291     virtual ~Node();
00382     enum NodeType {
00383         ELEMENT_NODE = 1,
00384         ATTRIBUTE_NODE = 2,
00385         TEXT_NODE = 3,
00386         CDATA_SECTION_NODE = 4,
00387         ENTITY_REFERENCE_NODE = 5,
00388         ENTITY_NODE = 6,
00389         PROCESSING_INSTRUCTION_NODE = 7,
00390         COMMENT_NODE = 8,
00391         DOCUMENT_NODE = 9,
00392         DOCUMENT_TYPE_NODE = 10,
00393         DOCUMENT_FRAGMENT_NODE = 11,
00394         NOTATION_NODE = 12
00395     };
00396 
00402     DOMString nodeName() const;
00403 
00414     DOMString nodeValue() const;
00415 
00422     void setNodeValue( const DOMString & );
00423 
00429     unsigned short nodeType() const;
00430 
00439     Node parentNode() const;
00440 
00454     NodeList childNodes() const;
00455 
00461     Node firstChild() const;
00462 
00468     Node lastChild() const;
00469 
00475     Node previousSibling() const;
00476 
00482     Node nextSibling() const;
00483 
00490     NamedNodeMap attributes() const;
00491 
00499     Document ownerDocument() const;
00500 
00535     Node insertBefore ( const Node &newChild, const Node &refChild );
00536 
00565     Node replaceChild ( const Node &newChild, const Node &oldChild );
00566 
00582     Node removeChild ( const Node &oldChild );
00583 
00610     Node appendChild ( const Node &newChild );
00611 
00620     bool hasChildNodes (  );
00621 
00642     Node cloneNode ( bool deep );
00643 
00661     void normalize (  );
00662 
00680     bool isSupported( const DOMString &feature,
00681                       const DOMString &version ) const;
00682 
00699     DOMString namespaceURI(  ) const;
00700 
00716     DOMString prefix(  ) const;
00717 
00735     void setPrefix(const DOMString &prefix );
00736 
00745     DOMString localName(  ) const;
00746 
00752     bool hasAttributes (  );
00753 
00782     void addEventListener(const DOMString &type,
00783                           EventListener *listener,
00784                           const bool useCapture);
00785 
00811     void removeEventListener(const DOMString &type,
00812                              EventListener *listener,
00813                              bool useCapture);
00814 
00838     bool dispatchEvent(const Event &evt);
00839 
00845     Q_UINT32 elementId() const;
00846 
00859     bool isNull() const;
00860 
00864     NodeImpl *handle() const;
00865 
00869     unsigned long index() const;
00870     QString toHTML();
00871     void applyChanges();
00872     void getCursor(int offset, int &_x, int &_y, int &height);
00877     QRect getRect();
00878 
00879 protected:
00880     NodeImpl *impl;
00881 };
00882 
00883 
00884 class NodeListImpl;
00885 
00895 class NodeList
00896 {
00897     friend class Element;
00898     friend class Node;
00899     friend class Document;
00900     friend class HTMLDocument;
00901     friend class KJS::HTMLDocument;
00902 
00903 public:
00904     NodeList();
00905     NodeList(const NodeList &other);
00906 
00907     NodeList & operator = (const NodeList &other);
00908 
00909     ~NodeList();
00910 
00916     unsigned long length() const;
00917 
00930     Node item ( unsigned long index ) const;
00931 
00936     NodeListImpl *handle() const;
00937     bool isNull() const;
00938 
00939 protected:
00940     NodeList(const NodeListImpl *i);
00941     NodeListImpl *impl;
00942 };
00943 
00944 
00945 
00950 typedef unsigned long long DOMTimeStamp;
00951 
00952 
00953 } //namespace
00954 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:33:45 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001