Refactor headers
[wimlib] / include / wimlib / encoding.h
1 #ifndef _WIMLIB_ENCODING_H
2 #define _WIMLIB_ENCODING_H
3
4 #include "wimlib/types.h"
5
6 extern void
7 iconv_global_cleanup(void);
8
9 extern bool wimlib_mbs_is_utf8;
10
11 #define DECLARE_CHAR_CONVERSION_FUNCTIONS(varname1, varname2,           \
12                                           chartype1, chartype2)         \
13                                                                         \
14 extern int                                                              \
15 varname1##_to_##varname2(const chartype1 *in, size_t in_nbytes,         \
16                          chartype2 **out_ret,                           \
17                          size_t *out_nbytes_ret);                       \
18                                                                         \
19 extern int                                                              \
20 varname1##_to_##varname2##_nbytes(const chartype1 *in, size_t in_nbytes,\
21                                   size_t *out_nbytes_ret);              \
22                                                                         \
23 extern int                                                              \
24 varname1##_to_##varname2##_buf(const chartype1 *in, size_t in_nbytes,   \
25                                chartype2 *out);
26
27
28 #if !TCHAR_IS_UTF16LE
29 DECLARE_CHAR_CONVERSION_FUNCTIONS(utf16le, tstr, utf16lechar, tchar);
30 DECLARE_CHAR_CONVERSION_FUNCTIONS(tstr, utf16le, tchar, utf16lechar);
31 #endif
32
33 extern int
34 utf8_to_tstr_simple(const char *utf8str, tchar **out);
35
36 extern int
37 tstr_to_utf8_simple(const tchar *tstr, char **out);
38
39 #endif /* _WIMLIB_ENCODING_H */