summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qregularexpression.h
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-05-31 18:04:04 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-05-31 21:46:32 +0200
commit529f052add3edbc1afb063a5cbbb118b67434fb6 (patch)
tree8d4b3c3a961bd4a07e2d03de36e3abf8e283d97a /src/corelib/text/qregularexpression.h
parent32a39c4ed1802eab7454d3e6007ff02aa9581b66 (diff)
Port QRegularExpression to QStringView, drop QStringRef
The idea is pretty simple -- add QRegularExpression matching over QStringView. When matching over a QString, keep the string alive (by taking a copy), and set the view onto that string. Otherwise, just use the view provided by the user (who is then responsible for ensuring the data stays valid while matching). Do just minor refactorings to support this use case in a cleaner fashion. In QRegularExpressionMatch drop the QStringRef-returning methods, as they cannot work any more -- in the general case there won't be a QString to build a QStringRef from. [ChangeLog][QtCore][QRegularExpression] All the APIs dealing with QStringRef have been ported to QStringView, following QStringRef deprecation in Qt 6.0. Change-Id: Ic367991d9583cc108c045e4387c9b7288c8f1ffd Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/text/qregularexpression.h')
-rw-r--r--src/corelib/text/qregularexpression.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/corelib/text/qregularexpression.h b/src/corelib/text/qregularexpression.h
index 10ff2e94cb..30bdcdd4de 100644
--- a/src/corelib/text/qregularexpression.h
+++ b/src/corelib/text/qregularexpression.h
@@ -121,7 +121,7 @@ public:
MatchType matchType = NormalMatch,
MatchOptions matchOptions = NoMatchOption) const;
- QRegularExpressionMatch match(const QStringRef &subjectRef,
+ QRegularExpressionMatch match(QStringView subjectView,
int offset = 0,
MatchType matchType = NormalMatch,
MatchOptions matchOptions = NoMatchOption) const;
@@ -131,7 +131,7 @@ public:
MatchType matchType = NormalMatch,
MatchOptions matchOptions = NoMatchOption) const;
- QRegularExpressionMatchIterator globalMatch(const QStringRef &subjectRef,
+ QRegularExpressionMatchIterator globalMatch(QStringView subjectView,
int offset = 0,
MatchType matchType = NormalMatch,
MatchOptions matchOptions = NoMatchOption) const;
@@ -221,16 +221,13 @@ public:
int lastCapturedIndex() const;
QString captured(int nth = 0) const;
- QStringRef capturedRef(int nth = 0) const;
QStringView capturedView(int nth = 0) const;
#if QT_STRINGVIEW_LEVEL < 2
QString captured(const QString &name) const;
- QStringRef capturedRef(const QString &name) const;
#endif
QString captured(QStringView name) const;
- QStringRef capturedRef(QStringView name) const;
QStringView capturedView(QStringView name) const;
QStringList capturedTexts() const;