GB18030ļ
An encoding capable of handling all known Unicode-encoded characters, and occasionally a few more (the most recent version of Unicode covers all values available in the most up-to-date GB-18030).
Aliasļ
-
constexpr basic_gb18030<char> ztd::text::gb18030 = {}ļ
An instance of basic_gb18030 for ease of use.
Base Templatesļ
-
template<typename _CodeUnit = char, typename _CodePoint = unicode_code_point>
class basic_gb18030 : public ztd::text::__txt_impl::__basic_gb18030<basic_gb18030<char, unicode_code_point>, char, unicode_code_point, false>ļ The GB18030 encoding, which can encode all of Unicode (and occasionally adds characters that exist outside of Unicode, but are still Unicode-compatible).
- Template Parameters:
_CodeUnit ā The default code unit type to use when outputting encoded units.
_CodePoint ā The code point type to use when outputting decoded units.
Public Types
-
using code_point = _CodePointļ
Shift-JIS outputs Unicode Scalar Values.
-
using state = __txt_detail::__empty_stateļ
Shift-JIS requires no state.
-
using is_decode_injective = ::std::true_typeļ
Marks this encoding as injective for the decode portion of its encoding actions.
-
using is_encode_injective = ::std::integral_constant<bool, !_IsGbk>ļ
Marks this encoding as injective for the encode portion of its encoding actions. This is true for GB18030, and not true for pure GBK.
-
using is_unicode_encoding = ::std::integral_constant<bool, !_IsGbk>ļ
GB18030-style encodings are Unicode Encodings (can encode all Unicode code points). GBK cannot.
Public Functions
-
inline constexpr ztd::span<const code_unit, _IsGbk ? 1 : 4> replacement_code_units() const noexceptļ
A fixed-size replacement for either the GBK or GB18030 encoding.
-
inline constexpr ztd::span<const code_point, 1> replacement_code_points() const noexceptļ
A fixed-size replacement for either the GBK or GB18030 encoding.
Public Static Functions
-
template<typename _Input, typename _Output, typename _ErrorHandler>
static inline constexpr auto decode_one(_Input &&__input, _Output &&__output, _ErrorHandler &&__error_handler, state &__state) noexceptļ Decodes a single complete unit of information as __code_point 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_point uunits from.
__output ā [in] The output view to write __code_point points into.
__error_handler ā [in] The error handler to invoke if encoding fails.
__state ā [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 &__state) noexceptļ Encodes a single complete unit of information as __code_point 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_point points from.
__output ā [in] The output view to write __code_point units into.
__error_handler ā [in] The error handler to invoke if encoding fails.
__state ā [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 constexpr std::size_t max_code_points = 1ļ
The Shift-JIS encoding can put out at most 1 code_point units per decoding action.
-
static constexpr std::size_t max_code_units = _IsGbk ? 2 : 4ļ
The Shift-JIS encoding can put out at most 4 code_point units per encoding action.