47 const char16_t *uc = needle.
utf16();
50 memset(skiptable,
l, 256 *
sizeof(
uchar));
54 skiptable[*uc & 0xff] =
l;
58 const char16_t *
start = uc;
60 skiptable[foldCase(uc,
start) & 0xff] =
l;
69 const char16_t *uc = haystack.
utf16();
71 const char16_t *puc = needle.
utf16();
78 const char16_t *current = uc +
index + pl_minus_one;
79 const char16_t *
end = uc +
l;
81 while (current <
end) {
82 qsizetype skip = skiptable[*current & 0xff];
86 if (*(current - skip) != puc[pl_minus_one-skip])
90 if (skip > pl_minus_one)
91 return (current - uc) - pl_minus_one;
95 if (skiptable[*(current - skip) & 0xff] == pl)
100 if (current >
end - skip)
105 while (current <
end) {
106 qsizetype skip = skiptable[foldCase(current, uc) & 0xff];
110 if (foldCase(current - skip, uc) != foldCase(puc + pl_minus_one - skip, puc))
114 if (skip > pl_minus_one)
115 return (current - uc) - pl_minus_one;
118 if (skiptable[foldCase(current - skip, uc) & 0xff] == pl)
123 if (current >
end - skip)
131 void QStringMatcher::updateSkipTable()
133 bm_init_skiptable(q_sv, q_skiptable, q_cs);
222 if (
this != &
other) {
223 q_pattern =
other.q_pattern;
226 memcpy(q_skiptable,
other.q_skiptable,
sizeof(q_skiptable));
313 return bm_find(
str, from, q_sv, q_skiptable, q_cs);
332 uchar skiptable[256];
333 bm_init_skiptable(needle, skiptable, cs);
334 if (haystackOffset < 0)
336 return bm_find(haystack, haystackOffset, needle, skiptable, cs);
The QString class provides a Unicode character string.
The QStringMatcher class holds a sequence of characters that can be quickly matched in a Unicode stri...
QStringMatcher & operator=(const QStringMatcher &other)
void setPattern(const QString &pattern)
void setCaseSensitivity(Qt::CaseSensitivity cs)
qsizetype indexIn(const QString &str, qsizetype from=0) const
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
constexpr const storage_type * utf16() const noexcept
constexpr qsizetype size() const noexcept
QT_BEGIN_INCLUDE_NAMESPACE typedef unsigned char uchar
qsizetype qFindStringBoyerMoore(QStringView haystack, qsizetype haystackOffset, QStringView needle, Qt::CaseSensitivity cs)