tmp/tmpee4__bgh/{from.md → to.md}
RENAMED
|
@@ -1,34 +1,36 @@
|
|
| 1 |
##### `codecvt` virtual functions <a id="locale.codecvt.virtuals">[[locale.codecvt.virtuals]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
-
result do_out(
|
|
|
|
| 5 |
const internT* from, const internT* from_end, const internT*& from_next,
|
| 6 |
externT* to, externT* to_end, externT*& to_next) const;
|
| 7 |
|
| 8 |
-
result do_in(
|
|
|
|
| 9 |
const externT* from, const externT* from_end, const externT*& from_next,
|
| 10 |
internT* to, internT* to_end, internT*& to_next) const;
|
| 11 |
```
|
| 12 |
|
| 13 |
-
*
|
| 14 |
`true`; `state` initialized, if at the beginning of a sequence, or else
|
| 15 |
equal to the result of converting the preceding characters in the
|
| 16 |
sequence.
|
| 17 |
|
| 18 |
-
*Effects:* Translates characters in the source range
|
| 19 |
-
placing the results in sequential positions starting at
|
| 20 |
-
`to`. Converts no more than `(from_end-from)` source
|
| 21 |
-
stores no more than `(to_end-to)` destination elements.
|
| 22 |
|
| 23 |
Stops if it encounters a character it cannot convert. It always leaves
|
| 24 |
the `from_next` and `to_next` pointers pointing one beyond the last
|
| 25 |
element successfully converted. If returns `noconv`, `internT` and
|
| 26 |
`externT` are the same type and the converted sequence is identical to
|
| 27 |
-
the input sequence
|
| 28 |
-
the value of `state` is unchanged, and there are no changes to the
|
| 29 |
-
values in
|
| 30 |
|
| 31 |
A `codecvt` facet that is used by `basic_filebuf` ([[file.streams]])
|
| 32 |
shall have the property that if
|
| 33 |
|
| 34 |
``` cpp
|
|
@@ -51,103 +53,105 @@ would return `ok`, where `to != to_end`, then
|
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
do_in(state, from, from_end, from_next, to, to + 1, to_next)
|
| 54 |
```
|
| 55 |
|
| 56 |
-
shall also return `ok`.[^
|
| 57 |
-
return `ok` or `partial` and set `from_next == from` and
|
| 58 |
-
`to_next != to`.
|
| 59 |
|
| 60 |
-
*
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
*Returns:* An enumeration value, as summarized in
|
| 65 |
Table [[tab:localization.convert.result.values.out.in]].
|
| 66 |
|
| 67 |
**Table: `do_in/do_out` result values** <a id="tab:localization.convert.result.values.out.in">[tab:localization.convert.result.values.out.in]</a>
|
| 68 |
|
| 69 |
| Value | Meaning |
|
| 70 |
| --------- | ------------------------------------------------------------------------------------------------ |
|
| 71 |
| `ok` | completed the conversion |
|
| 72 |
| `partial` | not all source characters converted |
|
| 73 |
-
| `error` | encountered a character in
|
| 74 |
| `noconv` | `internT` and `externT` are the same type, and input sequence is identical to converted sequence |
|
| 75 |
|
| 76 |
|
| 77 |
-
A return value of `partial`, if `(from_next==from_end)`, indicates
|
| 78 |
-
either the destination sequence has not absorbed all the available
|
| 79 |
destination elements, or that additional source elements are needed
|
| 80 |
before another destination element can be produced.
|
| 81 |
|
| 82 |
``` cpp
|
| 83 |
-
result do_unshift(stateT& state,
|
| 84 |
-
externT* to, externT* to_end, externT*& to_next) const;
|
| 85 |
```
|
| 86 |
|
| 87 |
-
*Requires:* `(to <= to_end)` well defined and true; state initialized,
|
| 88 |
if at the beginning of a sequence, or else equal to the result of
|
| 89 |
converting the preceding characters in the sequence.
|
| 90 |
|
| 91 |
*Effects:* Places characters starting at `to` that should be appended to
|
| 92 |
-
terminate a sequence when the current `stateT` is given by `state`.[^
|
| 93 |
Stores no more than `(to_end - to)` destination elements, and leaves the
|
| 94 |
`to_next` pointer pointing one beyond the last element successfully
|
| 95 |
stored.
|
| 96 |
|
| 97 |
*Returns:* An enumeration value, as summarized in
|
| 98 |
Table [[tab:localization.convert.result.values.unshift]].
|
| 99 |
|
| 100 |
**Table: `do_unshift` result values** <a id="tab:localization.convert.result.values.unshift">[tab:localization.convert.result.values.unshift]</a>
|
| 101 |
|
| 102 |
| Value | Meaning |
|
| 103 |
-
| --------- | ------------------------------------------------------------------------------------------------------------------ |
|
| 104 |
| `ok` | completed the sequence |
|
| 105 |
| `partial` | space for more than `to_end - to` destination elements was needed to terminate a sequence given the value of `state` |
|
| 106 |
| `error` | an unspecified error has occurred |
|
| 107 |
| `noconv` | no termination is needed for this `state_type` |
|
| 108 |
|
| 109 |
``` cpp
|
| 110 |
int do_encoding() const noexcept;
|
| 111 |
```
|
| 112 |
|
| 113 |
-
*Returns:* -1 if the encoding of the `externT` sequence is
|
| 114 |
state-dependent; else the constant number of `externT` characters needed
|
| 115 |
-
to produce an internal character; or 0 if this number is not a
|
| 116 |
-
constant.[^
|
| 117 |
|
| 118 |
``` cpp
|
| 119 |
bool do_always_noconv() const noexcept;
|
| 120 |
```
|
| 121 |
|
| 122 |
*Returns:* `true` if `do_in()` and `do_out()` return `noconv` for all
|
| 123 |
valid argument values. `codecvt<char, char, mbstate_t>` returns `true`.
|
| 124 |
|
| 125 |
``` cpp
|
| 126 |
-
int do_length(stateT& state, const externT* from, const externT* from_end,
|
| 127 |
-
size_t max) const;
|
| 128 |
```
|
| 129 |
|
| 130 |
-
*
|
| 131 |
initialized, if at the beginning of a sequence, or else equal to the
|
| 132 |
result of converting the preceding characters in the sequence.
|
| 133 |
|
| 134 |
*Effects:* The effect on the `state` argument is “as if” it called
|
| 135 |
`do_in(state, from, from_end, from, to, to+max, to)` for `to` pointing
|
| 136 |
to a buffer of at least `max` elements.
|
| 137 |
|
| 138 |
*Returns:* `(from_next-from)` where `from_next` is the largest value in
|
| 139 |
-
the range
|
| 140 |
range \[`from`, `from_next`) represents `max` or fewer valid complete
|
| 141 |
characters of type `internT`. The specialization
|
| 142 |
`codecvt<char, char, mbstate_t>`, returns the lesser of `max` and
|
| 143 |
`(from_end-from)`.
|
| 144 |
|
| 145 |
``` cpp
|
| 146 |
int do_max_length() const noexcept;
|
| 147 |
```
|
| 148 |
|
| 149 |
*Returns:* The maximum value that `do_length(state, from, from_end, 1)`
|
| 150 |
-
can return for any valid range
|
| 151 |
`state`. The specialization
|
| 152 |
`codecvt<char, char, mbstate_t>::do_max_length()` returns 1.
|
| 153 |
|
|
|
|
| 1 |
##### `codecvt` virtual functions <a id="locale.codecvt.virtuals">[[locale.codecvt.virtuals]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
+
result do_out(
|
| 5 |
+
stateT& state,
|
| 6 |
const internT* from, const internT* from_end, const internT*& from_next,
|
| 7 |
externT* to, externT* to_end, externT*& to_next) const;
|
| 8 |
|
| 9 |
+
result do_in(
|
| 10 |
+
stateT& state,
|
| 11 |
const externT* from, const externT* from_end, const externT*& from_next,
|
| 12 |
internT* to, internT* to_end, internT*& to_next) const;
|
| 13 |
```
|
| 14 |
|
| 15 |
+
*Requires:* `(from <= from_end && to <= to_end)` well-defined and
|
| 16 |
`true`; `state` initialized, if at the beginning of a sequence, or else
|
| 17 |
equal to the result of converting the preceding characters in the
|
| 18 |
sequence.
|
| 19 |
|
| 20 |
+
*Effects:* Translates characters in the source range \[`from`,
|
| 21 |
+
`from_end`), placing the results in sequential positions starting at
|
| 22 |
+
destination `to`. Converts no more than `(from_end - from)` source
|
| 23 |
+
elements, and stores no more than `(to_end - to)` destination elements.
|
| 24 |
|
| 25 |
Stops if it encounters a character it cannot convert. It always leaves
|
| 26 |
the `from_next` and `to_next` pointers pointing one beyond the last
|
| 27 |
element successfully converted. If returns `noconv`, `internT` and
|
| 28 |
`externT` are the same type and the converted sequence is identical to
|
| 29 |
+
the input sequence \[`from`, `from``next`). `to_next` is set equal to
|
| 30 |
+
`to`, the value of `state` is unchanged, and there are no changes to the
|
| 31 |
+
values in \[`to`, `to_end`).
|
| 32 |
|
| 33 |
A `codecvt` facet that is used by `basic_filebuf` ([[file.streams]])
|
| 34 |
shall have the property that if
|
| 35 |
|
| 36 |
``` cpp
|
|
|
|
| 53 |
|
| 54 |
``` cpp
|
| 55 |
do_in(state, from, from_end, from_next, to, to + 1, to_next)
|
| 56 |
```
|
| 57 |
|
| 58 |
+
shall also return `ok`.[^8]
|
|
|
|
|
|
|
| 59 |
|
| 60 |
+
[*Note 1*: As a result of operations on `state`, it can return `ok` or
|
| 61 |
+
`partial` and set `from_next == from` and
|
| 62 |
+
`to_next != to`. — *end note*]
|
| 63 |
+
|
| 64 |
+
*Remarks:* Its operations on `state` are unspecified.
|
| 65 |
+
|
| 66 |
+
[*Note 2*: This argument can be used, for example, to maintain shift
|
| 67 |
+
state, to specify conversion options (such as count only), or to
|
| 68 |
+
identify a cache of seek offsets. — *end note*]
|
| 69 |
|
| 70 |
*Returns:* An enumeration value, as summarized in
|
| 71 |
Table [[tab:localization.convert.result.values.out.in]].
|
| 72 |
|
| 73 |
**Table: `do_in/do_out` result values** <a id="tab:localization.convert.result.values.out.in">[tab:localization.convert.result.values.out.in]</a>
|
| 74 |
|
| 75 |
| Value | Meaning |
|
| 76 |
| --------- | ------------------------------------------------------------------------------------------------ |
|
| 77 |
| `ok` | completed the conversion |
|
| 78 |
| `partial` | not all source characters converted |
|
| 79 |
+
| `error` | encountered a character in {[}`from`, `from_end`{)} that it could not convert |
|
| 80 |
| `noconv` | `internT` and `externT` are the same type, and input sequence is identical to converted sequence |
|
| 81 |
|
| 82 |
|
| 83 |
+
A return value of `partial`, if `(from_next == from_end)`, indicates
|
| 84 |
+
that either the destination sequence has not absorbed all the available
|
| 85 |
destination elements, or that additional source elements are needed
|
| 86 |
before another destination element can be produced.
|
| 87 |
|
| 88 |
``` cpp
|
| 89 |
+
result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
|
|
|
|
| 90 |
```
|
| 91 |
|
| 92 |
+
*Requires:* `(to <= to_end)` well defined and `true`; state initialized,
|
| 93 |
if at the beginning of a sequence, or else equal to the result of
|
| 94 |
converting the preceding characters in the sequence.
|
| 95 |
|
| 96 |
*Effects:* Places characters starting at `to` that should be appended to
|
| 97 |
+
terminate a sequence when the current `stateT` is given by `state`.[^9]
|
| 98 |
Stores no more than `(to_end - to)` destination elements, and leaves the
|
| 99 |
`to_next` pointer pointing one beyond the last element successfully
|
| 100 |
stored.
|
| 101 |
|
| 102 |
*Returns:* An enumeration value, as summarized in
|
| 103 |
Table [[tab:localization.convert.result.values.unshift]].
|
| 104 |
|
| 105 |
**Table: `do_unshift` result values** <a id="tab:localization.convert.result.values.unshift">[tab:localization.convert.result.values.unshift]</a>
|
| 106 |
|
| 107 |
| Value | Meaning |
|
| 108 |
+
| --------- | -------------------------------------------------------------------------------------------------------------------- |
|
| 109 |
| `ok` | completed the sequence |
|
| 110 |
| `partial` | space for more than `to_end - to` destination elements was needed to terminate a sequence given the value of `state` |
|
| 111 |
| `error` | an unspecified error has occurred |
|
| 112 |
| `noconv` | no termination is needed for this `state_type` |
|
| 113 |
|
| 114 |
``` cpp
|
| 115 |
int do_encoding() const noexcept;
|
| 116 |
```
|
| 117 |
|
| 118 |
+
*Returns:* `-1` if the encoding of the `externT` sequence is
|
| 119 |
state-dependent; else the constant number of `externT` characters needed
|
| 120 |
+
to produce an internal character; or `0` if this number is not a
|
| 121 |
+
constant.[^10]
|
| 122 |
|
| 123 |
``` cpp
|
| 124 |
bool do_always_noconv() const noexcept;
|
| 125 |
```
|
| 126 |
|
| 127 |
*Returns:* `true` if `do_in()` and `do_out()` return `noconv` for all
|
| 128 |
valid argument values. `codecvt<char, char, mbstate_t>` returns `true`.
|
| 129 |
|
| 130 |
``` cpp
|
| 131 |
+
int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
|
|
|
|
| 132 |
```
|
| 133 |
|
| 134 |
+
*Requires:* `(from <= from_end)` well-defined and `true`; `state`
|
| 135 |
initialized, if at the beginning of a sequence, or else equal to the
|
| 136 |
result of converting the preceding characters in the sequence.
|
| 137 |
|
| 138 |
*Effects:* The effect on the `state` argument is “as if” it called
|
| 139 |
`do_in(state, from, from_end, from, to, to+max, to)` for `to` pointing
|
| 140 |
to a buffer of at least `max` elements.
|
| 141 |
|
| 142 |
*Returns:* `(from_next-from)` where `from_next` is the largest value in
|
| 143 |
+
the range \[`from`, `from_end`\] such that the sequence of values in the
|
| 144 |
range \[`from`, `from_next`) represents `max` or fewer valid complete
|
| 145 |
characters of type `internT`. The specialization
|
| 146 |
`codecvt<char, char, mbstate_t>`, returns the lesser of `max` and
|
| 147 |
`(from_end-from)`.
|
| 148 |
|
| 149 |
``` cpp
|
| 150 |
int do_max_length() const noexcept;
|
| 151 |
```
|
| 152 |
|
| 153 |
*Returns:* The maximum value that `do_length(state, from, from_end, 1)`
|
| 154 |
+
can return for any valid range \[`from`, `from_end`) and `stateT` value
|
| 155 |
`state`. The specialization
|
| 156 |
`codecvt<char, char, mbstate_t>::do_max_length()` returns 1.
|
| 157 |
|