47 m_cs(
Qt::CaseSensitive),
48 m_caseSensitiveSearcher(m_pattern.
data(), m_pattern.
data())
76void QLatin1StringMatcher::setSearcher() noexcept
84 m_foldBuffer[
i] =
static_cast<char>(
foldCase(m_pattern[
i].toLatin1()));
87 CaseInsensitiveSearcher(m_foldBuffer, &m_foldBuffer[bufferSize]);
94void QLatin1StringMatcher::freeSearcher() noexcept
112 if (m_pattern.latin1() ==
pattern.latin1() && m_pattern.size() ==
pattern.size())
163 if (m_pattern.isEmpty() && from == haystack.size())
165 if (from >= haystack.size())
167 auto begin = haystack.begin() + from;
168 auto end = haystack.end();
171 found = m_caseSensitiveSearcher(
begin,
end, m_pattern.begin(), m_pattern.end()).begin;
175 const qsizetype bufferSize = std::min(m_pattern.size(),
qsizetype(
sizeof m_foldBuffer));
177 const bool needleLongerThanBuffer = restNeedle.
size() > 0;
180 found = m_caseInsensitiveSearcher(found,
end, m_foldBuffer, &m_foldBuffer[bufferSize])
184 }
else if (!needleLongerThanBuffer) {
187 restHaystack = haystack.
sliced(
188 qMin(haystack.size(),
189 bufferSize +
qsizetype(std::distance(haystack.begin(), found))));
195 return std::distance(haystack.begin(), found);
Q_CORE_EXPORT qsizetype indexIn(QLatin1StringView haystack, qsizetype from=0) const noexcept
Searches for the pattern in the given haystack starting from from.
Q_CORE_EXPORT Qt::CaseSensitivity caseSensitivity() const noexcept
Returns the case sensitivity the matcher uses.
Q_CORE_EXPORT void setPattern(QLatin1StringView pattern) noexcept
Sets the pattern to search for.
Q_CORE_EXPORT ~QLatin1StringMatcher() noexcept
Destroys the Latin-1 string matcher.
CaseInsensitiveSearcher m_caseInsensitiveSearcher
Q_CORE_EXPORT QLatin1StringView pattern() const noexcept
Returns the Latin-1 pattern that the matcher searches for.
Q_CORE_EXPORT void setCaseSensitivity(Qt::CaseSensitivity cs) noexcept
Sets the case sensitivity to cs.
CaseSensitiveSearcher m_caseSensitiveSearcher
Q_CORE_EXPORT QLatin1StringMatcher() noexcept
Construct an empty Latin-1 string matcher.
constexpr const char * data() const noexcept
constexpr const_iterator end() const noexcept
constexpr QLatin1StringView sliced(qsizetype pos) const
constexpr const_iterator begin() const noexcept
constexpr qsizetype size() const noexcept
bool startsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
Combined button and popup list for selecting options.
static char32_t foldCase(const char16_t *ch, const char16_t *start)
constexpr const T & qMin(const T &a, const T &b)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)