Warning, file /frameworks/khtml/src/dom/dom_xml.cpp 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 1999 Lars Knoll (knoll@kde.org)
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 #include "dom/dom_xml.h"
0024 #include "dom/dom_exception.h"
0025 #include "xml/dom_textimpl.h"
0026 #include "xml/dom_xmlimpl.h"
0027 
0028 using namespace DOM;
0029 
0030 CDATASection::CDATASection()
0031 {
0032 }
0033 
0034 CDATASection::CDATASection(const CDATASection &) : Text()
0035 {
0036 }
0037 
0038 CDATASection &CDATASection::operator = (const Node &other)
0039 {
0040     NodeImpl *ohandle = other.handle();
0041     if (impl != ohandle) {
0042         if (!ohandle || ohandle->nodeType() != CDATA_SECTION_NODE) {
0043             if (impl) {
0044                 impl->deref();
0045             }
0046             impl = nullptr;
0047         } else {
0048             Node::operator =(other);
0049         }
0050     }
0051     return *this;
0052 }
0053 
0054 CDATASection &CDATASection::operator = (const CDATASection &other)
0055 {
0056     Node::operator =(other);
0057     return *this;
0058 }
0059 
0060 CDATASection::~CDATASection()
0061 {
0062 }
0063 
0064 CDATASection::CDATASection(CDATASectionImpl *i) : Text(i)
0065 {
0066 }
0067 
0068 // ----------------------------------------------------------------------------
0069 Entity::Entity()
0070 {
0071 }
0072 
0073 Entity::Entity(const Entity &) : Node()
0074 {
0075 }
0076 
0077 Entity &Entity::operator = (const Node &other)
0078 {
0079     NodeImpl *ohandle = other.handle();
0080     if (impl != ohandle) {
0081         if (!ohandle || ohandle->nodeType() != ENTITY_NODE) {
0082             if (impl) {
0083                 impl->deref();
0084             }
0085             impl = nullptr;
0086         } else {
0087             Node::operator =(other);
0088         }
0089     }
0090     return *this;
0091 }
0092 
0093 Entity &Entity::operator = (const Entity &other)
0094 {
0095     Node::operator =(other);
0096     return *this;
0097 }
0098 
0099 Entity::~Entity()
0100 {
0101 }
0102 
0103 DOMString Entity::publicId() const
0104 {
0105     if (!impl) {
0106         return DOMString();    // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
0107     }
0108 
0109     return ((EntityImpl *)impl)->publicId();
0110 }
0111 
0112 DOMString Entity::systemId() const
0113 {
0114     if (!impl) {
0115         return DOMString();    // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
0116     }
0117 
0118     return ((EntityImpl *)impl)->systemId();
0119 }
0120 
0121 DOMString Entity::notationName() const
0122 {
0123     if (!impl) {
0124         return DOMString();    // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
0125     }
0126 
0127     return ((EntityImpl *)impl)->notationName();
0128 }
0129 
0130 Entity::Entity(EntityImpl *i) : Node(i)
0131 {
0132 }
0133 
0134 // ----------------------------------------------------------------------------
0135 
0136 EntityReference::EntityReference()
0137 {
0138 }
0139 
0140 EntityReference::EntityReference(const EntityReference &) : Node()
0141 {
0142 }
0143 
0144 EntityReference &EntityReference::operator = (const Node &other)
0145 {
0146     NodeImpl *ohandle = other.handle();
0147     if (impl != ohandle) {
0148         if (!ohandle || ohandle->nodeType() != ENTITY_REFERENCE_NODE) {
0149             if (impl) {
0150                 impl->deref();
0151             }
0152             impl = nullptr;
0153         } else {
0154             Node::operator =(other);
0155         }
0156     }
0157     return *this;
0158 }
0159 
0160 EntityReference &EntityReference::operator = (const EntityReference &other)
0161 {
0162     Node::operator =(other);
0163     return *this;
0164 }
0165 
0166 EntityReference::~EntityReference()
0167 {
0168 }
0169 
0170 EntityReference::EntityReference(EntityReferenceImpl *i) : Node(i)
0171 {
0172 }
0173 
0174 // ----------------------------------------------------------------------------
0175 
0176 Notation::Notation()
0177 {
0178 }
0179 
0180 Notation::Notation(const Notation &) : Node()
0181 {
0182 }
0183 
0184 Notation &Notation::operator = (const Node &other)
0185 {
0186     NodeImpl *ohandle = other.handle();
0187     if (impl != ohandle) {
0188         if (!ohandle || ohandle->nodeType() != NOTATION_NODE) {
0189             if (impl) {
0190                 impl->deref();
0191             }
0192             impl = nullptr;
0193         } else {
0194             Node::operator =(other);
0195         }
0196     }
0197     return *this;
0198 }
0199 
0200 Notation &Notation::operator = (const Notation &other)
0201 {
0202     Node::operator =(other);
0203     return *this;
0204 }
0205 
0206 Notation::~Notation()
0207 {
0208 }
0209 
0210 DOMString Notation::publicId() const
0211 {
0212     if (!impl) {
0213         return DOMString();    // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
0214     }
0215 
0216     return ((NotationImpl *)impl)->publicId();
0217 }
0218 
0219 DOMString Notation::systemId() const
0220 {
0221     if (!impl) {
0222         return DOMString();    // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
0223     }
0224 
0225     return ((NotationImpl *)impl)->systemId();
0226 }
0227 
0228 Notation::Notation(NotationImpl *i) : Node(i)
0229 {
0230 }
0231 
0232 // ----------------------------------------------------------------------------
0233 
0234 ProcessingInstruction::ProcessingInstruction()
0235 {
0236 }
0237 
0238 ProcessingInstruction::ProcessingInstruction(const ProcessingInstruction &)
0239     : Node()
0240 {
0241 }
0242 
0243 ProcessingInstruction &ProcessingInstruction::operator = (const Node &other)
0244 {
0245     NodeImpl *ohandle = other.handle();
0246     if (impl != ohandle) {
0247         if (!ohandle || ohandle->nodeType() != PROCESSING_INSTRUCTION_NODE) {
0248             if (impl) {
0249                 impl->deref();
0250             }
0251             impl = nullptr;
0252         } else {
0253             Node::operator =(other);
0254         }
0255     }
0256     return *this;
0257 }
0258 
0259 ProcessingInstruction &ProcessingInstruction::operator = (const ProcessingInstruction &other)
0260 {
0261     Node::operator =(other);
0262     return *this;
0263 }
0264 
0265 ProcessingInstruction::~ProcessingInstruction()
0266 {
0267 }
0268 
0269 DOMString ProcessingInstruction::target() const
0270 {
0271     if (!impl) {
0272         return DOMString();    // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
0273     }
0274 
0275     return ((ProcessingInstructionImpl *)impl)->target();
0276 }
0277 
0278 DOMString ProcessingInstruction::data() const
0279 {
0280     if (!impl) {
0281         return DOMString();    // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
0282     }
0283 
0284     return ((ProcessingInstructionImpl *)impl)->data();
0285 }
0286 
0287 void ProcessingInstruction::setData(const DOMString &_data)
0288 {
0289     if (!impl) {
0290         return;    // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
0291     }
0292 
0293     int exceptioncode = 0;
0294     ((ProcessingInstructionImpl *)impl)->setData(_data, exceptioncode);
0295     if (exceptioncode) {
0296         throw DOMException(exceptioncode);
0297     }
0298 }
0299 
0300 ProcessingInstruction::ProcessingInstruction(ProcessingInstructionImpl *i) : Node(i)
0301 {
0302 }
0303 
0304 StyleSheet ProcessingInstruction::sheet() const
0305 {
0306     if (impl) {
0307         return ((ProcessingInstructionImpl *)impl)->sheet();
0308     }
0309     return nullptr;
0310 }
0311