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