propagate_errorΒΆ

This helper function processes an error for a transcoding operation and shuffles a result through its decode step and encode step error handlers. Nominally used after a solely decode portion of a transcode operation fails.

If the user is doing a direct conversion and can simply call the encode portion of the error handler directly, calling this function can be skipped entirely by the user.

template<typename _Result, typename _Output, typename _ToEncoding, typename _EncodeErrorHandler, typename _ToState, typename _ToInputProgress, typename _ToOutputProgress, typename _Input, typename _Intermediate, typename _FromState>
constexpr auto propagate_error(_Output &&__output, _ToEncoding &&__to_encoding, decode_result<_Input, _Intermediate, _FromState> &&__result, _EncodeErrorHandler &&__encode_error_handler, _ToState &__to_state, _ToInputProgress &&__to_input_progress, _ToOutputProgress &&__to_output_progress)ΒΆ

Transcoding helper. Takes the given __to_encoding and __encode_error_handler and launders the failed ztd::text::decode_result through it, producing a ztd::text::encode_result and transforming that into the desired ztd::text::transcode_result type.

Remark

This function is a helper whose sole purpose is to ensure that the other half of error handling is called by transcode-style functions written by the end user (e.g., writing overriding hooks for ztd::text::transcode). This function attempts to take care of any unread/unwritten characters and other minor points in its pursuit of properly making sure the error manifests on the other side.

Template Parameters

_Result – The exact transcode result type to use.

Parameters
  • __output – [in] The output view to be writing into.

  • __to_encoding – [in] The desired encoding that performs the encode portion of the transcoding step.

  • __result – [in] The result value that has an error on it.

  • __encode_error_handler – [in] The error handler to mill the __result and other relevant information through.

  • __to_state – [in] The current state of the encoding step of the transcode operation.

  • __to_input_progress – [in] Any unread output characters in any intermediate between the (failed) decode and encode operations.

  • __to_output_progress – [in] Any unread output characters in any intermediates between the (failed) decode and encode operations.

template<typename _Output, typename _ToEncoding, typename _EncodeErrorHandler, typename _ToState, typename _ToInputProgress, typename _ToOutputProgress, typename _Input, typename _Intermediate, typename _FromState>
constexpr auto propagate_error(_Output &&__output, _ToEncoding &&__to_encoding, decode_result<_Input, _Intermediate, _FromState> &&__result, _EncodeErrorHandler &&__encode_error_handler, _ToState &__to_state, _ToInputProgress &&__to_input_progress, _ToOutputProgress &&__to_output_progress)ΒΆ

Takes the given __to_encoding and __encode_error_handler and launders the failed ztd::text::decode_result through it, producing a ztd::text::encode_result and transforming that into the desired ztd::text::transcode_result type.

Remark

This function is a helper whose sole purpose is to ensure that the other half of error handling is called by transcode-style functions written by the end user (e.g., writing overriding hooks for ztd::text::transcode). This function attempts to take care of any unread/unwritten characters and other minor points in its pursuit of properly making sure the error manifests on the other side. Unlike it’s counterpart, this function does not take an _Result template parameter and instead deduces the returned transcode result type from inputs.

Parameters
  • __output – [in] The output view to be writing into.

  • __to_encoding – [in] The desired encoding that performs the encode portion of the transcoding step.

  • __result – [in] The result value that has an error on it.

  • __encode_error_handler – [in] The error handler to mill the __result and other relevant information through.

  • __to_state – [in] The current state of the encoding step of the transcode operation.

  • __to_input_progress – [in] Any unread output characters in any intermediate between the (failed) decode and encode operations.

  • __to_output_progress – [in] Any unread output characters in any intermediates between the (failed) decode and encode operations.