Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtCore More...
#include <qlatin1stringmatcher.h>
Public Member Functions | |
Q_CORE_EXPORT | QLatin1StringMatcher () noexcept |
Construct an empty Latin-1 string matcher. | |
Q_CORE_EXPORT | QLatin1StringMatcher (QLatin1StringView pattern, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept |
Constructs a Latin-1 string matcher that searches for the given pattern with given case sensitivity cs. | |
Q_CORE_EXPORT | ~QLatin1StringMatcher () noexcept |
Destroys the Latin-1 string matcher. | |
Q_CORE_EXPORT void | setPattern (QLatin1StringView pattern) noexcept |
Sets the pattern to search for. | |
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. | |
Q_CORE_EXPORT Qt::CaseSensitivity | caseSensitivity () const noexcept |
Returns the case sensitivity the matcher uses. | |
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 qsizetype | indexIn (QStringView haystack, qsizetype from=0) const noexcept |
\inmodule QtCore
Optimized search for substring in Latin-1 text.
A QLatin1StringMatcher can search for one QLatin1StringView as a substring of another, either ignoring case or taking it into account.
This class is useful when you have a Latin-1 encoded string that you want to repeatedly search for in some QLatin1StringViews (perhaps in a loop), or when you want to search for all instances of it in a given QLatin1StringView. Using a matcher object and indexIn() is faster than matching a plain QLatin1StringView with QLatin1StringView::indexOf() if repeated matching takes place. This class offers no benefit if you are doing one-off matches. The string to be searched for must not be destroyed or changed before the matcher object is destroyed, as the matcher accesses the string when searching for it.
Create a QLatin1StringMatcher for the QLatin1StringView you want to search for and the case sensitivity. Then call indexIn() with the QLatin1StringView that you want to search within.
Definition at line 140 of file qlatin1stringmatcher.h.
|
noexcept |
Construct an empty Latin-1 string matcher.
This will match at each position in any string.
Definition at line 45 of file qlatin1stringmatcher.cpp.
|
explicitnoexcept |
Constructs a Latin-1 string matcher that searches for the given pattern with given case sensitivity cs.
The pattern argument must not be destroyed before this matcher object. Call indexIn() to find the pattern in the given QLatin1StringView.
Definition at line 58 of file qlatin1stringmatcher.cpp.
|
noexcept |
Destroys the Latin-1 string matcher.
Definition at line 68 of file qlatin1stringmatcher.cpp.
|
noexcept |
Returns the case sensitivity the matcher uses.
Definition at line 150 of file qlatin1stringmatcher.cpp.
|
noexcept |
Searches for the pattern in the given haystack starting from from.
Definition at line 161 of file qlatin1stringmatcher.cpp.
|
noexcept |
Searches for the pattern in the given haystack starting from index position from.
Definition at line 175 of file qlatin1stringmatcher.cpp.
|
noexcept |
Returns the Latin-1 pattern that the matcher searches for.
Definition at line 125 of file qlatin1stringmatcher.cpp.
|
noexcept |
Sets the case sensitivity to cs.
Definition at line 135 of file qlatin1stringmatcher.cpp.
|
noexcept |
Sets the pattern to search for.
The string pointed to by the QLatin1StringView must not be destroyed before the matcher is destroyed, unless it is set to point to a different pattern with longer lifetime first.
Definition at line 110 of file qlatin1stringmatcher.cpp.
CaseInsensitiveSearcher QLatin1StringMatcher::m_caseInsensitiveSearcher |
Definition at line 170 of file qlatin1stringmatcher.h.
CaseSensitiveSearcher QLatin1StringMatcher::m_caseSensitiveSearcher |
Definition at line 169 of file qlatin1stringmatcher.h.