Remove QRegExp from the bootstrap library
All it's uses have been replaces with QRegularExpression. Change-Id: I5bcdfdd8a39dad6d1288f18f1b24d2eea9e028d2 Reviewed-by: Simon Hausmann <hausmann@gmail.com>
This commit is contained in:
parent
660b38bb2c
commit
56a7984a90
@ -41,6 +41,7 @@
|
|||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#include <qbuffer.h>
|
#include <qbuffer.h>
|
||||||
#include <qdatetime.h>
|
#include <qdatetime.h>
|
||||||
|
#include <qregexp.h>
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX)
|
#if defined(Q_OS_UNIX)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -66,6 +66,10 @@
|
|||||||
#define QT_NO_USING_NAMESPACE
|
#define QT_NO_USING_NAMESPACE
|
||||||
#define QT_NO_DEPRECATED
|
#define QT_NO_DEPRECATED
|
||||||
|
|
||||||
|
#ifndef QT_BUILD_QMAKE
|
||||||
|
#define QT_NO_REGEXP
|
||||||
|
#endif
|
||||||
|
|
||||||
// Keep feature-test macros in alphabetic order by feature name:
|
// Keep feature-test macros in alphabetic order by feature name:
|
||||||
#define QT_FEATURE_alloca 1
|
#define QT_FEATURE_alloca 1
|
||||||
#define QT_FEATURE_alloca_h -1
|
#define QT_FEATURE_alloca_h -1
|
||||||
|
@ -93,9 +93,6 @@
|
|||||||
#include "qdir_p.h"
|
#include "qdir_p.h"
|
||||||
#include "qabstractfileengine_p.h"
|
#include "qabstractfileengine_p.h"
|
||||||
|
|
||||||
#ifdef QT_BOOTSTRAPPED
|
|
||||||
#include <QtCore/qregexp.h>
|
|
||||||
#endif
|
|
||||||
#include <QtCore/qset.h>
|
#include <QtCore/qset.h>
|
||||||
#include <QtCore/qstack.h>
|
#include <QtCore/qstack.h>
|
||||||
#include <QtCore/qvariant.h>
|
#include <QtCore/qvariant.h>
|
||||||
@ -144,10 +141,7 @@ public:
|
|||||||
const QDir::Filters filters;
|
const QDir::Filters filters;
|
||||||
const QDirIterator::IteratorFlags iteratorFlags;
|
const QDirIterator::IteratorFlags iteratorFlags;
|
||||||
|
|
||||||
#if defined(QT_BOOTSTRAPPED)
|
#if QT_CONFIG(regularexpression)
|
||||||
// ### Qt6: Get rid of this once we don't bootstrap qmake anymore
|
|
||||||
QVector<QRegExp> nameRegExps;
|
|
||||||
#elif QT_CONFIG(regularexpression)
|
|
||||||
QVector<QRegularExpression> nameRegExps;
|
QVector<QRegularExpression> nameRegExps;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -173,15 +167,7 @@ QDirIteratorPrivate::QDirIteratorPrivate(const QFileSystemEntry &entry, const QS
|
|||||||
, filters(QDir::NoFilter == filters ? QDir::AllEntries : filters)
|
, filters(QDir::NoFilter == filters ? QDir::AllEntries : filters)
|
||||||
, iteratorFlags(flags)
|
, iteratorFlags(flags)
|
||||||
{
|
{
|
||||||
#if defined(QT_BOOTSTRAPPED)
|
#if QT_CONFIG(regularexpression)
|
||||||
nameRegExps.reserve(nameFilters.size());
|
|
||||||
for (const auto &filter : nameFilters) {
|
|
||||||
nameRegExps.append(
|
|
||||||
QRegExp(filter,
|
|
||||||
(filters & QDir::CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive,
|
|
||||||
QRegExp::Wildcard));
|
|
||||||
}
|
|
||||||
#elif QT_CONFIG(regularexpression)
|
|
||||||
nameRegExps.reserve(nameFilters.size());
|
nameRegExps.reserve(nameFilters.size());
|
||||||
for (const auto &filter : nameFilters) {
|
for (const auto &filter : nameFilters) {
|
||||||
QString re = QRegularExpression::wildcardToRegularExpression(filter);
|
QString re = QRegularExpression::wildcardToRegularExpression(filter);
|
||||||
@ -352,23 +338,15 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// name filter
|
// name filter
|
||||||
#if QT_CONFIG(regularexpression) || defined(QT_BOOTSTRAPPED)
|
#if QT_CONFIG(regularexpression)
|
||||||
// Pass all entries through name filters, except dirs if the AllDirs
|
// Pass all entries through name filters, except dirs if the AllDirs
|
||||||
if (!nameFilters.isEmpty() && !((filters & QDir::AllDirs) && fi.isDir())) {
|
if (!nameFilters.isEmpty() && !((filters & QDir::AllDirs) && fi.isDir())) {
|
||||||
bool matched = false;
|
bool matched = false;
|
||||||
for (const auto &re : nameRegExps) {
|
for (const auto &re : nameRegExps) {
|
||||||
#if defined(QT_BOOTSTRAPPED)
|
|
||||||
QRegExp copy = re;
|
|
||||||
if (copy.exactMatch(fileName)) {
|
|
||||||
matched = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (re.match(fileName).hasMatch()) {
|
if (re.match(fileName).hasMatch()) {
|
||||||
matched = true;
|
matched = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (!matched)
|
if (!matched)
|
||||||
return false;
|
return false;
|
||||||
|
@ -103,7 +103,6 @@ qt_add_module(Bootstrap
|
|||||||
../../corelib/text/qbytearraymatcher.cpp
|
../../corelib/text/qbytearraymatcher.cpp
|
||||||
../../corelib/text/qlocale.cpp
|
../../corelib/text/qlocale.cpp
|
||||||
../../corelib/text/qlocale_tools.cpp
|
../../corelib/text/qlocale_tools.cpp
|
||||||
../../corelib/text/qregexp.cpp
|
|
||||||
../../corelib/text/qregularexpression.cpp
|
../../corelib/text/qregularexpression.cpp
|
||||||
../../corelib/text/qstring.cpp
|
../../corelib/text/qstring.cpp
|
||||||
../../corelib/text/qstring_compat.cpp
|
../../corelib/text/qstring_compat.cpp
|
||||||
|
@ -104,7 +104,6 @@ qt_extend_target(Bootstrap
|
|||||||
../../corelib/text/qbytearraymatcher.cpp
|
../../corelib/text/qbytearraymatcher.cpp
|
||||||
../../corelib/text/qlocale.cpp
|
../../corelib/text/qlocale.cpp
|
||||||
../../corelib/text/qlocale_tools.cpp
|
../../corelib/text/qlocale_tools.cpp
|
||||||
../../corelib/text/qregexp.cpp
|
|
||||||
../../corelib/text/qregularexpression.cpp
|
../../corelib/text/qregularexpression.cpp
|
||||||
../../corelib/text/qstring.cpp
|
../../corelib/text/qstring.cpp
|
||||||
../../corelib/text/qstring_compat.cpp
|
../../corelib/text/qstring_compat.cpp
|
||||||
|
@ -90,7 +90,6 @@ SOURCES += \
|
|||||||
../../corelib/text/qbytearraymatcher.cpp \
|
../../corelib/text/qbytearraymatcher.cpp \
|
||||||
../../corelib/text/qlocale.cpp \
|
../../corelib/text/qlocale.cpp \
|
||||||
../../corelib/text/qlocale_tools.cpp \
|
../../corelib/text/qlocale_tools.cpp \
|
||||||
../../corelib/text/qregexp.cpp \
|
|
||||||
../../corelib/text/qregularexpression.cpp \
|
../../corelib/text/qregularexpression.cpp \
|
||||||
../../corelib/text/qstring.cpp \
|
../../corelib/text/qstring.cpp \
|
||||||
../../corelib/text/qstringbuilder.cpp \
|
../../corelib/text/qstringbuilder.cpp \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user