Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/c++/v1/codecvt is written in an unsupported language. File is not indexed.

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP_CODECVT
0011 #define _LIBCPP_CODECVT
0012 
0013 /*
0014     codecvt synopsis
0015 
0016 namespace std
0017 {
0018 
0019 enum codecvt_mode
0020 {
0021     consume_header = 4,
0022     generate_header = 2,
0023     little_endian = 1
0024 };
0025 
0026 template <class Elem, unsigned long Maxcode = 0x10ffff,
0027           codecvt_mode Mode = (codecvt_mode)0>
0028 class codecvt_utf8
0029     : public codecvt<Elem, char, mbstate_t>
0030 {
0031     explicit codecvt_utf8(size_t refs = 0);
0032     ~codecvt_utf8();
0033 };
0034 
0035 template <class Elem, unsigned long Maxcode = 0x10ffff,
0036           codecvt_mode Mode = (codecvt_mode)0>
0037 class codecvt_utf16
0038     : public codecvt<Elem, char, mbstate_t>
0039 {
0040     explicit codecvt_utf16(size_t refs = 0);
0041     ~codecvt_utf16();
0042 };
0043 
0044 template <class Elem, unsigned long Maxcode = 0x10ffff,
0045           codecvt_mode Mode = (codecvt_mode)0>
0046 class codecvt_utf8_utf16
0047     : public codecvt<Elem, char, mbstate_t>
0048 {
0049     explicit codecvt_utf8_utf16(size_t refs = 0);
0050     ~codecvt_utf8_utf16();
0051 };
0052 
0053 }  // std
0054 
0055 */
0056 
0057 #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0058 #  include <__cxx03/codecvt>
0059 #else
0060 #  include <__config>
0061 
0062 #  if _LIBCPP_HAS_LOCALIZATION
0063 
0064 #    include <__locale>
0065 #    include <version>
0066 
0067 #    if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0068 #      pragma GCC system_header
0069 #    endif
0070 
0071 #    if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT)
0072 
0073 _LIBCPP_BEGIN_NAMESPACE_STD
0074 
0075 enum _LIBCPP_DEPRECATED_IN_CXX17 codecvt_mode { consume_header = 4, generate_header = 2, little_endian = 1 };
0076 
0077 // codecvt_utf8
0078 
0079 template <class _Elem>
0080 class __codecvt_utf8;
0081 
0082 #      if _LIBCPP_HAS_WIDE_CHARACTERS
0083 template <>
0084 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<wchar_t> : public codecvt<wchar_t, char, mbstate_t> {
0085   unsigned long __maxcode_;
0086   _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0087   codecvt_mode __mode_;
0088   _LIBCPP_SUPPRESS_DEPRECATED_POP
0089 
0090 public:
0091   typedef wchar_t intern_type;
0092   typedef char extern_type;
0093   typedef mbstate_t state_type;
0094 
0095   _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0096   _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
0097       : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
0098   _LIBCPP_SUPPRESS_DEPRECATED_POP
0099 
0100 protected:
0101   result do_out(state_type& __st,
0102                 const intern_type* __frm,
0103                 const intern_type* __frm_end,
0104                 const intern_type*& __frm_nxt,
0105                 extern_type* __to,
0106                 extern_type* __to_end,
0107                 extern_type*& __to_nxt) const override;
0108   result do_in(state_type& __st,
0109                const extern_type* __frm,
0110                const extern_type* __frm_end,
0111                const extern_type*& __frm_nxt,
0112                intern_type* __to,
0113                intern_type* __to_end,
0114                intern_type*& __to_nxt) const override;
0115   result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
0116   int do_encoding() const _NOEXCEPT override;
0117   bool do_always_noconv() const _NOEXCEPT override;
0118   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
0119   int do_max_length() const _NOEXCEPT override;
0120 };
0121 #      endif // _LIBCPP_HAS_WIDE_CHARACTERS
0122 
0123 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0124 template <>
0125 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<char16_t> : public codecvt<char16_t, char, mbstate_t> {
0126   unsigned long __maxcode_;
0127   codecvt_mode __mode_;
0128 
0129 public:
0130   typedef char16_t intern_type;
0131   typedef char extern_type;
0132   typedef mbstate_t state_type;
0133 
0134   _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
0135       : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
0136   _LIBCPP_SUPPRESS_DEPRECATED_POP
0137 
0138 protected:
0139   result do_out(state_type& __st,
0140                 const intern_type* __frm,
0141                 const intern_type* __frm_end,
0142                 const intern_type*& __frm_nxt,
0143                 extern_type* __to,
0144                 extern_type* __to_end,
0145                 extern_type*& __to_nxt) const override;
0146   result do_in(state_type& __st,
0147                const extern_type* __frm,
0148                const extern_type* __frm_end,
0149                const extern_type*& __frm_nxt,
0150                intern_type* __to,
0151                intern_type* __to_end,
0152                intern_type*& __to_nxt) const override;
0153   result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
0154   int do_encoding() const _NOEXCEPT override;
0155   bool do_always_noconv() const _NOEXCEPT override;
0156   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
0157   int do_max_length() const _NOEXCEPT override;
0158 };
0159 
0160 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0161 template <>
0162 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<char32_t> : public codecvt<char32_t, char, mbstate_t> {
0163   unsigned long __maxcode_;
0164   codecvt_mode __mode_;
0165 
0166 public:
0167   typedef char32_t intern_type;
0168   typedef char extern_type;
0169   typedef mbstate_t state_type;
0170 
0171   _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
0172       : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
0173   _LIBCPP_SUPPRESS_DEPRECATED_POP
0174 
0175 protected:
0176   result do_out(state_type& __st,
0177                 const intern_type* __frm,
0178                 const intern_type* __frm_end,
0179                 const intern_type*& __frm_nxt,
0180                 extern_type* __to,
0181                 extern_type* __to_end,
0182                 extern_type*& __to_nxt) const override;
0183   result do_in(state_type& __st,
0184                const extern_type* __frm,
0185                const extern_type* __frm_end,
0186                const extern_type*& __frm_nxt,
0187                intern_type* __to,
0188                intern_type* __to_end,
0189                intern_type*& __to_nxt) const override;
0190   result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
0191   int do_encoding() const _NOEXCEPT override;
0192   bool do_always_noconv() const _NOEXCEPT override;
0193   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
0194   int do_max_length() const _NOEXCEPT override;
0195 };
0196 
0197 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0198 template <class _Elem, unsigned long _Maxcode = 0x10ffff, codecvt_mode _Mode = (codecvt_mode)0>
0199 class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8 : public __codecvt_utf8<_Elem> {
0200 public:
0201   _LIBCPP_HIDE_FROM_ABI explicit codecvt_utf8(size_t __refs = 0) : __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
0202 
0203   _LIBCPP_HIDE_FROM_ABI ~codecvt_utf8() {}
0204 };
0205 _LIBCPP_SUPPRESS_DEPRECATED_POP
0206 
0207 // codecvt_utf16
0208 
0209 template <class _Elem, bool _LittleEndian>
0210 class __codecvt_utf16;
0211 
0212 #      if _LIBCPP_HAS_WIDE_CHARACTERS
0213 template <>
0214 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<wchar_t, false> : public codecvt<wchar_t, char, mbstate_t> {
0215   unsigned long __maxcode_;
0216   _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0217   codecvt_mode __mode_;
0218   _LIBCPP_SUPPRESS_DEPRECATED_POP
0219 
0220 public:
0221   typedef wchar_t intern_type;
0222   typedef char extern_type;
0223   typedef mbstate_t state_type;
0224 
0225   _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0226   _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
0227       : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
0228   _LIBCPP_SUPPRESS_DEPRECATED_POP
0229 
0230 protected:
0231   result do_out(state_type& __st,
0232                 const intern_type* __frm,
0233                 const intern_type* __frm_end,
0234                 const intern_type*& __frm_nxt,
0235                 extern_type* __to,
0236                 extern_type* __to_end,
0237                 extern_type*& __to_nxt) const override;
0238   result do_in(state_type& __st,
0239                const extern_type* __frm,
0240                const extern_type* __frm_end,
0241                const extern_type*& __frm_nxt,
0242                intern_type* __to,
0243                intern_type* __to_end,
0244                intern_type*& __to_nxt) const override;
0245   result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
0246   int do_encoding() const _NOEXCEPT override;
0247   bool do_always_noconv() const _NOEXCEPT override;
0248   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
0249   int do_max_length() const _NOEXCEPT override;
0250 };
0251 
0252 template <>
0253 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<wchar_t, true> : public codecvt<wchar_t, char, mbstate_t> {
0254   unsigned long __maxcode_;
0255   _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0256   codecvt_mode __mode_;
0257   _LIBCPP_SUPPRESS_DEPRECATED_POP
0258 
0259 public:
0260   typedef wchar_t intern_type;
0261   typedef char extern_type;
0262   typedef mbstate_t state_type;
0263 
0264   _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0265   _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
0266       : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
0267   _LIBCPP_SUPPRESS_DEPRECATED_POP
0268 
0269 protected:
0270   result do_out(state_type& __st,
0271                 const intern_type* __frm,
0272                 const intern_type* __frm_end,
0273                 const intern_type*& __frm_nxt,
0274                 extern_type* __to,
0275                 extern_type* __to_end,
0276                 extern_type*& __to_nxt) const override;
0277   result do_in(state_type& __st,
0278                const extern_type* __frm,
0279                const extern_type* __frm_end,
0280                const extern_type*& __frm_nxt,
0281                intern_type* __to,
0282                intern_type* __to_end,
0283                intern_type*& __to_nxt) const override;
0284   result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
0285   int do_encoding() const _NOEXCEPT override;
0286   bool do_always_noconv() const _NOEXCEPT override;
0287   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
0288   int do_max_length() const _NOEXCEPT override;
0289 };
0290 #      endif // _LIBCPP_HAS_WIDE_CHARACTERS
0291 
0292 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0293 template <>
0294 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char16_t, false> : public codecvt<char16_t, char, mbstate_t> {
0295   unsigned long __maxcode_;
0296   codecvt_mode __mode_;
0297 
0298 public:
0299   typedef char16_t intern_type;
0300   typedef char extern_type;
0301   typedef mbstate_t state_type;
0302 
0303   _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
0304       : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
0305   _LIBCPP_SUPPRESS_DEPRECATED_POP
0306 
0307 protected:
0308   result do_out(state_type& __st,
0309                 const intern_type* __frm,
0310                 const intern_type* __frm_end,
0311                 const intern_type*& __frm_nxt,
0312                 extern_type* __to,
0313                 extern_type* __to_end,
0314                 extern_type*& __to_nxt) const override;
0315   result do_in(state_type& __st,
0316                const extern_type* __frm,
0317                const extern_type* __frm_end,
0318                const extern_type*& __frm_nxt,
0319                intern_type* __to,
0320                intern_type* __to_end,
0321                intern_type*& __to_nxt) const override;
0322   result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
0323   int do_encoding() const _NOEXCEPT override;
0324   bool do_always_noconv() const _NOEXCEPT override;
0325   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
0326   int do_max_length() const _NOEXCEPT override;
0327 };
0328 
0329 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0330 template <>
0331 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char16_t, true> : public codecvt<char16_t, char, mbstate_t> {
0332   unsigned long __maxcode_;
0333   codecvt_mode __mode_;
0334 
0335 public:
0336   typedef char16_t intern_type;
0337   typedef char extern_type;
0338   typedef mbstate_t state_type;
0339 
0340   _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
0341       : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
0342   _LIBCPP_SUPPRESS_DEPRECATED_POP
0343 
0344 protected:
0345   result do_out(state_type& __st,
0346                 const intern_type* __frm,
0347                 const intern_type* __frm_end,
0348                 const intern_type*& __frm_nxt,
0349                 extern_type* __to,
0350                 extern_type* __to_end,
0351                 extern_type*& __to_nxt) const override;
0352   result do_in(state_type& __st,
0353                const extern_type* __frm,
0354                const extern_type* __frm_end,
0355                const extern_type*& __frm_nxt,
0356                intern_type* __to,
0357                intern_type* __to_end,
0358                intern_type*& __to_nxt) const override;
0359   result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
0360   int do_encoding() const _NOEXCEPT override;
0361   bool do_always_noconv() const _NOEXCEPT override;
0362   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
0363   int do_max_length() const _NOEXCEPT override;
0364 };
0365 
0366 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0367 template <>
0368 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char32_t, false> : public codecvt<char32_t, char, mbstate_t> {
0369   unsigned long __maxcode_;
0370   codecvt_mode __mode_;
0371 
0372 public:
0373   typedef char32_t intern_type;
0374   typedef char extern_type;
0375   typedef mbstate_t state_type;
0376 
0377   _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
0378       : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
0379   _LIBCPP_SUPPRESS_DEPRECATED_POP
0380 
0381 protected:
0382   result do_out(state_type& __st,
0383                 const intern_type* __frm,
0384                 const intern_type* __frm_end,
0385                 const intern_type*& __frm_nxt,
0386                 extern_type* __to,
0387                 extern_type* __to_end,
0388                 extern_type*& __to_nxt) const override;
0389   result do_in(state_type& __st,
0390                const extern_type* __frm,
0391                const extern_type* __frm_end,
0392                const extern_type*& __frm_nxt,
0393                intern_type* __to,
0394                intern_type* __to_end,
0395                intern_type*& __to_nxt) const override;
0396   result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
0397   int do_encoding() const _NOEXCEPT override;
0398   bool do_always_noconv() const _NOEXCEPT override;
0399   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
0400   int do_max_length() const _NOEXCEPT override;
0401 };
0402 
0403 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0404 template <>
0405 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char32_t, true> : public codecvt<char32_t, char, mbstate_t> {
0406   unsigned long __maxcode_;
0407   codecvt_mode __mode_;
0408 
0409 public:
0410   typedef char32_t intern_type;
0411   typedef char extern_type;
0412   typedef mbstate_t state_type;
0413 
0414   _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
0415       : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
0416   _LIBCPP_SUPPRESS_DEPRECATED_POP
0417 
0418 protected:
0419   result do_out(state_type& __st,
0420                 const intern_type* __frm,
0421                 const intern_type* __frm_end,
0422                 const intern_type*& __frm_nxt,
0423                 extern_type* __to,
0424                 extern_type* __to_end,
0425                 extern_type*& __to_nxt) const override;
0426   result do_in(state_type& __st,
0427                const extern_type* __frm,
0428                const extern_type* __frm_end,
0429                const extern_type*& __frm_nxt,
0430                intern_type* __to,
0431                intern_type* __to_end,
0432                intern_type*& __to_nxt) const override;
0433   result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
0434   int do_encoding() const _NOEXCEPT override;
0435   bool do_always_noconv() const _NOEXCEPT override;
0436   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
0437   int do_max_length() const _NOEXCEPT override;
0438 };
0439 
0440 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0441 template <class _Elem, unsigned long _Maxcode = 0x10ffff, codecvt_mode _Mode = (codecvt_mode)0>
0442 class _LIBCPP_TEMPLATE_VIS
0443 _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf16 : public __codecvt_utf16<_Elem, _Mode & little_endian> {
0444 public:
0445   _LIBCPP_HIDE_FROM_ABI explicit codecvt_utf16(size_t __refs = 0)
0446       : __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
0447 
0448   _LIBCPP_HIDE_FROM_ABI ~codecvt_utf16() {}
0449 };
0450 _LIBCPP_SUPPRESS_DEPRECATED_POP
0451 
0452 // codecvt_utf8_utf16
0453 
0454 template <class _Elem>
0455 class __codecvt_utf8_utf16;
0456 
0457 #      if _LIBCPP_HAS_WIDE_CHARACTERS
0458 template <>
0459 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<wchar_t> : public codecvt<wchar_t, char, mbstate_t> {
0460   unsigned long __maxcode_;
0461   _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0462   codecvt_mode __mode_;
0463   _LIBCPP_SUPPRESS_DEPRECATED_POP
0464 
0465 public:
0466   typedef wchar_t intern_type;
0467   typedef char extern_type;
0468   typedef mbstate_t state_type;
0469 
0470   _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0471   _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
0472       : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
0473   _LIBCPP_SUPPRESS_DEPRECATED_POP
0474 
0475 protected:
0476   result do_out(state_type& __st,
0477                 const intern_type* __frm,
0478                 const intern_type* __frm_end,
0479                 const intern_type*& __frm_nxt,
0480                 extern_type* __to,
0481                 extern_type* __to_end,
0482                 extern_type*& __to_nxt) const override;
0483   result do_in(state_type& __st,
0484                const extern_type* __frm,
0485                const extern_type* __frm_end,
0486                const extern_type*& __frm_nxt,
0487                intern_type* __to,
0488                intern_type* __to_end,
0489                intern_type*& __to_nxt) const override;
0490   result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
0491   int do_encoding() const _NOEXCEPT override;
0492   bool do_always_noconv() const _NOEXCEPT override;
0493   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
0494   int do_max_length() const _NOEXCEPT override;
0495 };
0496 #      endif // _LIBCPP_HAS_WIDE_CHARACTERS
0497 
0498 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0499 template <>
0500 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<char32_t> : public codecvt<char32_t, char, mbstate_t> {
0501   unsigned long __maxcode_;
0502   codecvt_mode __mode_;
0503 
0504 public:
0505   typedef char32_t intern_type;
0506   typedef char extern_type;
0507   typedef mbstate_t state_type;
0508 
0509   _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
0510       : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
0511   _LIBCPP_SUPPRESS_DEPRECATED_POP
0512 
0513 protected:
0514   result do_out(state_type& __st,
0515                 const intern_type* __frm,
0516                 const intern_type* __frm_end,
0517                 const intern_type*& __frm_nxt,
0518                 extern_type* __to,
0519                 extern_type* __to_end,
0520                 extern_type*& __to_nxt) const override;
0521   result do_in(state_type& __st,
0522                const extern_type* __frm,
0523                const extern_type* __frm_end,
0524                const extern_type*& __frm_nxt,
0525                intern_type* __to,
0526                intern_type* __to_end,
0527                intern_type*& __to_nxt) const override;
0528   result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
0529   int do_encoding() const _NOEXCEPT override;
0530   bool do_always_noconv() const _NOEXCEPT override;
0531   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
0532   int do_max_length() const _NOEXCEPT override;
0533 };
0534 
0535 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0536 template <>
0537 class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<char16_t> : public codecvt<char16_t, char, mbstate_t> {
0538   unsigned long __maxcode_;
0539   codecvt_mode __mode_;
0540 
0541 public:
0542   typedef char16_t intern_type;
0543   typedef char extern_type;
0544   typedef mbstate_t state_type;
0545 
0546   _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
0547       : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
0548   _LIBCPP_SUPPRESS_DEPRECATED_POP
0549 
0550 protected:
0551   result do_out(state_type& __st,
0552                 const intern_type* __frm,
0553                 const intern_type* __frm_end,
0554                 const intern_type*& __frm_nxt,
0555                 extern_type* __to,
0556                 extern_type* __to_end,
0557                 extern_type*& __to_nxt) const override;
0558   result do_in(state_type& __st,
0559                const extern_type* __frm,
0560                const extern_type* __frm_end,
0561                const extern_type*& __frm_nxt,
0562                intern_type* __to,
0563                intern_type* __to_end,
0564                intern_type*& __to_nxt) const override;
0565   result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
0566   int do_encoding() const _NOEXCEPT override;
0567   bool do_always_noconv() const _NOEXCEPT override;
0568   int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
0569   int do_max_length() const _NOEXCEPT override;
0570 };
0571 
0572 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0573 template <class _Elem, unsigned long _Maxcode = 0x10ffff, codecvt_mode _Mode = (codecvt_mode)0>
0574 class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8_utf16 : public __codecvt_utf8_utf16<_Elem> {
0575 public:
0576   _LIBCPP_HIDE_FROM_ABI explicit codecvt_utf8_utf16(size_t __refs = 0)
0577       : __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
0578 
0579   _LIBCPP_HIDE_FROM_ABI ~codecvt_utf8_utf16() {}
0580 };
0581 _LIBCPP_SUPPRESS_DEPRECATED_POP
0582 
0583 _LIBCPP_END_NAMESPACE_STD
0584 
0585 #    endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT)
0586 
0587 #  endif // _LIBCPP_HAS_LOCALIZATION
0588 
0589 #  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0590 #    include <atomic>
0591 #    include <concepts>
0592 #    include <cstddef>
0593 #    include <cstdlib>
0594 #    include <cstring>
0595 #    include <initializer_list>
0596 #    include <iosfwd>
0597 #    include <limits>
0598 #    include <mutex>
0599 #    include <new>
0600 #    include <stdexcept>
0601 #    include <type_traits>
0602 #    include <typeinfo>
0603 #  endif
0604 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0605 
0606 #endif // _LIBCPP_CODECVT