dom_node.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _DOM_Node_h_
00030 #define _DOM_Node_h_
00031
00032 #include <qstring.h>
00033 #include <kdemacros.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 { return impl; }
00229 bool isNull() const { return !impl; }
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() : impl(0) {}
00278 Node(const Node &other);
00279
00283 Node( NodeImpl *_impl);
00284
00285 Node & operator = (const Node &other);
00286
00287 bool operator == (const Node &other) const;
00288
00289 bool operator != (const Node &other) const;
00290
00291 virtual ~Node();
00380 enum NodeType {
00381 ELEMENT_NODE = 1,
00382 ATTRIBUTE_NODE = 2,
00383 TEXT_NODE = 3,
00384 CDATA_SECTION_NODE = 4,
00385 ENTITY_REFERENCE_NODE = 5,
00386 ENTITY_NODE = 6,
00387 PROCESSING_INSTRUCTION_NODE = 7,
00388 COMMENT_NODE = 8,
00389 DOCUMENT_NODE = 9,
00390 DOCUMENT_TYPE_NODE = 10,
00391 DOCUMENT_FRAGMENT_NODE = 11,
00392 NOTATION_NODE = 12
00393 };
00394
00400 DOMString nodeName() const;
00401
00412 DOMString nodeValue() const;
00413
00420 void setNodeValue( const DOMString & );
00421
00427 unsigned short nodeType() const;
00428
00437 Node parentNode() const;
00438
00452 NodeList childNodes() const;
00453
00459 Node firstChild() const;
00460
00466 Node lastChild() const;
00467
00473 Node previousSibling() const;
00474
00480 Node nextSibling() const;
00481
00488 NamedNodeMap attributes() const;
00489
00497 Document ownerDocument() const;
00498
00533 Node insertBefore ( const Node &newChild, const Node &refChild );
00534
00563 Node replaceChild ( const Node &newChild, const Node &oldChild );
00564
00580 Node removeChild ( const Node &oldChild );
00581
00608 Node appendChild ( const Node &newChild );
00609
00618 bool hasChildNodes ( );
00619
00640 Node cloneNode ( bool deep );
00641
00659 void normalize ( );
00660
00678 bool isSupported( const DOMString &feature,
00679 const DOMString &version ) const;
00680
00697 DOMString namespaceURI( ) const;
00698
00714 DOMString prefix( ) const;
00715
00733 void setPrefix(const DOMString &prefix );
00734
00743 DOMString localName( ) const;
00744
00750 bool hasAttributes ( );
00751
00780 void addEventListener(const DOMString &type,
00781 EventListener *listener,
00782 const bool useCapture);
00783
00809 void removeEventListener(const DOMString &type,
00810 EventListener *listener,
00811 bool useCapture);
00812
00836 bool dispatchEvent(const Event &evt);
00837
00843 Q_UINT32 elementId() const;
00844
00857 bool isNull() const { return !impl; }
00858
00862 NodeImpl *handle() const { return impl; }
00863
00867 unsigned long index() const;
00868 QString toHTML();
00869 void applyChanges();
00873 void getCursor(int offset, int &_x, int &_y, int &height) KDE_DEPRECATED;
00878 QRect getRect();
00879
00880 protected:
00881 NodeImpl *impl;
00882 };
00883
00884
00885 class NodeListImpl;
00886
00896 class NodeList
00897 {
00898 friend class Element;
00899 friend class Node;
00900 friend class Document;
00901 friend class HTMLDocument;
00902 friend class KJS::HTMLDocument;
00903
00904 public:
00905 NodeList();
00906 NodeList(const NodeList &other);
00907
00908 NodeList & operator = (const NodeList &other);
00909
00910 ~NodeList();
00911
00917 unsigned long length() const;
00918
00931 Node item ( unsigned long index ) const;
00932
00937 NodeListImpl *handle() const { return impl; }
00938 bool isNull() const { return !impl; }
00939
00940 protected:
00941 NodeList(const NodeListImpl *i);
00942 NodeListImpl *impl;
00943 };
00944
00945
00946
00951 typedef unsigned long long DOMTimeStamp;
00952
00953
00954 }
00955 #endif
This file is part of the documentation for khtml Library Version 3.2.0.