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