QLatin1StringMatcher Class
Latin-1 テキスト内の部分文字列検索を最適化しました。詳細...
| ヘッダー: | #include <QLatin1StringMatcher> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake: | QT += core |
| 以下のように: | Qt 6.5 |
- 継承されたメンバーを含むすべてのメンバーの一覧
- QLatin1StringMatcher は、文字列データ用のクラス群の一部です。
パブリック関数
| QLatin1StringMatcher() | |
| QLatin1StringMatcher(QLatin1StringView pattern, Qt::CaseSensitivity cs = Qt::CaseSensitive) | |
| ~QLatin1StringMatcher() | |
| Qt::CaseSensitivity | caseSensitivity() const |
| qsizetype | indexIn(QLatin1StringView haystack, qsizetype from = 0) const |
(since 6.8) qsizetype | indexIn(QStringView haystack, qsizetype from = 0) const |
| QLatin1StringView | pattern() const |
| void | setCaseSensitivity(Qt::CaseSensitivity cs) |
| void | setPattern(QLatin1StringView pattern) |
詳細な説明
QLatin1StringMatcher は、大文字と小文字を区別するか、または区別せずに、ある文字列QLatin1StringView を別の文字列の部分文字列として検索することができます。
このクラスは、Latin-1 エンコードされた文字列を、いくつかの QLatin1StringViews 内で(おそらくループ内で)繰り返し検索したい場合や、特定のQLatin1StringView 内でその文字列のすべてのインスタンスを検索したい場合に役立ちます。繰り返しマッチングが行われる場合、マッチャーオブジェクトとindexIn() を使用する方が、単純なQLatin1StringView をQLatin1StringView::indexOf() でマッチングするよりも高速です。 単発のマッチングを行う場合、このクラスにはメリットはありません。マッチャーオブジェクトは検索時に文字列にアクセスするため、検索対象の文字列は、マッチャーオブジェクトが破棄されるまで破棄または変更されてはなりません。
検索対象のQLatin1StringView と大文字小文字の区別設定に基づいて、QLatin1StringMatcherを作成します。その後、検索対象のQLatin1StringView を指定して、indexIn()を呼び出します。
QLatin1StringView 、QStringMatcher 、およびQByteArrayMatcherも参照してください 。
メンバ関数のドキュメント
[noexcept] QLatin1StringMatcher::QLatin1StringMatcher()
空の Latin-1 文字列マッチャーを構築します。これは、任意の文字列の各位置で一致します。
setPattern()、setCaseSensitivity()、およびindexIn()も参照してください 。
[explicit noexcept] QLatin1StringMatcher::QLatin1StringMatcher(QLatin1StringView pattern, Qt::CaseSensitivity cs = Qt::CaseSensitive)
指定されたpattern を、指定された大文字小文字の区別設定cs に従って検索するLatin-1文字列マッチャーを構築します。pattern 引数は、このマッチャーオブジェクトが破棄される前に破棄してはなりません。indexIn()を呼び出すと、指定されたQLatin1StringView 内のpattern が検索されます。
[noexcept] QLatin1StringMatcher::~QLatin1StringMatcher()
Latin-1 文字列照合機能を破棄します。
[noexcept] Qt::CaseSensitivity QLatin1StringMatcher::caseSensitivity() const
マッチャーが使用する大文字小文字の区別設定を返します。
setCaseSensitivity() およびindexIn()も参照してください 。
[noexcept] qsizetype QLatin1StringMatcher::indexIn(QLatin1StringView haystack, qsizetype from = 0) const
from から始まる、指定されたhaystack 内のパターンを検索します。
caseSensitivity() およびpattern()も参照してください 。
[noexcept, since 6.8] qsizetype QLatin1StringMatcher::indexIn(QStringView haystack, qsizetype from = 0) const
指定されたhaystack 内の、インデックス位置from から始まるパターンを検索します。
これはオーバーロードされた関数です。
この関数は Qt 6.8 で導入されました。
caseSensitivity() およびpattern()も参照してください 。
[noexcept] QLatin1StringView QLatin1StringMatcher::pattern() const
マッチャーが検索対象とする Latin-1 パターンを返します。
setPattern() およびindexIn()も参照してください 。
[noexcept] void QLatin1StringMatcher::setCaseSensitivity(Qt::CaseSensitivity cs)
大文字と小文字の区別を `cs` に設定します。
caseSensitivity() およびindexIn()も参照してください 。
[noexcept] void QLatin1StringMatcher::setPattern(QLatin1StringView pattern)
検索対象のpattern を設定します。QLatin1StringView が指す文字列は、マッチャーが破棄される前に破棄されてはなりません。ただし、あらかじめ存続期間がより長い別のpattern を指すように設定されている場合はこの限りではありません。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.