transcode_result

template<typename _Input, typename _Output, typename _FromState, typename _ToState>
class ztd::text::transcode_result : public ztd::text::stateless_transcode_result<_Input, _Output>

The result of transcoding operations (such as ztd_text_transcode).

Public Functions

template<typename _ArgInput, typename _ArgOutput, typename _ArgFromState, typename _ArgToState>
inline constexpr transcode_result(_ArgInput &&__input, _ArgOutput &&__output, _ArgFromState &&__from_state, _ArgToState &&__to_state, encoding_error __error_code = encoding_error::ok)

Constructs a ztd::text::transcode_result, defaulting the error code to ztd::text::encoding_error::ok if not provided.

Parameters
  • __input[in] The input range to store.

  • __output[in] The output range to store.

  • __from_state[in] The state related to the “From Encoding” that performed the decode half of the operation.

  • __to_state[in] The state related to the “To Encoding” that performed the encode half of the operation.

  • __error_code[in] The error code for the encode operation, taken as the first of either the encode or decode operation that failed.

template<typename _ArgInput, typename _ArgOutput, typename _ArgFromState, typename _ArgToState>
inline constexpr transcode_result(_ArgInput &&__input, _ArgOutput &&__output, _ArgFromState &&__from_state, _ArgToState &&__to_state, encoding_error __error_code, ::std::size_t __handled_errors)

Constructs a ztd::text::transcode_result with the provided parameters and information, including whether or not an error was handled.

Parameters
  • __input[in] The input range to store.

  • __output[in] The output range to store.

  • __from_state[in] The state related to the “From Encoding” that performed the decode half of the operation.

  • __to_state[in] The state related to the “To Encoding” that performed the encode half of the operation.

  • __error_code[in] The error code for the encode operation, taken as the first of either the encode or decode operation that failed.

  • __handled_errors[in] Whether or not an error was handled. Some error handlers are corrective (see ztd::text::replacement_handler_t), and so the error code is not enough to determine if the handler was invoked. This allows the value to be provided directly when constructing this result type.

inline constexpr bool errors_were_handled() const noexcept

Whether or not any errors were handled.

Returns

Simply checks whether handled_errors is greater than 0.

Public Members

::ztd::reference_wrapper<_FromState> from_state

A reference to the state of the associated Encoding used for decoding input code units to intermediate code points.

::ztd::reference_wrapper<_ToState> to_state

A reference to the state of the associated Encoding used for encoding intermediate code points to code units.

_Input input

The reconstructed input_view object, with its .begin() incremented by the number of code units successfully read (can be identical to .begin() on original range on failure).

_Output output

The reconstructed output_view object, with its .begin() incremented by the number of code units successfully written (can be identical to .begin() on original range on failure).

encoding_error error_code

The kind of error that occured, if any.

::std::size_t handled_errors

Whether or not the error handler was invoked, regardless of if the error_code is set or not set to ztd::text::encoding_error::ok.