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