Struct qt_core::QTextBoundaryFinder
source · #[repr(C)]pub struct QTextBoundaryFinder { /* private fields */ }
Expand description
The QTextBoundaryFinder class provides a way of finding Unicode text boundaries in a string.
C++ class: QTextBoundaryFinder
.
The QTextBoundaryFinder class provides a way of finding Unicode text boundaries in a string.
QTextBoundaryFinder allows to find Unicode text boundaries in a string, accordingly to the Unicode text boundary specification (see Unicode Standard Annex #14 and Unicode Standard Annex #29).
QTextBoundaryFinder can operate on a QString in four possible modes depending on the value of BoundaryType.
Units of Unicode characters that make up what the user thinks of as a character or basic unit of the language are here called Grapheme clusters. The two unicode characters 'A' + diaeresis do for example form one grapheme cluster as the user thinks of them as one character, yet it is in this case represented by two unicode code points (see http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries).
Word boundaries are there to locate the start and end of what a language considers to be a word (see http://www.unicode.org/reports/tr29/#Word_Boundaries).
Line break boundaries give possible places where a line break might happen and sentence boundaries will show the beginning and end of whole sentences (see http://www.unicode.org/reports/tr29/#Sentence_Boundaries and http://www.unicode.org/reports/tr14/).
The first position in a string is always a valid boundary and refers to the position before the first character. The last position at the length of the string is also valid and refers to the position after the last character.
Implementations§
source§impl QTextBoundaryFinder
impl QTextBoundaryFinder
sourcepub unsafe fn boundary_reasons(&self) -> QFlags<BoundaryReason>
pub unsafe fn boundary_reasons(&self) -> QFlags<BoundaryReason>
Returns the reasons for the boundary finder to have chosen the current position as a boundary.
Calls C++ function: QFlags<QTextBoundaryFinder::BoundaryReason> QTextBoundaryFinder::boundaryReasons() const
.
Returns the reasons for the boundary finder to have chosen the current position as a boundary.
sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QTextBoundaryFinder>>
) -> Ref<QTextBoundaryFinder>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QTextBoundaryFinder>> ) -> Ref<QTextBoundaryFinder>
Assigns the object, other, to another QTextBoundaryFinder object.
Calls C++ function: QTextBoundaryFinder& QTextBoundaryFinder::operator=(const QTextBoundaryFinder& other)
.
Assigns the object, other, to another QTextBoundaryFinder object.
sourcepub unsafe fn is_at_boundary(&self) -> bool
pub unsafe fn is_at_boundary(&self) -> bool
sourcepub unsafe fn is_valid(&self) -> bool
pub unsafe fn is_valid(&self) -> bool
Returns true
if the text boundary finder is valid; otherwise returns false
. A default QTextBoundaryFinder is invalid.
Calls C++ function: bool QTextBoundaryFinder::isValid() const
.
Returns true
if the text boundary finder is valid; otherwise returns false
. A default QTextBoundaryFinder is invalid.
sourcepub unsafe fn new_0a() -> CppBox<QTextBoundaryFinder>
pub unsafe fn new_0a() -> CppBox<QTextBoundaryFinder>
Constructs an invalid QTextBoundaryFinder object.
Calls C++ function: [constructor] void QTextBoundaryFinder::QTextBoundaryFinder()
.
Constructs an invalid QTextBoundaryFinder object.
sourcepub unsafe fn new_2a(
type_: BoundaryType,
string: impl CastInto<Ref<QString>>
) -> CppBox<QTextBoundaryFinder>
pub unsafe fn new_2a( type_: BoundaryType, string: impl CastInto<Ref<QString>> ) -> CppBox<QTextBoundaryFinder>
Creates a QTextBoundaryFinder object of type operating on string.
Calls C++ function: [constructor] void QTextBoundaryFinder::QTextBoundaryFinder(QTextBoundaryFinder::BoundaryType type, const QString& string)
.
Creates a QTextBoundaryFinder object of type operating on string.
sourcepub unsafe fn new_5a(
type_: BoundaryType,
chars: impl CastInto<Ptr<QChar>>,
length: c_int,
buffer: *mut c_uchar,
buffer_size: c_int
) -> CppBox<QTextBoundaryFinder>
pub unsafe fn new_5a( type_: BoundaryType, chars: impl CastInto<Ptr<QChar>>, length: c_int, buffer: *mut c_uchar, buffer_size: c_int ) -> CppBox<QTextBoundaryFinder>
Creates a QTextBoundaryFinder object of type operating on chars with length.
Calls C++ function: [constructor] void QTextBoundaryFinder::QTextBoundaryFinder(QTextBoundaryFinder::BoundaryType type, const QChar* chars, int length, unsigned char* buffer = …, int bufferSize = …)
.
Creates a QTextBoundaryFinder object of type operating on chars with length.
buffer is an optional working buffer of size bufferSize you can pass to the QTextBoundaryFinder. If the buffer is large enough to hold the working data required (bufferSize >= length + 1), it will use this instead of allocating its own buffer.
Warning: QTextBoundaryFinder does not create a copy of chars. It is the application programmer's responsibility to ensure the array is allocated for as long as the QTextBoundaryFinder object stays alive. The same applies to buffer.
sourcepub unsafe fn new_4a(
type_: BoundaryType,
chars: impl CastInto<Ptr<QChar>>,
length: c_int,
buffer: *mut c_uchar
) -> CppBox<QTextBoundaryFinder>
pub unsafe fn new_4a( type_: BoundaryType, chars: impl CastInto<Ptr<QChar>>, length: c_int, buffer: *mut c_uchar ) -> CppBox<QTextBoundaryFinder>
Creates a QTextBoundaryFinder object of type operating on chars with length.
Calls C++ function: [constructor] void QTextBoundaryFinder::QTextBoundaryFinder(QTextBoundaryFinder::BoundaryType type, const QChar* chars, int length, unsigned char* buffer = …)
.
Creates a QTextBoundaryFinder object of type operating on chars with length.
buffer is an optional working buffer of size bufferSize you can pass to the QTextBoundaryFinder. If the buffer is large enough to hold the working data required (bufferSize >= length + 1), it will use this instead of allocating its own buffer.
Warning: QTextBoundaryFinder does not create a copy of chars. It is the application programmer's responsibility to ensure the array is allocated for as long as the QTextBoundaryFinder object stays alive. The same applies to buffer.
sourcepub unsafe fn new_3a(
type_: BoundaryType,
chars: impl CastInto<Ptr<QChar>>,
length: c_int
) -> CppBox<QTextBoundaryFinder>
pub unsafe fn new_3a( type_: BoundaryType, chars: impl CastInto<Ptr<QChar>>, length: c_int ) -> CppBox<QTextBoundaryFinder>
Creates a QTextBoundaryFinder object of type operating on chars with length.
Calls C++ function: [constructor] void QTextBoundaryFinder::QTextBoundaryFinder(QTextBoundaryFinder::BoundaryType type, const QChar* chars, int length)
.
Creates a QTextBoundaryFinder object of type operating on chars with length.
buffer is an optional working buffer of size bufferSize you can pass to the QTextBoundaryFinder. If the buffer is large enough to hold the working data required (bufferSize >= length + 1), it will use this instead of allocating its own buffer.
Warning: QTextBoundaryFinder does not create a copy of chars. It is the application programmer's responsibility to ensure the array is allocated for as long as the QTextBoundaryFinder object stays alive. The same applies to buffer.
sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QTextBoundaryFinder>>
) -> CppBox<QTextBoundaryFinder>
pub unsafe fn new_copy( other: impl CastInto<Ref<QTextBoundaryFinder>> ) -> CppBox<QTextBoundaryFinder>
Copies the QTextBoundaryFinder object, other.
Calls C++ function: [constructor] void QTextBoundaryFinder::QTextBoundaryFinder(const QTextBoundaryFinder& other)
.
Copies the QTextBoundaryFinder object, other.
sourcepub unsafe fn position(&self) -> c_int
pub unsafe fn position(&self) -> c_int
Returns the current position of the QTextBoundaryFinder.
Calls C++ function: int QTextBoundaryFinder::position() const
.
Returns the current position of the QTextBoundaryFinder.
The range is from 0 (the beginning of the string) to the length of the string inclusive.
See also setPosition().
sourcepub unsafe fn set_position(&self, position: c_int)
pub unsafe fn set_position(&self, position: c_int)
Sets the current position of the QTextBoundaryFinder to position.
Calls C++ function: void QTextBoundaryFinder::setPosition(int position)
.
Sets the current position of the QTextBoundaryFinder to position.
If position is out of bounds, it will be bound to only valid positions. In this case, valid positions are from 0 to the length of the string inclusive.
See also position().
sourcepub unsafe fn string(&self) -> CppBox<QString>
pub unsafe fn string(&self) -> CppBox<QString>
Returns the string the QTextBoundaryFinder object operates on.
Calls C++ function: QString QTextBoundaryFinder::string() const
.
Returns the string the QTextBoundaryFinder object operates on.
sourcepub unsafe fn to_end(&self)
pub unsafe fn to_end(&self)
Moves the finder to the end of the string. This is equivalent to setPosition(string.length()).
Calls C++ function: void QTextBoundaryFinder::toEnd()
.
Moves the finder to the end of the string. This is equivalent to setPosition(string.length()).
See also setPosition() and position().
sourcepub unsafe fn to_next_boundary(&self) -> c_int
pub unsafe fn to_next_boundary(&self) -> c_int
Moves the QTextBoundaryFinder to the next boundary position and returns that position.
Calls C++ function: int QTextBoundaryFinder::toNextBoundary()
.
Moves the QTextBoundaryFinder to the next boundary position and returns that position.
Returns -1 if there is no next boundary.
sourcepub unsafe fn to_previous_boundary(&self) -> c_int
pub unsafe fn to_previous_boundary(&self) -> c_int
Moves the QTextBoundaryFinder to the previous boundary position and returns that position.
Calls C++ function: int QTextBoundaryFinder::toPreviousBoundary()
.
Moves the QTextBoundaryFinder to the previous boundary position and returns that position.
Returns -1 if there is no previous boundary.
sourcepub unsafe fn to_start(&self)
pub unsafe fn to_start(&self)
Moves the finder to the start of the string. This is equivalent to setPosition(0).
Calls C++ function: void QTextBoundaryFinder::toStart()
.
Moves the finder to the start of the string. This is equivalent to setPosition(0).
See also setPosition() and position().
sourcepub unsafe fn type_(&self) -> BoundaryType
pub unsafe fn type_(&self) -> BoundaryType
Returns the type of the QTextBoundaryFinder.
Calls C++ function: QTextBoundaryFinder::BoundaryType QTextBoundaryFinder::type() const
.
Returns the type of the QTextBoundaryFinder.
Trait Implementations§
source§impl CppDeletable for QTextBoundaryFinder
impl CppDeletable for QTextBoundaryFinder
source§unsafe fn delete(&self)
unsafe fn delete(&self)
Destructs the QTextBoundaryFinder object.
Calls C++ function: [destructor] void QTextBoundaryFinder::~QTextBoundaryFinder()
.
Destructs the QTextBoundaryFinder object.