diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-12-02 12:31:41 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-12-10 02:15:18 +0100 |
commit | ce0b76731042412a0fa5a5f633fc48a52f79ef81 (patch) | |
tree | b0e697beba8c24158a6312341417b82b6a561d2c /src/corelib/text/qstringalgorithms.h | |
parent | be83ff65c424cff1036e7da19d6175826d9f7ed9 (diff) |
QStringView: add some QRegularExpression-related overloads
[ChangeLog][QtCore][QStringView] Added the indexOf(), contains(),
lastIndexOf() and count() methods taking a QRegularExpression.
Fixes: QTBUG-89050
Change-Id: Ic726754f67e06b3764302d2fad252e0378a77afc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qstringalgorithms.h')
-rw-r--r-- | src/corelib/text/qstringalgorithms.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/text/qstringalgorithms.h b/src/corelib/text/qstringalgorithms.h index 6d8fe114f1..870ae42af8 100644 --- a/src/corelib/text/qstringalgorithms.h +++ b/src/corelib/text/qstringalgorithms.h @@ -70,6 +70,8 @@ class QStringView; template <bool> class QBasicUtf8StringView; class QAnyStringView; class QChar; +class QRegularExpression; +class QRegularExpressionMatch; namespace QtPrivate { @@ -122,6 +124,21 @@ namespace QtPrivate { [[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QStringView haystack, QChar needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; [[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +#if QT_CONFIG(regularexpression) +[[nodiscard]] Q_CORE_EXPORT qsizetype indexOf(QStringView haystack, + const QRegularExpression &re, + qsizetype from = 0, + QRegularExpressionMatch *rmatch = nullptr); +[[nodiscard]] Q_CORE_EXPORT qsizetype lastIndexOf(QStringView haystack, + const QRegularExpression &re, + qsizetype from = -1, + QRegularExpressionMatch *rmatch = nullptr); +[[nodiscard]] Q_CORE_EXPORT bool contains(QStringView haystack, + const QRegularExpression &re, + QRegularExpressionMatch *rmatch = nullptr); +[[nodiscard]] Q_CORE_EXPORT qsizetype count(QStringView haystack, const QRegularExpression &re); +#endif + [[nodiscard]] Q_CORE_EXPORT QString convertToQString(QAnyStringView s); [[nodiscard]] Q_CORE_EXPORT QByteArray convertToLatin1(QStringView str); |