QTextBoundaryFinder Class
QTextBoundaryFinder 클래스는 문자열에서 유니코드 텍스트 경계를 찾는 방법을 제공합니다. 더 보기...
Header: | #include <QTextBoundaryFinder> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
- 상속된 멤버를 포함한 모든 멤버의 목록
- QTextBoundaryFinder는 암시적으로 공유되는 클래스 및 문자열 데이터용 클래스의 일부입니다.
참고: 이 클래스의 모든 함수는 재진입됩니다.
공용 유형
enum | BoundaryReason { NotAtBoundary, BreakOpportunity, StartOfItem, EndOfItem, MandatoryBreak, SoftHyphen } |
flags | BoundaryReasons |
enum | BoundaryType { Grapheme, Word, Line, Sentence } |
공용 함수
QTextBoundaryFinder() | |
QTextBoundaryFinder(QTextBoundaryFinder::BoundaryType type, const QString &string) | |
(since 6.0) | QTextBoundaryFinder(QTextBoundaryFinder::BoundaryType type, QStringView string, unsigned char *buffer = nullptr, qsizetype bufferSize = 0) |
QTextBoundaryFinder(QTextBoundaryFinder::BoundaryType type, const QChar *chars, qsizetype length, unsigned char *buffer = nullptr, qsizetype bufferSize = 0) | |
QTextBoundaryFinder(const QTextBoundaryFinder &other) | |
~QTextBoundaryFinder() | |
QTextBoundaryFinder::BoundaryReasons | boundaryReasons() const |
bool | isAtBoundary() const |
bool | isValid() const |
qsizetype | position() const |
void | setPosition(qsizetype position) |
QString | string() const |
void | toEnd() |
qsizetype | toNextBoundary() |
qsizetype | toPreviousBoundary() |
void | toStart() |
QTextBoundaryFinder::BoundaryType | type() const |
QTextBoundaryFinder & | operator=(const QTextBoundaryFinder &other) |
상세 설명
QTextBoundaryFinder는 유니코드 텍스트 경계 사양에 따라 문자열에서 유니코드 텍스트 경계를 찾을 수 있습니다 (유니코드 표준 부록 #14 및 유니코드 표준 부록 #29 참조).
QTextBoundaryFinder는 BoundaryType 의 값에 따라 네 가지 가능한 모드로 QString 에서 작동할 수 있습니다.
사용자가 문자 또는 언어의 기본 단위로 생각하는 것을 구성하는 유니코드 문자의 단위를 여기서 자소 클러스터라고 합니다. 예를 들어 두 개의 유니코드 문자 'A' + 분음 부호는 사용자가 하나의 문자로 생각하지만 이 경우 두 개의 유니코드 코드 포인트로 표시되므로 하나의 그래피엠 클러스터를 형성합니다( https://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries 참조).
단어 경계는 언어에서 단어로 간주하는 것의 시작과 끝을 찾기 위해 존재합니다( https://www.unicode.org/reports/tr29/#Word_Boundaries 참조).
줄 바꿈 경계는 줄 바꿈이 발생할 수 있는 위치를 표시하고, 문장 경계는 전체 문장의 시작과 끝을 표시합니다( https://www.unicode.org/reports/tr29/#Sentence_Boundaries 및 https://www.unicode.org/reports/tr14/ 참조 ).
문자열의 첫 번째 위치는 항상 유효한 경계이며 첫 번째 문자 앞의 위치를 나타냅니다. 문자열 길이의 마지막 위치도 유효하며 마지막 문자 이후의 위치를 나타냅니다.
멤버 유형 문서
열거형 QTextBoundaryFinder::BoundaryReason
플래그 QTextBoundaryFinder::BoundaryReasons
Constant | 값 | 설명 |
---|---|---|
QTextBoundaryFinder::NotAtBoundary | 0 | 경계 파인더가 경계 위치에 있지 않습니다. |
QTextBoundaryFinder::BreakOpportunity | 0x1f | 경계 파인더가 휴식 기회 위치에 있습니다. 이러한 나누기 기회는 항목 경계(항목 시작, 항목 끝 또는 두 가지의 조합), 필수 줄 바꿈 또는 소프트 하이픈일 수도 있습니다. |
QTextBoundaryFinder::StartOfItem (since Qt 5.0) | 0x20 | 경계 찾기는 소문자, 단어, 문장 또는 줄의 시작 부분에 있습니다. |
QTextBoundaryFinder::EndOfItem (since Qt 5.0) | 0x40 | 경계 찾기는 소문자, 단어, 문장 또는 줄의 끝에 있습니다. |
QTextBoundaryFinder::MandatoryBreak (since Qt 5.0) | 0x80 | 경계 찾기가 줄 끝에 있습니다(줄 경계 유형에서만 발생할 수 있음). |
QTextBoundaryFinder::SoftHyphen | 0x100 | 경계 찾기는 소프트 하이픈에 있습니다(선 경계 유형에서만 발생할 수 있음). |
BoundaryReasons 유형은 QFlags<BoundaryReason>에 대한 타입 정의입니다. BoundaryReason 값의 OR 조합을 저장합니다.
enum QTextBoundaryFinder::BoundaryType
상수 | 값 | 설명 |
---|---|---|
QTextBoundaryFinder::Grapheme | 0 | 가장 작은 경계인 문자를 찾습니다. 문자, 문장 부호, 숫자 등을 포함합니다. |
QTextBoundaryFinder::Word | 1 | 단어를 찾습니다. |
QTextBoundaryFinder::Line | 3 | 텍스트를 여러 줄로 나눌 수 있는 가능한 위치를 찾습니다. |
QTextBoundaryFinder::Sentence | 2 | 문장 경계를 찾습니다. 여기에는 마침표, 물음표 등이 포함됩니다. |
멤버 기능 문서
QTextBoundaryFinder::QTextBoundaryFinder()
유효하지 않은 QTextBoundaryFinder 객체를 생성합니다.
QTextBoundaryFinder::QTextBoundaryFinder(QTextBoundaryFinder::BoundaryType type, const QString &string)
string 에서 작동하는 type 의 QTextBoundaryFinder 객체를 생성합니다.
[since 6.0]
QTextBoundaryFinder::QTextBoundaryFinder(QTextBoundaryFinder::BoundaryType type, QStringView string, unsigned char *buffer = nullptr, qsizetype bufferSize = 0)
string 에서 작동하는 type 의 QTextBoundaryFinder 객체를 생성합니다.
buffer 는 QTextBoundaryFinder에 전달할 수 있는 bufferSize 크기의 선택적 작업 버퍼입니다. 버퍼가 필요한 작업 데이터를 저장할 수 있을 만큼 충분히 크면(bufferSize >= 길이 + 1) 자체 버퍼를 할당하는 대신 이 버퍼를 사용합니다.
경고: QTextBoundaryFinder는 string 의 복사본을 만들지 않습니다. QTextBoundaryFinder 객체가 살아있는 동안 배열이 할당되도록 하는 것은 애플리케이션 프로그래머의 책임입니다. buffer 에도 동일하게 적용됩니다.
이 함수는 Qt 6.0에 도입되었습니다.
QTextBoundaryFinder::QTextBoundaryFinder(QTextBoundaryFinder::BoundaryType type, const QChar *chars, qsizetype length, unsigned char *buffer = nullptr, qsizetype bufferSize = 0)
이 함수는 오버로드된 함수입니다.
QTextBoundaryFinder(유형, QStringView(문자, 길이), 버퍼, 버퍼 크기)와 동일합니다.
QTextBoundaryFinder::QTextBoundaryFinder(const QTextBoundaryFinder &other)
QTextBoundaryFinder 객체( other)를 복사합니다.
[noexcept]
QTextBoundaryFinder::~QTextBoundaryFinder()
QTextBoundaryFinder 객체를 파괴합니다.
QTextBoundaryFinder::BoundaryReasons QTextBoundaryFinder::boundaryReasons() const
경계 찾기가 현재 위치를 경계로 선택한 이유를 반환합니다.
bool QTextBoundaryFinder::isAtBoundary() const
객체의 position()이 현재 유효한 텍스트 경계에 있는 경우 true
를 반환합니다.
bool QTextBoundaryFinder::isValid() const
텍스트 경계 찾기가 유효하면 true
을 반환하고, 그렇지 않으면 false
을 반환합니다. 기본값 QTextBoundaryFinder 은 유효하지 않습니다.
qsizetype QTextBoundaryFinder::position() const
QTextBoundaryFinder 의 현재 위치를 반환합니다.
범위는 0(문자열의 시작)에서 문자열의 길이를 포함한 값입니다.
setPosition()도 참조하세요 .
void QTextBoundaryFinder::setPosition(qsizetype position)
QTextBoundaryFinder 의 현재 위치를 position 으로 설정합니다.
position 이 범위를 벗어난 경우 유효한 위치에만 바인딩됩니다. 이 경우 유효한 위치는 0부터 문자열 길이까지입니다.
position()도 참조하세요 .
QString QTextBoundaryFinder::string() const
QTextBoundaryFinder 객체가 작동하는 문자열을 반환합니다.
void QTextBoundaryFinder::toEnd()
문자열의 끝으로 파인더를 이동합니다. 이는 setPosition(string.length())와 동일합니다.
setPosition() 및 position()도 참조하세요 .
qsizetype QTextBoundaryFinder::toNextBoundary()
QTextBoundaryFinder 를 다음 경계 위치로 이동하고 해당 위치를 반환합니다.
다음 경계가 없으면 -1을 반환합니다.
qsizetype QTextBoundaryFinder::toPreviousBoundary()
QTextBoundaryFinder 을 이전 경계 위치로 이동하고 해당 위치를 반환합니다.
이전 경계가 없는 경우 -1을 반환합니다.
void QTextBoundaryFinder::toStart()
문자열의 시작 부분으로 파인더를 이동합니다. 이는 setPosition(0)에 해당합니다.
setPosition() 및 position()도 참조하세요 .
QTextBoundaryFinder::BoundaryType QTextBoundaryFinder::type() const
QTextBoundaryFinder 의 유형을 반환합니다.
QTextBoundaryFinder &QTextBoundaryFinder::operator=(const QTextBoundaryFinder &other)
개체 other 를 다른 QTextBoundaryFinder 개체에 할당합니다.
© 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.