10b57cec5SDimitry Andric// -*- C++ -*- 20b57cec5SDimitry Andric//===-------------------------- codecvt -----------------------------------===// 30b57cec5SDimitry Andric// 40b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 50b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 60b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 70b57cec5SDimitry Andric// 80b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 90b57cec5SDimitry Andric 100b57cec5SDimitry Andric#ifndef _LIBCPP_CODECVT 110b57cec5SDimitry Andric#define _LIBCPP_CODECVT 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric/* 140b57cec5SDimitry Andric codecvt synopsis 150b57cec5SDimitry Andric 160b57cec5SDimitry Andricnamespace std 170b57cec5SDimitry Andric{ 180b57cec5SDimitry Andric 190b57cec5SDimitry Andricenum codecvt_mode 200b57cec5SDimitry Andric{ 210b57cec5SDimitry Andric consume_header = 4, 220b57cec5SDimitry Andric generate_header = 2, 230b57cec5SDimitry Andric little_endian = 1 240b57cec5SDimitry Andric}; 250b57cec5SDimitry Andric 260b57cec5SDimitry Andrictemplate <class Elem, unsigned long Maxcode = 0x10ffff, 270b57cec5SDimitry Andric codecvt_mode Mode = (codecvt_mode)0> 280b57cec5SDimitry Andricclass codecvt_utf8 290b57cec5SDimitry Andric : public codecvt<Elem, char, mbstate_t> 300b57cec5SDimitry Andric{ 310b57cec5SDimitry Andric explicit codecvt_utf8(size_t refs = 0); 320b57cec5SDimitry Andric ~codecvt_utf8(); 330b57cec5SDimitry Andric}; 340b57cec5SDimitry Andric 350b57cec5SDimitry Andrictemplate <class Elem, unsigned long Maxcode = 0x10ffff, 360b57cec5SDimitry Andric codecvt_mode Mode = (codecvt_mode)0> 370b57cec5SDimitry Andricclass codecvt_utf16 380b57cec5SDimitry Andric : public codecvt<Elem, char, mbstate_t> 390b57cec5SDimitry Andric{ 400b57cec5SDimitry Andric explicit codecvt_utf16(size_t refs = 0); 410b57cec5SDimitry Andric ~codecvt_utf16(); 420b57cec5SDimitry Andric}; 430b57cec5SDimitry Andric 440b57cec5SDimitry Andrictemplate <class Elem, unsigned long Maxcode = 0x10ffff, 450b57cec5SDimitry Andric codecvt_mode Mode = (codecvt_mode)0> 460b57cec5SDimitry Andricclass codecvt_utf8_utf16 470b57cec5SDimitry Andric : public codecvt<Elem, char, mbstate_t> 480b57cec5SDimitry Andric{ 490b57cec5SDimitry Andric explicit codecvt_utf8_utf16(size_t refs = 0); 500b57cec5SDimitry Andric ~codecvt_utf8_utf16(); 510b57cec5SDimitry Andric}; 520b57cec5SDimitry Andric 530b57cec5SDimitry Andric} // std 540b57cec5SDimitry Andric 550b57cec5SDimitry Andric*/ 560b57cec5SDimitry Andric 570b57cec5SDimitry Andric#include <__config> 580b57cec5SDimitry Andric#include <__locale> 590b57cec5SDimitry Andric 600b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 610b57cec5SDimitry Andric#pragma GCC system_header 620b57cec5SDimitry Andric#endif 630b57cec5SDimitry Andric 640b57cec5SDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD 650b57cec5SDimitry Andric 660b57cec5SDimitry Andricenum codecvt_mode 670b57cec5SDimitry Andric{ 680b57cec5SDimitry Andric consume_header = 4, 690b57cec5SDimitry Andric generate_header = 2, 700b57cec5SDimitry Andric little_endian = 1 710b57cec5SDimitry Andric}; 720b57cec5SDimitry Andric 730b57cec5SDimitry Andric// codecvt_utf8 740b57cec5SDimitry Andric 750b57cec5SDimitry Andrictemplate <class _Elem> class __codecvt_utf8; 760b57cec5SDimitry Andric 770b57cec5SDimitry Andrictemplate <> 780b57cec5SDimitry Andricclass _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t> 790b57cec5SDimitry Andric : public codecvt<wchar_t, char, mbstate_t> 800b57cec5SDimitry Andric{ 810b57cec5SDimitry Andric unsigned long _Maxcode_; 820b57cec5SDimitry Andric codecvt_mode _Mode_; 830b57cec5SDimitry Andricpublic: 840b57cec5SDimitry Andric typedef wchar_t intern_type; 850b57cec5SDimitry Andric typedef char extern_type; 860b57cec5SDimitry Andric typedef mbstate_t state_type; 870b57cec5SDimitry Andric 880b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 890b57cec5SDimitry Andric explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode, 900b57cec5SDimitry Andric codecvt_mode _Mode) 910b57cec5SDimitry Andric : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), 920b57cec5SDimitry Andric _Mode_(_Mode) {} 930b57cec5SDimitry Andricprotected: 940b57cec5SDimitry Andric virtual result 950b57cec5SDimitry Andric do_out(state_type& __st, 960b57cec5SDimitry Andric const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 970b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 980b57cec5SDimitry Andric virtual result 990b57cec5SDimitry Andric do_in(state_type& __st, 1000b57cec5SDimitry Andric const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 1010b57cec5SDimitry Andric intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 1020b57cec5SDimitry Andric virtual result 1030b57cec5SDimitry Andric do_unshift(state_type& __st, 1040b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 1059ec406dcSDimitry Andric virtual int do_encoding() const _NOEXCEPT; 1069ec406dcSDimitry Andric virtual bool do_always_noconv() const _NOEXCEPT; 1070b57cec5SDimitry Andric virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, 1080b57cec5SDimitry Andric size_t __mx) const; 1099ec406dcSDimitry Andric virtual int do_max_length() const _NOEXCEPT; 1100b57cec5SDimitry Andric}; 1110b57cec5SDimitry Andric 112*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_PUSH 1130b57cec5SDimitry Andrictemplate <> 1140b57cec5SDimitry Andricclass _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t> 1150b57cec5SDimitry Andric : public codecvt<char16_t, char, mbstate_t> 1160b57cec5SDimitry Andric{ 1170b57cec5SDimitry Andric unsigned long _Maxcode_; 1180b57cec5SDimitry Andric codecvt_mode _Mode_; 1190b57cec5SDimitry Andricpublic: 1200b57cec5SDimitry Andric typedef char16_t intern_type; 1210b57cec5SDimitry Andric typedef char extern_type; 1220b57cec5SDimitry Andric typedef mbstate_t state_type; 1230b57cec5SDimitry Andric 1240b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1250b57cec5SDimitry Andric explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode, 1260b57cec5SDimitry Andric codecvt_mode _Mode) 1270b57cec5SDimitry Andric : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), 1280b57cec5SDimitry Andric _Mode_(_Mode) {} 129*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_POP 130*e8d8bef9SDimitry Andric 1310b57cec5SDimitry Andricprotected: 1320b57cec5SDimitry Andric virtual result 1330b57cec5SDimitry Andric do_out(state_type& __st, 1340b57cec5SDimitry Andric const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 1350b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 1360b57cec5SDimitry Andric virtual result 1370b57cec5SDimitry Andric do_in(state_type& __st, 1380b57cec5SDimitry Andric const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 1390b57cec5SDimitry Andric intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 1400b57cec5SDimitry Andric virtual result 1410b57cec5SDimitry Andric do_unshift(state_type& __st, 1420b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 1439ec406dcSDimitry Andric virtual int do_encoding() const _NOEXCEPT; 1449ec406dcSDimitry Andric virtual bool do_always_noconv() const _NOEXCEPT; 1450b57cec5SDimitry Andric virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, 1460b57cec5SDimitry Andric size_t __mx) const; 1479ec406dcSDimitry Andric virtual int do_max_length() const _NOEXCEPT; 1480b57cec5SDimitry Andric}; 1490b57cec5SDimitry Andric 150*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_PUSH 1510b57cec5SDimitry Andrictemplate <> 1520b57cec5SDimitry Andricclass _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t> 1530b57cec5SDimitry Andric : public codecvt<char32_t, char, mbstate_t> 1540b57cec5SDimitry Andric{ 1550b57cec5SDimitry Andric unsigned long _Maxcode_; 1560b57cec5SDimitry Andric codecvt_mode _Mode_; 1570b57cec5SDimitry Andricpublic: 1580b57cec5SDimitry Andric typedef char32_t intern_type; 1590b57cec5SDimitry Andric typedef char extern_type; 1600b57cec5SDimitry Andric typedef mbstate_t state_type; 1610b57cec5SDimitry Andric 1620b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1630b57cec5SDimitry Andric explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode, 1640b57cec5SDimitry Andric codecvt_mode _Mode) 1650b57cec5SDimitry Andric : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), 1660b57cec5SDimitry Andric _Mode_(_Mode) {} 167*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_POP 168*e8d8bef9SDimitry Andric 1690b57cec5SDimitry Andricprotected: 1700b57cec5SDimitry Andric virtual result 1710b57cec5SDimitry Andric do_out(state_type& __st, 1720b57cec5SDimitry Andric const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 1730b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 1740b57cec5SDimitry Andric virtual result 1750b57cec5SDimitry Andric do_in(state_type& __st, 1760b57cec5SDimitry Andric const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 1770b57cec5SDimitry Andric intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 1780b57cec5SDimitry Andric virtual result 1790b57cec5SDimitry Andric do_unshift(state_type& __st, 1800b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 1819ec406dcSDimitry Andric virtual int do_encoding() const _NOEXCEPT; 1829ec406dcSDimitry Andric virtual bool do_always_noconv() const _NOEXCEPT; 1830b57cec5SDimitry Andric virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, 1840b57cec5SDimitry Andric size_t __mx) const; 1859ec406dcSDimitry Andric virtual int do_max_length() const _NOEXCEPT; 1860b57cec5SDimitry Andric}; 1870b57cec5SDimitry Andric 1880b57cec5SDimitry Andrictemplate <class _Elem, unsigned long _Maxcode = 0x10ffff, 1890b57cec5SDimitry Andric codecvt_mode _Mode = (codecvt_mode)0> 1900b57cec5SDimitry Andricclass _LIBCPP_TEMPLATE_VIS codecvt_utf8 1910b57cec5SDimitry Andric : public __codecvt_utf8<_Elem> 1920b57cec5SDimitry Andric{ 1930b57cec5SDimitry Andricpublic: 1940b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1950b57cec5SDimitry Andric explicit codecvt_utf8(size_t __refs = 0) 1960b57cec5SDimitry Andric : __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {} 1970b57cec5SDimitry Andric 1980b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1990b57cec5SDimitry Andric ~codecvt_utf8() {} 2000b57cec5SDimitry Andric}; 2010b57cec5SDimitry Andric 2020b57cec5SDimitry Andric// codecvt_utf16 2030b57cec5SDimitry Andric 2040b57cec5SDimitry Andrictemplate <class _Elem, bool _LittleEndian> class __codecvt_utf16; 2050b57cec5SDimitry Andric 2060b57cec5SDimitry Andrictemplate <> 2070b57cec5SDimitry Andricclass _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false> 2080b57cec5SDimitry Andric : public codecvt<wchar_t, char, mbstate_t> 2090b57cec5SDimitry Andric{ 2100b57cec5SDimitry Andric unsigned long _Maxcode_; 2110b57cec5SDimitry Andric codecvt_mode _Mode_; 2120b57cec5SDimitry Andricpublic: 2130b57cec5SDimitry Andric typedef wchar_t intern_type; 2140b57cec5SDimitry Andric typedef char extern_type; 2150b57cec5SDimitry Andric typedef mbstate_t state_type; 2160b57cec5SDimitry Andric 2170b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 2180b57cec5SDimitry Andric explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode, 2190b57cec5SDimitry Andric codecvt_mode _Mode) 2200b57cec5SDimitry Andric : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), 2210b57cec5SDimitry Andric _Mode_(_Mode) {} 2220b57cec5SDimitry Andricprotected: 2230b57cec5SDimitry Andric virtual result 2240b57cec5SDimitry Andric do_out(state_type& __st, 2250b57cec5SDimitry Andric const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 2260b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 2270b57cec5SDimitry Andric virtual result 2280b57cec5SDimitry Andric do_in(state_type& __st, 2290b57cec5SDimitry Andric const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 2300b57cec5SDimitry Andric intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 2310b57cec5SDimitry Andric virtual result 2320b57cec5SDimitry Andric do_unshift(state_type& __st, 2330b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 2349ec406dcSDimitry Andric virtual int do_encoding() const _NOEXCEPT; 2359ec406dcSDimitry Andric virtual bool do_always_noconv() const _NOEXCEPT; 2360b57cec5SDimitry Andric virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, 2370b57cec5SDimitry Andric size_t __mx) const; 2389ec406dcSDimitry Andric virtual int do_max_length() const _NOEXCEPT; 2390b57cec5SDimitry Andric}; 2400b57cec5SDimitry Andric 2410b57cec5SDimitry Andrictemplate <> 2420b57cec5SDimitry Andricclass _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true> 2430b57cec5SDimitry Andric : public codecvt<wchar_t, char, mbstate_t> 2440b57cec5SDimitry Andric{ 2450b57cec5SDimitry Andric unsigned long _Maxcode_; 2460b57cec5SDimitry Andric codecvt_mode _Mode_; 2470b57cec5SDimitry Andricpublic: 2480b57cec5SDimitry Andric typedef wchar_t intern_type; 2490b57cec5SDimitry Andric typedef char extern_type; 2500b57cec5SDimitry Andric typedef mbstate_t state_type; 2510b57cec5SDimitry Andric 2520b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 2530b57cec5SDimitry Andric explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode, 2540b57cec5SDimitry Andric codecvt_mode _Mode) 2550b57cec5SDimitry Andric : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), 2560b57cec5SDimitry Andric _Mode_(_Mode) {} 2570b57cec5SDimitry Andricprotected: 2580b57cec5SDimitry Andric virtual result 2590b57cec5SDimitry Andric do_out(state_type& __st, 2600b57cec5SDimitry Andric const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 2610b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 2620b57cec5SDimitry Andric virtual result 2630b57cec5SDimitry Andric do_in(state_type& __st, 2640b57cec5SDimitry Andric const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 2650b57cec5SDimitry Andric intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 2660b57cec5SDimitry Andric virtual result 2670b57cec5SDimitry Andric do_unshift(state_type& __st, 2680b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 2699ec406dcSDimitry Andric virtual int do_encoding() const _NOEXCEPT; 2709ec406dcSDimitry Andric virtual bool do_always_noconv() const _NOEXCEPT; 2710b57cec5SDimitry Andric virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, 2720b57cec5SDimitry Andric size_t __mx) const; 2739ec406dcSDimitry Andric virtual int do_max_length() const _NOEXCEPT; 2740b57cec5SDimitry Andric}; 2750b57cec5SDimitry Andric 276*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_PUSH 2770b57cec5SDimitry Andrictemplate <> 2780b57cec5SDimitry Andricclass _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false> 2790b57cec5SDimitry Andric : public codecvt<char16_t, char, mbstate_t> 2800b57cec5SDimitry Andric{ 2810b57cec5SDimitry Andric unsigned long _Maxcode_; 2820b57cec5SDimitry Andric codecvt_mode _Mode_; 2830b57cec5SDimitry Andricpublic: 2840b57cec5SDimitry Andric typedef char16_t intern_type; 2850b57cec5SDimitry Andric typedef char extern_type; 2860b57cec5SDimitry Andric typedef mbstate_t state_type; 2870b57cec5SDimitry Andric 2880b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 2890b57cec5SDimitry Andric explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode, 2900b57cec5SDimitry Andric codecvt_mode _Mode) 2910b57cec5SDimitry Andric : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), 2920b57cec5SDimitry Andric _Mode_(_Mode) {} 293*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_POP 294*e8d8bef9SDimitry Andric 2950b57cec5SDimitry Andricprotected: 2960b57cec5SDimitry Andric virtual result 2970b57cec5SDimitry Andric do_out(state_type& __st, 2980b57cec5SDimitry Andric const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 2990b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 3000b57cec5SDimitry Andric virtual result 3010b57cec5SDimitry Andric do_in(state_type& __st, 3020b57cec5SDimitry Andric const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 3030b57cec5SDimitry Andric intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 3040b57cec5SDimitry Andric virtual result 3050b57cec5SDimitry Andric do_unshift(state_type& __st, 3060b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 3079ec406dcSDimitry Andric virtual int do_encoding() const _NOEXCEPT; 3089ec406dcSDimitry Andric virtual bool do_always_noconv() const _NOEXCEPT; 3090b57cec5SDimitry Andric virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, 3100b57cec5SDimitry Andric size_t __mx) const; 3119ec406dcSDimitry Andric virtual int do_max_length() const _NOEXCEPT; 3120b57cec5SDimitry Andric}; 3130b57cec5SDimitry Andric 314*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_PUSH 3150b57cec5SDimitry Andrictemplate <> 3160b57cec5SDimitry Andricclass _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true> 3170b57cec5SDimitry Andric : public codecvt<char16_t, char, mbstate_t> 3180b57cec5SDimitry Andric{ 3190b57cec5SDimitry Andric unsigned long _Maxcode_; 3200b57cec5SDimitry Andric codecvt_mode _Mode_; 3210b57cec5SDimitry Andricpublic: 3220b57cec5SDimitry Andric typedef char16_t intern_type; 3230b57cec5SDimitry Andric typedef char extern_type; 3240b57cec5SDimitry Andric typedef mbstate_t state_type; 3250b57cec5SDimitry Andric 3260b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 3270b57cec5SDimitry Andric explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode, 3280b57cec5SDimitry Andric codecvt_mode _Mode) 3290b57cec5SDimitry Andric : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), 3300b57cec5SDimitry Andric _Mode_(_Mode) {} 331*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_POP 332*e8d8bef9SDimitry Andric 3330b57cec5SDimitry Andricprotected: 3340b57cec5SDimitry Andric virtual result 3350b57cec5SDimitry Andric do_out(state_type& __st, 3360b57cec5SDimitry Andric const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 3370b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 3380b57cec5SDimitry Andric virtual result 3390b57cec5SDimitry Andric do_in(state_type& __st, 3400b57cec5SDimitry Andric const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 3410b57cec5SDimitry Andric intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 3420b57cec5SDimitry Andric virtual result 3430b57cec5SDimitry Andric do_unshift(state_type& __st, 3440b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 3459ec406dcSDimitry Andric virtual int do_encoding() const _NOEXCEPT; 3469ec406dcSDimitry Andric virtual bool do_always_noconv() const _NOEXCEPT; 3470b57cec5SDimitry Andric virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, 3480b57cec5SDimitry Andric size_t __mx) const; 3499ec406dcSDimitry Andric virtual int do_max_length() const _NOEXCEPT; 3500b57cec5SDimitry Andric}; 3510b57cec5SDimitry Andric 352*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_PUSH 3530b57cec5SDimitry Andrictemplate <> 3540b57cec5SDimitry Andricclass _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false> 3550b57cec5SDimitry Andric : public codecvt<char32_t, char, mbstate_t> 3560b57cec5SDimitry Andric{ 3570b57cec5SDimitry Andric unsigned long _Maxcode_; 3580b57cec5SDimitry Andric codecvt_mode _Mode_; 3590b57cec5SDimitry Andricpublic: 3600b57cec5SDimitry Andric typedef char32_t intern_type; 3610b57cec5SDimitry Andric typedef char extern_type; 3620b57cec5SDimitry Andric typedef mbstate_t state_type; 3630b57cec5SDimitry Andric 3640b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 3650b57cec5SDimitry Andric explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode, 3660b57cec5SDimitry Andric codecvt_mode _Mode) 3670b57cec5SDimitry Andric : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), 3680b57cec5SDimitry Andric _Mode_(_Mode) {} 369*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_POP 370*e8d8bef9SDimitry Andric 3710b57cec5SDimitry Andricprotected: 3720b57cec5SDimitry Andric virtual result 3730b57cec5SDimitry Andric do_out(state_type& __st, 3740b57cec5SDimitry Andric const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 3750b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 3760b57cec5SDimitry Andric virtual result 3770b57cec5SDimitry Andric do_in(state_type& __st, 3780b57cec5SDimitry Andric const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 3790b57cec5SDimitry Andric intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 3800b57cec5SDimitry Andric virtual result 3810b57cec5SDimitry Andric do_unshift(state_type& __st, 3820b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 3839ec406dcSDimitry Andric virtual int do_encoding() const _NOEXCEPT; 3849ec406dcSDimitry Andric virtual bool do_always_noconv() const _NOEXCEPT; 3850b57cec5SDimitry Andric virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, 3860b57cec5SDimitry Andric size_t __mx) const; 3879ec406dcSDimitry Andric virtual int do_max_length() const _NOEXCEPT; 3880b57cec5SDimitry Andric}; 3890b57cec5SDimitry Andric 390*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_PUSH 3910b57cec5SDimitry Andrictemplate <> 3920b57cec5SDimitry Andricclass _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true> 3930b57cec5SDimitry Andric : public codecvt<char32_t, char, mbstate_t> 3940b57cec5SDimitry Andric{ 3950b57cec5SDimitry Andric unsigned long _Maxcode_; 3960b57cec5SDimitry Andric codecvt_mode _Mode_; 3970b57cec5SDimitry Andricpublic: 3980b57cec5SDimitry Andric typedef char32_t intern_type; 3990b57cec5SDimitry Andric typedef char extern_type; 4000b57cec5SDimitry Andric typedef mbstate_t state_type; 4010b57cec5SDimitry Andric 4020b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 4030b57cec5SDimitry Andric explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode, 4040b57cec5SDimitry Andric codecvt_mode _Mode) 4050b57cec5SDimitry Andric : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), 4060b57cec5SDimitry Andric _Mode_(_Mode) {} 407*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_POP 408*e8d8bef9SDimitry Andric 4090b57cec5SDimitry Andricprotected: 4100b57cec5SDimitry Andric virtual result 4110b57cec5SDimitry Andric do_out(state_type& __st, 4120b57cec5SDimitry Andric const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 4130b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 4140b57cec5SDimitry Andric virtual result 4150b57cec5SDimitry Andric do_in(state_type& __st, 4160b57cec5SDimitry Andric const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 4170b57cec5SDimitry Andric intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 4180b57cec5SDimitry Andric virtual result 4190b57cec5SDimitry Andric do_unshift(state_type& __st, 4200b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 4219ec406dcSDimitry Andric virtual int do_encoding() const _NOEXCEPT; 4229ec406dcSDimitry Andric virtual bool do_always_noconv() const _NOEXCEPT; 4230b57cec5SDimitry Andric virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, 4240b57cec5SDimitry Andric size_t __mx) const; 4259ec406dcSDimitry Andric virtual int do_max_length() const _NOEXCEPT; 4260b57cec5SDimitry Andric}; 4270b57cec5SDimitry Andric 4280b57cec5SDimitry Andrictemplate <class _Elem, unsigned long _Maxcode = 0x10ffff, 4290b57cec5SDimitry Andric codecvt_mode _Mode = (codecvt_mode)0> 4300b57cec5SDimitry Andricclass _LIBCPP_TEMPLATE_VIS codecvt_utf16 4310b57cec5SDimitry Andric : public __codecvt_utf16<_Elem, _Mode & little_endian> 4320b57cec5SDimitry Andric{ 4330b57cec5SDimitry Andricpublic: 4340b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 4350b57cec5SDimitry Andric explicit codecvt_utf16(size_t __refs = 0) 4360b57cec5SDimitry Andric : __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {} 4370b57cec5SDimitry Andric 4380b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 4390b57cec5SDimitry Andric ~codecvt_utf16() {} 4400b57cec5SDimitry Andric}; 4410b57cec5SDimitry Andric 4420b57cec5SDimitry Andric// codecvt_utf8_utf16 4430b57cec5SDimitry Andric 4440b57cec5SDimitry Andrictemplate <class _Elem> class __codecvt_utf8_utf16; 4450b57cec5SDimitry Andric 4460b57cec5SDimitry Andrictemplate <> 4470b57cec5SDimitry Andricclass _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t> 4480b57cec5SDimitry Andric : public codecvt<wchar_t, char, mbstate_t> 4490b57cec5SDimitry Andric{ 4500b57cec5SDimitry Andric unsigned long _Maxcode_; 4510b57cec5SDimitry Andric codecvt_mode _Mode_; 4520b57cec5SDimitry Andricpublic: 4530b57cec5SDimitry Andric typedef wchar_t intern_type; 4540b57cec5SDimitry Andric typedef char extern_type; 4550b57cec5SDimitry Andric typedef mbstate_t state_type; 4560b57cec5SDimitry Andric 4570b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 4580b57cec5SDimitry Andric explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode, 4590b57cec5SDimitry Andric codecvt_mode _Mode) 4600b57cec5SDimitry Andric : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), 4610b57cec5SDimitry Andric _Mode_(_Mode) {} 4620b57cec5SDimitry Andricprotected: 4630b57cec5SDimitry Andric virtual result 4640b57cec5SDimitry Andric do_out(state_type& __st, 4650b57cec5SDimitry Andric const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 4660b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 4670b57cec5SDimitry Andric virtual result 4680b57cec5SDimitry Andric do_in(state_type& __st, 4690b57cec5SDimitry Andric const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 4700b57cec5SDimitry Andric intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 4710b57cec5SDimitry Andric virtual result 4720b57cec5SDimitry Andric do_unshift(state_type& __st, 4730b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 4749ec406dcSDimitry Andric virtual int do_encoding() const _NOEXCEPT; 4759ec406dcSDimitry Andric virtual bool do_always_noconv() const _NOEXCEPT; 4760b57cec5SDimitry Andric virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, 4770b57cec5SDimitry Andric size_t __mx) const; 4789ec406dcSDimitry Andric virtual int do_max_length() const _NOEXCEPT; 4790b57cec5SDimitry Andric}; 4800b57cec5SDimitry Andric 481*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_PUSH 4820b57cec5SDimitry Andrictemplate <> 4830b57cec5SDimitry Andricclass _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t> 4840b57cec5SDimitry Andric : public codecvt<char32_t, char, mbstate_t> 4850b57cec5SDimitry Andric{ 4860b57cec5SDimitry Andric unsigned long _Maxcode_; 4870b57cec5SDimitry Andric codecvt_mode _Mode_; 4880b57cec5SDimitry Andricpublic: 4890b57cec5SDimitry Andric typedef char32_t intern_type; 4900b57cec5SDimitry Andric typedef char extern_type; 4910b57cec5SDimitry Andric typedef mbstate_t state_type; 4920b57cec5SDimitry Andric 4930b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 4940b57cec5SDimitry Andric explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode, 4950b57cec5SDimitry Andric codecvt_mode _Mode) 4960b57cec5SDimitry Andric : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), 4970b57cec5SDimitry Andric _Mode_(_Mode) {} 498*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_POP 499*e8d8bef9SDimitry Andric 5000b57cec5SDimitry Andricprotected: 5010b57cec5SDimitry Andric virtual result 5020b57cec5SDimitry Andric do_out(state_type& __st, 5030b57cec5SDimitry Andric const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 5040b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 5050b57cec5SDimitry Andric virtual result 5060b57cec5SDimitry Andric do_in(state_type& __st, 5070b57cec5SDimitry Andric const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 5080b57cec5SDimitry Andric intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 5090b57cec5SDimitry Andric virtual result 5100b57cec5SDimitry Andric do_unshift(state_type& __st, 5110b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 5129ec406dcSDimitry Andric virtual int do_encoding() const _NOEXCEPT; 5139ec406dcSDimitry Andric virtual bool do_always_noconv() const _NOEXCEPT; 5140b57cec5SDimitry Andric virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, 5150b57cec5SDimitry Andric size_t __mx) const; 5169ec406dcSDimitry Andric virtual int do_max_length() const _NOEXCEPT; 5170b57cec5SDimitry Andric}; 5180b57cec5SDimitry Andric 519*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_PUSH 5200b57cec5SDimitry Andrictemplate <> 5210b57cec5SDimitry Andricclass _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t> 5220b57cec5SDimitry Andric : public codecvt<char16_t, char, mbstate_t> 5230b57cec5SDimitry Andric{ 5240b57cec5SDimitry Andric unsigned long _Maxcode_; 5250b57cec5SDimitry Andric codecvt_mode _Mode_; 5260b57cec5SDimitry Andricpublic: 5270b57cec5SDimitry Andric typedef char16_t intern_type; 5280b57cec5SDimitry Andric typedef char extern_type; 5290b57cec5SDimitry Andric typedef mbstate_t state_type; 5300b57cec5SDimitry Andric 5310b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 5320b57cec5SDimitry Andric explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode, 5330b57cec5SDimitry Andric codecvt_mode _Mode) 5340b57cec5SDimitry Andric : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), 5350b57cec5SDimitry Andric _Mode_(_Mode) {} 536*e8d8bef9SDimitry Andric_LIBCPP_SUPPRESS_DEPRECATED_POP 537*e8d8bef9SDimitry Andric 5380b57cec5SDimitry Andricprotected: 5390b57cec5SDimitry Andric virtual result 5400b57cec5SDimitry Andric do_out(state_type& __st, 5410b57cec5SDimitry Andric const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, 5420b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 5430b57cec5SDimitry Andric virtual result 5440b57cec5SDimitry Andric do_in(state_type& __st, 5450b57cec5SDimitry Andric const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, 5460b57cec5SDimitry Andric intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; 5470b57cec5SDimitry Andric virtual result 5480b57cec5SDimitry Andric do_unshift(state_type& __st, 5490b57cec5SDimitry Andric extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; 5509ec406dcSDimitry Andric virtual int do_encoding() const _NOEXCEPT; 5519ec406dcSDimitry Andric virtual bool do_always_noconv() const _NOEXCEPT; 5520b57cec5SDimitry Andric virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, 5530b57cec5SDimitry Andric size_t __mx) const; 5549ec406dcSDimitry Andric virtual int do_max_length() const _NOEXCEPT; 5550b57cec5SDimitry Andric}; 5560b57cec5SDimitry Andric 5570b57cec5SDimitry Andrictemplate <class _Elem, unsigned long _Maxcode = 0x10ffff, 5580b57cec5SDimitry Andric codecvt_mode _Mode = (codecvt_mode)0> 5590b57cec5SDimitry Andricclass _LIBCPP_TEMPLATE_VIS codecvt_utf8_utf16 5600b57cec5SDimitry Andric : public __codecvt_utf8_utf16<_Elem> 5610b57cec5SDimitry Andric{ 5620b57cec5SDimitry Andricpublic: 5630b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 5640b57cec5SDimitry Andric explicit codecvt_utf8_utf16(size_t __refs = 0) 5650b57cec5SDimitry Andric : __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {} 5660b57cec5SDimitry Andric 5670b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 5680b57cec5SDimitry Andric ~codecvt_utf8_utf16() {} 5690b57cec5SDimitry Andric}; 5700b57cec5SDimitry Andric 5710b57cec5SDimitry Andric_LIBCPP_END_NAMESPACE_STD 5720b57cec5SDimitry Andric 5730b57cec5SDimitry Andric#endif // _LIBCPP_CODECVT 574