qtlite: Fix build libs with -no-feature-regularexpression

Change-Id: I427ff1f8f4986fbf466aba60a9d3de614c1e006f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
Mikhail Svetkin 2019-01-04 16:01:46 +01:00
parent fc585d3821
commit 3b514f8535
7 changed files with 50 additions and 4 deletions

View File

@ -1052,11 +1052,13 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
return false;
#ifndef QT_BOOTSTRAPPED
#if QT_CONFIG(regularexpression)
case QMetaType::QRegularExpression:
if (d->type != QMetaType::QCborValue || !v_cast<QCborValue>(d)->isRegularExpression())
return false;
*static_cast<QRegularExpression *>(result) = v_cast<QCborValue>(d)->toRegularExpression();
break;
#endif
case QMetaType::QJsonValue:
switch (d->type) {
case QMetaType::Nullptr:
@ -1232,9 +1234,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
case QVariant::Url:
*static_cast<QCborValue *>(result) = QCborValue(*v_cast<QUrl>(d));
break;
#if QT_CONFIG(regularexpression)
case QVariant::RegularExpression:
*static_cast<QCborValue *>(result) = QCborValue(*v_cast<QRegularExpression>(d));
break;
#endif
case QVariant::Uuid:
*static_cast<QCborValue *>(result) = QCborValue(*v_cast<QUuid>(d));
break;

View File

@ -1771,6 +1771,7 @@ QCborValue::QCborValue(const QUrl &url)
container->elements[1].type = String;
}
#if QT_CONFIG(regularexpression)
/*!
Creates a QCborValue object of the regular expression pattern extended type
and containing the value represented by \a rx. The value can later be retrieved
@ -1789,6 +1790,7 @@ QCborValue::QCborValue(const QRegularExpression &rx)
// change type
t = RegularExpression;
}
#endif // QT_CONFIG(regularexpression)
/*!
Creates a QCborValue object of the UUID extended type and containing the
@ -1942,6 +1944,7 @@ QUrl QCborValue::toUrl(const QUrl &defaultValue) const
return QUrl::fromEncoded(byteData->asByteArrayView());
}
#if QT_CONFIG(regularexpression)
/*!
Returns the regular expression value stored in this QCborValue, if it is of
the regular expression pattern extended type. Otherwise, it returns \a
@ -1960,6 +1963,7 @@ QRegularExpression QCborValue::toRegularExpression(const QRegularExpression &def
Q_ASSERT(n == -1);
return QRegularExpression(container->stringAt(1));
}
#endif // QT_CONFIG(regularexpression)
/*!
Returns the UUID value stored in this QCborValue, if it is of the UUID
@ -2400,12 +2404,16 @@ uint qHash(const QCborValue &value, uint seed)
return qHash(value.toDateTime(), seed);
case QCborValue::Url:
return qHash(value.toUrl(), seed);
#if QT_CONFIG(regularexpression)
case QCborValue::RegularExpression:
return qHash(value.toRegularExpression(), seed);
#endif
case QCborValue::Uuid:
return qHash(value.toUuid(), seed);
case QCborValue::Invalid:
return seed;
default:
break;
}
Q_ASSERT(value.isSimpleType());
@ -2450,12 +2458,16 @@ static QDebug debugContents(QDebug &dbg, const QCborValue &v)
return dbg << v.toDateTime();
case QCborValue::Url:
return dbg << v.toUrl();
#if QT_CONFIG(regularexpression)
case QCborValue::RegularExpression:
return dbg << v.toRegularExpression();
#endif
case QCborValue::Uuid:
return dbg << v.toUuid();
case QCborValue::Invalid:
return dbg << "<invalid>";
default:
break;
}
if (v.isSimpleType())
return dbg << v.toSimpleType();

View File

@ -43,7 +43,9 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qcborcommon.h>
#include <QtCore/qregularexpression.h>
#if QT_CONFIG(regularexpression)
# include <QtCore/qregularexpression.h>
#endif
#include <QtCore/qstring.h>
#include <QtCore/qstringview.h>
#include <QtCore/qurl.h>
@ -155,7 +157,9 @@ public:
explicit QCborValue(const QDateTime &dt);
explicit QCborValue(const QUrl &url);
#if QT_CONFIG(regularexpression)
explicit QCborValue(const QRegularExpression &rx);
#endif
explicit QCborValue(const QUuid &uuid);
~QCborValue() { if (container) dispose(); }
@ -233,7 +237,9 @@ public:
QString toString(const QString &defaultValue = {}) const;
QDateTime toDateTime(const QDateTime &defaultValue = {}) const;
QUrl toUrl(const QUrl &defaultValue = {}) const;
#if QT_CONFIG(regularexpression)
QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const;
#endif
QUuid toUuid(const QUuid &defaultValue = {}) const;
#ifdef Q_QDOC
@ -380,8 +386,10 @@ public:
{ return concrete().toDateTime(defaultValue); }
QUrl toUrl(const QUrl &defaultValue = {}) const
{ return concrete().toUrl(defaultValue); }
#if QT_CONFIG(regularexpression)
QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const
{ return concrete().toRegularExpression(defaultValue); }
#endif
QUuid toUuid(const QUuid &defaultValue = {}) const
{ return concrete().toUuid(defaultValue); }

View File

@ -543,14 +543,19 @@ QVariant QCborValue::toVariant() const
case Url:
return toUrl();
#if QT_CONFIG(regularexpression)
case RegularExpression:
return toRegularExpression();
#endif
case Uuid:
return toUuid();
case Invalid:
return QVariant();
default:
break;
}
if (isSimpleType())
@ -714,8 +719,10 @@ QCborValue QCborValue::fromVariant(const QVariant &variant)
case QVariant::Hash:
return QCborMap::fromVariantHash(variant.toHash());
#ifndef QT_BOOTSTRAPPED
#if QT_CONFIG(regularexpression)
case QVariant::RegularExpression:
return QCborValue(variant.toRegularExpression());
#endif
case QMetaType::QJsonValue:
return fromJsonValue(variant.toJsonValue());
case QMetaType::QJsonObject:

View File

@ -51,7 +51,9 @@
#include <private/qguiapplication_p.h>
#include <QScreen>
#include <QDir>
#include <QRegularExpression>
#if QT_CONFIG(regularexpression)
# include <QRegularExpression>
#endif
#include <QLoggingCategory>
#if defined(Q_OS_LINUX)

View File

@ -48,7 +48,9 @@
#undef register
#include <GL/glx.h>
#include <QtCore/QRegularExpression>
#if QT_CONFIG(regularexpression)
# include <QtCore/QRegularExpression>
#endif
#include <QtGui/QOpenGLContext>
#include <QtGui/QOffscreenSurface>
@ -722,6 +724,7 @@ void QGLXContext::queryDummyContext()
// The issue was fixed in Xcb 1.11, but we can't check for that
// at runtime, so instead assume it fixed with recent Mesa versions
// released several years after the Xcb fix.
#if QT_CONFIG(regularexpression)
QRegularExpression versionTest(QStringLiteral("Mesa (\\d+)"));
QRegularExpressionMatch result = versionTest.match(QString::fromLatin1(mesaVersionStr));
int versionNr = 0;
@ -731,6 +734,7 @@ void QGLXContext::queryDummyContext()
// White-listed
m_supportsThreading = true;
}
#endif
}
if (!m_supportsThreading) {
qCDebug(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: "

View File

@ -43,7 +43,9 @@
#include "qtestresult_p.h"
#include "qtestassert.h"
#include <QtCore/qregularexpression.h>
#if QT_CONFIG(regularexpression)
# include <QtCore/qregularexpression.h>
#endif
QT_BEGIN_NAMESPACE
@ -146,6 +148,7 @@ void QTapTestLogger::addIncident(IncidentTypes type, const char *description,
outputString(YAML_INDENT "---\n");
if (type != XFail) {
#if QT_CONFIG(regularexpression)
// This is fragile, but unfortunately testlib doesn't plumb
// the expected and actual values to the loggers (yet).
static QRegularExpression verifyRegex(
@ -206,6 +209,12 @@ void QTapTestLogger::addIncident(IncidentTypes type, const char *description,
YAML_INDENT "# %s\n", description);
outputString(unparsableDescription.data());
}
#else
QTestCharBuffer unparsableDescription;
QTest::qt_asprintf(&unparsableDescription,
YAML_INDENT "# %s\n", description);
outputString(unparsableDescription.data());
#endif
}
if (file) {