Flutter Engine
The Flutter Engine
Classes | Namespaces | Macros | Typedefs | Functions
SkUnicode_icu.cpp File Reference
#include "modules/skunicode/include/SkUnicode_icu.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkMutex.h"
#include "include/private/base/SkSpan_impl.h"
#include "include/private/base/SkTArray.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/base/SkTo.h"
#include "modules/skunicode/include/SkUnicode.h"
#include "modules/skunicode/src/SkBidiFactory_icu_full.h"
#include "modules/skunicode/src/SkUnicode_icu_bidi.h"
#include "modules/skunicode/src/SkUnicode_icupriv.h"
#include "src/base/SkBitmaskEnum.h"
#include "src/base/SkUTF.h"
#include "src/core/SkChecksum.h"
#include "src/core/SkTHash.h"
#include <unicode/ubrk.h>
#include <unicode/uchar.h>
#include <unicode/uloc.h>
#include <unicode/umachine.h>
#include <unicode/utext.h>
#include <unicode/utypes.h>
#include <cstdint>
#include <cstring>
#include <functional>
#include <memory>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

class  SkBreakIterator_icu
 
class  SkIcuBreakIteratorCache
 
struct  SkIcuBreakIteratorCache::Request::Hash
 
class  SkUnicode_icu
 

Namespaces

namespace  SkUnicodes
 
namespace  SkUnicodes::ICU
 

Macros

#define SKICU_FUNC(funcname)
 

Typedefs

using ICUUText = std::unique_ptr< UText, SkFunctionObject< utext_close_wrapper > >
 
using ICUBreakIterator = std::unique_ptr< UBreakIterator, SkFunctionObject< ubrk_close_wrapper > >
 

Functions

const SkICULibSkGetICULib ()
 
static SKICU_EMIT_FUNCS UBreakIterator * sk_ubrk_clone (const UBreakIterator *bi, UErrorCode *status)
 
static UText * utext_close_wrapper (UText *ut)
 
static void ubrk_close_wrapper (UBreakIterator *bi)
 
static SkUnichar utf8_next (const char **ptr, const char *end)
 
static UBreakIteratorType convertType (SkUnicode::BreakType type)
 
SKUNICODE_API sk_sp< SkUnicodeSkUnicodes::ICU::Make ()
 

Macro Definition Documentation

◆ SKICU_FUNC

#define SKICU_FUNC (   funcname)
Value:
template <typename... Args> \
auto sk_##funcname(Args&&... args) -> decltype(funcname(std::forward<Args>(args)...)) { \
return SkGetICULib()->f_##funcname(std::forward<Args>(args)...); \
} \
const SkICULib * SkGetICULib()
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

Definition at line 55 of file SkUnicode_icu.cpp.

Typedef Documentation

◆ ICUBreakIterator

using ICUBreakIterator = std::unique_ptr<UBreakIterator, SkFunctionObject<ubrk_close_wrapper> >

Definition at line 80 of file SkUnicode_icu.cpp.

◆ ICUUText

using ICUUText = std::unique_ptr<UText, SkFunctionObject<utext_close_wrapper> >

Definition at line 79 of file SkUnicode_icu.cpp.

Function Documentation

◆ convertType()

static UBreakIteratorType convertType ( SkUnicode::BreakType  type)
static

Definition at line 87 of file SkUnicode_icu.cpp.

87 {
88 switch (type) {
89 case SkUnicode::BreakType::kLines: return UBRK_LINE;
90 case SkUnicode::BreakType::kGraphemes: return UBRK_CHARACTER;
91 case SkUnicode::BreakType::kWords: return UBRK_WORD;
93 return UBRK_SENTENCE;
94 default:
95 return UBRK_CHARACTER;
96 }
97}
GLenum type

◆ sk_ubrk_clone()

static SKICU_EMIT_FUNCS UBreakIterator * sk_ubrk_clone ( const UBreakIterator *  bi,
UErrorCode *  status 
)
inlinestatic

Definition at line 64 of file SkUnicode_icu.cpp.

64 {
65 const auto* icu = SkGetICULib();
66 SkASSERT(icu->f_ubrk_clone_ || icu->f_ubrk_safeClone_);
67 return icu->f_ubrk_clone_
68 ? icu->f_ubrk_clone_(bi, status)
69 : icu->f_ubrk_safeClone_(bi, nullptr, nullptr, status);
70}
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ SkGetICULib()

const SkICULib * SkGetICULib ( )

Definition at line 49 of file SkUnicode_icu.cpp.

49 {
50 static const auto gICU = SkLoadICULib();
51 return gICU.get();
52}
std::unique_ptr< SkICULib > SkLoadICULib()

◆ ubrk_close_wrapper()

static void ubrk_close_wrapper ( UBreakIterator *  bi)
static

Definition at line 75 of file SkUnicode_icu.cpp.

75 {
76 sk_ubrk_close(bi);
77}

◆ utext_close_wrapper()

static UText * utext_close_wrapper ( UText *  ut)
static

Definition at line 72 of file SkUnicode_icu.cpp.

72 {
73 return sk_utext_close(ut);
74}

◆ utf8_next()

static SkUnichar utf8_next ( const char **  ptr,
const char *  end 
)
inlinestatic

Replaces invalid utf-8 sequences with REPLACEMENT CHARACTER U+FFFD.

Definition at line 82 of file SkUnicode_icu.cpp.

82 {
83 SkUnichar val = SkUTF::NextUTF8(ptr, end);
84 return val < 0 ? 0xFFFD : val;
85}
int32_t SkUnichar
Definition: SkTypes.h:175
glong glong end
SK_SPI SkUnichar NextUTF8(const char **ptr, const char *end)
Definition: SkUTF.cpp:118