default_handler

The default handler for all operations. A class type that simply wraps ztd::text::replacement_handler_t unless configured otherwise. You can change it to throw by default (NOT recommended) by using ZTD_TEXT_DEFAULT_HANDLER_THROWS.

Using this type, implicitly or explicitly, signals to ztd.text that you would like it to gently admonish you if any part of a conversion could be potentially lossy (valid data is put in, but it cannot be handled by the desired encode/decode/transcode operation).

constexpr default_handler_t ztd::text::default_handler = {}

An instance of the default_handler_t type for ease of use.

class default_handler_t : private replacement_handler_t

The default error handler for the entire library. Can be configured to use different strategies at build time. Without configuration, it defaults to the ztd::text::replacement_handler_t.

Public Types

using error_handler = __error_handler_base_t

The underlying error handler type.

Private Functions

template<typename _Encoding, typename _Input, typename _Output, typename _State, typename _InputProgress, typename _OutputProgress>
inline constexpr auto operator()(const _Encoding &__encoding, encode_result<_Input, _Output, _State> __result, const _InputProgress &__input_progress, const _OutputProgress &__output_progress) const noexcept(::ztd::text::is_nothrow_skip_input_error_v<const _Encoding&, encode_result<_Input, _Output, _State>, const _InputProgress&, const _OutputProgress&>)

The function call for inserting replacement code units at the point of failure, before returning flow back to the caller of the encode operation.

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

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

  • __input_progress – [in] How much input was (potentially irreversibly) read from the input range before undergoing the attempted encode operation.

  • __output_progress – [in] How much output was (potentially irreversibly) written to the output range before undergoing the attempted encode operation.

template<typename _Encoding, typename _Input, typename _Output, typename _State, typename _InputProgress, typename _OutputProgress>
inline constexpr auto operator()(const _Encoding &__encoding, decode_result<_Input, _Output, _State> __result, const _InputProgress &__input_progress, const _OutputProgress &__output_progress) const noexcept(::ztd::text::is_nothrow_skip_input_error_v<const _Encoding&, decode_result<_Input, _Output, _State>, const _InputProgress&, const _OutputProgress&>)

The function call for inserting replacement code points at the point of failure, before returning flow back to the caller of the decode operation.

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

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

  • __input_progress – [in] How much input was (potentially irreversibly) read from the input range before undergoing the attempted encode operation.

  • __output_progress – [in] How much output was (potentially irreversibly) written to the output range before undergoing the attempted encode operation.