40 #ifndef QBYTEARRAYMATCHER_H
41 #define QBYTEARRAYMATCHER_H
43 #include <QtCore/qbytearray.h>
50 class QByteArrayMatcherPrivate;
68 #if QT_CORE_REMOVED_SINCE(6, 3)
79 if (q_pattern.isNull())
80 return QByteArray(
reinterpret_cast<const char*
>(
p.p),
p.l);
85 QByteArrayMatcherPrivate *
d;
88 uchar q_skiptable[256];
106 : m_skiptable(generate(
pattern,
n)) {}
110 #if QT_CORE_REMOVED_SINCE(6, 3) && QT_POINTER_SIZE != 4
111 Q_CORE_EXPORT
int indexOfIn(
const char *needle,
uint nlen,
const char *haystack,
int hlen,
int from)
const noexcept;
118 static constexpr Skiptable generate(
const char *
pattern,
size_t n) noexcept
120 const auto uchar_max = (std::numeric_limits<uchar>::max)();
128 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
129 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
130 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
131 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
132 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
133 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
134 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
135 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
137 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
138 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
139 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
140 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
141 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
142 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
143 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
144 max, max, max, max, max, max, max, max, max, max, max, max, max, max, max, max,
159 static_assert(
N > 2,
"QStaticByteArrayMatcher makes no sense for finding a single-char pattern");
164 for (
size_t i = 0;
i <
N; ++
i)
165 m_pattern[
i] = patternToMatch[
i];
172 {
return this->
indexOfIn(m_pattern,
N - 1, haystack, hlen, from); }
small capitals from c petite p scientific i
[1]
The QByteArray class provides an array of bytes.
qsizetype size() const noexcept
The QByteArrayMatcher class holds a sequence of bytes that can be quickly matched in a byte array.
QByteArrayMatcher(QByteArrayView pattern)
Q_WEAK_OVERLOAD qsizetype indexIn(const QByteArray &ba, qsizetype from=0) const
QByteArray pattern() const
constexpr qsizetype size() const noexcept
constexpr const_pointer data() const noexcept
constexpr QStaticByteArrayMatcherBase(const char *pattern, size_t n) noexcept
Q_CORE_EXPORT qsizetype indexOfIn(const char *needle, size_t nlen, const char *haystack, qsizetype hlen, qsizetype from) const noexcept
~QStaticByteArrayMatcherBase()=default
The QStaticByteArrayMatcher class is a compile-time version of QByteArrayMatcher.
qsizetype indexIn(const char *haystack, qsizetype hlen, qsizetype from=0) const noexcept
qsizetype indexIn(QByteArrayView haystack, qsizetype from=0) const noexcept
constexpr QStaticByteArrayMatcher(const char(&patternToMatch)[N]) noexcept
template< size_t N > QStaticByteArrayMatcher qMakeStaticByteArrayMatcher(const char(&pattern)[N])
QByteArray pattern() const
Q_WEAK_OVERLOAD qsizetype indexIn(const QByteArray &haystack, qsizetype from=0) const noexcept
auto it unsigned count const
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
QT_BEGIN_INCLUDE_NAMESPACE typedef unsigned char uchar
GLenum GLuint GLenum GLsizei length
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei void * table
QThreadStorage< int * > dummy[8]