From 82d02b7b95908dec16e41c5af1c63579729c589b Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Thu, 7 Nov 2019 17:26:55 +0100 Subject: Deprecate SAX classes in Qt XML Deprecated the SAX classes and disabled or replaced their uses in tests if applicable. Removed the saxbookmarks example, no point in keeping examples for the deprecated code. [ChangeLog][QtXml] SAX classes are now deprecated. Use QXmlStreamReader, QXmlStreamWriter in QtCore instead. Task-number: QTBUG-76177 Change-Id: Ic171d62fa0527b0f36f94cf09a69586092269957 Reviewed-by: Friedemann Kleint Reviewed-by: Paul Wicking Reviewed-by: Kai Koehne --- tests/auto/xml/sax/qxml/tst_qxml.cpp | 7 ++++++- tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp | 8 ++++++++ tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp | 10 ++++++++-- tests/auto/xml/sax/qxmlsimplereader/parser/parser.h | 6 ++++++ tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp | 9 +++++++++ 5 files changed, 37 insertions(+), 3 deletions(-) (limited to 'tests/auto/xml/sax') diff --git a/tests/auto/xml/sax/qxml/tst_qxml.cpp b/tests/auto/xml/sax/qxml/tst_qxml.cpp index 1cdb9701fa..db6584edda 100644 --- a/tests/auto/xml/sax/qxml/tst_qxml.cpp +++ b/tests/auto/xml/sax/qxml/tst_qxml.cpp @@ -26,7 +26,6 @@ ** ****************************************************************************/ - #include #include @@ -38,13 +37,17 @@ class tst_QXml : public QObject Q_OBJECT private slots: +#if QT_DEPRECATED_SINCE(5, 15) void getSetCheck(); void interpretedAs0D() const; #ifndef QT_NO_EXCEPTIONS void exception(); #endif +#endif // QT_DEPRECATED_SINCE(5, 15) }; +#if QT_DEPRECATED_SINCE(5, 15) + class MyXmlEntityResolver : public QXmlEntityResolver { public: @@ -225,5 +228,7 @@ void tst_QXml::exception() } #endif +#endif // QT_DEPRECATED_SINCE(5, 15) + QTEST_MAIN(tst_QXml) #include "tst_qxml.moc" diff --git a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp index d40c8c2fd6..afdcc825d8 100644 --- a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp +++ b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp @@ -45,13 +45,18 @@ class tst_QXmlInputSource : public QObject { Q_OBJECT +#if QT_DEPRECATED_SINCE(5, 15) private slots: void reset() const; void resetSimplified() const; void waitForReadyIODevice() const; void inputFromSlowDevice() const; +#endif // QT_DEPRECATED_SINCE(5, 15) }; +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED /*! \internal \since 4.4 @@ -292,5 +297,8 @@ void tst_QXmlInputSource::inputFromSlowDevice() const QCOMPARE(data, expectedData); } +QT_WARNING_POP +#endif // QT_DEPRECATED_SINCE(5, 15) + QTEST_MAIN(tst_QXmlInputSource) #include "tst_qxmlinputsource.moc" diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp index 556603a681..44f8101955 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp @@ -26,12 +26,15 @@ ** ****************************************************************************/ +#include "parser.h" + +#if QT_DEPRECATED_SINCE(5, 15) #include #include -#include "parser.h" - +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED class ContentHandler : public QXmlDefaultHandler { public: @@ -440,3 +443,6 @@ QString Parser::errorMsg() const { return handler->errorMsg(); } + +QT_WARNING_POP +#endif // QT_DEPRECATED_SINCE(5, 15) diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h index 604678f06b..9c51cdf095 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h +++ b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h @@ -28,6 +28,10 @@ #ifndef PARSER_H #define PARSER_H +#include + +#if QT_DEPRECATED_SINCE(5, 15) + #include #include #include @@ -48,4 +52,6 @@ private: ContentHandler *handler; }; +#endif // QT_DEPRECATED_SINCE(5, 15) + #endif diff --git a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp index 8c4c6c7179..cea4e3c8b8 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp @@ -127,6 +127,7 @@ class tst_QXmlSimpleReader : public QObject { Q_OBJECT +#if QT_DEPRECATED_SINCE(5, 15) public: tst_QXmlSimpleReader(); ~tst_QXmlSimpleReader(); @@ -157,8 +158,13 @@ class tst_QXmlSimpleReader : public QObject static QDomDocument fromByteArray(const QString &title, const QByteArray &ba, bool *ok); XmlServer *server; QString prefix; +#endif // QT_DEPRECATED_SINCE(5, 15) }; +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + tst_QXmlSimpleReader::tst_QXmlSimpleReader() : server(new XmlServer(this)) { server->start(); @@ -820,5 +826,8 @@ void tst_QXmlSimpleReader::dtdRecursionLimit() } } +QT_WARNING_POP +#endif // QT_DEPRECATED_SINCE(5, 15) + QTEST_MAIN(tst_QXmlSimpleReader) #include "tst_qxmlsimplereader.moc" -- cgit v1.2.3