Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkBreakIterator_icu Class Reference
Inheritance diagram for SkBreakIterator_icu:
SkBreakIterator

Public Member Functions

 SkBreakIterator_icu (ICUBreakIterator iter)
 
Position first () override
 
Position current () override
 
Position next () override
 
Status status () override
 
bool isDone () override
 
bool setText (const char utftext8[], int utf8Units) override
 
bool setText (const char16_t utftext16[], int utf16Units) override
 
- Public Member Functions inherited from SkBreakIterator
virtual ~SkBreakIterator ()=default
 
virtual Position first ()=0
 
virtual Position current ()=0
 
virtual Position next ()=0
 
virtual Status status ()=0
 
virtual bool isDone ()=0
 
virtual bool setText (const char utftext8[], int utf8Units)=0
 
virtual bool setText (const char16_t utftext16[], int utf16Units)=0
 

Additional Inherited Members

- Public Types inherited from SkBreakIterator
typedef int32_t Position
 
typedef int32_t Status
 

Detailed Description

Definition at line 99 of file SkUnicode_icu.cpp.

Constructor & Destructor Documentation

◆ SkBreakIterator_icu()

SkBreakIterator_icu::SkBreakIterator_icu ( ICUBreakIterator  iter)
inlineexplicit

Definition at line 103 of file SkUnicode_icu.cpp.

104 : fBreakIterator(std::move(iter))
105 , fLastResult(0) {}

Member Function Documentation

◆ current()

Position SkBreakIterator_icu::current ( )
inlineoverridevirtual

Implements SkBreakIterator.

Definition at line 107 of file SkUnicode_icu.cpp.

107{ return fLastResult = sk_ubrk_current(fBreakIterator.get()); }

◆ first()

Position SkBreakIterator_icu::first ( )
inlineoverridevirtual

Implements SkBreakIterator.

Definition at line 106 of file SkUnicode_icu.cpp.

106{ return fLastResult = sk_ubrk_first(fBreakIterator.get()); }

◆ isDone()

bool SkBreakIterator_icu::isDone ( )
inlineoverridevirtual

Implements SkBreakIterator.

Definition at line 110 of file SkUnicode_icu.cpp.

110{ return fLastResult == UBRK_DONE; }

◆ next()

Position SkBreakIterator_icu::next ( )
inlineoverridevirtual

Implements SkBreakIterator.

Definition at line 108 of file SkUnicode_icu.cpp.

108{ return fLastResult = sk_ubrk_next(fBreakIterator.get()); }

◆ setText() [1/2]

bool SkBreakIterator_icu::setText ( const char  utftext8[],
int  utf8Units 
)
inlineoverridevirtual

Implements SkBreakIterator.

Definition at line 112 of file SkUnicode_icu.cpp.

112 {
113 UErrorCode status = U_ZERO_ERROR;
114 ICUUText text(sk_utext_openUTF8(nullptr, &utftext8[0], utf8Units, &status));
115
116 if (U_FAILURE(status)) {
117 SkDEBUGF("Break error: %s", sk_u_errorName(status));
118 return false;
119 }
120 SkASSERT(text);
121 sk_ubrk_setUText(fBreakIterator.get(), text.get(), &status);
122 if (U_FAILURE(status)) {
123 SkDEBUGF("Break error: %s", sk_u_errorName(status));
124 return false;
125 }
126 fLastResult = 0;
127 return true;
128 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define SkDEBUGF(...)
Definition: SkDebug.h:24
std::unique_ptr< UText, SkFunctionObject< utext_close_wrapper > > ICUUText
Status status() override
std::u16string text

◆ setText() [2/2]

bool SkBreakIterator_icu::setText ( const char16_t  utftext16[],
int  utf16Units 
)
inlineoverridevirtual

Implements SkBreakIterator.

Definition at line 129 of file SkUnicode_icu.cpp.

129 {
130 UErrorCode status = U_ZERO_ERROR;
131 ICUUText text(sk_utext_openUChars(nullptr, reinterpret_cast<const UChar*>(&utftext16[0]),
132 utf16Units, &status));
133
134 if (U_FAILURE(status)) {
135 SkDEBUGF("Break error: %s", sk_u_errorName(status));
136 return false;
137 }
138 SkASSERT(text);
139 sk_ubrk_setUText(fBreakIterator.get(), text.get(), &status);
140 if (U_FAILURE(status)) {
141 SkDEBUGF("Break error: %s", sk_u_errorName(status));
142 return false;
143 }
144 fLastResult = 0;
145 return true;
146 }

◆ status()

Status SkBreakIterator_icu::status ( )
inlineoverridevirtual

Implements SkBreakIterator.

Definition at line 109 of file SkUnicode_icu.cpp.

109{ return sk_ubrk_getRuleStatus(fBreakIterator.get()); }

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