|
21 | 21 | #define FCITX_UTF8_MAX_LENGTH 6 |
22 | 22 |
|
23 | 23 | /// \brief Get utf8 string length |
24 | | -FCITXUTILS_EXPORT |
25 | | -size_t fcitx_utf8_strlen(const char *s); |
| 24 | +FCITXUTILS_EXPORT size_t fcitx_utf8_strlen(const char *s); |
26 | 25 |
|
27 | 26 | /// \brief Get UCS-4 char in the utf8 string |
28 | | -FCITXUTILS_EXPORT |
29 | | -char *fcitx_utf8_get_char(const char *in, uint32_t *chr); |
| 27 | +FCITXUTILS_EXPORT char *fcitx_utf8_get_char(const char *in, uint32_t *chr); |
30 | 28 |
|
31 | 29 | /// \brief Get the number of bytes of next character. |
32 | | -FCITXUTILS_EXPORT |
33 | | -unsigned int fcitx_utf8_char_len(const char *in); |
| 30 | +FCITXUTILS_EXPORT unsigned int fcitx_utf8_char_len(const char *in); |
34 | 31 |
|
35 | 32 | /// \brief Get the pointer to the nth character. |
36 | 33 | /// |
37 | 34 | /// This function will not touch the content for s, so const pointer |
38 | 35 | /// can be safely passed and converted. |
39 | | -FCITXUTILS_EXPORT |
40 | | -char *fcitx_utf8_get_nth_char(const char *s, uint32_t n); |
| 36 | +FCITXUTILS_EXPORT char *fcitx_utf8_get_nth_char(const char *s, uint32_t n); |
41 | 37 |
|
42 | 38 | /// \brief Check if the string is valid utf8 string. |
43 | | -FCITXUTILS_EXPORT |
44 | | -bool fcitx_utf8_check_string(const char *s); |
| 39 | +FCITXUTILS_EXPORT bool fcitx_utf8_check_string(const char *s); |
45 | 40 |
|
46 | 41 | /// \brief Get validated character. |
47 | 42 | /// |
48 | 43 | /// Returns the UCS-4 value if its valid character. Returns (uint32_t) -1 if |
49 | 44 | /// it is not a valid char, (uint32_t)-2 if length is not enough. |
50 | | -FCITXUTILS_EXPORT |
51 | | -uint32_t fcitx_utf8_get_char_validated(const char *p, int max_len, int *plen); |
| 45 | +FCITXUTILS_EXPORT uint32_t fcitx_utf8_get_char_validated(const char *p, |
| 46 | + int max_len, |
| 47 | + int *plen); |
52 | 48 |
|
53 | 49 | /// \brief Copy most byte length, but keep utf8 valid. |
54 | | -FCITXUTILS_EXPORT |
55 | | -void fcitx_utf8_strncpy(char *str, const char *s, size_t byte); |
| 50 | +FCITXUTILS_EXPORT void fcitx_utf8_strncpy(char *str, const char *s, |
| 51 | + size_t byte); |
56 | 52 |
|
57 | 53 | /// \brief Count most byte length, utf8 string length. |
58 | | -FCITXUTILS_EXPORT |
59 | | -size_t fcitx_utf8_strnlen(const char *str, size_t byte); |
| 54 | +FCITXUTILS_EXPORT size_t fcitx_utf8_strnlen(const char *str, size_t byte); |
60 | 55 |
|
61 | 56 | /// \brief Count most byte length, utf8 string length and validates the string |
62 | | -FCITXUTILS_EXPORT |
63 | | -size_t fcitx_utf8_strnlen_validated(const char *str, size_t byte); |
| 57 | +FCITXUTILS_EXPORT size_t fcitx_utf8_strnlen_validated(const char *str, |
| 58 | + size_t byte); |
64 | 59 |
|
65 | 60 | /// \brief Return the utf8 bytes of a UCS4 char. |
66 | | -FCITXUTILS_EXPORT |
67 | | -int fcitx_ucs4_char_len(uint32_t c); |
| 61 | +FCITXUTILS_EXPORT int fcitx_ucs4_char_len(uint32_t c); |
68 | 62 |
|
69 | 63 | /// \brief Convert ucs4 char to utf8, need to have enough memory for it. |
70 | | -FCITXUTILS_EXPORT |
71 | | -int fcitx_ucs4_to_utf8(uint32_t c, char *output); |
| 64 | +FCITXUTILS_EXPORT int fcitx_ucs4_to_utf8(uint32_t c, char *output); |
72 | 65 |
|
73 | 66 | #endif |
0 commit comments