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 <oswald.buddenhagen@qt.io>
This commit is contained in:
Ulf Hermann 2018-02-09 14:29:21 +01:00
parent dd74f5d347
commit 5a4787dca0
28 changed files with 107 additions and 117 deletions

View File

@ -91,8 +91,7 @@
# include "private/qcore_unix_p.h" # include "private/qcore_unix_p.h"
#endif #endif
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#if !defined QT_NO_REGULAREXPRESSION
# ifdef __UCLIBC__ # ifdef __UCLIBC__
# if __UCLIBC_HAS_BACKTRACE__ # if __UCLIBC_HAS_BACKTRACE__
# define QLOGGING_HAVE_BACKTRACE # define QLOGGING_HAVE_BACKTRACE
@ -106,6 +105,7 @@
extern char *__progname; extern char *__progname;
#endif #endif
#ifndef QT_BOOTSTRAPPED
#if defined(Q_OS_LINUX) && (defined(__GLIBC__) || QT_HAS_INCLUDE(<sys/syscall.h>)) #if defined(Q_OS_LINUX) && (defined(__GLIBC__) || QT_HAS_INCLUDE(<sys/syscall.h>))
# include <sys/syscall.h> # include <sys/syscall.h>

View File

@ -42,7 +42,9 @@
#include <qfile.h> #include <qfile.h>
#include <qhash.h> #include <qhash.h>
#include <qtextstream.h> #include <qtextstream.h>
#if QT_CONFIG(regularexpression)
#include <qregularexpression.h> #include <qregularexpression.h>
#endif
#include <private/qfilesystemengine_p.h> #include <private/qfilesystemengine_p.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -53,12 +53,15 @@
#include "qdatastream.h" #include "qdatastream.h"
#include "qmetatypeswitcher_p.h" #include "qmetatypeswitcher_p.h"
#if QT_CONFIG(regularexpression)
# include "qregularexpression.h"
#endif
#ifndef QT_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
# include "qbitarray.h" # include "qbitarray.h"
# include "qurl.h" # include "qurl.h"
# include "qvariant.h" # include "qvariant.h"
# include "qabstractitemmodel.h" # include "qabstractitemmodel.h"
# include "qregularexpression.h"
# include "qjsonvalue.h" # include "qjsonvalue.h"
# include "qjsonobject.h" # include "qjsonobject.h"
# include "qjsonarray.h" # include "qjsonarray.h"
@ -1481,12 +1484,12 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
stream << *static_cast<const NS(QRegExp)*>(data); stream << *static_cast<const NS(QRegExp)*>(data);
break; break;
#endif #endif
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#ifndef QT_NO_REGULAREXPRESSION
case QMetaType::QRegularExpression: case QMetaType::QRegularExpression:
stream << *static_cast<const NS(QRegularExpression)*>(data); stream << *static_cast<const NS(QRegularExpression)*>(data);
break; break;
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
case QMetaType::QEasingCurve: case QMetaType::QEasingCurve:
stream << *static_cast<const NS(QEasingCurve)*>(data); stream << *static_cast<const NS(QEasingCurve)*>(data);
break; break;
@ -1711,12 +1714,12 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
stream >> *static_cast< NS(QRegExp)*>(data); stream >> *static_cast< NS(QRegExp)*>(data);
break; break;
#endif #endif
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#ifndef QT_NO_REGULAREXPRESSION
case QMetaType::QRegularExpression: case QMetaType::QRegularExpression:
stream >> *static_cast< NS(QRegularExpression)*>(data); stream >> *static_cast< NS(QRegularExpression)*>(data);
break; break;
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
case QMetaType::QEasingCurve: case QMetaType::QEasingCurve:
stream >> *static_cast< NS(QEasingCurve)*>(data); stream >> *static_cast< NS(QEasingCurve)*>(data);
break; break;

View File

