QStaticLatin1StringMatcher Class
template <Qt::CaseSensitivity CS, size_t N> class QStaticLatin1StringMatcherQStaticLatin1StringMatcher 클래스는 QLatin1StringMatcher 의 컴파일 타임 버전입니다... .
헤더: | #include <QStaticLatin1StringMatcher> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
이후: | Qt 6.7 |
- 상속된 멤버를 포함한 모든 멤버의 목록
- QStaticLatin1StringMatcher는 문자열 데이터용 클래스의 일부입니다.
공용 함수
qsizetype | indexIn(QLatin1StringView haystack, qsizetype from = 0) const |
qsizetype | indexIn(QStringView haystack, qsizetype from = 0) const |
관련 비회원
(since 6.7) auto | qMakeStaticCaseInsensitiveLatin1StringMatcher(const char (&)[N] patternToMatch) |
(since 6.7) auto | qMakeStaticCaseSensitiveLatin1StringMatcher(const char (&)[N] patternToMatch) |
상세 설명
이 클래스는 컴파일 타임에 알려진 하위 문자열을 라틴 1 문자열에서 효율적으로 검색해야 할 때 유용합니다. 예를 들어 파서에서 흔히 볼 수 있습니다. 특히 검색할 문자열이 반복적으로 검색되거나 검색할 하위 문자열의 접두사와 일치하는 항목이 많이 포함될 수 있는 큰 Latin-1 문자열 내에서 검색할 경우 일치자 객체의 indexIn()를 사용하는 것이 검색하려는 문자열의 indexOf() 멤버 메서드를 사용하는 것보다 빠릅니다.
QLatin1StringMatcher 과 달리 이 클래스는 컴파일 타임에 내부 표현을 계산하므로 일회성 Latin-1 문자열 일치를 수행하는 경우에도 유용할 수 있습니다.
qMakeStaticCaseSensitiveLatin1StringMatcher() 또는 qMakeStaticCaseInsensitiveLatin1StringMatcher()을 호출하여 검색할 Latin-1 문자열을 C 문자열 리터럴로 전달하여 QStaticLatin1StringMatcher를 생성합니다. 해당 함수의 반환값을 static constexpr auto
변수에 저장하므로 N
템플릿 매개 변수를 명시적으로 전달할 필요가 없습니다.
그런 다음 QLatin1StringMatcher 에서와 마찬가지로 검색하려는 QLatin1StringView 에서 indexIn()를 호출합니다.
이 클래스는 컴파일 타임에 모든 사전 계산을 수행하도록 설계되었으므로 setPattern() 또는 setCaseSensitivity() 메서드를 제공하지 않습니다.
참고: INTEGRITY 운영 체제는 현재 지원되지 않습니다.
QLatin1StringMatcher, QStaticByteArrayMatcher, QByteArrayMatcher 를참조하세요 .
멤버 함수 문서
[constexpr noexcept]
qsizetype QStaticLatin1StringMatcher::indexIn(QLatin1StringView haystack, qsizetype from = 0) const
[constexpr noexcept]
qsizetype QStaticLatin1StringMatcher::indexIn(QStringView haystack, qsizetype from = 0) const
QLatin1StringView haystack , 바이트 위치 from (기본값 0, 즉 첫 번째 바이트부터)에서 생성자에서 설정한 QLatin1StringView pattern()을 검색합니다. 생성자에도 설정된 대소문자 구분을 사용합니다.
haystack 에서 pattern()이 일치하는 위치를 반환하거나 일치하는 항목이 없으면 -1을 반환합니다.
관련 비회원
[constexpr noexcept, since 6.7]
template <size_t N> auto qMakeStaticCaseInsensitiveLatin1StringMatcher(const char (&)[N] patternToMatch)
전달된 patternToMatch 에서 대소문자를 구분하지 않고 자동으로 결정된 올바른 N
이 포함된 QStaticLatin1StringMatcher 을 반환합니다.
이 함수를 최대한 활용하려면 결과를 static constexpr auto
변수에 할당하세요:
static constexpr auto matcher = qMakeStaticCaseInsensitiveLatin1StringViewMatcher("needle");
이 함수는 Qt 6.7에 도입되었습니다.
[constexpr noexcept, since 6.7]
template <size_t N> auto qMakeStaticCaseSensitiveLatin1StringMatcher(const char (&)[N] patternToMatch)
전달된 patternToMatch 에서 대소문자를 구분하여 자동으로 결정된 올바른 N
으로 QStaticLatin1StringMatcher 을 반환합니다.
이 함수를 최대한 활용하려면 결과를 static constexpr auto
변수에 할당하세요:
static constexpr auto matcher = qMakeStaticCaseSensitiveLatin1StringViewMatcher("needle");
이 함수는 Qt 6.7에 도입되었습니다.
© 2025 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.