skip_input_error

Utilizes ztd::text::is_input_error_skippable to check if a hypothetical encoding object encoding and a hypothetical result object result can be utilized to call encoding.skip_input_error(result). Otherwise, it only skips forward by

It is particularly used with ztd::text::replacement_handler and ztd::text::skip_handler. You can use this function to perform encoding-aware and encoding-specific skips for a given encode and decode operation. This is particularly useful for Unicode encodings, as well as other variable-width encodings in the wild, which may be good to accommodate for in your own error handlers.

template<typename _Encoding, typename _Result, typename _InputProgress, typename _OutputProgress>
constexpr auto ztd::text::skip_input_error(const _Encoding &__encoding, _Result &&__result, const _InputProgress &__input_progress, const _OutputProgress &__output_progress) noexcept(::ztd::text::is_nothrow_skip_input_error_v<const _Encoding&, _Result, const _InputProgress&, const _OutputProgress&>)

Attempts to skip over an input error in the text.

"\xC0\x9F\x8D\xB7meow"

Remark

If there exists a well-formed function call of the form __encoding.skip_input_error(__result), it will call that function. Otherwise, it will attempt to grab the input iterator and pre-increment it exactly once. The goal for this is to provide functionality which can smartly skip over a collection of ill-formed code units or bytes in an input sequence, rather than generated e.g. 3 different replacement characters for a mal-formed UTF-8 sequence. For example, given this malformed wineglass code point as an input UTF-8 sequence:

when used in conjunction with ztd::text::utf8 (and similar), a proper decode/transcode call will error on \xC0’. Then, this function skips until the’m’` input code unit, resulting in a leftover sequence of

β€œmeow”.

Parameters:
  • __encoding – [in] The Encoding that experienced the error.

  • __result – [in] The current result state of the encode or decode operation.

  • __input_progress – [in] A contiguous range containing all of the (potentially) irreversibly read input from an encoding operation.

  • __output_progress – [in] A contiguous range containing all of the (potentially) irreversibly written output from an encoding operation.

template<typename _Result, typename _InputProgress, typename _OutputProgress>
constexpr auto ztd::text::skip_utf32_input_error(_Result &&__result, const _InputProgress &__input_progress, const _OutputProgress &__output_progress) noexcept

Attempts to skip over an input error in the text.

Remark

This function is specifically for UTF-32 input, where e.g. multiple surrogates may be part of the incoming text and the target encoding does not support that. Therefore, it will skip over every too-large codepoint, and every surrogate pair codepoint, before stopping.

Parameters:
  • __result – [in] The current result state of the encode or decode operation.

  • __input_progress – [in] A contiguous range containing all of the (potentially) irreversibly read input from an encoding operation.

  • __output_progress – [in] A contiguous range containing all of the (potentially) irreversibly written output from an encoding operation.

template<typename _Result, typename _InputProgress, typename _OutputProgress>
constexpr auto ztd::text::skip_utf32_with_surrogates_input_error(_Result &&__result, const _InputProgress &__input_progress, const _OutputProgress &__output_progress) noexcept

Attempts to skip over an input error in the text.

Remark

This function is specifically for UTF-32 input that also includes surrogate values as a valid option. Therefore, it will skip over every too-large codepoint.

Parameters:
  • __result – [in] The current result state of the encode or decode operation.

  • __input_progress – [in] A contiguous range containing all of the (potentially) irreversibly read input from an encoding operation.

  • __output_progress – [in] A contiguous range containing all of the (potentially) irreversibly written output from an encoding operation.