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