Kanzi  3.9.6
Kanzi Engine API
kanzi::TextBreakIterator Class Reference

#include <kanzi/core.ui/text/text_break_iterator.hpp>

Public Types

enum  Type { Type::Word, Type::Line }
 Type of text break iterator. More...
 

Public Member Functions

char32_t char32At (size_t offset) const
 Returns the UTF-32 Unicode codepoint at the given offset. More...
 
size_t current () const
 Returns the current position of the iterator. More...
 
size_t first ()
 Sets the iterator position to the beginning of the string. More...
 
size_t following (size_t offset)
 Sets the iterator to the first boundary that follows the given offset. More...
 
size_t last ()
 Sets the iterator position to after the last character of the string. More...
 
size_t next ()
 Advance the iterator to the next boundary. More...
 
TextBreakIteratoroperator= (TextBreakIterator &&) noexcept
 Move assignment. More...
 
size_t preceding (size_t offset)
 Sets the iterator to the first boundary that precedes the given offset. More...
 
size_t previous ()
 Advance the iterator to the previous boundary. More...
 
 TextBreakIterator (Type type, const char *utf8String, int64_t utf8Length)
 Constructs a text break iterator for a UTF-8 string. More...
 
 TextBreakIterator (Type type, const char16_t *utf16String, int64_t utf16Length)
 Constructs a text break iterator for a UTF-16 string. More...
 
 TextBreakIterator (TextBreakIterator &&) noexcept
 Move constructor. More...
 
 ~TextBreakIterator ()
 TextBreakIterator destructor. More...
 

Static Public Attributes

static constexpr auto s_done
 Value indicating that all boundaries have been returned. More...
 

Member Enumeration Documentation

◆ Type

Type of text break iterator.

Enumerator
Word 

Iterate word boundaries.

Line 

Iterate line breaks.

Constructor & Destructor Documentation

◆ TextBreakIterator() [1/3]

kanzi::TextBreakIterator::TextBreakIterator ( Type  type,
const char *  utf8String,
int64_t  utf8Length 
)
explicit

Constructs a text break iterator for a UTF-8 string.

Indexes returned by TextBreakIterator refer to the elements in the original character array.

Parameters
typeType of the text break iterator.
utf8StringString in UTF-8 format.
utf8LengthA length of the given string. If the string is 0-terminated, -1.

◆ TextBreakIterator() [2/3]

kanzi::TextBreakIterator::TextBreakIterator ( Type  type,
const char16_t *  utf16String,
int64_t  utf16Length 
)
explicit

Constructs a text break iterator for a UTF-16 string.

Indexes returned by TextBreakIterator refer to the elements in the original character array.

Parameters
typeType of the text break iterator.
utf16StringString in UTF-16 format.
utf16LengthA length of the given string. If the string is 0-terminated, -1.

◆ TextBreakIterator() [3/3]

kanzi::TextBreakIterator::TextBreakIterator ( TextBreakIterator &&  )
noexcept

Move constructor.

◆ ~TextBreakIterator()

kanzi::TextBreakIterator::~TextBreakIterator ( )

TextBreakIterator destructor.

Member Function Documentation

◆ operator=()

TextBreakIterator& kanzi::TextBreakIterator::operator= ( TextBreakIterator &&  )
noexcept

Move assignment.

◆ first()

size_t kanzi::TextBreakIterator::first ( )

Sets the iterator position to the beginning of the string.

Returns
New iterator position (zero).

◆ last()

size_t kanzi::TextBreakIterator::last ( )

Sets the iterator position to after the last character of the string.

Returns
New iterator position.

◆ next()

size_t kanzi::TextBreakIterator::next ( )

Advance the iterator to the next boundary.

Returns
New iterator position. If all boundaries have already been returned, returns s_done.

◆ previous()

size_t kanzi::TextBreakIterator::previous ( )

Advance the iterator to the previous boundary.

Returns
New iterator position. If all boundaries have already been returned, returns s_done.

◆ current()

size_t kanzi::TextBreakIterator::current ( ) const

Returns the current position of the iterator.

Returns
Current position of the iterator.

◆ preceding()

size_t kanzi::TextBreakIterator::preceding ( size_t  offset)

Sets the iterator to the first boundary that precedes the given offset.

Parameters
offsetA character offset in the original character array.
Returns
New iterator position. If all boundaries have already been returned, returns s_done.

◆ following()

size_t kanzi::TextBreakIterator::following ( size_t  offset)

Sets the iterator to the first boundary that follows the given offset.

Parameters
offsetA character offset in the original character array.
Returns
New iterator position. If all boundaries have already been returned, returns s_done.

◆ char32At()

char32_t kanzi::TextBreakIterator::char32At ( size_t  offset) const

Returns the UTF-32 Unicode codepoint at the given offset.

Parameters
offsetA character offset in the original character array.
Returns
UTF-32 Unicode codepoint at the given offset.

Member Data Documentation

◆ s_done

constexpr auto kanzi::TextBreakIterator::s_done
static

Value indicating that all boundaries have been returned.


The documentation for this class was generated from the following file: