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