add macro wrap for QXmlStream related code

To fix a compile error when QXmlStream is removed by defining macro,
but it is still used in some files.

Change-Id: I776c799732212b7401767440448248fc7b5dc480
Reviewed-by: David Faure <faure@kde.org>
bb10
Jing Bai 2012-08-29 13:48:43 +02:00 committed by Qt by Nokia
parent 0f409aca96
commit 32cfff864e
2 changed files with 13 additions and 0 deletions

View File

@ -529,6 +529,10 @@ QList<QMimeType> QMimeBinaryProvider::allMimeTypes()
void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data)
{
#ifdef QT_NO_XMLSTREAMREADER
qWarning() << "Cannot load mime type since QXmlStreamReader is not available.";
return;
#else
if (data.loaded)
return;
data.loaded = true;
@ -618,6 +622,7 @@ void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data)
// But is this really worth the effort?
}
#endif
#endif //QT_NO_XMLSTREAMREADER
}
// Binary search in the icons or generic-icons list

View File

@ -174,6 +174,7 @@ static bool parseNumber(const QString &n, int *target, QString *errorMessage)
// Evaluate a magic match rule like
// <match value="must be converted with BinHex" type="string" offset="11"/>
// <match value="0x9501" type="big16" offset="0:64"/>
#ifndef QT_NO_XMLSTREAMREADER
static bool createMagicMatchRule(const QXmlStreamAttributes &atts,
QString *errorMessage, QMimeMagicRule *&rule)
{
@ -202,9 +203,15 @@ static bool createMagicMatchRule(const QXmlStreamAttributes &atts,
return true;
}
#endif
bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString *errorMessage)
{
#ifdef QT_NO_XMLSTREAMREADER
if (errorMessage)
*errorMessage = QString::fromLatin1("QXmlStreamReader is not available, cannot parse.");
return false;
#else
QMimeTypePrivate data;
int priority = 50;
QStack<QMimeMagicRule *> currentRules; // stack for the nesting of rules
@ -338,6 +345,7 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
}
return true;
#endif //QT_NO_XMLSTREAMREADER
}
QT_END_NAMESPACE