ASCIIο
The American Standard Code for Information Interchange (ASCII). A typical 7-bit encoding that is bitwise-compatible with UTF-8.
Aliasesο
-
typedef basic_ascii<char> ztd::text::ascii_tο
The American Standard Code for Information Exchange (ASCII) Encoding.
Remark
The most vanilla and unimaginative encoding there is in the world, excluding tons of other languages, dialects, and even common English idioms and borrowed words. Please donβt pick this unless you have good reason!
Base Templateο
-
template<typename _CodeUnit, typename _CodePoint = unicode_code_point>
class basic_asciiο The American Standard Code for Information Exchange (ASCII) Encoding.
Remark
The most vanilla and unimaginative encoding there is in the world, excluding tons of other languages, dialects, and even common English idioms and borrowed words. Please donβt pick this unless you have good reason!
- Template Parameters:
_CodeUnit β The code unit type to work over.
Public Types
-
using code_unit = _CodeUnitο
The individual units that result from an encode operation or are used as input to a decode operation.
-
using code_point = _CodePointο
The individual units that result from a decode operation or as used as input to an encode operation. For most encodings, this is going to be a Unicode Code Point or a Unicode Scalar Value.
-
using state = __txt_detail::__empty_stateο
The state that can be used between calls to the encoder and decoder.
Remark
It is an empty struct because there is no shift state to preserve between complete units of encoded information. It is also only
state
and not separatelydecode_state
andencode_state
because one type suffices for both.
-
using is_decode_injective = ::std::true_typeο
Whether or not the decode operation can process all forms of input into code point values.
Remark
ASCII can decode from its 7-bit (unpacked) code units to Unicode Code Points. Since the converion is lossless, this property is true.
-
using is_encode_injective = ::std::false_typeο
Whether or not the encode operation can process all forms of input into code unit values. This is not true for ASCII, as many Unicode Code Point and Unicode Scalar Values cannot be represented in ASCII. Since the conversion is lossy, this property is false.
Public Static Functions
-
static inline constexpr ::ztd::span<const code_unit, 1> replacement_code_units() noexceptο
A range of code units representing the values to use when a replacement happen. For ASCII, this must be β?β instead of the usual Unicode Replacement Character UβοΏ½β.
-
template<typename _Input, typename _Output, typename _ErrorHandler>
static inline constexpr auto decode_one(_Input &&__input, _Output &&__output, _ErrorHandler &&__error_handler, state &__s)ο Decodes a single complete unit of information as code points and produces a result with the input and output ranges moved past what was successfully read and written; or, produces an error and returns the input and output ranges untouched.
Remark
To the best ability of the implementation, the iterators will be returned untouched (e.g., the input models at least a view and a forward_range). If it is not possible, returned ranges may be incremented even if an error occurs due to the semantics of any view that models an input_range.
- Parameters:
__input β [in] The input view to read code uunits from.
__output β [in] The output view to write code points into.
__error_handler β [in] The error handler to invoke if encoding fails.
__s β [inout] The necessary state information. For this encoding, the state is empty and means very little.
- Returns:
A ztd::text::decode_result object that contains the input range, output range, error handler, and a reference to the passed-in state.
-
template<typename _Input, typename _Output, typename _ErrorHandler>
static inline constexpr auto encode_one(_Input &&__input, _Output &&__output, _ErrorHandler &&__error_handler, state &__s)ο Encodes a single complete unit of information as code units and produces a result with the input and output ranges moved past what was successfully read and written; or, produces an error and returns the input and output ranges untouched.
Remark
To the best ability of the implementation, the iterators will be returned untouched (e.g., the input models at least a view and a forward_range). If it is not possible, returned ranges may be incremented even if an error occurs due to the semantics of any view that models an input_range.
- Parameters:
__input β [in] The input view to read code points from.
__output β [in] The output view to write code units into.
__error_handler β [in] The error handler to invoke if encoding fails.
__s β [inout] The necessary state information. For this encoding, the state is empty and means very little.
- Returns:
A ztd::text::encode_result object that contains the input range, output range, error handler, and a reference to the passed-in state.
Public Static Attributes
-
static constexprconst::std::size_t max_code_units = 1ο
The maximum code units a single complete operation of encoding can produce.
-
static constexprconst::std::size_t max_code_points = 1ο
The maximum number of code points a single complete operation of decoding can produce. This is 1 for all Unicode Transformation Format (UTF) encodings.