From 5a4787dca01c302dd462a76222dfbf28c8951a8d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 9 Feb 2018 14:29:21 +0100 Subject: Modernize the "regularexpression" feature Use QT_CONFIG(regularexpression), disentangle it from QT_BOOTSTRAPPED, switch it off in the bootstrap build, remove the #ifdefs from qregularexpression.{h|cpp}, and add QT_REQUIRE_CONFIG(regularexpression) to the header. qregularexpression.{h|cpp} are already correctly excluded in tools.pri if !qtConfig(regularexpression). Change-Id: I21de154a6a118b76f99003d3acb72ac1e220d302 Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qlogging.cpp | 4 +-- src/corelib/io/qstandardpaths_unix.cpp | 2 ++ src/corelib/kernel/qmetatype.cpp | 17 +++++++----- src/corelib/kernel/qmetatype_p.h | 2 +- src/corelib/kernel/qobject.cpp | 8 +++--- src/corelib/kernel/qobject.h | 6 ++--- src/corelib/kernel/qvariant.cpp | 16 +++++++----- src/corelib/kernel/qvariant.h | 16 ++++++------ src/corelib/tools/qregularexpression.cpp | 4 --- src/corelib/tools/qregularexpression.h | 6 ++--- src/corelib/tools/qstring.cpp | 30 +++++++++------------- src/corelib/tools/qstring.h | 8 +++--- src/corelib/tools/qstringlist.cpp | 22 +++++++--------- src/corelib/tools/qstringlist.h | 24 ++++++----------- src/gui/opengl/qopenglshaderprogram.cpp | 1 - src/gui/text/qtextdocument.cpp | 6 +++-- src/gui/text/qtextdocument.h | 2 +- src/gui/util/qvalidator.cpp | 4 +-- src/gui/util/qvalidator.h | 8 +++--- .../windows/qwindowsfontdatabase_ft.cpp | 2 +- .../eglfs/api/qeglfsdeviceintegration.cpp | 2 +- src/plugins/platformthemes/platformthemes.pro | 2 +- src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp | 10 ++++---- src/testlib/qtestcase.cpp | 4 +-- src/testlib/qtestcase.h | 2 +- src/testlib/qtestlog.cpp | 10 +++++--- src/widgets/dialogs/qcolordialog.cpp | 2 +- 27 files changed, 105 insertions(+), 115 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 99c57c3b7a..17002c4231 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -91,8 +91,7 @@ # include "private/qcore_unix_p.h" #endif -#ifndef QT_BOOTSTRAPPED -#if !defined QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) # ifdef __UCLIBC__ # if __UCLIBC_HAS_BACKTRACE__ # define QLOGGING_HAVE_BACKTRACE @@ -106,6 +105,7 @@ extern char *__progname; #endif +#ifndef QT_BOOTSTRAPPED #if defined(Q_OS_LINUX) && (defined(__GLIBC__) || QT_HAS_INCLUDE()) # include diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index e49edd9a40..748ce67dac 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -42,7 +42,9 @@ #include #include #include +#if QT_CONFIG(regularexpression) #include +#endif #include #include #include diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 5abc2ebd70..518381712a 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -53,12 +53,15 @@ #include "qdatastream.h" #include "qmetatypeswitcher_p.h" +#if QT_CONFIG(regularexpression) +# include "qregularexpression.h" +#endif + #ifndef QT_BOOTSTRAPPED # include "qbitarray.h" # include "qurl.h" # include "qvariant.h" # include "qabstractitemmodel.h" -# include "qregularexpression.h" # include "qjsonvalue.h" # include "qjsonobject.h" # include "qjsonarray.h" @@ -1481,12 +1484,12 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) stream << *static_cast(data); break; #endif -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) case QMetaType::QRegularExpression: stream << *static_cast(data); break; -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) +#ifndef QT_BOOTSTRAPPED case QMetaType::QEasingCurve: stream << *static_cast(data); break; @@ -1711,12 +1714,12 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) stream >> *static_cast< NS(QRegExp)*>(data); break; #endif -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) case QMetaType::QRegularExpression: stream >> *static_cast< NS(QRegularExpression)*>(data); break; -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) +#ifndef QT_BOOTSTRAPPED case QMetaType::QEasingCurve: stream >> *static_cast< NS(QEasingCurve)*>(data); break; diff --git a/src/corelib/kernel/qmetatype_p.h b/src/corelib/kernel/qmetatype_p.h index 6f1334d082..0bf6bcb922 100644 --- a/src/corelib/kernel/qmetatype_p.h +++ b/src/corelib/kernel/qmetatype_p.h @@ -219,7 +219,7 @@ template<> struct TypeDefinition { static const bool IsAvailable = fals #ifdef QT_NO_REGEXP template<> struct TypeDefinition { static const bool IsAvailable = false; }; #endif -#if defined(QT_BOOTSTRAPPED) || defined(QT_NO_REGULAREXPRESSION) +#if !QT_CONFIG(regularexpression) template<> struct TypeDefinition { static const bool IsAvailable = false; }; #endif #ifdef QT_NO_SHORTCUT diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 9e1c3a50cb..dcc1bb5814 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -50,7 +50,9 @@ #include "qvariant.h" #include "qmetaobject.h" #include -#include +#if QT_CONFIG(regularexpression) +# include +#endif #include #include #include @@ -1921,7 +1923,7 @@ void qt_qFindChildren_helper(const QObject *parent, const QRegExp &re, } #endif // QT_NO_REGEXP -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) /*! \internal */ @@ -1943,7 +1945,7 @@ void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re qt_qFindChildren_helper(obj, re, mo, list, options); } } -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) /*! \internal diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 0e608a3208..aac9bcdee9 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -74,7 +74,7 @@ class QWidget; #ifndef QT_NO_REGEXP class QRegExp; #endif -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) class QRegularExpression; #endif #ifndef QT_NO_USERDATA @@ -187,7 +187,7 @@ public: } #endif -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) template inline QList findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const { @@ -197,7 +197,7 @@ public: reinterpret_cast *>(&list), options); return list; } -#endif +#endif // QT_CONFIG(regularexpression) inline const QObjectList &children() const { return d_ptr->children; } diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index f77831c703..c3c36e05d7 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -48,7 +48,9 @@ #include "qdatetime.h" #include "qeasingcurve.h" #include "qlist.h" +#if QT_CONFIG(regularexpression) #include "qregularexpression.h" +#endif #include "qstring.h" #include "qstringlist.h" #include "qurl.h" @@ -1941,12 +1943,12 @@ QVariant::QVariant(const QRegExp ®Exp) : d(RegExp) { v_construct(&d, regExp); } #endif // QT_NO_REGEXP -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) QVariant::QVariant(const QRegularExpression &re) : d(RegularExpression) { v_construct(&d, re); } -#endif +#endif // QT_CONFIG(regularexpression) +#ifndef QT_BOOTSTRAPPED QVariant::QVariant(const QUuid &uuid) : d(Uuid) { v_construct(&d, uuid); } @@ -2650,7 +2652,7 @@ QRegExp QVariant::toRegExp() const } #endif -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(regularexpression) /*! \fn QRegularExpression QVariant::toRegularExpression() const \since 5.0 @@ -2660,13 +2662,13 @@ QRegExp QVariant::toRegExp() const \sa canConvert(), convert() */ -#ifndef QT_NO_REGULAREXPRESSION QRegularExpression QVariant::toRegularExpression() const { return qVariantToHelper(d, handlerManager); } -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) +#ifndef QT_BOOTSTRAPPED /*! \since 5.0 @@ -2758,7 +2760,7 @@ QJsonDocument QVariant::toJsonDocument() const { return qVariantToHelper(d, handlerManager); } -#endif +#endif // QT_BOOTSTRAPPED /*! \fn QChar QVariant::toChar() const diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 7ce4e1a4d8..361768ef00 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -81,9 +81,9 @@ class QRectF; #ifndef QT_NO_REGEXP class QRegExp; #endif // QT_NO_REGEXP -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) class QRegularExpression; -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) class QTextFormat; class QTextLength; class QUrl; @@ -248,10 +248,10 @@ class Q_CORE_EXPORT QVariant #ifndef QT_NO_REGEXP QVariant(const QRegExp ®Exp); #endif // QT_NO_REGEXP -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) QVariant(const QRegularExpression &re); -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) +#ifndef QT_BOOTSTRAPPED QVariant(const QUrl &url); QVariant(const QEasingCurve &easing); QVariant(const QUuid &uuid); @@ -322,10 +322,10 @@ class Q_CORE_EXPORT QVariant #ifndef QT_NO_REGEXP QRegExp toRegExp() const; #endif // QT_NO_REGEXP -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) QRegularExpression toRegularExpression() const; -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) +#ifndef QT_BOOTSTRAPPED QUrl toUrl() const; QEasingCurve toEasingCurve() const; QUuid toUuid() const; diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 86bc99716d..13eff07c04 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -41,8 +41,6 @@ #include "qregularexpression.h" -#ifndef QT_NO_REGULAREXPRESSION - #include #include #include @@ -2912,5 +2910,3 @@ static const char *pcreCompileErrorCodes[] = #endif // #if 0 QT_END_NAMESPACE - -#endif // QT_NO_REGULAREXPRESSION diff --git a/src/corelib/tools/qregularexpression.h b/src/corelib/tools/qregularexpression.h index 050841e70e..398fc9ec9c 100644 --- a/src/corelib/tools/qregularexpression.h +++ b/src/corelib/tools/qregularexpression.h @@ -43,13 +43,13 @@ #include -#ifndef QT_NO_REGULAREXPRESSION - #include #include #include #include +QT_REQUIRE_CONFIG(regularexpression); + QT_BEGIN_NAMESPACE class QStringView; @@ -277,6 +277,4 @@ Q_DECLARE_SHARED(QRegularExpressionMatchIterator) QT_END_NAMESPACE -#endif // QT_NO_REGULAREXPRESSION - #endif // QREGULAREXPRESSION_H diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index b56ad34546..f6360f5504 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -40,7 +40,9 @@ #include "qstringlist.h" #include "qregexp.h" +#if QT_CONFIG(regularexpression) #include "qregularexpression.h" +#endif #include "qunicodetables_p.h" #ifndef QT_NO_TEXTCODEC #include @@ -3695,7 +3697,7 @@ int QString::lastIndexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs } -#if !(defined(QT_NO_REGEXP) && defined(QT_NO_REGULAREXPRESSION)) +#if !(defined(QT_NO_REGEXP) && !QT_CONFIG(regularexpression)) struct QStringCapture { int pos; @@ -3862,8 +3864,7 @@ QString& QString::replace(const QRegExp &rx, const QString &after) } #endif -#ifndef QT_NO_REGULAREXPRESSION -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(regularexpression) /*! \overload replace() \since 5.0 @@ -3991,8 +3992,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after) return *this; } -#endif // QT_BOOTSTRAPPED -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) /*! Returns the number of (potentially overlapping) occurrences of @@ -4207,8 +4207,7 @@ int QString::count(const QRegExp& rx) const } #endif // QT_NO_REGEXP -#ifndef QT_NO_REGULAREXPRESSION -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(regularexpression) /*! \overload indexOf() \since 5.0 @@ -4386,8 +4385,7 @@ int QString::count(const QRegularExpression &re) const } return count; } -#endif // QT_BOOTSTRAPPED -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) /*! \fn int QString::count() const @@ -4509,7 +4507,7 @@ QString QString::section(const QString &sep, int start, int end, SectionFlags fl return ret; } -#if !(defined(QT_NO_REGEXP) && defined(QT_NO_REGULAREXPRESSION)) +#if !(defined(QT_NO_REGEXP) && !QT_CONFIG(regularexpression)) class qt_section_chunk { public: qt_section_chunk() {} @@ -4619,8 +4617,7 @@ QString QString::section(const QRegExp ®, int start, int end, SectionFlags fl } #endif -#ifndef QT_NO_REGULAREXPRESSION -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(regularexpression) /*! \overload section() \since 5.0 @@ -4664,8 +4661,7 @@ QString QString::section(const QRegularExpression &re, int start, int end, Secti return extractSections(sections, start, end, flags); } -#endif // QT_BOOTSTRAPPED -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) /*! Returns a substring that contains the \a n leftmost characters @@ -7586,8 +7582,7 @@ QVector QString::splitRef(const QRegExp &rx, SplitBehavior behavior) } #endif -#ifndef QT_NO_REGULAREXPRESSION -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(regularexpression) namespace { template static ResultList splitString(const QString &source, MidMethod mid, const QRegularExpression &re, @@ -7667,8 +7662,7 @@ QVector QString::splitRef(const QRegularExpression &re, SplitBehavio { return splitString >(*this, &QString::midRef, re, behavior); } -#endif // QT_BOOTSTRAPPED -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) /*! \enum QString::NormalizationForm diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index b8f4d49831..f27f7efa2b 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -353,7 +353,7 @@ public: inline bool contains(QRegExp &rx) const { return indexOf(rx) != -1; } #endif -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) int indexOf(const QRegularExpression &re, int from = 0) const; int indexOf(const QRegularExpression &re, int from, QRegularExpressionMatch *rmatch) const; // ### Qt 6: merge overloads int lastIndexOf(const QRegularExpression &re, int from = -1) const; @@ -377,7 +377,7 @@ public: #ifndef QT_NO_REGEXP QString section(const QRegExp ®, int start, int end = -1, SectionFlags flags = SectionDefault) const; #endif -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) QString section(const QRegularExpression &re, int start, int end = -1, SectionFlags flags = SectionDefault) const; #endif Q_REQUIRED_RESULT QString left(int n) const; @@ -502,7 +502,7 @@ public: inline QString &remove(const QRegExp &rx) { return replace(rx, QString()); } #endif -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) QString &replace(const QRegularExpression &re, const QString &after); inline QString &remove(const QRegularExpression &re) { return replace(re, QString()); } @@ -522,7 +522,7 @@ public: Q_REQUIRED_RESULT QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const; Q_REQUIRED_RESULT QVector splitRef(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const; #endif -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) Q_REQUIRED_RESULT QStringList split(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const; Q_REQUIRED_RESULT QVector splitRef(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const; #endif diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index 17f6bd8539..d10d9ad9d0 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -39,7 +39,9 @@ #include #include -#include +#if QT_CONFIG(regularexpression) +# include +#endif #include @@ -361,8 +363,7 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegExp } #endif -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) /*! \fn QStringList QStringList::filter(const QRegularExpression &re) const \overload @@ -380,8 +381,7 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegula } return res; } -#endif // QT_NO_REGULAREXPRESSION -#endif // QT_BOOTSTRAPPED +#endif // QT_CONFIG(regularexpression) /*! \fn QStringList &QStringList::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs) @@ -436,8 +436,7 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegExp &r } #endif -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) /*! \fn QStringList &QStringList::replaceInStrings(const QRegularExpression &re, const QString &after) \overload @@ -466,8 +465,7 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegularEx for (int i = 0; i < that->size(); ++i) (*that)[i].replace(re, after); } -#endif // QT_NO_REGULAREXPRESSION -#endif // QT_BOOTSTRAPPED +#endif // QT_CONFIG(regularexpression) static int accumulatedSize(const QStringList &list, int seplen) { @@ -674,8 +672,7 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int } #endif -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) /*! \fn int QStringList::indexOf(const QRegularExpression &re, int from) const \overload @@ -732,8 +729,7 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegularEx } return -1; } -#endif // QT_NO_REGULAREXPRESSION -#endif // QT_BOOTSTRAPPED +#endif // QT_CONFIG(regularexpression) /*! \fn int QStringList::removeDuplicates() diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index b11856d9be..e58445b8c0 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -84,12 +84,10 @@ public: inline QStringList &replaceInStrings(const QRegExp &rx, const QString &after); #endif -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) inline QStringList filter(const QRegularExpression &re) const; inline QStringList &replaceInStrings(const QRegularExpression &re, const QString &after); -#endif // QT_NO_REGULAREXPRESSION -#endif // QT_BOOTSTRAPPED +#endif // QT_CONFIG(regularexpression) #ifndef Q_QDOC private: @@ -138,12 +136,10 @@ public: inline int lastIndexOf(QRegExp &rx, int from = -1) const; #endif -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) inline int indexOf(const QRegularExpression &re, int from = 0) const; inline int lastIndexOf(const QRegularExpression &re, int from = -1) const; -#endif // QT_NO_REGULAREXPRESSION -#endif // QT_BOOTSTRAPPED +#endif // QT_CONFIG(regularexpression) using QList::indexOf; using QList::lastIndexOf; @@ -179,14 +175,12 @@ namespace QtPrivate { int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int from); #endif -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QRegularExpression &rx, const QString &after); QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QRegularExpression &re); int Q_CORE_EXPORT QStringList_indexOf(const QStringList *that, const QRegularExpression &re, int from); int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, const QRegularExpression &re, int from); -#endif // QT_NO_REGULAREXPRESSION -#endif // QT_BOOTSTRAPPED +#endif // QT_CONFIG(regularexpression) } inline void QListSpecialMethods::sort(Qt::CaseSensitivity cs) @@ -275,8 +269,7 @@ inline int QStringList::lastIndexOf(QRegExp &rx, int from) const } #endif -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) inline QStringList &QListSpecialMethods::replaceInStrings(const QRegularExpression &rx, const QString &after) { QtPrivate::QStringList_replaceInStrings(self(), rx, after); @@ -297,8 +290,7 @@ inline int QStringList::lastIndexOf(const QRegularExpression &rx, int from) cons { return QtPrivate::QStringList_lastIndexOf(this, rx, from); } -#endif // QT_NO_REGULAREXPRESSION -#endif // QT_BOOTSTRAPPED +#endif // QT_CONFIG(regularexpression) #endif // Q_QDOC QT_END_NAMESPACE diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index 1fe30f7e0e..2ae9c6d327 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index e27b388762..44d1b2f201 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -47,7 +47,9 @@ #include "qtextlist.h" #include #include +#if QT_CONFIG(regularexpression) #include +#endif #include #include #include @@ -1488,7 +1490,7 @@ QTextCursor QTextDocument::find(const QRegExp &expr, const QTextCursor &cursor, } #endif // QT_REGEXP -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) static bool findInBlock(const QTextBlock &block, const QRegularExpression &expression, int offset, QTextDocument::FindFlags options, QTextCursor *cursor) { @@ -1613,7 +1615,7 @@ QTextCursor QTextDocument::find(const QRegularExpression &expr, const QTextCurso } return find(expr, pos, options); } -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) /*! \fn QTextObject *QTextDocument::createObject(const QTextFormat &format) diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index c847d3ce88..64e39d4648 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -175,7 +175,7 @@ public: QTextCursor find(const QRegExp &expr, const QTextCursor &cursor, FindFlags options = FindFlags()) const; #endif -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) QTextCursor find(const QRegularExpression &expr, int from = 0, FindFlags options = FindFlags()) const; QTextCursor find(const QRegularExpression &expr, const QTextCursor &cursor, FindFlags options = FindFlags()) const; #endif diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp index 1709012291..7982ad967e 100644 --- a/src/gui/util/qvalidator.cpp +++ b/src/gui/util/qvalidator.cpp @@ -916,7 +916,7 @@ void QRegExpValidator::setRegExp(const QRegExp& rx) #endif -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) /*! \class QRegularExpressionValidator @@ -1067,7 +1067,7 @@ void QRegularExpressionValidatorPrivate::setRegularExpression(const QRegularExpr } } -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) QT_END_NAMESPACE diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h index ad23092537..cc7cbcb559 100644 --- a/src/gui/util/qvalidator.h +++ b/src/gui/util/qvalidator.h @@ -45,7 +45,9 @@ #include #include #include -#include +#if QT_CONFIG(regularexpression) +# include +#endif #include QT_BEGIN_NAMESPACE @@ -194,7 +196,7 @@ private: #endif // QT_NO_REGEXP -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) class QRegularExpressionValidatorPrivate; @@ -223,7 +225,7 @@ private: Q_DECLARE_PRIVATE(QRegularExpressionValidator) }; -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) #endif // QT_NO_VALIDATOR diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp index 78477de38a..299dfd40cd 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp @@ -119,7 +119,7 @@ static FontKeys &fontKeys() QSettings::NativeFormat); const QStringList allKeys = fontRegistry.allKeys(); const QString trueType = QStringLiteral("(TrueType)"); -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) const QRegularExpression sizeListMatch(QStringLiteral("\\s(\\d+,)+\\d+")); #else const QRegExp sizeListMatch(QLatin1String("\\s(\\d+,)+\\d+")); diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index 1b8f50a1c6..f151713400 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -140,7 +140,7 @@ QByteArray QEglFSDeviceIntegration::fbDeviceName() const int QEglFSDeviceIntegration::framebufferIndex() const { int fbIndex = 0; -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)")); QRegularExpressionMatch match = fbIndexRx.match(QString::fromLocal8Bit(fbDeviceName())); if (match.hasMatch()) diff --git a/src/plugins/platformthemes/platformthemes.pro b/src/plugins/platformthemes/platformthemes.pro index ebf92ba9d5..17b1d91c6a 100644 --- a/src/plugins/platformthemes/platformthemes.pro +++ b/src/plugins/platformthemes/platformthemes.pro @@ -1,6 +1,6 @@ TEMPLATE = subdirs QT_FOR_CONFIG += widgets-private -qtConfig(dbus): SUBDIRS += flatpak +qtConfig(dbus):qtConfig(regularexpression): SUBDIRS += flatpak qtHaveModule(widgets):qtConfig(gtk3): SUBDIRS += gtk3 diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index f715d3cba3..cb3d905f46 100644 --- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -51,7 +51,7 @@ #include #include #include -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) #include #include #endif @@ -625,7 +625,7 @@ QVariant QSQLiteResult::handle() const ///////////////////////////////////////////////////////// -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) static void _q_regexp(sqlite3_context* context, int argc, sqlite3_value** argv) { if (Q_UNLIKELY(argc != 2)) { @@ -724,7 +724,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c bool sharedCache = false; bool openReadOnlyOption = false; bool openUriOption = false; -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) static const QLatin1String regexpConnectOption = QLatin1String("QSQLITE_ENABLE_REGEXP"); bool defineRegexp = false; int regexpCacheSize = 25; @@ -748,7 +748,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c } else if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE")) { sharedCache = true; } -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) else if (option.startsWith(regexpConnectOption)) { option = option.mid(regexpConnectOption.size()).trimmed(); if (option.isEmpty()) { @@ -777,7 +777,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c sqlite3_busy_timeout(d->access, timeOut); setOpen(true); setOpenError(false); -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) if (defineRegexp) { auto cache = new QCache(regexpCacheSize); sqlite3_create_function_v2(d->access, "regexp", 2, SQLITE_UTF8, cache, &_q_regexp, NULL, diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 7e9c03dbd4..d53530dadd 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1971,7 +1971,7 @@ void QTest::ignoreMessage(QtMsgType type, const char *message) QTestLog::ignoreMessage(type, message); } -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) /*! \overload @@ -1991,7 +1991,7 @@ void QTest::ignoreMessage(QtMsgType type, const QRegularExpression &messagePatte { QTestLog::ignoreMessage(type, messagePattern); } -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) /*! \internal */ diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index f38f7ed4df..cc666c365a 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -290,7 +290,7 @@ namespace QTest const char *file, int line); Q_TESTLIB_EXPORT void qWarn(const char *message, const char *file = nullptr, int line = 0); Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message); -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern); #endif diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 4964c6538e..6260b9e3fd 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -55,7 +55,9 @@ #include #include #include +#if QT_CONFIG(regularexpression) #include +#endif #include #include @@ -139,7 +141,7 @@ namespace QTest { return tp == type && (pattern.type() == QVariant::String ? stringsMatch(pattern.toString(), message) : -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) pattern.toRegularExpression().match(message).hasMatch()); #else false); @@ -364,7 +366,7 @@ void QTestLog::printUnhandledIgnoreMessages() if (list->pattern.type() == QVariant::String) { message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"'); } else { -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"'); #endif } @@ -548,14 +550,14 @@ void QTestLog::ignoreMessage(QtMsgType type, const char *msg) QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QString::fromLocal8Bit(msg)); } -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expression) { QTEST_ASSERT(expression.isValid()); QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression)); } -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) void QTestLog::setMaxWarnings(int m) { diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 896baed6c5..cf1119254b 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1299,7 +1299,7 @@ QColorShower::QColorShower(QColorDialog *parent) lblHtml->setBuddy(htEd); #endif -#if !defined(QT_NO_REGULAREXPRESSION) +#if QT_CONFIG(regularexpression) QRegularExpression regExp(QStringLiteral("#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})")); QRegularExpressionValidator *validator = new QRegularExpressionValidator(regExp, this); htEd->setValidator(validator); -- cgit v1.2.3