KHtml

dom_xmlimpl.h
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright (C) 2000 Peter Kelly ([email protected])
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef _DOM_XmlImpl_h_
24 #define _DOM_XmlImpl_h_
25 
26 #include "xml/dom_nodeimpl.h"
27 #include "misc/loader_client.h"
28 
29 #include <qxml.h>
30 
31 namespace khtml
32 {
33 class CachedCSSStyleSheet;
34 }
35 
36 namespace DOM
37 {
38 
39 class DocumentImpl;
40 class CSSStyleSheetImpl;
41 class StyleSheetImpl;
42 class DOMString;
43 
44 class EntityImpl : public NodeBaseImpl
45 {
46 public:
47  EntityImpl(DocumentImpl *doc);
48  EntityImpl(DocumentImpl *doc, DOMString _name);
49  EntityImpl(DocumentImpl *doc, DOMString _publicId, DOMString _systemId, DOMString _notationName);
50  virtual ~EntityImpl();
51 
52  // DOM methods & attributes for Entity
53 
54  virtual DOMString publicId() const;
55  virtual DOMString systemId() const;
56  virtual DOMString notationName() const;
57 
58  // DOM methods overridden from parent classes
59 
60  DOMString nodeName() const override;
61  unsigned short nodeType() const override;
62  WTF::PassRefPtr<NodeImpl> cloneNode(bool deep) override;
63 
64  // Other methods (not part of DOM)
65 
66  bool childTypeAllowed(unsigned short type) override;
67 
68  DOMString toString() const override;
69 
70 protected:
71  DOMStringImpl *m_publicId;
72  DOMStringImpl *m_systemId;
73  DOMStringImpl *m_notationName;
74  DOMStringImpl *m_name;
75 };
76 
77 class EntityReferenceImpl : public NodeBaseImpl
78 {
79 public:
80  EntityReferenceImpl(DocumentImpl *doc);
81  EntityReferenceImpl(DocumentImpl *doc, DOMStringImpl *_entityName);
82  virtual ~EntityReferenceImpl();
83 
84  // DOM methods overridden from parent classes
85 
86  DOMString nodeName() const override;
87  unsigned short nodeType() const override;
88  WTF::PassRefPtr<NodeImpl> cloneNode(bool deep) override;
89 
90  // Other methods (not part of DOM)
91 
92  bool childTypeAllowed(unsigned short type) override;
93 
94  DOMString toString() const override;
95 protected:
96  DOMStringImpl *m_entityName;
97 };
98 
99 class NotationImpl : public NodeBaseImpl
100 {
101 public:
102  NotationImpl(DocumentImpl *doc);
103  NotationImpl(DocumentImpl *doc, DOMString _name, DOMString _publicId, DOMString _systemId);
104  virtual ~NotationImpl();
105 
106  // DOM methods & attributes for Notation
107 
108  virtual DOMString publicId() const;
109  virtual DOMString systemId() const;
110 
111  // DOM methods overridden from parent classes
112 
113  DOMString nodeName() const override;
114  unsigned short nodeType() const override;
115  WTF::PassRefPtr<NodeImpl> cloneNode(bool deep) override;
116 
117  // Other methods (not part of DOM)
118 
119  bool childTypeAllowed(unsigned short type) override;
120 protected:
121  DOMStringImpl *m_name;
122  DOMStringImpl *m_publicId;
123  DOMStringImpl *m_systemId;
124 };
125 
126 class ProcessingInstructionImpl : public NodeBaseImpl, private khtml::CachedObjectClient
127 {
128 public:
129  ProcessingInstructionImpl(DocumentImpl *doc);
130  ProcessingInstructionImpl(DocumentImpl *doc, DOMString _target, DOMString _data);
131  virtual ~ProcessingInstructionImpl();
132 
133  // DOM methods & attributes for Notation
134 
135  virtual DOMString target() const;
136  DOMString data() const
137  {
138  return m_data;
139  }
140  virtual void setData(const DOMString &_data, int &exceptioncode);
141 
142  // DOM methods overridden from parent classes
143 
144  DOMString nodeName() const override;
145  unsigned short nodeType() const override;
146  DOMString nodeValue() const override;
147  void setNodeValue(const DOMString &_nodeValue, int &exceptioncode) override;
148  WTF::PassRefPtr<NodeImpl> cloneNode(bool deep) override;
149 
150  // Other methods (not part of DOM)
151 
152  virtual DOMString localHref() const;
153  bool childTypeAllowed(unsigned short type) override;
154  StyleSheetImpl *sheet() const;
155  void checkStyleSheet();
156  void setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheet, const DOM::DOMString &charset, const DOM::DOMString &mimetype) override;
157  virtual void setStyleSheet(CSSStyleSheetImpl *sheet);
158 
159  DOMString toString() const override;
160 
161  bool offsetInCharacters() const override
162  {
163  return true;
164  }
165  int maxCharacterOffset() const override;
166 
167  bool isAlternate() const
168  {
169  return m_alternate;
170  }
171 protected:
172  DOMStringImpl *m_target;
173  DOMStringImpl *m_data;
174  DOMStringImpl *m_localHref;
175  DOMStringImpl *m_title;
176  DOMStringImpl *m_media;
177  bool m_alternate;
178  khtml::CachedCSSStyleSheet *m_cachedSheet;
179  CSSStyleSheetImpl *m_sheet;
180 };
181 
182 class XMLAttributeReader : public QXmlDefaultHandler
183 {
184 public:
185  XMLAttributeReader(const QString &_attrString);
186  virtual ~XMLAttributeReader();
187  QXmlAttributes readAttrs(bool &ok);
188  bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts) override;
189 
190 protected:
191  QXmlAttributes attrs;
192  QString m_attrString;
193 };
194 
195 } //namespace
196 
197 #endif
This file is part of the HTML rendering engine for KDE.
a cached style sheet.
Definition: loader.h:282
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
This library provides a full-featured HTML parser and widget.
char * toString(const T &value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Oct 26 2021 22:48:01 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.