Convert remaining QT_NO_XMLSTREAM* to use feature system
Replace the check in qxmlstream.h with a QT_REQUIRE_CONFIG since the code that includes this header does no checking, whether on the define or the feature, so is better off getting told about the missing feature at the point of include than complaining about an undefined type despite its header being overtly included. For the rest, just do the usual transformation to QT_CONFIG(), flipping the ones that were #ifdef rather than #ifndef, so the condition is positive. Shifted a couple of open-braces of classes to the next line, where they belong, in the process. Change-Id: If9c496082f0489b0f9f4070364cbf840e603fce1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
526ce669ed
commit
7337474d04
@ -208,9 +208,6 @@ qt_internal_add_module(Core
|
||||
serialization/qjsonvalue.cpp serialization/qjsonvalue.h
|
||||
serialization/qjsonwriter.cpp serialization/qjsonwriter_p.h
|
||||
serialization/qtextstream.cpp serialization/qtextstream.h serialization/qtextstream_p.h
|
||||
serialization/qxmlstream.cpp serialization/qxmlstream.h serialization/qxmlstream_p.h
|
||||
serialization/qxmlstreamgrammar.cpp serialization/qxmlstreamgrammar_p.h
|
||||
serialization/qxmlstreamparser_p.h
|
||||
serialization/qxmlutils.cpp serialization/qxmlutils_p.h
|
||||
text/qanystringview.h
|
||||
text/qbytearray.cpp text/qbytearray.h text/qbytearray_p.h
|
||||
@ -480,6 +477,13 @@ qt_internal_extend_target(Core CONDITION FREEBSD
|
||||
"LINKER:--warn-unresolved-symbols"
|
||||
)
|
||||
|
||||
qt_internal_extend_target(Core CONDITION QT_FEATURE_xmlstream
|
||||
SOURCES
|
||||
serialization/qxmlstream.cpp serialization/qxmlstream.h serialization/qxmlstream_p.h
|
||||
serialization/qxmlstreamgrammar.cpp serialization/qxmlstreamgrammar_p.h
|
||||
serialization/qxmlstreamparser_p.h
|
||||
)
|
||||
|
||||
qt_internal_extend_target(Core CONDITION QT_FEATURE_animation
|
||||
SOURCES
|
||||
animation/qabstractanimation.cpp animation/qabstractanimation.h animation/qabstractanimation_p.h
|
||||
|
@ -770,21 +770,18 @@ qt_feature("cpp-winrt" PRIVATE PUBLIC
|
||||
AUTODETECT WIN32
|
||||
CONDITION WIN32 AND TEST_cpp_winrt
|
||||
)
|
||||
qt_feature_definition("xmlstream" "QT_NO_XMLSTREAM" NEGATE VALUE "1")
|
||||
qt_feature("xmlstreamreader" PUBLIC
|
||||
SECTION "Kernel"
|
||||
LABEL "QXmlStreamReader"
|
||||
PURPOSE "Provides a well-formed XML parser with a simple streaming API."
|
||||
CONDITION QT_FEATURE_xmlstream
|
||||
)
|
||||
qt_feature_definition("xmlstreamreader" "QT_NO_XMLSTREAMREADER" NEGATE VALUE "1")
|
||||
qt_feature("xmlstreamwriter" PUBLIC
|
||||
SECTION "Kernel"
|
||||
LABEL "QXmlStreamWriter"
|
||||
PURPOSE "Provides a XML writer with a simple streaming API."
|
||||
CONDITION QT_FEATURE_xmlstream
|
||||
)
|
||||
qt_feature_definition("xmlstreamwriter" "QT_NO_XMLSTREAMWRITER" NEGATE VALUE "1")
|
||||
qt_feature("textdate" PUBLIC
|
||||
SECTION "Data structures"
|
||||
LABEL "Text Date"
|
||||
|
@ -482,11 +482,7 @@ void QMimeBinaryProvider::addAllMimeTypes(QList<QMimeType> &result)
|
||||
|
||||
bool QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data)
|
||||
{
|
||||
#ifdef QT_NO_XMLSTREAMREADER
|
||||
Q_UNUSED(data);
|
||||
qWarning("Cannot load mime type since QXmlStreamReader is not available.");
|
||||
return false;
|
||||
#else
|
||||
#if QT_CONFIG(xmlstreamreader)
|
||||
if (data.loaded)
|
||||
return true;
|
||||
|
||||
@ -557,7 +553,11 @@ bool QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data)
|
||||
data.localeComments = e.localeComments;
|
||||
data.globPatterns = e.globPatterns;
|
||||
return true;
|
||||
#endif //QT_NO_XMLSTREAMREADER
|
||||
#else
|
||||
Q_UNUSED(data);
|
||||
qWarning("Cannot load mime type since QXmlStreamReader is not available.");
|
||||
return false;
|
||||
#endif // feature xmlstreamreader
|
||||
}
|
||||
|
||||
// Binary search in the icons or generic-icons list
|
||||
|
@ -139,7 +139,7 @@ bool QMimeTypeParserBase::parseNumber(QStringView n, int *target, QString *error
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMREADER
|
||||
#if QT_CONFIG(xmlstreamreader)
|
||||
struct CreateMagicMatchRuleResult
|
||||
{
|
||||
QString errorMessage; // must be first
|
||||
@ -160,16 +160,11 @@ static CreateMagicMatchRuleResult createMagicMatchRule(const QXmlStreamAttribute
|
||||
const auto mask = atts.value(QLatin1StringView(matchMaskAttributeC));
|
||||
return CreateMagicMatchRuleResult(type, value, offsets, mask);
|
||||
}
|
||||
#endif
|
||||
#endif // feature xmlstreamreader
|
||||
|
||||
bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString *errorMessage)
|
||||
{
|
||||
#ifdef QT_NO_XMLSTREAMREADER
|
||||
Q_UNUSED(dev);
|
||||
if (errorMessage)
|
||||
*errorMessage = QString::fromLatin1("QXmlStreamReader is not available, cannot parse '%1'.").arg(fileName);
|
||||
return false;
|
||||
#else
|
||||
#if QT_CONFIG(xmlstreamreader)
|
||||
QMimeTypePrivate data;
|
||||
data.loaded = true;
|
||||
int priority = 50;
|
||||
@ -311,7 +306,12 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
|
||||
}
|
||||
|
||||
return true;
|
||||
#endif //QT_NO_XMLSTREAMREADER
|
||||
#else
|
||||
Q_UNUSED(dev);
|
||||
if (errorMessage)
|
||||
*errorMessage = "QXmlStreamReader is not available, cannot parse '%1'."_L1.arg(fileName);
|
||||
return false;
|
||||
#endif // feature xmlstreamreader
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "QtCore/qxmlstream.h"
|
||||
|
||||
#ifndef QT_NO_XMLSTREAM
|
||||
#if QT_CONFIG(xmlstream)
|
||||
|
||||
#include "qxmlutils_p.h"
|
||||
#include <qdebug.h>
|
||||
@ -232,7 +232,7 @@ QString QXmlStreamEntityResolver::resolveUndeclaredEntity(const QString &/*name*
|
||||
return QString();
|
||||
}
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMREADER
|
||||
#if QT_CONFIG(xmlstreamreader)
|
||||
|
||||
QString QXmlStreamReaderPrivate::resolveUndeclaredEntity(const QString &name)
|
||||
{
|
||||
@ -777,7 +777,7 @@ QString QXmlStreamReader::tokenString() const
|
||||
return QLatin1StringView(QXmlStreamReader_tokenTypeString.at(d->type));
|
||||
}
|
||||
|
||||
#endif // QT_NO_XMLSTREAMREADER
|
||||
#endif // feature xmlstreamreader
|
||||
|
||||
QXmlStreamPrivateTagStack::QXmlStreamPrivateTagStack()
|
||||
{
|
||||
@ -791,7 +791,7 @@ QXmlStreamPrivateTagStack::QXmlStreamPrivateTagStack()
|
||||
tagsDone = false;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMREADER
|
||||
#if QT_CONFIG(xmlstreamreader)
|
||||
|
||||
QXmlStreamReaderPrivate::QXmlStreamReaderPrivate(QXmlStreamReader *q)
|
||||
:q_ptr(q)
|
||||
@ -2272,7 +2272,7 @@ QXmlStreamAttributes QXmlStreamReader::attributes() const
|
||||
return d->attributes;
|
||||
}
|
||||
|
||||
#endif // QT_NO_XMLSTREAMREADER
|
||||
#endif // feature xmlstreamreader
|
||||
|
||||
/*!
|
||||
\class QXmlStreamAttribute
|
||||
@ -2631,7 +2631,7 @@ void QXmlStreamAttributes::append(const QString &qualifiedName, const QString &v
|
||||
append(QXmlStreamAttribute(qualifiedName, value));
|
||||
}
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMREADER
|
||||
#if QT_CONFIG(xmlstreamreader)
|
||||
|
||||
/*! \fn bool QXmlStreamReader::isStartDocument() const
|
||||
Returns \c true if tokenType() equals \l StartDocument; otherwise returns \c false.
|
||||
@ -2747,7 +2747,7 @@ QStringView QXmlStreamReader::documentEncoding() const
|
||||
return QStringView();
|
||||
}
|
||||
|
||||
#endif // QT_NO_XMLSTREAMREADER
|
||||
#endif // feature xmlstreamreader
|
||||
|
||||
/*!
|
||||
\class QXmlStreamWriter
|
||||
@ -2824,9 +2824,10 @@ QStringView QXmlStreamReader::documentEncoding() const
|
||||
|
||||
*/
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMWRITER
|
||||
#if QT_CONFIG(xmlstreamwriter)
|
||||
|
||||
class QXmlStreamWriterPrivate : public QXmlStreamPrivateTagStack {
|
||||
class QXmlStreamWriterPrivate : public QXmlStreamPrivateTagStack
|
||||
{
|
||||
QXmlStreamWriter *q_ptr;
|
||||
Q_DECLARE_PUBLIC(QXmlStreamWriter)
|
||||
public:
|
||||
@ -3746,7 +3747,7 @@ void QXmlStreamWriterPrivate::writeStartElement(QAnyStringView namespaceUri, QAn
|
||||
tag.namespaceDeclarationsSize = lastNamespaceDeclaration;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMREADER
|
||||
#if QT_CONFIG(xmlstreamreader)
|
||||
/*! Writes the current state of the \a reader. All possible valid
|
||||
states are supported.
|
||||
|
||||
@ -3827,9 +3828,9 @@ void QXmlStreamWriter::writeCurrentToken(const QXmlStreamReader &reader)
|
||||
otherwise returns \c false.
|
||||
*/
|
||||
|
||||
#endif // QT_NO_XMLSTREAMREADER
|
||||
#endif // QT_NO_XMLSTREAMWRITER
|
||||
#endif // feature xmlstreamreader
|
||||
#endif // feature xmlstreamwriter
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_XMLSTREAM
|
||||
#endif // feature xmlstream
|
||||
|
@ -149,7 +149,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMREADER
|
||||
#if QT_CONFIG(xmlstreamreader)
|
||||
|
||||
bool QXmlStreamReaderPrivate::parse()
|
||||
{
|
||||
@ -1478,7 +1478,7 @@ nmtoken ::= COLON;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // feature xmlstreamreader
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QtCore/qiodevice.h>
|
||||
|
||||
#ifndef QT_NO_XMLSTREAM
|
||||
QT_REQUIRE_CONFIG(xmlstream);
|
||||
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtCore/qscopedpointer.h>
|
||||
@ -176,8 +176,9 @@ public:
|
||||
virtual QString resolveUndeclaredEntity(const QString &name);
|
||||
};
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMREADER
|
||||
class Q_CORE_EXPORT QXmlStreamReader {
|
||||
#if QT_CONFIG(xmlstreamreader)
|
||||
class Q_CORE_EXPORT QXmlStreamReader
|
||||
{
|
||||
QDOC_PROPERTY(bool namespaceProcessing READ namespaceProcessing WRITE setNamespaceProcessing)
|
||||
public:
|
||||
enum TokenType {
|
||||
@ -314,9 +315,9 @@ private:
|
||||
QScopedPointer<QXmlStreamReaderPrivate> d_ptr;
|
||||
|
||||
};
|
||||
#endif // QT_NO_XMLSTREAMREADER
|
||||
#endif // feature xmlstreamreader
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMWRITER
|
||||
#if QT_CONFIG(xmlstreamwriter)
|
||||
|
||||
class QXmlStreamWriterPrivate;
|
||||
|
||||
@ -402,7 +403,7 @@ public:
|
||||
void writeStartElement(QAnyStringView qualifiedName);
|
||||
void writeStartElement(QAnyStringView namespaceUri, QAnyStringView name);
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMREADER
|
||||
#if QT_CONFIG(xmlstreamreader)
|
||||
void writeCurrentToken(const QXmlStreamReader &reader);
|
||||
#endif
|
||||
|
||||
@ -413,9 +414,8 @@ private:
|
||||
Q_DECLARE_PRIVATE(QXmlStreamWriter)
|
||||
QScopedPointer<QXmlStreamWriterPrivate> d_ptr;
|
||||
};
|
||||
#endif // QT_NO_XMLSTREAMWRITER
|
||||
#endif // feature xmlstreamwriter
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_XMLSTREAM
|
||||
#endif // QXMLSTREAM_H
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMREADER
|
||||
#if QT_CONFIG(xmlstreamreader)
|
||||
|
||||
bool QXmlStreamReaderPrivate::parse()
|
||||
{
|
||||
@ -989,7 +989,7 @@ bool QXmlStreamReaderPrivate::parse()
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // feature xmlstreamreader
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user