rename __call__ to mf in cython.mf
[liba.git] / include / a / utf.h
blobeaf47651f1a41075e73ec9cef9ec162a1e565f1f
1 /*!
2 @file utf.h
3 @brief Unicode Transformation Format
4 | Unicode | UTF-8 |
5 |---------|-------|
6 | U+0000000 ~ U+0000007F | 0XXXXXXX |
7 | U+0000080 ~ U+000007FF | 110XXXXX 10XXXXXX |
8 | U+0000800 ~ U+0000FFFF | 1110XXXX 10XXXXXX 10XXXXXX |
9 | U+0010000 ~ U+001FFFFF | 11110XXX 10XXXXXX 10XXXXXX 10XXXXXX |
10 | U+0200000 ~ U+03FFFFFF | 111110XX 10XXXXXX 10XXXXXX 10XXXXXX 10XXXXXX |
11 | U+4000000 ~ U+7FFFFFFF | 1111110X 10XXXXXX 10XXXXXX 10XXXXXX 10XXXXXX 10XXXXXX |
14 #ifndef LIBA_UTF_H
15 #define LIBA_UTF_H
17 #include "a.h"
19 /*!
20 @ingroup A
21 @addtogroup A_UTF Unicode Transformation Format
25 #if defined(__cplusplus)
26 extern "C" {
27 #endif /* __cplusplus */
29 /*!
30 @brief encode one unicode code point into UTF-8
31 @param[in] str a buffer to store a UTF-8 character
32 @param[in] val the unicode value to be encoded
33 @return offset to the next character
35 A_EXTERN unsigned int a_utf_encode(void *str, a_u32 val);
37 /*!
38 @brief decode one unicode code point from UTF-8
39 @param[in] str string terminated with a null character
40 @param[in,out] val a pointer to a variable that stores unicode
41 @return offset to the next character
42 @retval 0 null character or invalid
44 A_EXTERN unsigned int a_utf_decode(void const *str, a_u32 *val);
46 /*!
47 @brief length of a UTF-8 string terminated with a null character
48 @param[in] str string terminated with a null character
49 @return length of the UTF-8 string
51 A_EXTERN a_size a_utf_length(void const *str);
52 #define a_utf_len(str) a_utf_length(str)
54 #if defined(__cplusplus)
55 } /* extern "C" */
56 #endif /* __cplusplus */
58 /*! @} A_UTF */
60 #endif /* a/utf.h */