@ -219,7 +219,7 @@ template<> struct TypeDefinition<QPointF> { static const bool IsAvailable = fals
#ifdef QT_NO_REGEXP #ifdef QT_NO_REGEXP
template<> struct TypeDefinition<QRegExp> { static const bool IsAvailable = false; }; template<> struct TypeDefinition<QRegExp> { static const bool IsAvailable = false; };
#endif #endif
#if defined(QT_BOOTSTRAPPED) || defined(QT_NO_REGULAREXPRESSION) #if !QT_CONFIG(regularexpression)
template<> struct TypeDefinition<QRegularExpression> { static const bool IsAvailable = false; }; template<> struct TypeDefinition<QRegularExpression> { static const bool IsAvailable = false; };
#endif #endif
#ifdef QT_NO_SHORTCUT #ifdef QT_NO_SHORTCUT

View File

@ -50,7 +50,9 @@
#include "qvariant.h" #include "qvariant.h"
#include "qmetaobject.h" #include "qmetaobject.h"
#include <qregexp.h> #include <qregexp.h>
#include <qregularexpression.h> #if QT_CONFIG(regularexpression)
# include <qregularexpression.h>
#endif
#include <qthread.h> #include <qthread.h>
#include <private/qthread_p.h> #include <private/qthread_p.h>
#include <qdebug.h> #include <qdebug.h>
@ -1921,7 +1923,7 @@ void qt_qFindChildren_helper(const QObject *parent, const QRegExp &re,
} }
#endif // QT_NO_REGEXP #endif // QT_NO_REGEXP
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
/*! /*!
\internal \internal
*/ */
@ -1943,7 +1945,7 @@ void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re
qt_qFindChildren_helper(obj, re, mo, list, options); qt_qFindChildren_helper(obj, re, mo, list, options);
} }
} }
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
/*! /*!
\internal \internal

View File

@ -74,7 +74,7 @@ class QWidget;
#ifndef QT_NO_REGEXP #ifndef QT_NO_REGEXP
class QRegExp; class QRegExp;
#endif #endif
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
class QRegularExpression; class QRegularExpression;
#endif #endif
#ifndef QT_NO_USERDATA #ifndef QT_NO_USERDATA
@ -187,7 +187,7 @@ public:
} }
#endif #endif
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
template<typename T> template<typename T>
inline QList<T> findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const inline QList<T> findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
{ {
@ -197,7 +197,7 @@ public:
reinterpret_cast<QList<void *> *>(&list), options); reinterpret_cast<QList<void *> *>(&list), options);
return list; return list;
} }
#endif #endif // QT_CONFIG(regularexpression)
inline const QObjectList &children() const { return d_ptr->children; } inline const QObjectList &children() const { return d_ptr->children; }

View File

@ -48,7 +48,9 @@
#include "qdatetime.h" #include "qdatetime.h"
#include "qeasingcurve.h" #include "qeasingcurve.h"
#include "qlist.h" #include "qlist.h"
#if QT_CONFIG(regularexpression)
#include "qregularexpression.h" #include "qregularexpression.h"
#endif
#include "qstring.h" #include "qstring.h"
#include "qstringlist.h" #include "qstringlist.h"
#include "qurl.h" #include "qurl.h"
@ -1941,12 +1943,12 @@ QVariant::QVariant(const QRegExp &regExp)
: d(RegExp) : d(RegExp)
{ v_construct<QRegExp>(&d, regExp); } { v_construct<QRegExp>(&d, regExp); }
#endif // QT_NO_REGEXP #endif // QT_NO_REGEXP
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#ifndef QT_NO_REGULAREXPRESSION
QVariant::QVariant(const QRegularExpression &re) QVariant::QVariant(const QRegularExpression &re)
: d(RegularExpression) : d(RegularExpression)
{ v_construct<QRegularExpression>(&d, re); } { v_construct<QRegularExpression>(&d, re); }
#endif #endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
QVariant::QVariant(const QUuid &uuid) QVariant::QVariant(const QUuid &uuid)
: d(Uuid) : d(Uuid)
{ v_construct<QUuid>(&d, uuid); } { v_construct<QUuid>(&d, uuid); }
@ -2650,7 +2652,7 @@ QRegExp QVariant::toRegExp() const
} }
#endif #endif
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
/*! /*!
\fn QRegularExpression QVariant::toRegularExpression() const \fn QRegularExpression QVariant::toRegularExpression() const
\since 5.0 \since 5.0
@ -2660,13 +2662,13 @@ QRegExp QVariant::toRegExp() const
\sa canConvert(), convert() \sa canConvert(), convert()
*/ */
#ifndef QT_NO_REGULAREXPRESSION
QRegularExpression QVariant::toRegularExpression() const QRegularExpression QVariant::toRegularExpression() const
{ {
return qVariantToHelper<QRegularExpression>(d, handlerManager); return qVariantToHelper<QRegularExpression>(d, handlerManager);
} }
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
/*! /*!
\since 5.0 \since 5.0
@ -2758,7 +2760,7 @@ QJsonDocument QVariant::toJsonDocument() const
{ {
return qVariantToHelper<QJsonDocument>(d, handlerManager); return qVariantToHelper<QJsonDocument>(d, handlerManager);
} }
#endif #endif // QT_BOOTSTRAPPED
/*! /*!
\fn QChar QVariant::toChar() const \fn QChar QVariant::toChar() const

View File

@ -81,9 +81,9 @@ class QRectF;
#ifndef QT_NO_REGEXP #ifndef QT_NO_REGEXP
class QRegExp; class QRegExp;
#endif // QT_NO_REGEXP #endif // QT_NO_REGEXP
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
class QRegularExpression; class QRegularExpression;
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
class QTextFormat; class QTextFormat;
class QTextLength; class QTextLength;
class QUrl; class QUrl;
@ -248,10 +248,10 @@ class Q_CORE_EXPORT QVariant
#ifndef QT_NO_REGEXP #ifndef QT_NO_REGEXP
QVariant(const QRegExp &regExp); QVariant(const QRegExp &regExp);
#endif // QT_NO_REGEXP #endif // QT_NO_REGEXP
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#ifndef QT_NO_REGULAREXPRESSION
QVariant(const QRegularExpression &re); QVariant(const QRegularExpression &re);
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
QVariant(const QUrl &url); QVariant(const QUrl &url);
QVariant(const QEasingCurve &easing); QVariant(const QEasingCurve &easing);
QVariant(const QUuid &uuid); QVariant(const QUuid &uuid);
@ -322,10 +322,10 @@ class Q_CORE_EXPORT QVariant
#ifndef QT_NO_REGEXP #ifndef QT_NO_REGEXP
QRegExp toRegExp() const; QRegExp toRegExp() const;
#endif // QT_NO_REGEXP #endif // QT_NO_REGEXP
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#ifndef QT_NO_REGULAREXPRESSION
QRegularExpression toRegularExpression() const; QRegularExpression toRegularExpression() const;
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
QUrl toUrl() const; QUrl toUrl() const;
QEasingCurve toEasingCurve() const; QEasingCurve toEasingCurve() const;
QUuid toUuid() const; QUuid toUuid() const;

View File

@ -41,8 +41,6 @@
#include "qregularexpression.h" #include "qregularexpression.h"
#ifndef QT_NO_REGULAREXPRESSION
#include <QtCore/qcoreapplication.h> #include <QtCore/qcoreapplication.h>
#include <QtCore/qhashfunctions.h> #include <QtCore/qhashfunctions.h>
#include <QtCore/qreadwritelock.h> #include <QtCore/qreadwritelock.h>
@ -2912,5 +2910,3 @@ static const char *pcreCompileErrorCodes[] =
#endif // #if 0 #endif // #if 0
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_REGULAREXPRESSION

View File

@ -43,13 +43,13 @@
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
#ifndef QT_NO_REGULAREXPRESSION
#include <QtCore/qstring.h> #include <QtCore/qstring.h>
#include <QtCore/qstringlist.h> #include <QtCore/qstringlist.h>
#include <QtCore/qshareddata.h> #include <QtCore/qshareddata.h>
#include <QtCore/qvariant.h> #include <QtCore/qvariant.h>
QT_REQUIRE_CONFIG(regularexpression);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QStringView; class QStringView;
@ -277,6 +277,4 @@ Q_DECLARE_SHARED(QRegularExpressionMatchIterator)
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_REGULAREXPRESSION
#endif // QREGULAREXPRESSION_H #endif // QREGULAREXPRESSION_H

View File

@ -40,7 +40,9 @@
#include "qstringlist.h" #include "qstringlist.h"
#include "qregexp.h" #include "qregexp.h"
#if QT_CONFIG(regularexpression)
#include "qregularexpression.h" #include "qregularexpression.h"
#endif
#include "qunicodetables_p.h" #include "qunicodetables_p.h"
#ifndef QT_NO_TEXTCODEC #ifndef QT_NO_TEXTCODEC
#include <qtextcodec.h> #include <qtextcodec.h>
@ -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 struct QStringCapture
{ {
int pos; int pos;
@ -3862,8 +3864,7 @@ QString& QString::replace(const QRegExp &rx, const QString &after)
} }
#endif #endif
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
/*! /*!
\overload replace() \overload replace()
\since 5.0 \since 5.0
@ -3991,8 +3992,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after)
return *this; return *this;
} }
#endif // QT_BOOTSTRAPPED #endif // QT_CONFIG(regularexpression)
#endif // QT_NO_REGULAREXPRESSION
/*! /*!
Returns the number of (potentially overlapping) occurrences of Returns the number of (potentially overlapping) occurrences of
@ -4207,8 +4207,7 @@ int QString::count(const QRegExp& rx) const
} }
#endif // QT_NO_REGEXP #endif // QT_NO_REGEXP
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
/*! /*!
\overload indexOf() \overload indexOf()
\since 5.0 \since 5.0
@ -4386,8 +4385,7 @@ int QString::count(const QRegularExpression &re) const
} }
return count; return count;
} }
#endif // QT_BOOTSTRAPPED #endif // QT_CONFIG(regularexpression)
#endif // QT_NO_REGULAREXPRESSION
/*! \fn int QString::count() const /*! \fn int QString::count() const
@ -4509,7 +4507,7 @@ QString QString::section(const QString &sep, int start, int end, SectionFlags fl
return ret; return ret;
} }
#if !(defined(QT_NO_REGEXP) && defined(QT_NO_REGULAREXPRESSION)) #if !(defined(QT_NO_REGEXP) && !QT_CONFIG(regularexpression))
class qt_section_chunk { class qt_section_chunk {
public: public:
qt_section_chunk() {} qt_section_chunk() {}
@ -4619,8 +4617,7 @@ QString QString::section(const QRegExp &reg, int start, int end, SectionFlags fl
} }
#endif #endif
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
/*! /*!
\overload section() \overload section()
\since 5.0 \since 5.0
@ -4664,8 +4661,7 @@ QString QString::section(const QRegularExpression &re, int start, int end, Secti
return extractSections(sections, start, end, flags); return extractSections(sections, start, end, flags);
} }
#endif // QT_BOOTSTRAPPED #endif // QT_CONFIG(regularexpression)
#endif // QT_NO_REGULAREXPRESSION
/*! /*!
Returns a substring that contains the \a n leftmost characters Returns a substring that contains the \a n leftmost characters
@ -7586,8 +7582,7 @@ QVector<QStringRef> QString::splitRef(const QRegExp &rx, SplitBehavior behavior)
} }
#endif #endif
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
namespace { namespace {
template<class ResultList, typename MidMethod> template<class ResultList, typename MidMethod>
static ResultList splitString(const QString &source, MidMethod mid, const QRegularExpression &re, static ResultList splitString(const QString &source, MidMethod mid, const QRegularExpression &re,
@ -7667,8 +7662,7 @@ QVector<QStringRef> QString::splitRef(const QRegularExpression &re, SplitBehavio
{ {
return splitString<QVector<QStringRef> >(*this, &QString::midRef, re, behavior); return splitString<QVector<QStringRef> >(*this, &QString::midRef, re, behavior);
} }
#endif // QT_BOOTSTRAPPED #endif // QT_CONFIG(regularexpression)
#endif // QT_NO_REGULAREXPRESSION
/*! /*!
\enum QString::NormalizationForm \enum QString::NormalizationForm

View File

@ -353,7 +353,7 @@ public:
inline bool contains(QRegExp &rx) const { return indexOf(rx) != -1; } inline bool contains(QRegExp &rx) const { return indexOf(rx) != -1; }
#endif #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 = 0) const;
int indexOf(const QRegularExpression &re, int from, QRegularExpressionMatch *rmatch) const; // ### Qt 6: merge overloads int indexOf(const QRegularExpression &re, int from, QRegularExpressionMatch *rmatch) const; // ### Qt 6: merge overloads
int lastIndexOf(const QRegularExpression &re, int from = -1) const; int lastIndexOf(const QRegularExpression &re, int from = -1) const;
@ -377,7 +377,7 @@ public:
#ifndef QT_NO_REGEXP #ifndef QT_NO_REGEXP
QString section(const QRegExp &reg, int start, int end = -1, SectionFlags flags = SectionDefault) const; QString section(const QRegExp &reg, int start, int end = -1, SectionFlags flags = SectionDefault) const;
#endif #endif
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
QString section(const QRegularExpression &re, int start, int end = -1, SectionFlags flags = SectionDefault) const; QString section(const QRegularExpression &re, int start, int end = -1, SectionFlags flags = SectionDefault) const;
#endif #endif
Q_REQUIRED_RESULT QString left(int n) const; Q_REQUIRED_RESULT QString left(int n) const;
@ -502,7 +502,7 @@ public:
inline QString &remove(const QRegExp &rx) inline QString &remove(const QRegExp &rx)
{ return replace(rx, QString()); } { return replace(rx, QString()); }
#endif #endif
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
QString &replace(const QRegularExpression &re, const QString &after); QString &replace(const QRegularExpression &re, const QString &after);
inline QString &remove(const QRegularExpression &re) inline QString &remove(const QRegularExpression &re)
{ return replace(re, QString()); } { return replace(re, QString()); }
@ -522,7 +522,7 @@ public:
Q_REQUIRED_RESULT QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const; Q_REQUIRED_RESULT QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const;
Q_REQUIRED_RESULT QVector<QStringRef> splitRef(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const; Q_REQUIRED_RESULT QVector<QStringRef> splitRef(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const;
#endif #endif
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
Q_REQUIRED_RESULT QStringList split(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const; Q_REQUIRED_RESULT QStringList split(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const;
Q_REQUIRED_RESULT QVector<QStringRef> splitRef(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const; Q_REQUIRED_RESULT QVector<QStringRef> splitRef(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const;
#endif #endif

View File

@ -39,7 +39,9 @@
#include <qstringlist.h> #include <qstringlist.h>
#include <qset.h> #include <qset.h>
#include <qregularexpression.h> #if QT_CONFIG(regularexpression)
# include <qregularexpression.h>
#endif
#include <algorithm> #include <algorithm>
@ -361,8 +363,7 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegExp
} }
#endif #endif
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#ifndef QT_NO_REGULAREXPRESSION
/*! /*!
\fn QStringList QStringList::filter(const QRegularExpression &re) const \fn QStringList QStringList::filter(const QRegularExpression &re) const
\overload \overload
@ -380,8 +381,7 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegula
} }
return res; return res;
} }
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
#endif // QT_BOOTSTRAPPED
/*! /*!
\fn QStringList &QStringList::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs) \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 #endif
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#ifndef QT_NO_REGULAREXPRESSION
/*! /*!
\fn QStringList &QStringList::replaceInStrings(const QRegularExpression &re, const QString &after) \fn QStringList &QStringList::replaceInStrings(const QRegularExpression &re, const QString &after)
\overload \overload
@ -466,8 +465,7 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegularEx
for (int i = 0; i < that->size(); ++i) for (int i = 0; i < that->size(); ++i)
(*that)[i].replace(re, after); (*that)[i].replace(re, after);
} }
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
#endif // QT_BOOTSTRAPPED
static int accumulatedSize(const QStringList &list, int seplen) static int accumulatedSize(const QStringList &list, int seplen)
{ {
@ -674,8 +672,7 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int
} }
#endif #endif
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#ifndef QT_NO_REGULAREXPRESSION
/*! /*!
\fn int QStringList::indexOf(const QRegularExpression &re, int from) const \fn int QStringList::indexOf(const QRegularExpression &re, int from) const
\overload \overload
@ -732,8 +729,7 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegularEx
} }
return -1; return -1;
} }
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
#endif // QT_BOOTSTRAPPED
/*! /*!
\fn int QStringList::removeDuplicates() \fn int QStringList::removeDuplicates()

View File

@ -84,12 +84,10 @@ public:
inline QStringList &replaceInStrings(const QRegExp &rx, const QString &after); inline QStringList &replaceInStrings(const QRegExp &rx, const QString &after);
#endif #endif
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#ifndef QT_NO_REGULAREXPRESSION
inline QStringList filter(const QRegularExpression &re) const; inline QStringList filter(const QRegularExpression &re) const;
inline QStringList &replaceInStrings(const QRegularExpression &re, const QString &after); inline QStringList &replaceInStrings(const QRegularExpression &re, const QString &after);
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
#endif // QT_BOOTSTRAPPED
#ifndef Q_QDOC #ifndef Q_QDOC
private: private:
@ -138,12 +136,10 @@ public:
inline int lastIndexOf(QRegExp &rx, int from = -1) const; inline int lastIndexOf(QRegExp &rx, int from = -1) const;
#endif #endif
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#ifndef QT_NO_REGULAREXPRESSION
inline int indexOf(const QRegularExpression &re, int from = 0) const; inline int indexOf(const QRegularExpression &re, int from = 0) const;
inline int lastIndexOf(const QRegularExpression &re, int from = -1) const; inline int lastIndexOf(const QRegularExpression &re, int from = -1) const;
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
#endif // QT_BOOTSTRAPPED
using QList<QString>::indexOf; using QList<QString>::indexOf;
using QList<QString>::lastIndexOf; using QList<QString>::lastIndexOf;
@ -179,14 +175,12 @@ namespace QtPrivate {
int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int from); int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int from);
#endif #endif
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#ifndef QT_NO_REGULAREXPRESSION
void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QRegularExpression &rx, const QString &after); 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); 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_indexOf(const QStringList *that, const QRegularExpression &re, int from);
int Q_CORE_EXPORT QStringList_lastIndexOf(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_CONFIG(regularexpression)
#endif // QT_BOOTSTRAPPED
} }
inline void QListSpecialMethods<QString>::sort(Qt::CaseSensitivity cs) inline void QListSpecialMethods<QString>::sort(Qt::CaseSensitivity cs)
@ -275,8 +269,7 @@ inline int QStringList::lastIndexOf(QRegExp &rx, int from) const
} }
#endif #endif
#ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression)
#ifndef QT_NO_REGULAREXPRESSION
inline QStringList &QListSpecialMethods<QString>::replaceInStrings(const QRegularExpression &rx, const QString &after) inline QStringList &QListSpecialMethods<QString>::replaceInStrings(const QRegularExpression &rx, const QString &after)
{ {
QtPrivate::QStringList_replaceInStrings(self(), rx, 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); return QtPrivate::QStringList_lastIndexOf(this, rx, from);
} }
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
#endif // QT_BOOTSTRAPPED
#endif // Q_QDOC #endif // Q_QDOC
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -46,7 +46,6 @@
#include <QtCore/qfile.h> #include <QtCore/qfile.h>
#include <QtCore/qvarlengtharray.h> #include <QtCore/qvarlengtharray.h>
#include <QtCore/qvector.h> #include <QtCore/qvector.h>
#include <QtCore/qregularexpression.h>
#include <QtCore/qloggingcategory.h> #include <QtCore/qloggingcategory.h>
#include <QtCore/qcryptographichash.h> #include <QtCore/qcryptographichash.h>
#include <QtCore/qcoreapplication.h> #include <QtCore/qcoreapplication.h>

View File

@ -47,7 +47,9 @@
#include "qtextlist.h" #include "qtextlist.h"
#include <qdebug.h> #include <qdebug.h>
#include <qregexp.h> #include <qregexp.h>
#if QT_CONFIG(regularexpression)
#include <qregularexpression.h> #include <qregularexpression.h>
#endif
#include <qvarlengtharray.h> #include <qvarlengtharray.h>
#include <qtextcodec.h> #include <qtextcodec.h>
#include <qthread.h> #include <qthread.h>
@ -1488,7 +1490,7 @@ QTextCursor QTextDocument::find(const QRegExp &expr, const QTextCursor &cursor,
} }
#endif // QT_REGEXP #endif // QT_REGEXP
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
static bool findInBlock(const QTextBlock &block, const QRegularExpression &expression, int offset, static bool findInBlock(const QTextBlock &block, const QRegularExpression &expression, int offset,
QTextDocument::FindFlags options, QTextCursor *cursor) QTextDocument::FindFlags options, QTextCursor *cursor)
{ {
@ -1613,7 +1615,7 @@ QTextCursor QTextDocument::find(const QRegularExpression &expr, const QTextCurso
} }
return find(expr, pos, options); return find(expr, pos, options);
} }
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
/*! /*!
\fn QTextObject *QTextDocument::createObject(const QTextFormat &format) \fn QTextObject *QTextDocument::createObject(const QTextFormat &format)

View File

@ -175,7 +175,7 @@ public:
QTextCursor find(const QRegExp &expr, const QTextCursor &cursor, FindFlags options = FindFlags()) const; QTextCursor find(const QRegExp &expr, const QTextCursor &cursor, FindFlags options = FindFlags()) const;
#endif #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, int from = 0, FindFlags options = FindFlags()) const;
QTextCursor find(const QRegularExpression &expr, const QTextCursor &cursor, FindFlags options = FindFlags()) const; QTextCursor find(const QRegularExpression &expr, const QTextCursor &cursor, FindFlags options = FindFlags()) const;
#endif #endif

View File

@ -916,7 +916,7 @@ void QRegExpValidator::setRegExp(const QRegExp& rx)
#endif #endif
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
/*! /*!
\class QRegularExpressionValidator \class QRegularExpressionValidator
@ -1067,7 +1067,7 @@ void QRegularExpressionValidatorPrivate::setRegularExpression(const QRegularExpr
} }
} }
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -45,7 +45,9 @@
#include <QtCore/qobject.h> #include <QtCore/qobject.h>
#include <QtCore/qstring.h> #include <QtCore/qstring.h>
#include <QtCore/qregexp.h> #include <QtCore/qregexp.h>
#include <QtCore/qregularexpression.h> #if QT_CONFIG(regularexpression)
# include <QtCore/qregularexpression.h>
#endif
#include <QtCore/qlocale.h> #include <QtCore/qlocale.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -194,7 +196,7 @@ private:
#endif // QT_NO_REGEXP #endif // QT_NO_REGEXP
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
class QRegularExpressionValidatorPrivate; class QRegularExpressionValidatorPrivate;
@ -223,7 +225,7 @@ private:
Q_DECLARE_PRIVATE(QRegularExpressionValidator) Q_DECLARE_PRIVATE(QRegularExpressionValidator)
}; };
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
#endif // QT_NO_VALIDATOR #endif // QT_NO_VALIDATOR

View File

@ -119,7 +119,7 @@ static FontKeys &fontKeys()
QSettings::NativeFormat); QSettings::NativeFormat);
const QStringList allKeys = fontRegistry.allKeys(); const QStringList allKeys = fontRegistry.allKeys();
const QString trueType = QStringLiteral("(TrueType)"); const QString trueType = QStringLiteral("(TrueType)");
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
const QRegularExpression sizeListMatch(QStringLiteral("\\s(\\d+,)+\\d+")); const QRegularExpression sizeListMatch(QStringLiteral("\\s(\\d+,)+\\d+"));
#else #else
const QRegExp sizeListMatch(QLatin1String("\\s(\\d+,)+\\d+")); const QRegExp sizeListMatch(QLatin1String("\\s(\\d+,)+\\d+"));

View File

@ -140,7 +140,7 @@ QByteArray QEglFSDeviceIntegration::fbDeviceName() const
int QEglFSDeviceIntegration::framebufferIndex() const int QEglFSDeviceIntegration::framebufferIndex() const
{ {
int fbIndex = 0; int fbIndex = 0;
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)")); QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)"));
QRegularExpressionMatch match = fbIndexRx.match(QString::fromLocal8Bit(fbDeviceName())); QRegularExpressionMatch match = fbIndexRx.match(QString::fromLocal8Bit(fbDeviceName()));
if (match.hasMatch()) if (match.hasMatch())

View File

@ -1,6 +1,6 @@
TEMPLATE = subdirs TEMPLATE = subdirs
QT_FOR_CONFIG += widgets-private QT_FOR_CONFIG += widgets-private
qtConfig(dbus): SUBDIRS += flatpak qtConfig(dbus):qtConfig(regularexpression): SUBDIRS += flatpak
qtHaveModule(widgets):qtConfig(gtk3): SUBDIRS += gtk3 qtHaveModule(widgets):qtConfig(gtk3): SUBDIRS += gtk3

View File

@ -51,7 +51,7 @@
#include <qstringlist.h> #include <qstringlist.h>
#include <qvector.h> #include <qvector.h>
#include <qdebug.h> #include <qdebug.h>
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
#include <qcache.h> #include <qcache.h>
#include <qregularexpression.h> #include <qregularexpression.h>
#endif #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) static void _q_regexp(sqlite3_context* context, int argc, sqlite3_value** argv)
{ {
if (Q_UNLIKELY(argc != 2)) { if (Q_UNLIKELY(argc != 2)) {
@ -724,7 +724,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
bool sharedCache = false; bool sharedCache = false;
bool openReadOnlyOption = false; bool openReadOnlyOption = false;
bool openUriOption = false; bool openUriOption = false;
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
static const QLatin1String regexpConnectOption = QLatin1String("QSQLITE_ENABLE_REGEXP"); static const QLatin1String regexpConnectOption = QLatin1String("QSQLITE_ENABLE_REGEXP");
bool defineRegexp = false; bool defineRegexp = false;
int regexpCacheSize = 25; 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")) { } else if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE")) {
sharedCache = true; sharedCache = true;
} }
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
else if (option.startsWith(regexpConnectOption)) { else if (option.startsWith(regexpConnectOption)) {
option = option.mid(regexpConnectOption.size()).trimmed(); option = option.mid(regexpConnectOption.size()).trimmed();
if (option.isEmpty()) { if (option.isEmpty()) {
@ -777,7 +777,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
sqlite3_busy_timeout(d->access, timeOut); sqlite3_busy_timeout(d->access, timeOut);
setOpen(true); setOpen(true);
setOpenError(false); setOpenError(false);
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
if (defineRegexp) { if (defineRegexp) {
auto cache = new QCache<QString, QRegularExpression>(regexpCacheSize); auto cache = new QCache<QString, QRegularExpression>(regexpCacheSize);
sqlite3_create_function_v2(d->access, "regexp", 2, SQLITE_UTF8, cache, &_q_regexp, NULL, sqlite3_create_function_v2(d->access, "regexp", 2, SQLITE_UTF8, cache, &_q_regexp, NULL,

View File

@ -1971,7 +1971,7 @@ void QTest::ignoreMessage(QtMsgType type, const char *message)
QTestLog::ignoreMessage(type, message); QTestLog::ignoreMessage(type, message);
} }
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
/*! /*!
\overload \overload
@ -1991,7 +1991,7 @@ void QTest::ignoreMessage(QtMsgType type, const QRegularExpression &messagePatte
{ {
QTestLog::ignoreMessage(type, messagePattern); QTestLog::ignoreMessage(type, messagePattern);
} }
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
/*! \internal /*! \internal
*/ */

