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

Public Member Functions

 SkBreakIterator_libgrapheme (SkUnicode_libgrapheme *unicode)
 
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 238 of file SkUnicode_libgrapheme.cpp.

Constructor & Destructor Documentation

◆ SkBreakIterator_libgrapheme()

SkBreakIterator_libgrapheme::SkBreakIterator_libgrapheme ( SkUnicode_libgrapheme unicode)
inlineexplicit

Definition at line 244 of file SkUnicode_libgrapheme.cpp.

244: fUnicode(unicode) { }

Member Function Documentation

◆ current()

Position SkBreakIterator_libgrapheme::current ( )
inlineoverridevirtual

Implements SkBreakIterator.

Definition at line 247 of file SkUnicode_libgrapheme.cpp.

248 { return fLineBreaks[fLineBreakIndex].pos; }

◆ first()

Position SkBreakIterator_libgrapheme::first ( )
inlineoverridevirtual

Implements SkBreakIterator.

Definition at line 245 of file SkUnicode_libgrapheme.cpp.

246 { return fLineBreaks[(fLineBreakIndex = 0)].pos; }
SkPoint pos

◆ isDone()

bool SkBreakIterator_libgrapheme::isDone ( )
inlineoverridevirtual

Implements SkBreakIterator.

Definition at line 257 of file SkUnicode_libgrapheme.cpp.

257{ return fLineBreaks[fLineBreakIndex].pos == kDone; }

◆ next()

Position SkBreakIterator_libgrapheme::next ( )
inlineoverridevirtual

Implements SkBreakIterator.

Definition at line 249 of file SkUnicode_libgrapheme.cpp.

250 { return fLineBreaks[++fLineBreakIndex].pos; }

◆ setText() [1/2]

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

Implements SkBreakIterator.

Definition at line 258 of file SkUnicode_libgrapheme.cpp.

258 {
259 fLineBreaks.clear();
260 size_t lineBreak = 0;
261 // first() must always go to the beginning of the string.
262 fLineBreaks.emplace_back(0, SkUnicode::LineBreakType::kHardLineBreak);
263 for (size_t pos = 0; pos < utf8Units;) {
264 pos += grapheme_next_line_break_utf8(utftext8 + pos, utf8Units - pos);
265 auto codePoint = utftext8[pos];
266 fLineBreaks.emplace_back(pos,
267 fUnicode->isHardBreak(codePoint)
270 }
271 // There is always an "end" which signals "done".
272 fLineBreaks.emplace_back(kDone, SkUnicode::LineBreakType::kHardLineBreak);
273 fLineBreakIndex = 0;
274 return true;
275 }
bool isHardBreak(SkUnichar utf8) override

◆ setText() [2/2]

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

Implements SkBreakIterator.

Definition at line 276 of file SkUnicode_libgrapheme.cpp.

276 {
277 SkASSERT(false);
278 return false;
279 }
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ status()

Status SkBreakIterator_libgrapheme::status ( )
inlineoverridevirtual

Implements SkBreakIterator.

Definition at line 251 of file SkUnicode_libgrapheme.cpp.

251 {
252 return fLineBreaks[fLineBreakIndex].breakType ==
254 ? SkUnicode::CodeUnitFlags::kHardLineBreakBefore
255 : SkUnicode::CodeUnitFlags::kSoftLineBreakBefore;
256 }

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