blob: ece8abd5f224b2c37ad61c0808ad99e3f89559d7 [file] [log] [blame]
Florin Malita40f3db42021-07-27 14:02:28 -04001/*
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_icu_DEFINED
8#define SkUnicode_icu_DEFINED
9
10#include <unicode/ubidi.h>
11#include <unicode/ubrk.h>
12#include <unicode/uscript.h>
13#include <unicode/ustring.h>
14#include <unicode/utext.h>
15#include <unicode/utypes.h>
16
17#include "include/private/SkTemplates.h"
18
19#define SKICU_EMIT_FUNCS \
20 SKICU_FUNC(u_errorName) \
21 SKICU_FUNC(u_getIntPropertyValue) \
22 SKICU_FUNC(u_iscntrl) \
23 SKICU_FUNC(u_isspace) \
24 SKICU_FUNC(u_isWhitespace) \
25 SKICU_FUNC(ubidi_close) \
26 SKICU_FUNC(ubidi_getLength) \
27 SKICU_FUNC(ubidi_getLevelAt) \
28 SKICU_FUNC(ubidi_openSized) \
29 SKICU_FUNC(ubidi_reorderVisual) \
30 SKICU_FUNC(ubidi_setPara) \
31 SKICU_FUNC(ubrk_close) \
32 SKICU_FUNC(ubrk_current) \
33 SKICU_FUNC(ubrk_first) \
34 SKICU_FUNC(ubrk_following) \
35 SKICU_FUNC(ubrk_getRuleStatus) \
36 SKICU_FUNC(ubrk_next) \
37 SKICU_FUNC(ubrk_open) \
38 SKICU_FUNC(ubrk_preceding) \
39 SKICU_FUNC(ubrk_setText) \
40 SKICU_FUNC(ubrk_setUText) \
41 SKICU_FUNC(uloc_getDefault) \
42 SKICU_FUNC(uscript_getScript) \
43 SKICU_FUNC(utext_close) \
44 SKICU_FUNC(utext_openUChars) \
45 SKICU_FUNC(utext_openUTF8) \
46
47#define SKICU_FUNC(funcname) decltype(funcname)* f_##funcname;
48struct SkICULib {
49 SKICU_EMIT_FUNCS
50
51 // ubrk_clone added as draft in ICU69 and Android API 31 (first ICU NDK).
52 // ubrk_safeClone deprecated in ICU69 and not exposed by Android.
53 UBreakIterator* (*f_ubrk_clone_)(const UBreakIterator*, UErrorCode*);
54 UBreakIterator* (*f_ubrk_safeClone_)(const UBreakIterator*, void*, int32_t*, UErrorCode*);
55};
56#undef SKICU_FUNC
57
58// Platform/config specific ICU factory.
59std::unique_ptr<SkICULib> SkLoadICULib();
60
61#endif // SkUnicode_icu_DEFINED