KHTML
dom_node.h
Go to the documentation of this file.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 <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
00871 quint32 elementId() const;
00872
00885 bool isNull() const { return !impl; }
00886
00890 NodeImpl *handle() const { return impl; }
00891
00895 unsigned long index() const;
00896 KDE_DEPRECATED QString toHTML();
00897 void applyChanges();
00901 KDE_DEPRECATED void getCursor(int offset, int &_x, int &_y, int &height);
00906 QRect getRect();
00907
00908 protected:
00909 NodeImpl *impl;
00910 };
00911
00912
00913 class NodeListImpl;
00914
00924 class KHTML_EXPORT NodeList
00925 {
00926 friend class Element;
00927 friend class Node;
00928 friend class Document;
00929 friend class HTMLDocument;
00930 friend class KJS::HTMLDocument;
00931 friend class KJS::Window;
00932
00933 public:
00934 NodeList();
00935 NodeList(const NodeList &other);
00936
00937 NodeList & operator = (const NodeList &other);
00938
00939 ~NodeList();
00940
00946 unsigned long length() const;
00947
00960 Node item ( unsigned long index ) const;
00961
00966 NodeListImpl *handle() const { return impl; }
00967 bool isNull() const { return !impl; }
00968
00969 protected:
00970 NodeList(const NodeListImpl *i);
00971 NodeListImpl *impl;
00972 };
00973
00974
00975
00980 typedef unsigned long long DOMTimeStamp;
00981
00982
00983 }
00984 #endif