diff options
Diffstat (limited to 'src/corelib/text/qregularexpression.h')
-rw-r--r-- | src/corelib/text/qregularexpression.h | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/src/corelib/text/qregularexpression.h b/src/corelib/text/qregularexpression.h index 9b7de26d07..2b51b94b15 100644 --- a/src/corelib/text/qregularexpression.h +++ b/src/corelib/text/qregularexpression.h @@ -50,10 +50,10 @@ public: QRegularExpression(); explicit QRegularExpression(const QString &pattern, PatternOptions options = NoPatternOption); - QRegularExpression(const QRegularExpression &re); + QRegularExpression(const QRegularExpression &re) noexcept; QRegularExpression(QRegularExpression &&re) = default; ~QRegularExpression(); - QRegularExpression &operator=(const QRegularExpression &re); + QRegularExpression &operator=(const QRegularExpression &re) noexcept; QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QRegularExpression) void swap(QRegularExpression &other) noexcept { d.swap(other.d); } @@ -91,11 +91,20 @@ public: MatchType matchType = NormalMatch, MatchOptions matchOptions = NoMatchOption) const; +#if QT_DEPRECATED_SINCE(6, 8) [[nodiscard]] + QT_DEPRECATED_VERSION_X_6_8("Use matchView instead.") QRegularExpressionMatch match(QStringView subjectView, qsizetype offset = 0, MatchType matchType = NormalMatch, MatchOptions matchOptions = NoMatchOption) const; +#endif + + [[nodiscard]] + QRegularExpressionMatch matchView(QStringView subjectView, + qsizetype offset = 0, + MatchType matchType = NormalMatch, + MatchOptions matchOptions = NoMatchOption) const; [[nodiscard]] QRegularExpressionMatchIterator globalMatch(const QString &subject, @@ -103,17 +112,27 @@ public: MatchType matchType = NormalMatch, MatchOptions matchOptions = NoMatchOption) const; +#if QT_DEPRECATED_SINCE(6, 8) [[nodiscard]] + QT_DEPRECATED_VERSION_X_6_8("Use globalMatchView instead.") QRegularExpressionMatchIterator globalMatch(QStringView subjectView, qsizetype offset = 0, MatchType matchType = NormalMatch, MatchOptions matchOptions = NoMatchOption) const; +#endif + + [[nodiscard]] + QRegularExpressionMatchIterator globalMatchView(QStringView subjectView, + qsizetype offset = 0, + MatchType matchType = NormalMatch, + MatchOptions matchOptions = NoMatchOption) const; void optimize() const; enum WildcardConversionOption { DefaultWildcardConversion = 0x0, - UnanchoredWildcardConversion = 0x1 + UnanchoredWildcardConversion = 0x1, + NonPathWildcardConversion = 0x2, }; Q_DECLARE_FLAGS(WildcardConversionOptions, WildcardConversionOption) @@ -156,6 +175,7 @@ private: Q_DECLARE_SHARED(QRegularExpression) Q_DECLARE_OPERATORS_FOR_FLAGS(QRegularExpression::PatternOptions) Q_DECLARE_OPERATORS_FOR_FLAGS(QRegularExpression::MatchOptions) +Q_DECLARE_OPERATORS_FOR_FLAGS(QRegularExpression::WildcardConversionOptions) #ifndef QT_NO_DATASTREAM Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const QRegularExpression &re); @@ -193,18 +213,26 @@ public: int lastCapturedIndex() const; +#if QT_CORE_REMOVED_SINCE(6, 8) bool hasCaptured(const QString &name) const - { return hasCaptured(QStringView(name)); } + { return hasCaptured(qToAnyStringViewIgnoringNull(name)); } bool hasCaptured(QStringView name) const; +#endif + bool hasCaptured(QAnyStringView name) const; bool hasCaptured(int nth) const; QString captured(int nth = 0) const; QStringView capturedView(int nth = 0) const; +#if QT_CORE_REMOVED_SINCE(6, 8) QString captured(const QString &name) const - { return captured(QStringView(name)); } + { return captured(qToAnyStringViewIgnoringNull(name)); } + QString captured(QStringView name) const; QStringView capturedView(QStringView name) const; +#endif + QString captured(QAnyStringView name) const; + QStringView capturedView(QAnyStringView name) const; QStringList capturedTexts() const; @@ -212,16 +240,21 @@ public: qsizetype capturedLength(int nth = 0) const; qsizetype capturedEnd(int nth = 0) const; +#if QT_CORE_REMOVED_SINCE(6, 8) qsizetype capturedStart(const QString &name) const - { return capturedStart(QStringView(name)); } + { return capturedStart(qToAnyStringViewIgnoringNull(name)); } qsizetype capturedLength(const QString &name) const - { return capturedLength(QStringView(name)); } + { return capturedLength(qToAnyStringViewIgnoringNull(name)); } qsizetype capturedEnd(const QString &name) const - { return capturedEnd(QStringView(name)); } + { return capturedEnd(qToAnyStringViewIgnoringNull(name)); } qsizetype capturedStart(QStringView name) const; qsizetype capturedLength(QStringView name) const; qsizetype capturedEnd(QStringView name) const; +#endif + qsizetype capturedStart(QAnyStringView name) const; + qsizetype capturedLength(QAnyStringView name) const; + qsizetype capturedEnd(QAnyStringView name) const; private: friend class QRegularExpression; |