[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:52:15 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 02465c7a7e9f5dfc698341b62cc0df716355a598
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jul 22 22:26:11 2004 +0000
- remove a bunch of now-unused code
* ForwardingHeaders/qxml.h: Removed.
* kwq/KWQXmlAttributes.h: Removed.
* kwq/KWQXmlAttributes.mm: Removed.
* kwq/KWQXmlDefaultHandler.h: Removed.
* kwq/KWQXmlDefaultHandler.mm: Removed.
* kwq/KWQXmlSimpleReader.h: Removed.
* kwq/KWQXmlSimpleReader.mm: Removed.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@7099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 072cc0c..2932d74 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,17 @@
2004-07-22 Darin Adler <darin at apple.com>
+ - remove a bunch of now-unused code
+
+ * ForwardingHeaders/qxml.h: Removed.
+ * kwq/KWQXmlAttributes.h: Removed.
+ * kwq/KWQXmlAttributes.mm: Removed.
+ * kwq/KWQXmlDefaultHandler.h: Removed.
+ * kwq/KWQXmlDefaultHandler.mm: Removed.
+ * kwq/KWQXmlSimpleReader.h: Removed.
+ * kwq/KWQXmlSimpleReader.mm: Removed.
+
+2004-07-22 Darin Adler <darin at apple.com>
+
Reviewed by Dave.
- got rid of QXml classes and changed XML parsing to use libxml directly
@@ -580,7 +592,6 @@
* layout-tests/editing/deleting/delete-image-004-expected.txt:
* layout-tests/editing/selection/extend-by-character-006-expected.txt:
-
2004-07-09 Chris Blumenberg <cblu at apple.com>
Allowed my change for 3715785 to compile on Jaguar.
diff --git a/WebCore/ForwardingHeaders/qxml.h b/WebCore/ForwardingHeaders/qxml.h
deleted file mode 100644
index 9178076..0000000
--- a/WebCore/ForwardingHeaders/qxml.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "KWQXmlAttributes.h"
-#include "KWQXmlDefaultHandler.h"
diff --git a/WebCore/kwq/KWQXmlAttributes.h b/WebCore/kwq/KWQXmlAttributes.h
deleted file mode 100644
index de85cf0..0000000
--- a/WebCore/kwq/KWQXmlAttributes.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KWQXMLATTRIBUTES_H
-#define KWQXMLATTRIBUTES_H
-
-#include "KWQString.h"
-
-struct KWQXmlNamespace;
-
-class QXmlAttributes {
-public:
- QXmlAttributes() : _ref(0), _length(0), _names(0), _values(0), _uris(0) { }
- QXmlAttributes(const char **expatStyleAttributes);
- ~QXmlAttributes();
-
- QXmlAttributes(const QXmlAttributes &);
- QXmlAttributes &operator=(const QXmlAttributes &);
-
- int length() const { return _length; }
- QString qName(int index) const { return _names[index]; }
- QString localName(int index) const;
- QString uri(int index) const { if (!_uris) return QString::null; return _uris[index]; }
- QString value(int index) const { return _values[index]; }
-
- QString value(const QString &) const;
-
- void split(KWQXmlNamespace* ns);
-
-private:
- mutable int *_ref;
- int _length;
- QString *_names;
- QString *_values;
- QString *_uris;
-};
-
-#endif
diff --git a/WebCore/kwq/KWQXmlAttributes.mm b/WebCore/kwq/KWQXmlAttributes.mm
deleted file mode 100644
index 975b0ba..0000000
--- a/WebCore/kwq/KWQXmlAttributes.mm
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "KWQXmlAttributes.h"
-#include "KWQXmlSimpleReader.h"
-
-#include "KWQAssertions.h"
-
-QXmlAttributes::QXmlAttributes(const char **saxStyleAttributes)
- : _ref(0), _uris(0)
-{
- int length = 0;
- if (saxStyleAttributes) {
- for (const char **p = saxStyleAttributes; *p; p += 2) {
- ASSERT(p[1]);
- ++length;
- }
- }
-
- _length = length;
- if (!length) {
- _names = 0;
- _values = 0;
- _uris = 0;
- } else {
- _names = new QString [length];
- _values = new QString [length];
- }
-
- if (saxStyleAttributes) {
- int i = 0;
- for (const char **p = saxStyleAttributes; *p; p += 2) {
- _names[i] = QString::fromUtf8(p[0]);
- _values[i] = QString::fromUtf8(p[1]);
- ++i;
- }
- }
-}
-
-QXmlAttributes::~QXmlAttributes()
-{
- if (_ref && !--*_ref) {
- delete _ref;
- _ref = 0;
- }
- if (!_ref) {
- delete [] _names;
- delete [] _values;
- delete [] _uris;
- }
-}
-
-QXmlAttributes::QXmlAttributes(const QXmlAttributes &other)
- : _ref(other._ref)
- , _length(other._length)
- , _names(other._names)
- , _values(other._values)
- , _uris(other._uris)
-{
- if (!_ref) {
- _ref = new int (2);
- other._ref = _ref;
- } else {
- ++*_ref;
- }
-}
-
-QXmlAttributes &QXmlAttributes::operator=(const QXmlAttributes &other)
-{
- if (_ref && !--*_ref) {
- delete _ref;
- _ref = 0;
- }
- if (!_ref) {
- delete [] _names;
- delete [] _values;
- delete [] _uris;
- }
-
- _ref = other._ref;
- _length = other._length;
- _names = other._names;
- _values = other._values;
- _uris = other._uris;
-
- if (!_ref) {
- _ref = new int (2);
- other._ref = _ref;
- } else {
- ++*_ref;
- }
-
- return *this;
-}
-
-QString QXmlAttributes::localName(int index) const
-{
- int colonPos = _names[index].find(':');
- if (colonPos != -1)
- // Peel off the prefix to return the localName.
- return _names[index].right(_names[index].length() - colonPos - 1);
- return _names[index];
-}
-
-QString QXmlAttributes::value(const QString &name) const
-{
- for (int i = 0; i != _length; ++i) {
- if (name == _names[i]) {
- return _values[i];
- }
- }
- return QString::null;
-}
-
-void QXmlAttributes::split(KWQXmlNamespace* ns)
-{
- for (int i = 0; i < _length; ++i) {
- int colonPos = _names[i].find(':');
- if (colonPos != -1) {
- QString prefix = _names[i].left(colonPos);
- QString uri;
- if (prefix == "xmlns") {
- // FIXME: The URI is the xmlns namespace? I seem to recall DOM lvl 3 saying something about this.
- }
- else
- uri = ns->uriForPrefix(prefix);
-
- if (!uri.isEmpty()) {
- if (!_uris)
- _uris = new QString[_length];
- _uris[i] = uri;
- }
- }
- }
-}
diff --git a/WebCore/kwq/KWQXmlDefaultHandler.h b/WebCore/kwq/KWQXmlDefaultHandler.h
deleted file mode 100644
index 0e7f1e0..0000000
--- a/WebCore/kwq/KWQXmlDefaultHandler.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KWQXMLDEFAULTHANDLER_H
-#define KWQXMLDEFAULTHANDLER_H
-
-#include "KWQXmlSimpleReader.h"
-
-class QXmlDefaultHandler :
- public QXmlContentHandler,
- public QXmlLexicalHandler,
- public QXmlErrorHandler,
- public QXmlDeclHandler,
- public QXmlDTDHandler
-{
- virtual bool startDocument();
- virtual bool endDocument();
- virtual bool startPrefixMapping(const QString &prefix, const QString &URI);
- virtual bool endPrefixMapping(const QString &prefix);
- virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes);
- virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName);
- virtual bool characters(const QString &characters);
- virtual bool ignorableWhitespace(const QString &characters);
- virtual bool processingInstruction(const QString &target, const QString &data);
- virtual bool skippedEntity(const QString &name);
-
- virtual bool startDTD(const QString &name, const QString &publicId, const QString &systemId);
- virtual bool endDTD();
- virtual bool startEntity(const QString &name);
- virtual bool endEntity(const QString &name);
- virtual bool startCDATA();
- virtual bool endCDATA();
- virtual bool comment(const QString &characters);
-
- virtual bool warning(const QXmlParseException &exception);
- virtual bool error(const QXmlParseException &exception);
- virtual bool fatalError(const QXmlParseException &exception);
-
- virtual bool attributeDecl(const QString &entityName, const QString &attributeName, const QString &type, const QString &valueDefault, const QString &value);
- virtual bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId);
- virtual bool internalEntityDecl(const QString &name, const QString &value);
-
- virtual bool notationDecl(const QString& name, const QString& publicId, const QString& systemId);
- virtual bool unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName);
-
- virtual QString errorString();
-};
-
-#endif
diff --git a/WebCore/kwq/KWQXmlDefaultHandler.mm b/WebCore/kwq/KWQXmlDefaultHandler.mm
deleted file mode 100644
index 156ae92..0000000
--- a/WebCore/kwq/KWQXmlDefaultHandler.mm
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "KWQXmlDefaultHandler.h"
-
-bool QXmlDefaultHandler::startDocument()
-{
- return true;
-}
-
-bool QXmlDefaultHandler::endDocument()
-{
- return true;
-}
-
-bool QXmlDefaultHandler::startPrefixMapping(const QString &prefix, const QString &URI)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::endPrefixMapping(const QString &prefix)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::characters(const QString &characters)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::ignorableWhitespace(const QString &characters)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::processingInstruction(const QString &target, const QString &data)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::skippedEntity(const QString &name)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::startDTD(const QString &name, const QString &publicId, const QString &systemId)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::endDTD()
-{
- return true;
-}
-
-bool QXmlDefaultHandler::startEntity(const QString &name)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::endEntity(const QString &name)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::startCDATA()
-{
- return true;
-}
-
-bool QXmlDefaultHandler::endCDATA()
-{
- return true;
-}
-
-bool QXmlDefaultHandler::comment(const QString &characters)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::warning(const QXmlParseException &exception)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::error(const QXmlParseException &exception)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::fatalError(const QXmlParseException &exception)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::attributeDecl(const QString &entityName, const QString &attributeName, const QString &type, const QString &valueDefault, const QString &value)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::internalEntityDecl(const QString &name, const QString &value)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::notationDecl(const QString& name, const QString& publicId, const QString& systemId)
-{
- return true;
-}
-
-bool QXmlDefaultHandler::unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName)
-{
- return true;
-}
-
-QString QXmlDefaultHandler::errorString()
-{
- return QString::null;
-}
diff --git a/WebCore/kwq/KWQXmlSimpleReader.h b/WebCore/kwq/KWQXmlSimpleReader.h
deleted file mode 100644
index 644badd..0000000
--- a/WebCore/kwq/KWQXmlSimpleReader.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KWQXMLSIMPLEREADER_H
-#define KWQXMLSIMPLEREADER_H
-
-#include "KWQString.h"
-#include "KWQPtrStack.h"
-
-struct KWQXmlNamespace {
- QString m_prefix;
- QString m_uri;
- KWQXmlNamespace* m_parent;
-
- int m_ref;
-
- KWQXmlNamespace() :m_parent(0), m_ref(0) {}
-
- KWQXmlNamespace(const QString& p, const QString& u, KWQXmlNamespace* parent)
- :m_prefix(p),
- m_uri(u),
- m_parent(parent),
- m_ref(0)
- {
- if (m_parent) m_parent->ref();
- }
-
- QString uriForPrefix(const QString& prefix) {
- if (prefix == m_prefix)
- return m_uri;
- if (m_parent)
- return m_parent->uriForPrefix(prefix);
- return "";
- }
-
- void ref() { m_ref++; }
- void deref() { if (--m_ref == 0) { if (m_parent) m_parent->deref(); delete this; } }
-};
-
-class QXmlAttributes;
-
-class QXmlInputSource {
-public:
- void setData(const QString &data) { _data = data; }
- QString data() const { return _data; }
-private:
- QString _data;
-};
-
-class QXmlParseException {
-public:
- QXmlParseException(const QString &m, int c, int l) : m_message(m), m_column(c), m_line(l) { }
- QString message() const { return m_message; }
- int columnNumber() const { return m_column; }
- int lineNumber() const { return m_line; }
-private:
- QString m_message;
- int m_column;
- int m_line;
-};
-
-class QXmlContentHandler {
-public:
- virtual bool startDocument() = 0;
- virtual bool endDocument() = 0;
- virtual bool startPrefixMapping(const QString &prefix, const QString &URI) = 0;
- virtual bool endPrefixMapping(const QString &prefix) = 0;
- virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes) = 0;
- virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName) = 0;
- virtual bool characters(const QString &characters) = 0;
- virtual bool ignorableWhitespace(const QString &characters) = 0;
- virtual bool processingInstruction(const QString &target, const QString &data) = 0;
- virtual bool skippedEntity(const QString &name) = 0;
- virtual QString errorString() = 0;
-};
-
-class QXmlLexicalHandler {
-public:
- virtual bool startDTD(const QString &name, const QString &publicId, const QString &systemId) = 0;
- virtual bool endDTD() = 0;
- virtual bool startEntity(const QString &name) = 0;
- virtual bool endEntity(const QString &name) = 0;
- virtual bool startCDATA() = 0;
- virtual bool endCDATA() = 0;
- virtual bool comment(const QString &characters) = 0;
- virtual QString errorString() = 0;
-};
-
-class QXmlErrorHandler {
-public:
- virtual bool warning(const QXmlParseException &exception) = 0;
- virtual bool error(const QXmlParseException &exception) = 0;
- virtual bool fatalError(const QXmlParseException &exception) = 0;
- virtual QString errorString() = 0;
-};
-
-class QXmlDeclHandler {
-public:
- virtual bool attributeDecl(const QString &entityName, const QString &attributeName, const QString &type, const QString &valueDefault, const QString &value) = 0;
- virtual bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId) = 0;
- virtual bool internalEntityDecl(const QString &name, const QString &value) = 0;
-};
-
-class QXmlDTDHandler {
-public:
- virtual bool notationDecl(const QString& name, const QString& publicId, const QString& systemId) = 0;
- virtual bool unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName) = 0;
- virtual QString errorString() = 0;
-};
-
-class QXmlSimpleReader {
-public:
- QXmlSimpleReader();
-
- void setContentHandler(QXmlContentHandler *handler) { _contentHandler = handler; }
- void setDeclHandler(QXmlDeclHandler *handler) { _declarationHandler= handler; }
- void setDTDHandler(QXmlDTDHandler *handler) { _DTDHandler = handler; }
- void setErrorHandler(QXmlErrorHandler *handler) { _errorHandler = handler; }
- void setLexicalHandler(QXmlLexicalHandler *handler) { _lexicalHandler = handler; }
-
- QXmlContentHandler *contentHandler() const { return _contentHandler; }
- QXmlErrorHandler *errorHandler() const { return _errorHandler; }
- QXmlLexicalHandler *lexicalHandler() const { return _lexicalHandler; }
-
- bool parse(const QXmlInputSource &input);
-
- KWQXmlNamespace* pushNamespaces(QXmlAttributes& attributes);
- KWQXmlNamespace* popNamespaces();
- KWQXmlNamespace* xmlNamespace() { return m_namespaceStack.current(); }
-
- bool parserStopped() const { return m_parserStopped; }
- void stopParsing();
-
- bool sawError() const { return m_sawError; }
- void recordError() { m_sawError = true; }
-
- int lineNumber() const;
- int columnNumber() const;
-
-private:
- QXmlContentHandler *_contentHandler;
- QXmlDeclHandler *_declarationHandler;
- QXmlDTDHandler *_DTDHandler;
- QXmlErrorHandler *_errorHandler;
- QXmlLexicalHandler *_lexicalHandler;
- QPtrStack<KWQXmlNamespace> m_namespaceStack;
- struct _xmlParserCtxt *m_context;
- bool m_parserStopped : 1;
- bool m_sawError : 1;
-};
-
-#endif
diff --git a/WebCore/kwq/KWQXmlSimpleReader.mm b/WebCore/kwq/KWQXmlSimpleReader.mm
deleted file mode 100644
index 088c1b4..0000000
--- a/WebCore/kwq/KWQXmlSimpleReader.mm
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "KWQXmlSimpleReader.h"
-
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
-
-#include "KWQAssertions.h"
-#include "KWQXmlAttributes.h"
-
-static void startElementHandler(void *userData, const xmlChar *name, const xmlChar **libxmlAttributes)
-{
- QXmlSimpleReader *reader = static_cast<QXmlSimpleReader *>(userData);
-
- if (reader->parserStopped()) {
- return;
- }
-
- QXmlAttributes attributes(reinterpret_cast<const char **>(libxmlAttributes));
- KWQXmlNamespace* ns = reader->pushNamespaces(attributes);
- attributes.split(ns);
-
- QString qName = QString::fromUtf8(reinterpret_cast<const char *>(name));
- QString localName;
- QString uri;
- QString prefix;
- int colonPos = qName.find(':');
- if (colonPos != -1) {
- localName = qName.right(qName.length() - colonPos - 1);
- prefix = qName.left(colonPos);
- }
- else
- localName = qName;
- uri = reader->xmlNamespace()->uriForPrefix(prefix);
-
- // We pass in the namespace of the element, and then the name both with and without
- // the namespace prefix.
- reader->contentHandler()->startElement(uri, localName, qName, attributes);
-}
-
-static void endElementHandler(void *userData, const xmlChar *name)
-{
- QXmlSimpleReader *reader = static_cast<QXmlSimpleReader *>(userData);
- if (reader->parserStopped()) {
- return;
- }
- QString qName = QString::fromUtf8(reinterpret_cast<const char *>(name));
- QString localName;
- QString uri;
- QString prefix;
- int colonPos = qName.find(':');
- if (colonPos != -1) {
- localName = qName.right(qName.length() - colonPos - 1);
- prefix = qName.left(colonPos);
- }
- else
- localName = qName;
- uri = reader->xmlNamespace()->uriForPrefix(prefix);
-
- KWQXmlNamespace* ns = reader->popNamespaces();
- if (ns)
- ns->deref();
-
- reader->contentHandler()->endElement(uri, localName, qName);
-}
-
-static void charactersHandler(void *userData, const xmlChar *s, int len)
-{
- QXmlSimpleReader *reader = static_cast<QXmlSimpleReader *>(userData);
- if (reader->parserStopped()) {
- return;
- }
- reader->contentHandler()->characters(QString::fromUtf8(reinterpret_cast<const char *>(s), len));
-}
-
-static void processingInstructionHandler(void *userData, const xmlChar *target, const xmlChar *data)
-{
- QXmlSimpleReader *reader = static_cast<QXmlSimpleReader *>(userData);
- if (reader->parserStopped()) {
- return;
- }
- reader->contentHandler()->processingInstruction(
- QString::fromUtf8(reinterpret_cast<const char *>(target)),
- QString::fromUtf8(reinterpret_cast<const char *>(data)));
-}
-
-static void cdataBlockHandler(void *userData, const xmlChar *s, int len)
-{
- QXmlSimpleReader *reader = static_cast<QXmlSimpleReader *>(userData);
- if (reader->parserStopped()) {
- return;
- }
- reader->lexicalHandler()->startCDATA();
- reader->contentHandler()->characters(QString::fromUtf8(reinterpret_cast<const char *>(s), len));
- reader->lexicalHandler()->endCDATA();
-}
-
-static void commentHandler(void *userData, const xmlChar *comment)
-{
- QXmlSimpleReader *reader = static_cast<QXmlSimpleReader *>(userData);
- reader->lexicalHandler()->comment(QString::fromUtf8(reinterpret_cast<const char *>(comment)));
-}
-
-static void warningHandler(void *userData, const char *message, ...)
-{
- QXmlSimpleReader *reader = static_cast<QXmlSimpleReader *>(userData);
- if (reader->parserStopped()) {
- return;
- }
- if (reader->errorHandler()) {
- char *m;
- va_list args;
- va_start(args, message);
- vasprintf(&m, message, args);
- va_end(args);
- if (!reader->errorHandler()->warning(QXmlParseException(m, reader->columnNumber(), reader->lineNumber()))) {
- reader->stopParsing();
- }
- free(m);
- }
-}
-
-static void fatalErrorHandler(void *userData, const char *message, ...)
-{
- QXmlSimpleReader *reader = static_cast<QXmlSimpleReader *>(userData);
- if (reader->parserStopped()) {
- return;
- }
- if (!reader->errorHandler()) {
- reader->stopParsing();
- } else {
- char *m;
- va_list args;
- va_start(args, message);
- vasprintf(&m, message, args);
- va_end(args);
- if (!reader->errorHandler()->fatalError(QXmlParseException(m, reader->columnNumber(), reader->lineNumber()))) {
- reader->stopParsing();
- }
- reader->recordError();
- free(m);
- }
-}
-
-static void normalErrorHandler(void *userData, const char *message, ...)
-{
- QXmlSimpleReader *reader = static_cast<QXmlSimpleReader *>(userData);
- if (reader->parserStopped()) {
- return;
- }
- if (!reader->errorHandler()) {
- reader->stopParsing();
- } else {
- char *m;
- va_list args;
- va_start(args, message);
- vasprintf(&m, message, args);
- va_end(args);
- if (!reader->errorHandler()->error(QXmlParseException(m, reader->columnNumber(), reader->lineNumber()))) {
- reader->stopParsing();
- }
- reader->recordError();
- free(m);
- }
-}
-
-QXmlSimpleReader::QXmlSimpleReader()
- : _contentHandler(0)
- , _declarationHandler(0)
- , _DTDHandler(0)
- , _errorHandler(0)
- , _lexicalHandler(0)
-{
-}
-
-KWQXmlNamespace* QXmlSimpleReader::pushNamespaces(QXmlAttributes& attrs)
-{
- KWQXmlNamespace* ns = m_namespaceStack.current();
- if (!ns)
- ns = new KWQXmlNamespace();
-
- // Search for any xmlns attributes.
- for (int i = 0; i < attrs.length(); i++) {
- QString qName = attrs.qName(i);
- if (qName == "xmlns")
- ns = new KWQXmlNamespace(QString::null, attrs.value(i), ns);
- else if (qName.startsWith("xmlns:"))
- ns = new KWQXmlNamespace(qName.right(qName.length()-6), attrs.value(i), ns);
- }
-
- m_namespaceStack.push(ns);
- ns->ref();
- return ns;
-}
-
-KWQXmlNamespace* QXmlSimpleReader::popNamespaces()
-{
- return m_namespaceStack.pop();
-}
-
-bool QXmlSimpleReader::parse(const QXmlInputSource &input)
-{
- if (_contentHandler && !_contentHandler->startDocument()) {
- return false;
- }
-
- static bool didInit = false;
- if (!didInit) {
- xmlInitParser();
- didInit = true;
- }
- xmlSAXHandler handler;
- memset(&handler, 0, sizeof(handler));
- handler.error = normalErrorHandler;
- handler.fatalError = fatalErrorHandler;
- if (_contentHandler) {
- handler.characters = charactersHandler;
- handler.endElement = endElementHandler;
- handler.processingInstruction = processingInstructionHandler;
- handler.startElement = startElementHandler;
- }
- if (_lexicalHandler) {
- handler.cdataBlock = cdataBlockHandler;
- handler.comment = commentHandler;
- }
- if (_errorHandler) {
- handler.warning = warningHandler;
- }
- m_parserStopped = false;
- m_sawError = false;
- m_context = xmlCreatePushParserCtxt(&handler, this, NULL, 0, NULL);
- const QChar BOM(0xFEFF);
- const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char *>(&BOM);
- xmlSwitchEncoding(m_context, BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE);
- xmlParseChunk(m_context,
- reinterpret_cast<const char *>(input.data().unicode()),
- input.data().length() * sizeof(QChar), 1);
- xmlFreeParserCtxt(m_context);
- m_context = NULL;
- return !m_sawError;
-}
-
-void QXmlSimpleReader::stopParsing()
-{
- xmlStopParser(m_context);
- m_parserStopped = true;
-}
-
-int QXmlSimpleReader::lineNumber() const
-{
- return m_context->input->line;
-}
-
-int QXmlSimpleReader::columnNumber() const
-{
- return m_context->input->col;
-}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list