SHIFT-JISX0208ļƒ

The version of SHIFT-JIS that corresponds to standard X0208, one of the more prevalent versions.

Note that many versions of SHIFT-JIS do not correspond to one standard and often have different interpretations or characteristics. The communities which use them label them, indiscriminately, as SHIFT-JIS without any kind of specific indicator or even out-of-band modifier. The text community surrounding this is, with all due respect, one gigantic mess. Most industry professionals inside and outside of Japan dealing with such text tend to gravitate towards the SHIFT-JISX0208 release, and simply use replacement characters / invalid indicators for such input text.

As such, it is advisable to perhaps attempt to find some out-of-band data to see if a specific data is, indeed, meant to be SHIFT-JISX0208.

Aliasesļƒ

constexpr basic_shift_jis_x0208<char> ztd::text::shift_jis_x0208 = {}ļƒ

An instance of basic_shift_jis_x0208 for ease of use.

constexpr auto &ztd::text::shift_jis = shift_jis_x0208ļƒ

An instance of basic_shift_jis for ease of use.

using ztd::text::shift_jis_t = basic_shift_jis_x0208<char>ļƒ

A convenience alais that defaults shift_jis to the x0208 version.

template<typename _CodeUnit, typename _CodePoint = unicode_code_point>
using ztd::text::basic_shift_jis = basic_shift_jis_x0208<_CodeUnit, _CodePoint>ļƒ

A convenience alais that defaults basic_shift_jis to the x0208 version.

Base Templatesļƒ

template<typename _CodeUnit = char, typename _CodePoint = unicode_code_point>
class basic_shift_jis_x0208ļƒ

The Shift-JIS Encoding (with extensions x0208) for use with most Shift-JIS applications. Identical version of what is a part of the WHATWG encoding standard for Shift-JIS.

Template Parameters:
  • _CodeUnit ā€“ The code unit type to use.

  • _CodePoint ā€“ The code point type to use.

Public Types

using code_unit = _CodeUnitļƒ

Shift-JIS is generally stored as minimum-8-bit values in a sequence.

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.

Public Functions

inline constexpr ztd::span<const code_unit, 1> replacement_code_units() const noexceptļƒ

A fixed-size 1-element span with the __code_point unit ā€œ?ā€.

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 point per decoding action.

static constexpr std::size_t max_code_units = 2ļƒ

The Shift-JIS encoding can put out at most 2 __code_point units per encoding action.