Flutter Engine
The Flutter Engine
Functions
word_boundaries.cpp File Reference
#include "include/core/SkTypes.h"
#include "modules/skplaintexteditor/src/word_boundaries.h"
#include "modules/skunicode/include/SkUnicode.h"
#include <memory>

Go to the source code of this file.

Functions

std::vector< bool > GetUtf8WordBoundaries (const char *begin, size_t byteCount, const char *locale)
 

Function Documentation

◆ GetUtf8WordBoundaries()

std::vector< bool > GetUtf8WordBoundaries ( const char *  begin,
size_t  byteCount,
const char *  locale 
)

Definition at line 43 of file word_boundaries.cpp.

43 {
44 auto unicode = get_unicode();
45 if (nullptr == unicode) {
46 return {};
47 }
48 std::vector<SkUnicode::Position> positions;
49 if (!unicode->getWords(begin, byteCount, locale, &positions) || byteCount == 0) {
50 return {};
51 }
52 std::vector<bool> result;
53 result.resize(byteCount);
54 for (auto& pos : positions) {
55 result[pos] = true;
56 }
57 return result;
58}
SkPoint pos
sk_sp< SkUnicode > get_unicode()
static const char * begin(const StringSlice &s)
Definition: editor.cpp:252
GAsyncResult * result