File indexing completed on 2025-01-18 09:29:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 #ifndef BOOST_BEAST_ZLIB_IMPL_ERROR_IPP
0039 #define BOOST_BEAST_ZLIB_IMPL_ERROR_IPP
0040
0041 #include <boost/beast/zlib/error.hpp>
0042 #include <type_traits>
0043
0044 namespace boost {
0045 namespace beast {
0046 namespace zlib {
0047 namespace detail {
0048
0049 class error_codes : public error_category
0050 {
0051 public:
0052 const char*
0053 name() const noexcept override
0054 {
0055 return "boost.beast.zlib";
0056 }
0057
0058 std::string
0059 message(int ev) const override
0060 {
0061 switch(static_cast<error>(ev))
0062 {
0063 case error::need_buffers: return "need buffers";
0064 case error::end_of_stream: return "unexpected end of deflate stream";
0065 case error::need_dict: return "need dict";
0066 case error::stream_error: return "stream error";
0067
0068 case error::invalid_block_type: return "invalid block type";
0069 case error::invalid_stored_length: return "invalid stored block length";
0070 case error::too_many_symbols: return "too many symbols";
0071 case error::invalid_code_lengths: return "invalid code lengths";
0072 case error::invalid_bit_length_repeat: return "invalid bit length repeat";
0073 case error::missing_eob: return "missing end of block code";
0074 case error::invalid_literal_length: return "invalid literal/length code";
0075 case error::invalid_distance_code: return "invalid distance code";
0076 case error::invalid_distance: return "invalid distance";
0077
0078 case error::over_subscribed_length: return "over-subscribed length";
0079 case error::incomplete_length_set: return "incomplete length set";
0080
0081 case error::general:
0082 default:
0083 return "beast.zlib error";
0084 }
0085 }
0086
0087 error_condition
0088 default_error_condition(int ev) const noexcept override
0089 {
0090 return error_condition{ev, *this};
0091 }
0092
0093 bool
0094 equivalent(int ev,
0095 error_condition const& condition
0096 ) const noexcept override
0097 {
0098 return condition.value() == ev &&
0099 &condition.category() == this;
0100 }
0101
0102 bool
0103 equivalent(error_code const& error, int ev) const noexcept override
0104 {
0105 return error.value() == ev &&
0106 &error.category() == this;
0107 }
0108 };
0109
0110 }
0111
0112 error_code
0113 make_error_code(error ev)
0114 {
0115 static detail::error_codes const cat{};
0116 return error_code{static_cast<
0117 std::underlying_type<error>::type>(ev), cat};
0118 }
0119
0120 }
0121 }
0122 }
0123
0124 #endif