Warning, file /frameworks/khtml/src/xml/dom_xmlimpl.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * This file is part of the DOM implementation for KDE.
0003  *
0004  * Copyright (C) 2000 Peter Kelly (pmk@post.com)
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Library General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Library General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Library General Public License
0017  * along with this library; see the file COPYING.LIB.  If not, write to
0018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019  * Boston, MA 02110-1301, USA.
0020  *
0021  */
0022 
0023 #ifndef _DOM_XmlImpl_h_
0024 #define _DOM_XmlImpl_h_
0025 
0026 #include "xml/dom_nodeimpl.h"
0027 #include "misc/loader_client.h"
0028 
0029 #include <qxml.h>
0030 
0031 namespace khtml
0032 {
0033 class CachedCSSStyleSheet;
0034 }
0035 
0036 namespace DOM
0037 {
0038 
0039 class DocumentImpl;
0040 class CSSStyleSheetImpl;
0041 class StyleSheetImpl;
0042 class DOMString;
0043 
0044 class EntityImpl : public NodeBaseImpl
0045 {
0046 public:
0047     EntityImpl(DocumentImpl *doc);
0048     EntityImpl(DocumentImpl *doc, DOMString _name);
0049     EntityImpl(DocumentImpl *doc, DOMString _publicId, DOMString _systemId, DOMString _notationName);
0050     virtual ~EntityImpl();
0051 
0052     // DOM methods & attributes for Entity
0053 
0054     virtual DOMString publicId() const;
0055     virtual DOMString systemId() const;
0056     virtual DOMString notationName() const;
0057 
0058     // DOM methods overridden from  parent classes
0059 
0060     DOMString nodeName() const override;
0061     unsigned short nodeType() const override;
0062     WTF::PassRefPtr<NodeImpl> cloneNode(bool deep) override;
0063 
0064     // Other methods (not part of DOM)
0065 
0066     bool childTypeAllowed(unsigned short type) override;
0067 
0068     DOMString toString() const override;
0069 
0070 protected:
0071     DOMStringImpl *m_publicId;
0072     DOMStringImpl *m_systemId;
0073     DOMStringImpl *m_notationName;
0074     DOMStringImpl *m_name;
0075 };
0076 
0077 class EntityReferenceImpl : public NodeBaseImpl
0078 {
0079 public:
0080     EntityReferenceImpl(DocumentImpl *doc);
0081     EntityReferenceImpl(DocumentImpl *doc, DOMStringImpl *_entityName);
0082     virtual ~EntityReferenceImpl();
0083 
0084     // DOM methods overridden from  parent classes
0085 
0086     DOMString nodeName() const override;
0087     unsigned short nodeType() const override;
0088     WTF::PassRefPtr<NodeImpl> cloneNode(bool deep) override;
0089 
0090     // Other methods (not part of DOM)
0091 
0092     bool childTypeAllowed(unsigned short type) override;
0093 
0094     DOMString toString() const override;
0095 protected:
0096     DOMStringImpl *m_entityName;
0097 };
0098 
0099 class NotationImpl : public NodeBaseImpl
0100 {
0101 public:
0102     NotationImpl(DocumentImpl *doc);
0103     NotationImpl(DocumentImpl *doc, DOMString _name, DOMString _publicId, DOMString _systemId);
0104     virtual ~NotationImpl();
0105 
0106     // DOM methods & attributes for Notation
0107 
0108     virtual DOMString publicId() const;
0109     virtual DOMString systemId() const;
0110 
0111     // DOM methods overridden from  parent classes
0112 
0113     DOMString nodeName() const override;
0114     unsigned short nodeType() const override;
0115     WTF::PassRefPtr<NodeImpl> cloneNode(bool deep) override;
0116 
0117     // Other methods (not part of DOM)
0118 
0119     bool childTypeAllowed(unsigned short type) override;
0120 protected:
0121     DOMStringImpl *m_name;
0122     DOMStringImpl *m_publicId;
0123     DOMStringImpl *m_systemId;
0124 };
0125 
0126 class ProcessingInstructionImpl : public NodeBaseImpl, private khtml::CachedObjectClient
0127 {
0128 public:
0129     ProcessingInstructionImpl(DocumentImpl *doc);
0130     ProcessingInstructionImpl(DocumentImpl *doc, DOMString _target, DOMString _data);
0131     virtual ~ProcessingInstructionImpl();
0132 
0133     // DOM methods & attributes for Notation
0134 
0135     virtual DOMString target() const;
0136     DOMString data() const
0137     {
0138         return m_data;
0139     }
0140     virtual void setData(const DOMString &_data, int &exceptioncode);
0141 
0142     // DOM methods overridden from  parent classes
0143 
0144     DOMString nodeName() const override;
0145     unsigned short nodeType() const override;
0146     DOMString nodeValue() const override;
0147     void setNodeValue(const DOMString &_nodeValue, int &exceptioncode) override;
0148     WTF::PassRefPtr<NodeImpl> cloneNode(bool deep) override;
0149 
0150     // Other methods (not part of DOM)
0151 
0152     virtual DOMString localHref() const;
0153     bool childTypeAllowed(unsigned short type) override;
0154     StyleSheetImpl *sheet() const;
0155     void checkStyleSheet();
0156     void setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheet, const DOM::DOMString &charset, const DOM::DOMString &mimetype) override;
0157     virtual void setStyleSheet(CSSStyleSheetImpl *sheet);
0158 
0159     DOMString toString() const override;
0160 
0161     bool offsetInCharacters() const override
0162     {
0163         return true;
0164     }
0165     int maxCharacterOffset() const override;
0166 
0167     bool isAlternate() const
0168     {
0169         return m_alternate;
0170     }
0171 protected:
0172     DOMStringImpl *m_target;
0173     DOMStringImpl *m_data;
0174     DOMStringImpl *m_localHref;
0175     DOMStringImpl *m_title;
0176     DOMStringImpl *m_media;
0177     bool m_alternate;
0178     khtml::CachedCSSStyleSheet *m_cachedSheet;
0179     CSSStyleSheetImpl *m_sheet;
0180 };
0181 
0182 class XMLAttributeReader : public QXmlDefaultHandler
0183 {
0184 public:
0185     XMLAttributeReader(const QString &_attrString);
0186     virtual ~XMLAttributeReader();
0187     QXmlAttributes readAttrs(bool &ok);
0188     bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts) override;
0189 
0190 protected:
0191     QXmlAttributes attrs;
0192     QString m_attrString;
0193 };
0194 
0195 } //namespace
0196 
0197 #endif