1 /* 2 * Copyright 2021 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 #ifndef SkUnicode_icupriv_DEFINED 8 #define SkUnicode_icupriv_DEFINED 9 10 #include <unicode/ubidi.h> 11 #include <unicode/ubrk.h> 12 #include <unicode/uchar.h> 13 #include <unicode/uloc.h> 14 #include <unicode/uscript.h> 15 #include <unicode/ustring.h> 16 #include <unicode/utext.h> 17 #include <unicode/utypes.h> 18 #include <cstdint> 19 #include <memory> 20 21 #define SKICU_EMIT_FUNCS \ 22 SKICU_FUNC(u_errorName) \ 23 SKICU_FUNC(u_hasBinaryProperty) \ 24 SKICU_FUNC(u_getIntPropertyValue) \ 25 SKICU_FUNC(u_iscntrl) \ 26 SKICU_FUNC(u_isspace) \ 27 SKICU_FUNC(u_isWhitespace) \ 28 SKICU_FUNC(u_strToUpper) \ 29 SKICU_FUNC(ubidi_close) \ 30 SKICU_FUNC(ubidi_getDirection) \ 31 SKICU_FUNC(ubidi_getLength) \ 32 SKICU_FUNC(ubidi_getLevelAt) \ 33 SKICU_FUNC(ubidi_openSized) \ 34 SKICU_FUNC(ubidi_reorderVisual) \ 35 SKICU_FUNC(ubidi_setPara) \ 36 SKICU_FUNC(ubrk_close) \ 37 SKICU_FUNC(ubrk_current) \ 38 SKICU_FUNC(ubrk_first) \ 39 SKICU_FUNC(ubrk_following) \ 40 SKICU_FUNC(ubrk_getRuleStatus) \ 41 SKICU_FUNC(ubrk_next) \ 42 SKICU_FUNC(ubrk_open) \ 43 SKICU_FUNC(ubrk_preceding) \ 44 SKICU_FUNC(ubrk_setText) \ 45 SKICU_FUNC(ubrk_setUText) \ 46 SKICU_FUNC(uloc_forLanguageTag) \ 47 SKICU_FUNC(uloc_getDefault) \ 48 SKICU_FUNC(uscript_getScript) \ 49 SKICU_FUNC(utext_close) \ 50 SKICU_FUNC(utext_openUChars) \ 51 SKICU_FUNC(utext_openUTF8) \ 52 53 #define SKICU_FUNC(funcname) decltype(funcname)* f_##funcname; 54 struct SkICULib { 55 SKICU_EMIT_FUNCS 56 57 // ubrk_clone added as draft in ICU69 and Android API 31 (first ICU NDK). 58 // ubrk_safeClone deprecated in ICU69 and not exposed by Android. 59 UBreakIterator* (*f_ubrk_clone_)(const UBreakIterator*, UErrorCode*); 60 UBreakIterator* (*f_ubrk_safeClone_)(const UBreakIterator*, void*, int32_t*, UErrorCode*); 61 62 // ubrk_getLocaleByType not exposed by Android. 63 const char* (*f_ubrk_getLocaleByType)(const UBreakIterator*, ULocDataLocaleType, UErrorCode*); 64 }; 65 #undef SKICU_FUNC 66 67 // Platform/config specific ICU factory. 68 std::unique_ptr<SkICULib> SkLoadICULib(); 69 70 // Get cached already loaded ICU library. 71 const SkICULib* SkGetICULib(); 72 73 #endif // SkUnicode_icupriv_DEFINED 74