QTextBoundaryFinder Class
QTextBoundaryFinder 클래스는 문자열 내에서 유니코드 텍스트 경계를 찾는 방법을 제공합니다. 더 보기...
| 헤더: | #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) | |
(since 6.11) | QTextBoundaryFinder(QTextBoundaryFinder &&other) |
| ~QTextBoundaryFinder() | |
| QTextBoundaryFinder::BoundaryReasons | boundaryReasons() const |
| bool | isAtBoundary() const |
| bool | isValid() const |
| qsizetype | position() const |
| void | setPosition(qsizetype position) |
| QString | string() const |
(since 6.11) void | swap(QTextBoundaryFinder &other) |
| void | toEnd() |
| qsizetype | toNextBoundary() |
| qsizetype | toPreviousBoundary() |
| void | toStart() |
| QTextBoundaryFinder::BoundaryType | type() const |
(since 6.11) QTextBoundaryFinder & | operator=(QTextBoundaryFinder &&other) |
| QTextBoundaryFinder & | operator=(const QTextBoundaryFinder &other) |
상세 설명
QTextBoundaryFinder를 사용하면 유니코드 텍스트 경계 사양( 유니코드 표준 부록 #14 및 유니코드 표준 부록 #29 참조)에 따라 문자열에서 유니코드 텍스트 경계를 찾을 수 있습니다.
QTextBoundaryFinder는 BoundaryType 의 값에 따라 네 가지 모드 중 하나로 문자열( QString )을 처리할 수 있습니다.
사용자가 문자 또는 언어의 기본 단위로 인식하는 유니코드 문자의 집합을 여기서는 ‘그래프렘 클러스터(Grapheme clusters)’라고 부릅니다. 예를 들어, 두 개의 유니코드 문자 '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/ 참조).
문자열의 첫 번째 위치는 항상 유효한 경계이며, 첫 번째 문자 바로 앞의 위치를 가리킵니다. 문자열 길이의 끝 위치도 유효하며, 마지막 문자 바로 뒤의 위치를 가리킵니다.
멤버 유형 문서
enum QTextBoundaryFinder::BoundaryReason
flags QTextBoundaryFinder::BoundaryReasons
| 상수 | 값 | 설명 |
|---|---|---|
QTextBoundaryFinder::NotAtBoundary | 0 | 경계 탐지기가 경계 위치에 있지 않습니다. |
QTextBoundaryFinder::BreakOpportunity | 0x1f | 경계 탐지기가 줄바꿈 가능 위치에 있습니다. 이러한 줄바꿈 가능 위치는 항목 경계(StartOfItem, EndOfItem 또는 둘의 조합), 필수 줄바꿈 또는 소프트 하이픈일 수도 있습니다. |
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>에 대한 typedef입니다. 이 유형은 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 bufferSize 크기의 선택적 작업 버퍼로, QTextBoundaryFinder에 전달할 수 있습니다. 버퍼가 필요한 작업 데이터를 담기에 충분히 크다면(bufferSize >= length + 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(type, QStringView(chars, length), buffer, bufferSize)와 동일합니다.
이 함수는 오버로드된 함수입니다.
QTextBoundaryFinder::QTextBoundaryFinder(const QTextBoundaryFinder &other)
other 의 QTextBoundaryFinder 객체를 복사합니다.
[noexcept, since 6.11] QTextBoundaryFinder::QTextBoundaryFinder(QTextBoundaryFinder &&other)
other 에서 새로운 QTextBoundaryFinder 객체를 생성합니다.
참고: 이동된대상인 other는 부분적으로 형성된 상태로 배치되며, 이 상태에서는 소멸과 새 값 할당만이 유효한 연산입니다.
이 함수는 Qt 6.11에서 도입되었습니다.
[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 객체가 연산 대상으로 사용하는 문자열을 반환합니다.
[noexcept, since 6.11] void QTextBoundaryFinder::swap(QTextBoundaryFinder &other)
이 텍스트 경계 찾기 기능을 other 로 대체합니다. 이 작업은 매우 빠르며 실패하는 일이 없습니다.
이 함수는 Qt 6.11에서 도입되었습니다.
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 의 유형을 반환합니다.
[noexcept, since 6.11] QTextBoundaryFinder &QTextBoundaryFinder::operator=(QTextBoundaryFinder &&other)
other 를 이 QTextBoundaryFinder 인스턴스에 이동 할당합니다.
참고: 이동 대상인 other객체는 부분적으로 형성된 상태가 되며, 이 상태에서는 소멸과 새 값 할당만이 유효한 연산입니다.
이 함수는 Qt 6.11에서 도입되었습니다.
QTextBoundaryFinder &QTextBoundaryFinder::operator=(const QTextBoundaryFinder &other)
other 객체를 다른 QTextBoundaryFinder 객체에 할당합니다.
© 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.