Coverage Report

Created: 2025-08-28 06:28

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