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