File indexing completed on 2025-01-18 10:07:38
0001
0002
0003
0004
0005 #ifndef QSTRINGMATCHER_H
0006 #define QSTRINGMATCHER_H
0007
0008 #include <QtCore/qstring.h>
0009 #include <QtCore/qstringview.h>
0010
0011 QT_BEGIN_NAMESPACE
0012
0013
0014 class QStringMatcherPrivate;
0015
0016 class Q_CORE_EXPORT QStringMatcher
0017 {
0018 void updateSkipTable();
0019 public:
0020 QStringMatcher() = default;
0021 explicit QStringMatcher(const QString &pattern,
0022 Qt::CaseSensitivity cs = Qt::CaseSensitive);
0023 QStringMatcher(const QChar *uc, qsizetype len,
0024 Qt::CaseSensitivity cs = Qt::CaseSensitive)
0025 : QStringMatcher(QStringView(uc, len), cs)
0026 {}
0027 QStringMatcher(QStringView pattern,
0028 Qt::CaseSensitivity cs = Qt::CaseSensitive);
0029 QStringMatcher(const QStringMatcher &other);
0030 ~QStringMatcher();
0031
0032 QStringMatcher &operator=(const QStringMatcher &other);
0033
0034 void setPattern(const QString &pattern);
0035 void setCaseSensitivity(Qt::CaseSensitivity cs);
0036
0037 qsizetype indexIn(const QString &str, qsizetype from = 0) const
0038 { return indexIn(QStringView(str), from); }
0039 qsizetype indexIn(const QChar *str, qsizetype length, qsizetype from = 0) const
0040 { return indexIn(QStringView(str, length), from); }
0041 qsizetype indexIn(QStringView str, qsizetype from = 0) const;
0042 QString pattern() const;
0043 QStringView patternView() const noexcept
0044 { return q_sv; }
0045
0046 inline Qt::CaseSensitivity caseSensitivity() const { return q_cs; }
0047
0048 private:
0049 QStringMatcherPrivate *d_ptr = nullptr;
0050 Qt::CaseSensitivity q_cs = Qt::CaseSensitive;
0051 QString q_pattern;
0052 QStringView q_sv;
0053 uchar q_skiptable[256] = {};
0054 };
0055
0056 QT_END_NAMESPACE
0057
0058 #endif