Home | History | Annotate | Line # | Download | only in include
      1 // -*- C++ -*-
      2 //===-------------------------- codecvt -----------------------------------===//
      3 //
      4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
      5 // See https://llvm.org/LICENSE.txt for license information.
      6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 #ifndef _LIBCPP_CODECVT
     11 #define _LIBCPP_CODECVT
     12 
     13 /*
     14     codecvt synopsis
     15 
     16 namespace std
     17 {
     18 
     19 enum codecvt_mode
     20 {
     21     consume_header = 4,
     22     generate_header = 2,
     23     little_endian = 1
     24 };
     25 
     26 template <class Elem, unsigned long Maxcode = 0x10ffff,
     27           codecvt_mode Mode = (codecvt_mode)0>
     28 class codecvt_utf8
     29     : public codecvt<Elem, char, mbstate_t>
     30 {
     31     explicit codecvt_utf8(size_t refs = 0);
     32     ~codecvt_utf8();
     33 };
     34 
     35 template <class Elem, unsigned long Maxcode = 0x10ffff,
     36           codecvt_mode Mode = (codecvt_mode)0>
     37 class codecvt_utf16
     38     : public codecvt<Elem, char, mbstate_t>
     39 {
     40     explicit codecvt_utf16(size_t refs = 0);
     41     ~codecvt_utf16();
     42 };
     43 
     44 template <class Elem, unsigned long Maxcode = 0x10ffff,
     45           codecvt_mode Mode = (codecvt_mode)0>
     46 class codecvt_utf8_utf16
     47     : public codecvt<Elem, char, mbstate_t>
     48 {
     49     explicit codecvt_utf8_utf16(size_t refs = 0);
     50     ~codecvt_utf8_utf16();
     51 };
     52 
     53 }  // std
     54 
     55 */
     56 
     57 #include <__config>
     58 #include <__locale>
     59 
     60 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
     61 #pragma GCC system_header
     62 #endif
     63 
     64 _LIBCPP_BEGIN_NAMESPACE_STD
     65 
     66 enum codecvt_mode
     67 {
     68     consume_header = 4,
     69     generate_header = 2,
     70     little_endian = 1
     71 };
     72 
     73 // codecvt_utf8
     74 
     75 template <class _Elem> class __codecvt_utf8;
     76 
     77 template <>
     78 class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t>
     79     : public codecvt<wchar_t, char, mbstate_t>
     80 {
     81     unsigned long _Maxcode_;
     82     codecvt_mode _Mode_;
     83 public:
     84     typedef wchar_t   intern_type;
     85     typedef char      extern_type;
     86     typedef mbstate_t state_type;
     87 
     88     _LIBCPP_INLINE_VISIBILITY
     89     explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
     90                             codecvt_mode _Mode)
     91         : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
     92           _Mode_(_Mode) {}
     93 protected:
     94     virtual result
     95         do_out(state_type& __st,
     96                const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
     97                extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
     98     virtual result
     99         do_in(state_type& __st,
    100               const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
    101               intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
    102     virtual result
    103         do_unshift(state_type& __st,
    104                    extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    105     virtual int do_encoding() const _NOEXCEPT;
    106     virtual bool do_always_noconv() const _NOEXCEPT;
    107     virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
    108                           size_t __mx) const;
    109     virtual int do_max_length() const _NOEXCEPT;
    110 };
    111 
    112 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
    113 template <>
    114 class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
    115     : public codecvt<char16_t, char, mbstate_t>
    116 {
    117     unsigned long _Maxcode_;
    118     codecvt_mode _Mode_;
    119 public:
    120     typedef char16_t  intern_type;
    121     typedef char      extern_type;
    122     typedef mbstate_t state_type;
    123 
    124     _LIBCPP_INLINE_VISIBILITY
    125     explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
    126                             codecvt_mode _Mode)
    127         : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
    128           _Mode_(_Mode) {}
    129 _LIBCPP_SUPPRESS_DEPRECATED_POP
    130 
    131 protected:
    132     virtual result
    133         do_out(state_type& __st,
    134                const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
    135                extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    136     virtual result
    137         do_in(state_type& __st,
    138               const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
    139               intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
    140     virtual result
    141         do_unshift(state_type& __st,
    142                    extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    143     virtual int do_encoding() const _NOEXCEPT;
    144     virtual bool do_always_noconv() const _NOEXCEPT;
    145     virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
    146                           size_t __mx) const;
    147     virtual int do_max_length() const _NOEXCEPT;
    148 };
    149 
    150 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
    151 template <>
    152 class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
    153     : public codecvt<char32_t, char, mbstate_t>
    154 {
    155     unsigned long _Maxcode_;
    156     codecvt_mode _Mode_;
    157 public:
    158     typedef char32_t  intern_type;
    159     typedef char      extern_type;
    160     typedef mbstate_t state_type;
    161 
    162     _LIBCPP_INLINE_VISIBILITY
    163     explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
    164                             codecvt_mode _Mode)
    165         : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
    166           _Mode_(_Mode) {}
    167 _LIBCPP_SUPPRESS_DEPRECATED_POP
    168 
    169 protected:
    170     virtual result
    171         do_out(state_type& __st,
    172                const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
    173                extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    174     virtual result
    175         do_in(state_type& __st,
    176               const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
    177               intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
    178     virtual result
    179         do_unshift(state_type& __st,
    180                    extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    181     virtual int do_encoding() const _NOEXCEPT;
    182     virtual bool do_always_noconv() const _NOEXCEPT;
    183     virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
    184                           size_t __mx) const;
    185     virtual int do_max_length() const _NOEXCEPT;
    186 };
    187 
    188 template <class _Elem, unsigned long _Maxcode = 0x10ffff,
    189           codecvt_mode _Mode = (codecvt_mode)0>
    190 class _LIBCPP_TEMPLATE_VIS codecvt_utf8
    191     : public __codecvt_utf8<_Elem>
    192 {
    193 public:
    194     _LIBCPP_INLINE_VISIBILITY
    195     explicit codecvt_utf8(size_t __refs = 0)
    196         : __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
    197 
    198     _LIBCPP_INLINE_VISIBILITY
    199     ~codecvt_utf8() {}
    200 };
    201 
    202 // codecvt_utf16
    203 
    204 template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
    205 
    206 template <>
    207 class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false>
    208     : public codecvt<wchar_t, char, mbstate_t>
    209 {
    210     unsigned long _Maxcode_;
    211     codecvt_mode _Mode_;
    212 public:
    213     typedef wchar_t   intern_type;
    214     typedef char      extern_type;
    215     typedef mbstate_t state_type;
    216 
    217     _LIBCPP_INLINE_VISIBILITY
    218     explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
    219                             codecvt_mode _Mode)
    220         : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
    221           _Mode_(_Mode) {}
    222 protected:
    223     virtual result
    224         do_out(state_type& __st,
    225                const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
    226                extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    227     virtual result
    228         do_in(state_type& __st,
    229               const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
    230               intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
    231     virtual result
    232         do_unshift(state_type& __st,
    233                    extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    234     virtual int do_encoding() const _NOEXCEPT;
    235     virtual bool do_always_noconv() const _NOEXCEPT;
    236     virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
    237                           size_t __mx) const;
    238     virtual int do_max_length() const _NOEXCEPT;
    239 };
    240 
    241 template <>
    242 class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true>
    243     : public codecvt<wchar_t, char, mbstate_t>
    244 {
    245     unsigned long _Maxcode_;
    246     codecvt_mode _Mode_;
    247 public:
    248     typedef wchar_t   intern_type;
    249     typedef char      extern_type;
    250     typedef mbstate_t state_type;
    251 
    252     _LIBCPP_INLINE_VISIBILITY
    253     explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
    254                             codecvt_mode _Mode)
    255         : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
    256           _Mode_(_Mode) {}
    257 protected:
    258     virtual result
    259         do_out(state_type& __st,
    260                const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
    261                extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    262     virtual result
    263         do_in(state_type& __st,
    264               const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
    265               intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
    266     virtual result
    267         do_unshift(state_type& __st,
    268                    extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    269     virtual int do_encoding() const _NOEXCEPT;
    270     virtual bool do_always_noconv() const _NOEXCEPT;
    271     virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
    272                           size_t __mx) const;
    273     virtual int do_max_length() const _NOEXCEPT;
    274 };
    275 
    276 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
    277 template <>
    278 class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
    279     : public codecvt<char16_t, char, mbstate_t>
    280 {
    281     unsigned long _Maxcode_;
    282     codecvt_mode _Mode_;
    283 public:
    284     typedef char16_t  intern_type;
    285     typedef char      extern_type;
    286     typedef mbstate_t state_type;
    287 
    288     _LIBCPP_INLINE_VISIBILITY
    289     explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
    290                             codecvt_mode _Mode)
    291         : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
    292           _Mode_(_Mode) {}
    293 _LIBCPP_SUPPRESS_DEPRECATED_POP
    294 
    295 protected:
    296     virtual result
    297         do_out(state_type& __st,
    298                const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
    299                extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    300     virtual result
    301         do_in(state_type& __st,
    302               const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
    303               intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
    304     virtual result
    305         do_unshift(state_type& __st,
    306                    extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    307     virtual int do_encoding() const _NOEXCEPT;
    308     virtual bool do_always_noconv() const _NOEXCEPT;
    309     virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
    310                           size_t __mx) const;
    311     virtual int do_max_length() const _NOEXCEPT;
    312 };
    313 
    314 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
    315 template <>
    316 class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
    317     : public codecvt<char16_t, char, mbstate_t>
    318 {
    319     unsigned long _Maxcode_;
    320     codecvt_mode _Mode_;
    321 public:
    322     typedef char16_t  intern_type;
    323     typedef char      extern_type;
    324     typedef mbstate_t state_type;
    325 
    326     _LIBCPP_INLINE_VISIBILITY
    327     explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
    328                             codecvt_mode _Mode)
    329         : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
    330           _Mode_(_Mode) {}
    331 _LIBCPP_SUPPRESS_DEPRECATED_POP
    332 
    333 protected:
    334     virtual result
    335         do_out(state_type& __st,
    336                const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
    337                extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    338     virtual result
    339         do_in(state_type& __st,
    340               const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
    341               intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
    342     virtual result
    343         do_unshift(state_type& __st,
    344                    extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    345     virtual int do_encoding() const _NOEXCEPT;
    346     virtual bool do_always_noconv() const _NOEXCEPT;
    347     virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
    348                           size_t __mx) const;
    349     virtual int do_max_length() const _NOEXCEPT;
    350 };
    351 
    352 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
    353 template <>
    354 class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
    355     : public codecvt<char32_t, char, mbstate_t>
    356 {
    357     unsigned long _Maxcode_;
    358     codecvt_mode _Mode_;
    359 public:
    360     typedef char32_t  intern_type;
    361     typedef char      extern_type;
    362     typedef mbstate_t state_type;
    363 
    364     _LIBCPP_INLINE_VISIBILITY
    365     explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
    366                             codecvt_mode _Mode)
    367         : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
    368           _Mode_(_Mode) {}
    369 _LIBCPP_SUPPRESS_DEPRECATED_POP
    370 
    371 protected:
    372     virtual result
    373         do_out(state_type& __st,
    374                const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
    375                extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    376     virtual result
    377         do_in(state_type& __st,
    378               const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
    379               intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
    380     virtual result
    381         do_unshift(state_type& __st,
    382                    extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    383     virtual int do_encoding() const _NOEXCEPT;
    384     virtual bool do_always_noconv() const _NOEXCEPT;
    385     virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
    386                           size_t __mx) const;
    387     virtual int do_max_length() const _NOEXCEPT;
    388 };
    389 
    390 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
    391 template <>
    392 class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
    393     : public codecvt<char32_t, char, mbstate_t>
    394 {
    395     unsigned long _Maxcode_;
    396     codecvt_mode _Mode_;
    397 public:
    398     typedef char32_t  intern_type;
    399     typedef char      extern_type;
    400     typedef mbstate_t state_type;
    401 
    402     _LIBCPP_INLINE_VISIBILITY
    403     explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
    404                             codecvt_mode _Mode)
    405         : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
    406           _Mode_(_Mode) {}
    407 _LIBCPP_SUPPRESS_DEPRECATED_POP
    408 
    409 protected:
    410     virtual result
    411         do_out(state_type& __st,
    412                const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
    413                extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    414     virtual result
    415         do_in(state_type& __st,
    416               const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
    417               intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
    418     virtual result
    419         do_unshift(state_type& __st,
    420                    extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    421     virtual int do_encoding() const _NOEXCEPT;
    422     virtual bool do_always_noconv() const _NOEXCEPT;
    423     virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
    424                           size_t __mx) const;
    425     virtual int do_max_length() const _NOEXCEPT;
    426 };
    427 
    428 template <class _Elem, unsigned long _Maxcode = 0x10ffff,
    429           codecvt_mode _Mode = (codecvt_mode)0>
    430 class _LIBCPP_TEMPLATE_VIS codecvt_utf16
    431     : public __codecvt_utf16<_Elem, _Mode & little_endian>
    432 {
    433 public:
    434     _LIBCPP_INLINE_VISIBILITY
    435     explicit codecvt_utf16(size_t __refs = 0)
    436         : __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
    437 
    438     _LIBCPP_INLINE_VISIBILITY
    439     ~codecvt_utf16() {}
    440 };
    441 
    442 // codecvt_utf8_utf16
    443 
    444 template <class _Elem> class __codecvt_utf8_utf16;
    445 
    446 template <>
    447 class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t>
    448     : public codecvt<wchar_t, char, mbstate_t>
    449 {
    450     unsigned long _Maxcode_;
    451     codecvt_mode _Mode_;
    452 public:
    453     typedef wchar_t   intern_type;
    454     typedef char      extern_type;
    455     typedef mbstate_t state_type;
    456 
    457     _LIBCPP_INLINE_VISIBILITY
    458     explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
    459                             codecvt_mode _Mode)
    460         : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
    461           _Mode_(_Mode) {}
    462 protected:
    463     virtual result
    464         do_out(state_type& __st,
    465                const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
    466                extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    467     virtual result
    468         do_in(state_type& __st,
    469               const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
    470               intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
    471     virtual result
    472         do_unshift(state_type& __st,
    473                    extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    474     virtual int do_encoding() const _NOEXCEPT;
    475     virtual bool do_always_noconv() const _NOEXCEPT;
    476     virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
    477                           size_t __mx) const;
    478     virtual int do_max_length() const _NOEXCEPT;
    479 };
    480 
    481 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
    482 template <>
    483 class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
    484     : public codecvt<char32_t, char, mbstate_t>
    485 {
    486     unsigned long _Maxcode_;
    487     codecvt_mode _Mode_;
    488 public:
    489     typedef char32_t  intern_type;
    490     typedef char      extern_type;
    491     typedef mbstate_t state_type;
    492 
    493     _LIBCPP_INLINE_VISIBILITY
    494     explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
    495                             codecvt_mode _Mode)
    496         : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
    497           _Mode_(_Mode) {}
    498 _LIBCPP_SUPPRESS_DEPRECATED_POP
    499 
    500 protected:
    501     virtual result
    502         do_out(state_type& __st,
    503                const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
    504                extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    505     virtual result
    506         do_in(state_type& __st,
    507               const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
    508               intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
    509     virtual result
    510         do_unshift(state_type& __st,
    511                    extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    512     virtual int do_encoding() const _NOEXCEPT;
    513     virtual bool do_always_noconv() const _NOEXCEPT;
    514     virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
    515                           size_t __mx) const;
    516     virtual int do_max_length() const _NOEXCEPT;
    517 };
    518 
    519 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
    520 template <>
    521 class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
    522     : public codecvt<char16_t, char, mbstate_t>
    523 {
    524     unsigned long _Maxcode_;
    525     codecvt_mode _Mode_;
    526 public:
    527     typedef char16_t  intern_type;
    528     typedef char      extern_type;
    529     typedef mbstate_t state_type;
    530 
    531     _LIBCPP_INLINE_VISIBILITY
    532     explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
    533                             codecvt_mode _Mode)
    534         : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
    535           _Mode_(_Mode) {}
    536 _LIBCPP_SUPPRESS_DEPRECATED_POP
    537 
    538 protected:
    539     virtual result
    540         do_out(state_type& __st,
    541                const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
    542                extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    543     virtual result
    544         do_in(state_type& __st,
    545               const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
    546               intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
    547     virtual result
    548         do_unshift(state_type& __st,
    549                    extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
    550     virtual int do_encoding() const _NOEXCEPT;
    551     virtual bool do_always_noconv() const _NOEXCEPT;
    552     virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
    553                           size_t __mx) const;
    554     virtual int do_max_length() const _NOEXCEPT;
    555 };
    556 
    557 template <class _Elem, unsigned long _Maxcode = 0x10ffff,
    558           codecvt_mode _Mode = (codecvt_mode)0>
    559 class _LIBCPP_TEMPLATE_VIS codecvt_utf8_utf16
    560     : public __codecvt_utf8_utf16<_Elem>
    561 {
    562 public:
    563     _LIBCPP_INLINE_VISIBILITY
    564     explicit codecvt_utf8_utf16(size_t __refs = 0)
    565         : __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
    566 
    567     _LIBCPP_INLINE_VISIBILITY
    568     ~codecvt_utf8_utf16() {}
    569 };
    570 
    571 _LIBCPP_END_NAMESPACE_STD
    572 
    573 #endif // _LIBCPP_CODECVT
    574