tmp/tmp2_8l81e6/{from.md → to.md}
RENAMED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
#### Class template `codecvt` <a id="locale.codecvt">[[locale.codecvt]]</a>
|
| 2 |
|
|
|
|
|
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
class codecvt_base {
|
| 6 |
public:
|
| 7 |
enum result { ok, partial, error, noconv };
|
|
@@ -70,19 +72,19 @@ mapped between.
|
|
| 70 |
The specializations required in [[locale.category.facets]]
|
| 71 |
[[locale.category]] convert the implementation-defined native character
|
| 72 |
set. `codecvt<char, char, mbstate_t>` implements a degenerate
|
| 73 |
conversion; it does not convert at all. The specialization
|
| 74 |
`codecvt<char16_t, char8_t, mbstate_t>` converts between the UTF-16 and
|
| 75 |
-
UTF-8 encoding forms, and the specialization
|
| 76 |
-
`<char32_t, char8_t, mbstate_t>` converts between the UTF-32 and
|
| 77 |
-
encoding forms. `codecvt<wchar_t, char, mbstate_t>` converts
|
| 78 |
-
native character sets for ordinary and wide characters.
|
| 79 |
-
on `mbstate_t` perform conversion between encodings
|
| 80 |
-
implementer. Other encodings can be converted by
|
| 81 |
-
program-defined `stateT` type. Objects of type
|
| 82 |
-
state that is useful to communicate to or from
|
| 83 |
-
or `do_out` members.
|
| 84 |
|
| 85 |
##### Members <a id="locale.codecvt.members">[[locale.codecvt.members]]</a>
|
| 86 |
|
| 87 |
``` cpp
|
| 88 |
result out(
|
|
@@ -195,44 +197,45 @@ shall also return `ok`.[^8]
|
|
| 195 |
|
| 196 |
[*Note 1*: As a result of operations on `state`, it can return `ok` or
|
| 197 |
`partial` and set `from_next == from` and
|
| 198 |
`to_next != to`. — *end note*]
|
| 199 |
|
| 200 |
-
*Remarks:* Its operations on `state` are unspecified.
|
| 201 |
-
|
| 202 |
-
[*Note 2*: This argument can be used, for example, to maintain shift
|
| 203 |
-
state, to specify conversion options (such as count only), or to
|
| 204 |
-
identify a cache of seek offsets. — *end note*]
|
| 205 |
-
|
| 206 |
*Returns:* An enumeration value, as summarized in
|
| 207 |
[[locale.codecvt.inout]].
|
| 208 |
|
| 209 |
**Table: `do_in/do_out` result values** <a id="locale.codecvt.inout">[locale.codecvt.inout]</a>
|
| 210 |
|
| 211 |
| Value | Meaning |
|
| 212 |
| --------- | ------------------------------------------------------------------------------------------------ |
|
| 213 |
| `ok` | completed the conversion |
|
| 214 |
| `partial` | not all source characters converted |
|
| 215 |
-
| `error` | encountered a character in {[}`from`, `from_end`{)} that
|
| 216 |
| `noconv` | `internT` and `externT` are the same type, and input sequence is identical to converted sequence |
|
| 217 |
|
| 218 |
|
| 219 |
A return value of `partial`, if `(from_next == from_end)`, indicates
|
| 220 |
that either the destination sequence has not absorbed all the available
|
| 221 |
destination elements, or that additional source elements are needed
|
| 222 |
before another destination element can be produced.
|
| 223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
``` cpp
|
| 225 |
result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
|
| 226 |
```
|
| 227 |
|
| 228 |
*Preconditions:* `(to <= to_end)` is well-defined and `true`; `state` is
|
| 229 |
initialized, if at the beginning of a sequence, or else is equal to the
|
| 230 |
result of converting the preceding characters in the sequence.
|
| 231 |
|
| 232 |
*Effects:* Places characters starting at `to` that should be appended to
|
| 233 |
terminate a sequence when the current `stateT` is given by `state`.[^9]
|
|
|
|
| 234 |
Stores no more than `(to_end - to)` destination elements, and leaves the
|
| 235 |
`to_next` pointer pointing one beyond the last element successfully
|
| 236 |
stored.
|
| 237 |
|
| 238 |
*Returns:* An enumeration value, as summarized in
|
|
|
|
| 1 |
#### Class template `codecvt` <a id="locale.codecvt">[[locale.codecvt]]</a>
|
| 2 |
|
| 3 |
+
##### General <a id="locale.codecvt.general">[[locale.codecvt.general]]</a>
|
| 4 |
+
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
class codecvt_base {
|
| 8 |
public:
|
| 9 |
enum result { ok, partial, error, noconv };
|
|
|
|
| 72 |
The specializations required in [[locale.category.facets]]
|
| 73 |
[[locale.category]] convert the implementation-defined native character
|
| 74 |
set. `codecvt<char, char, mbstate_t>` implements a degenerate
|
| 75 |
conversion; it does not convert at all. The specialization
|
| 76 |
`codecvt<char16_t, char8_t, mbstate_t>` converts between the UTF-16 and
|
| 77 |
+
UTF-8 encoding forms, and the specialization
|
| 78 |
+
`codecvt<char32_t, char8_t, mbstate_t>` converts between the UTF-32 and
|
| 79 |
+
UTF-8 encoding forms. `codecvt<wchar_t, char, mbstate_t>` converts
|
| 80 |
+
between the native character sets for ordinary and wide characters.
|
| 81 |
+
Specializations on `mbstate_t` perform conversion between encodings
|
| 82 |
+
known to the library implementer. Other encodings can be converted by
|
| 83 |
+
specializing on a program-defined `stateT` type. Objects of type
|
| 84 |
+
`stateT` can contain any state that is useful to communicate to or from
|
| 85 |
+
the specialized `do_in` or `do_out` members.
|
| 86 |
|
| 87 |
##### Members <a id="locale.codecvt.members">[[locale.codecvt.members]]</a>
|
| 88 |
|
| 89 |
``` cpp
|
| 90 |
result out(
|
|
|
|
| 197 |
|
| 198 |
[*Note 1*: As a result of operations on `state`, it can return `ok` or
|
| 199 |
`partial` and set `from_next == from` and
|
| 200 |
`to_next != to`. — *end note*]
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
*Returns:* An enumeration value, as summarized in
|
| 203 |
[[locale.codecvt.inout]].
|
| 204 |
|
| 205 |
**Table: `do_in/do_out` result values** <a id="locale.codecvt.inout">[locale.codecvt.inout]</a>
|
| 206 |
|
| 207 |
| Value | Meaning |
|
| 208 |
| --------- | ------------------------------------------------------------------------------------------------ |
|
| 209 |
| `ok` | completed the conversion |
|
| 210 |
| `partial` | not all source characters converted |
|
| 211 |
+
| `error` | encountered a character in {[}`from`, `from_end`{)} that cannot be converted |
|
| 212 |
| `noconv` | `internT` and `externT` are the same type, and input sequence is identical to converted sequence |
|
| 213 |
|
| 214 |
|
| 215 |
A return value of `partial`, if `(from_next == from_end)`, indicates
|
| 216 |
that either the destination sequence has not absorbed all the available
|
| 217 |
destination elements, or that additional source elements are needed
|
| 218 |
before another destination element can be produced.
|
| 219 |
|
| 220 |
+
*Remarks:* Its operations on `state` are unspecified.
|
| 221 |
+
|
| 222 |
+
[*Note 2*: This argument can be used, for example, to maintain shift
|
| 223 |
+
state, to specify conversion options (such as count only), or to
|
| 224 |
+
identify a cache of seek offsets. — *end note*]
|
| 225 |
+
|
| 226 |
``` cpp
|
| 227 |
result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
|
| 228 |
```
|
| 229 |
|
| 230 |
*Preconditions:* `(to <= to_end)` is well-defined and `true`; `state` is
|
| 231 |
initialized, if at the beginning of a sequence, or else is equal to the
|
| 232 |
result of converting the preceding characters in the sequence.
|
| 233 |
|
| 234 |
*Effects:* Places characters starting at `to` that should be appended to
|
| 235 |
terminate a sequence when the current `stateT` is given by `state`.[^9]
|
| 236 |
+
|
| 237 |
Stores no more than `(to_end - to)` destination elements, and leaves the
|
| 238 |
`to_next` pointer pointing one beyond the last element successfully
|
| 239 |
stored.
|
| 240 |
|
| 241 |
*Returns:* An enumeration value, as summarized in
|