summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-02-09 14:29:21 +0100
committerUlf Hermann <ulf.hermann@qt.io>2018-03-20 08:19:25 +0000
commit5a4787dca01c302dd462a76222dfbf28c8951a8d (patch)
tree897b7caea659526d740e98c06b11c15970d35a7b /src/corelib/tools/qstring.cpp
parentdd74f5d347d0a5a21527142f85114374e2d90646 (diff)
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>
Diffstat (limited to 'src/corelib/tools/qstring.cpp')
-rw-r--r--src/corelib/tools/qstring.cpp30
1 files changed, 12 insertions, 18 deletions
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 <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
{
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 &reg, 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<QStringRef> QString::splitRef(const QRegExp &rx, SplitBehavior behavior)
}
#endif
-#ifndef QT_NO_REGULAREXPRESSION
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(regularexpression)
namespace {
template<class ResultList, typename MidMethod>
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);
}
-#endif // QT_BOOTSTRAPPED
-#endif // QT_NO_REGULAREXPRESSION
+#endif // QT_CONFIG(regularexpression)
/*!
\enum QString::NormalizationForm