View File

@ -290,7 +290,7 @@ namespace QTest
const char *file, int line); const char *file, int line);
Q_TESTLIB_EXPORT void qWarn(const char *message, const char *file = nullptr, int line = 0); 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); 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); Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern);
#endif #endif

View File

@ -55,7 +55,9 @@
#include <QtCore/qbytearray.h> #include <QtCore/qbytearray.h>
#include <QtCore/QElapsedTimer> #include <QtCore/QElapsedTimer>
#include <QtCore/QVariant> #include <QtCore/QVariant>
#if QT_CONFIG(regularexpression)
#include <QtCore/QRegularExpression> #include <QtCore/QRegularExpression>
#endif
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -139,7 +141,7 @@ namespace QTest {
return tp == type return tp == type
&& (pattern.type() == QVariant::String ? && (pattern.type() == QVariant::String ?
stringsMatch(pattern.toString(), message) : stringsMatch(pattern.toString(), message) :
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
pattern.toRegularExpression().match(message).hasMatch()); pattern.toRegularExpression().match(message).hasMatch());
#else #else
false); false);
@ -364,7 +366,7 @@ void QTestLog::printUnhandledIgnoreMessages()
if (list->pattern.type() == QVariant::String) { if (list->pattern.type() == QVariant::String) {
message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"'); message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"');
} else { } else {
#ifndef QT_NO_REGULAREXPRESSION #if QT_CONFIG(regularexpression)
message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"'); message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"');
#endif #endif
} }
@ -548,14 +550,14 @@ void QTestLog::ignoreMessage(QtMsgType type, const char *msg)
QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QString::fromLocal8Bit(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) void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expression)
{ {
QTEST_ASSERT(expression.isValid()); QTEST_ASSERT(expression.isValid());
QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression)); QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression));
} }
#endif // QT_NO_REGULAREXPRESSION #endif // QT_CONFIG(regularexpression)
void QTestLog::setMaxWarnings(int m) void QTestLog::setMaxWarnings(int m)
{ {

View File

@ -1299,7 +1299,7 @@ QColorShower::QColorShower(QColorDialog *parent)
lblHtml->setBuddy(htEd); lblHtml->setBuddy(htEd);
#endif #endif
#if !defined(QT_NO_REGULAREXPRESSION) #if QT_CONFIG(regularexpression)
QRegularExpression regExp(QStringLiteral("#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})")); QRegularExpression regExp(QStringLiteral("#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})"));
QRegularExpressionValidator *validator = new QRegularExpressionValidator(regExp, this); QRegularExpressionValidator *validator = new QRegularExpressionValidator(regExp, this);
htEd->setValidator(validator); htEd->setValidator(validator);

View File

@ -32,7 +32,7 @@
#if defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM) #if defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM)
#define SHOULD_CHECK_ARM_ON_X86 #define SHOULD_CHECK_ARM_ON_X86
#if QT_CONFIG(process) && !defined(QT_NO_REGULAREXPRESSION) #if QT_CONFIG(process) && QT_CONFIG(regularexpression)
#include <QProcess> #include <QProcess>
#include <QRegularExpression> #include <QRegularExpression>
#endif #endif
@ -88,7 +88,7 @@ static bool isX86SpecificFileAvailable()
*/ */
static bool isReportedArchitectureX86(void) static bool isReportedArchitectureX86(void)
{ {
#if QT_CONFIG(process) && !defined(QT_NO_REGULAREXPRESSION) #if QT_CONFIG(process) && QT_CONFIG(regularexpression)
QProcess unamer; QProcess unamer;
QString machineString; QString machineString;