Skip to content

Commit

Permalink
馃洜 unused error handlers are now properly used!
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhD committed Jul 27, 2021
1 parent 6cf1fa1 commit 9c33e6c
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions include/ztd/text/any_encoding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,19 +404,21 @@ namespace ztd { namespace text {
virtual __decode_result __decode_one(_DecodeCodeUnits __input, _DecodeCodePoints __output,
__decode_error_handler __error_handler, decode_state& __state) const override {
__real_decode_state& __actual_state = this->_M_get_state(__state);
__txt_detail::__pass_through_handler __pass_handler;
__txt_detail::__forwarding_handler<any_encoding_with, __decode_error_handler> __forwarding_handler(
*this, __error_handler);
auto __raw_result = this->__base_t::get_value().decode_one(
::std::move(__input), ::std::move(__output), __pass_handler, __actual_state);
::std::move(__input), ::std::move(__output), __forwarding_handler, __actual_state);
return __decode_result(::std::move(__raw_result.input), ::std::move(__raw_result.output), __state,
__raw_result.error_code, __raw_result.handled_errors);
}

virtual __encode_result __encode_one(_EncodeCodePoints __input, _EncodeCodeUnits __output,
__encode_error_handler __error_handler, encode_state& __state) const override {
__real_encode_state& __actual_state = this->_M_get_state(__state);
__txt_detail::__pass_through_handler __pass_handler;
__txt_detail::__forwarding_handler<any_encoding_with, __encode_error_handler> __forwarding_handler(
*this, __error_handler);
auto __raw_result = this->__base_t::get_value().encode_one(
::std::move(__input), ::std::move(__output), __pass_handler, __actual_state);
::std::move(__input), ::std::move(__output), __forwarding_handler, __actual_state);
return __encode_result(::std::move(__raw_result.input), ::std::move(__raw_result.output), __state,
__raw_result.error_code, __raw_result.handled_errors);
}
Expand Down Expand Up @@ -478,26 +480,27 @@ namespace ztd { namespace text {
virtual __count_decodable_result __count_decodable_one(_DecodeCodeUnits __input,
__count_decodable_error_handler __error_handler, decode_state& __state) const override {
__real_decode_state& __actual_state = this->_M_get_state(__state);
__txt_detail::__pass_through_handler __pass_handler;
__txt_detail::__forwarding_handler<any_encoding_with, __count_decodable_error_handler>
__forwarding_handler(*this, __error_handler);
auto& __encoding = this->__base_t::get_value();
if constexpr (is_detected_v<__txt_detail::__detect_adl_internal_text_count_decodable_one, _Encoding,
_DecodeCodeUnits, __txt_detail::__pass_through_handler, __real_decode_state>) {
auto __raw_result = text_count_decodable_one(
__encoding, ::std::move(__input), __pass_handler, __actual_state);
__encoding, ::std::move(__input), __forwarding_handler, __actual_state);
return __count_decodable_result(::std::move(__raw_result.input), __raw_result.count, __state,
__raw_result.error_code, __raw_result.handled_errors);
}
else if constexpr (is_detected_v<__txt_detail::__detect_adl_internal_text_count_decodable_one,
_Encoding, _DecodeCodeUnits, __txt_detail::__pass_through_handler,
__real_decode_state>) {
auto __raw_result = __text_count_decodable_one(
__encoding, ::std::move(__input), __pass_handler, __actual_state);
__encoding, ::std::move(__input), __forwarding_handler, __actual_state);
return __count_decodable_result(::std::move(__raw_result.input), __raw_result.count, __state,
__raw_result.error_code, __raw_result.handled_errors);
}
else {
auto __raw_result = __txt_detail::__basic_count_decodable_one(
::std::move(__input), __encoding, __pass_handler, __actual_state);
::std::move(__input), __encoding, __forwarding_handler, __actual_state);
return __count_decodable_result(::std::move(__raw_result.input), __raw_result.count, __state,
__raw_result.error_code, __raw_result.handled_errors);
}
Expand All @@ -506,26 +509,27 @@ namespace ztd { namespace text {
virtual __count_encodable_result __count_encodable_one(_EncodeCodePoints __input,
__count_encodable_error_handler __error_handler, encode_state& __state) const override {
__real_encode_state& __actual_state = this->_M_get_state(__state);
__txt_detail::__pass_through_handler __pass_handler;
__txt_detail::__forwarding_handler<any_encoding_with, __count_encodable_error_handler>
__forwarding_handler(*this, __error_handler);
auto& __encoding = this->__base_t::get_value();
if constexpr (is_detected_v<__txt_detail::__detect_adl_text_count_encodable_one, _Encoding,
_EncodeCodePoints, __txt_detail::__pass_through_handler, __real_encode_state>) {
auto __raw_result = text_count_encodable_one(
__encoding, ::std::move(__input), __pass_handler, __actual_state);
__encoding, ::std::move(__input), __forwarding_handler, __actual_state);
return __count_encodable_result(::std::move(__raw_result.input), __raw_result.count, __state,
__raw_result.error_code, __raw_result.handled_errors);
}
else if constexpr (is_detected_v<__txt_detail::__detect_adl_internal_text_count_encodable_one,
_Encoding, _EncodeCodePoints, __txt_detail::__pass_through_handler,
__real_encode_state>) {
auto __raw_result = __text_count_encodable_one(
__encoding, ::std::move(__input), __pass_handler, __actual_state);
__encoding, ::std::move(__input), __forwarding_handler, __actual_state);
return __count_encodable_result(::std::move(__raw_result.input), __raw_result.count, __state,
__raw_result.error_code, __raw_result.handled_errors);
}
else {
auto __raw_result = __txt_detail::__basic_count_encodable_one(
::std::move(__input), __encoding, __pass_handler, __actual_state);
::std::move(__input), __encoding, __forwarding_handler, __actual_state);
return __count_encodable_result(::std::move(__raw_result.input), __raw_result.count, __state);
}
}
Expand All @@ -534,19 +538,21 @@ namespace ztd { namespace text {
virtual __decode_result __decode(_DecodeCodeUnits __input, _DecodeCodePoints __output,
__decode_error_handler __error_handler, decode_state& __state) const override {
__real_decode_state& __actual_state = this->_M_get_state(__state);
__txt_detail::__pass_through_handler __pass_handler;
__txt_detail::__forwarding_handler<any_encoding_with, __decode_error_handler> __forwarding_handler(
*this, __error_handler);
auto __raw_result = ::ztd::text::decode_into(::std::move(__input), this->__base_t::get_value(),
::std::move(__output), __pass_handler, __actual_state);
::std::move(__output), __forwarding_handler, __actual_state);
return __decode_result(::std::move(__raw_result.input), ::std::move(__raw_result.output), __state,
__raw_result.error_code, __raw_result.handled_errors);
}

virtual __encode_result __encode(_EncodeCodePoints __input, _EncodeCodeUnits __output,
__encode_error_handler __error_handler, encode_state& __state) const override {
__real_encode_state& __actual_state = this->_M_get_state(__state);
__txt_detail::__pass_through_handler __pass_handler;
__txt_detail::__forwarding_handler<any_encoding_with, __encode_error_handler> __forwarding_handler(
*this, __error_handler);
auto __raw_result = ::ztd::text::encode_into(::std::move(__input), this->__base_t::get_value(),
::std::move(__output), __pass_handler, __actual_state);
::std::move(__output), __forwarding_handler, __actual_state);
return __encode_result(::std::move(__raw_result.input), ::std::move(__raw_result.output), __state,
__raw_result.error_code, __raw_result.handled_errors);
}
Expand All @@ -571,19 +577,21 @@ namespace ztd { namespace text {
__count_decodable_error_handler __error_handler, decode_state& __state) const override {
__real_decode_state& __actual_state = this->_M_get_state(__state);
auto& __encoding = this->__base_t::get_value();
__txt_detail::__pass_through_handler __pass_handler;
__txt_detail::__forwarding_handler<any_encoding_with, __count_encodable_error_handler>
__forwarding_handler(*this, __error_handler);
auto __raw_result = ::ztd::text::count_decodable(
::std::move(__input), __encoding, __pass_handler, __actual_state);
::std::move(__input), __encoding, __forwarding_handler, __actual_state);
return __count_decodable_result(::std::move(__raw_result.input), __raw_result.count, __state,
__raw_result.error_code, __raw_result.handled_errors);
}

virtual __count_encodable_result __count_encodable(_EncodeCodePoints __input,
__count_encodable_error_handler __error_handler, encode_state& __state) const override {
__real_encode_state& __actual_state = this->_M_get_state(__state);
__txt_detail::__pass_through_handler __pass_handler;
__txt_detail::__forwarding_handler<any_encoding_with, __count_encodable_error_handler>
__forwarding_handler(*this, __error_handler);
auto __raw_result = ::ztd::text::count_encodable(
::std::move(__input), this->__base_t::get_value(), __pass_handler, __actual_state);
::std::move(__input), this->__base_t::get_value(), __forwarding_handler, __actual_state);
return __count_encodable_result(::std::move(__raw_result.input), __raw_result.count, __state,
__raw_result.error_code, __raw_result.handled_errors);
}
Expand Down

0 comments on commit 9c33e6c

Please sign in to comment.