From Jason Turner

[locale.stdcvt]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpz6g1qc6f/{from.md → to.md} +0 -89
tmp/tmpz6g1qc6f/{from.md → to.md} RENAMED
@@ -1,89 +0,0 @@
1
- ## Standard code conversion facets <a id="locale.stdcvt">[[locale.stdcvt]]</a>
2
-
3
- The header `<codecvt>` provides code conversion facets for various
4
- character encodings.
5
-
6
- ``` cpp
7
- namespace std {
8
- enum codecvt_mode {
9
- consume_header = 4,
10
- generate_header = 2,
11
- little_endian = 1
12
- };
13
-
14
- template<class Elem, unsigned long Maxcode = 0x10ffff,
15
- codecvt_mode Mode = (codecvt_mode)0>
16
- class codecvt_utf8
17
- : public codecvt<Elem, char, mbstate_t> {
18
- public:
19
- explicit codecvt_utf8(size_t refs = 0);
20
- ~codecvt_utf8();
21
- };
22
-
23
- template<class Elem, unsigned long Maxcode = 0x10ffff,
24
- codecvt_mode Mode = (codecvt_mode)0>
25
- class codecvt_utf16
26
- : public codecvt<Elem, char, mbstate_t> {
27
- public:
28
- explicit codecvt_utf16(size_t refs = 0);
29
- ~codecvt_utf16();
30
- };
31
-
32
- template<class Elem, unsigned long Maxcode = 0x10ffff,
33
- codecvt_mode Mode = (codecvt_mode)0>
34
- class codecvt_utf8_utf16
35
- : public codecvt<Elem, char, mbstate_t> {
36
- public:
37
- explicit codecvt_utf8_utf16(size_t refs = 0);
38
- ~codecvt_utf8_utf16();
39
- };
40
- }
41
- ```
42
-
43
- For each of the three code conversion facets `codecvt_utf8`,
44
- `codecvt_utf16`, and `codecvt_utf8_utf16`:
45
-
46
- - `Elem` is the wide-character type, such as `wchar_t`, `char16_t`, or
47
- `char32_t`.
48
- - `Maxcode` is the largest wide-character code that the facet will read
49
- or write without reporting a conversion error.
50
- - If `(Mode & consume_header)`, the facet shall consume an initial
51
- header sequence, if present, when reading a multibyte sequence to
52
- determine the endianness of the subsequent multibyte sequence to be
53
- read.
54
- - If `(Mode & generate_header)`, the facet shall generate an initial
55
- header sequence when writing a multibyte sequence to advertise the
56
- endianness of the subsequent multibyte sequence to be written.
57
- - If `(Mode & little_endian)`, the facet shall generate a multibyte
58
- sequence in little-endian order, as opposed to the default big-endian
59
- order.
60
-
61
- For the facet `codecvt_utf8`:
62
-
63
- - The facet shall convert between UTF-8 multibyte sequences and UCS2 or
64
- UCS4 (depending on the size of `Elem`) within the program.
65
- - Endianness shall not affect how multibyte sequences are read or
66
- written.
67
- - The multibyte sequences may be written as either a text or a binary
68
- file.
69
-
70
- For the facet `codecvt_utf16`:
71
-
72
- - The facet shall convert between UTF-16 multibyte sequences and UCS2 or
73
- UCS4 (depending on the size of `Elem`) within the program.
74
- - Multibyte sequences shall be read or written according to the `Mode`
75
- flag, as set out above.
76
- - The multibyte sequences may be written only as a binary file.
77
- Attempting to write to a text file produces undefined behavior.
78
-
79
- For the facet `codecvt_utf8_utf16`:
80
-
81
- - The facet shall convert between UTF-8 multibyte sequences and UTF-16
82
- (one or two 16-bit codes) within the program.
83
- - Endianness shall not affect how multibyte sequences are read or
84
- written.
85
- - The multibyte sequences may be written as either a text or a binary
86
- file.
87
-
88
- ISO/IEC 10646-1:1993.
89
-