Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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,
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 QStringView patternView() const noexcept
44 { return q_sv; }
45
46 inline Qt::CaseSensitivity caseSensitivity() const { return q_cs; }
47
48private:
49 QStringMatcherPrivate *d_ptr = nullptr;
51 QString q_pattern;
52 QStringView q_sv;
53 uchar q_skiptable[256] = {};
54};
55
57
58#endif // QSTRINGMATCHER_H
\inmodule QtCore
\inmodule QtCore
QStringView patternView() const noexcept
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:78
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
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:32
ptrdiff_t qsizetype
Definition qtypes.h:165
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)