1 | //===-- Definition of a class for mbstate_t and conversion -----*-- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLVM_LIBC_SRC___SUPPORT_CHARACTER_CONVERTER_H |
10 | #define LLVM_LIBC_SRC___SUPPORT_CHARACTER_CONVERTER_H |
11 | |
12 | #include "hdr/types/char32_t.h" |
13 | #include "hdr/types/char8_t.h" |
14 | #include "src/__support/wchar/mbstate.h" |
15 | #include "src/__support/wchar/utf_ret.h" |
16 | |
17 | namespace LIBC_NAMESPACE_DECL { |
18 | namespace internal { |
19 | |
20 | class CharacterConverter { |
21 | private: |
22 | mbstate *state; |
23 | |
24 | public: |
25 | CharacterConverter(mbstate *mbstate); |
26 | |
27 | bool isComplete(); |
28 | |
29 | int push(char8_t utf8_byte); |
30 | int push(char32_t utf32); |
31 | |
32 | utf_ret<char8_t> pop_utf8(); |
33 | utf_ret<char32_t> pop_utf32(); |
34 | }; |
35 | |
36 | } // namespace internal |
37 | } // namespace LIBC_NAMESPACE_DECL |
38 | |
39 | #endif // LLVM_LIBC_SRC___SUPPORT_CHARACTER_CONVERTER_H |
40 | |