Encoding¶
-
template<EncodingForm
Encoding
>
usingcode_unit_t
¶ The type of the code units used by
Encoding
.
-
template<EncodingForm
Encoding
>
constexpr automax_width_v
¶ The maximum number of code units needed by
Encoding
to represent one code point.
-
template<EncodingForm
Encoding
>
constexpr autoreplacement_character_v
¶ The character used to replace invalid input when
replace_errors
is used for an encoding operation.Note
Decoding always uses U+FFFD ʀᴇᴘʟᴀᴄᴇᴍᴇɴᴛ ᴄʜᴀʀᴀᴄᴛᴇʀ to replace errors.
-
template<EncodingForm
Encoding
>
usingcoding_state_t
¶ The type of the state used by
Encoding
. For stateless encoding forms this is an empty type.
-
template<EncodingForm
Encoding
>
usingis_stateless
¶ Derives from
std::true_type
ifEncoding
is stateless; fromstd::false_type
otherwise.
-
template<EncodingForm
Encoding
>
constexpr boolis_stateless_v
¶ True if
Encoding
is stateless; false otherwise.
-
template<EncodingForm
Encoding
>
coded_character_t<Encoding>encode_one
(code_point u, coding_state_t<Encoding> &state)¶ Warning
This part of the interface is still being worked out; it is likely to change signficantly or to be removed before the next release.
Encodes
u
according toEncoding
.Parameters: - u – the code point to be encoded
- state – the current encoding state; it is modified according to the encoding performed
Returns: a range of the code units that encode
u
Throws: encode_error
when the input cannot be encoded byEncoding
-
template<EncodingForm
Encoding
>
usingcoded_character_t
¶ Range of the code units that encode one code point.
-
template<EncodingForm
Encoding
, ForwardRangeRng
, EncodeErrorHandlerHandler
>
autoencode
(Rng rng, Handler &&handler)¶ Encodes a range of code points, according to
Encoding
.Parameters: - rng – The range of code points to encode
- handler – The strategy for error handling
Returns: a range of the code units that encode the code points in
rng
Validation: as performed by
Encoding
; errors are handled byhandler
-
template<EncodingForm
Encoding
, ForwardIteratorIt
, SentinelSt
>
std::pair<code_point, It>decode_one
(It first, St last, coding_state_t<Encoding> &state)¶ Warning
This part of the interface is still being worked out; it is likely to change signficantly or to be removed before the next release.
Decodes the first code point from the range [
first
,last
), according toEncoding
.Parameters: - first – an iterator to the first code unit to be decoded
- last – an iterator/sentinel to the end of the range of code units
- state – the current decoding state; it is modified according to the decoding performed
Returns: a pair of the decoded code point and an iterator to first code unit of the next encoded code point
Throws: decode_error
when the input cannot be decoded byEncoding
-
template<EncodingForm
Encoding
, ForwardRangeRng
, EncodeErrorHandlerHandler
>
autodecode
(Rng rng, Handler &&handler)¶ Decodes a range of code points, according to
Encoding
.Parameters: - rng – The range of code points to encode
- handler – The strategy for error handling
Returns: a range of the code points that the code units in
rng
representValidation: as performed by
Encoding
; errors are handled byhandler
-
template<EncodingForm
Encoding
>
usingcoded_character
¶ A container type for the code units that encode a single code point according to
Encoding
.