Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qstringmatcher.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// Copyright (C) 2019 Mail.ru Group.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QSTRINGMATCHER_H
6#define QSTRINGMATCHER_H
7
8#include <QtCore/qstring.h>
9#include <QtCore/qstringview.h>
10
12
13
14class QStringMatcherPrivate;
15
16class Q_CORE_EXPORT QStringMatcher
17{
18 void updateSkipTable();
19public:
20 QStringMatcher() = default;
21 explicit QStringMatcher(const QString &pattern,
26 {}
31
32 QStringMatcher &operator=(const QStringMatcher &other);
33
34 void setPattern(const QString &pattern);
36
37 qsizetype indexIn(const QString &str, qsizetype from = 0) const
38 { return indexIn(QStringView(str), from); }
40 { return indexIn(QStringView(str, length), from); }
41 qsizetype indexIn(QStringView str, qsizetype from = 0) const;
42 QString pattern() const;
43 inline Qt::CaseSensitivity caseSensitivity() const { return q_cs; }
44
45private:
46 QStringMatcherPrivate *d_ptr = nullptr;
48 QString q_pattern;
49 QStringView q_sv;
50 uchar q_skiptable[256] = {};
51};
52
54
55#endif // QSTRINGMATCHER_H
\inmodule QtCore
Definition qchar.h:48
\inmodule QtCore
Qt::CaseSensitivity caseSensitivity() const
Returns the case sensitivity setting for this string matcher.
qsizetype indexIn(const QChar *str, qsizetype length, qsizetype from=0) const
QStringMatcher(const QChar *uc, qsizetype len, Qt::CaseSensitivity cs=Qt::CaseSensitive)
QStringMatcher()=default
Constructs an empty string matcher that won't match anything.
qsizetype indexIn(const QString &str, qsizetype from=0) const
Searches the string str from character position from (default 0, i.e.
\inmodule QtCore
Definition qstringview.h:76
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
QString str
[2]
Combined button and popup list for selecting options.
CaseSensitivity
@ CaseSensitive
GLenum GLuint GLenum GLsizei length
GLenum GLsizei len
GLubyte * pattern
unsigned char uchar
Definition qtypes.h:27
ptrdiff_t qsizetype
Definition qtypes.h:70
QSharedPointer< T > other(t)
[5]
wordList<< "alpha"<< "omega"<< "omicron"<< "zeta";QLineEdit *lineEdit=new QLineEdit(this);QCompleter *completer=new QCompleter(wordList, this);completer-> setCaseSensitivity(Qt::CaseInsensitive)