File indexing completed on 2025-07-05 08:28:06
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 BOOST_BEAST_DECL
0059 char const*
0060 message(int ev, char*, std::size_t) const noexcept override
0061 {
0062 switch(static_cast<error>(ev))
0063 {
0064 case error::need_buffers: return "need buffers";
0065 case error::end_of_stream: return "unexpected end of deflate stream";
0066 case error::need_dict: return "need dict";
0067 case error::stream_error: return "stream error";
0068
0069 case error::invalid_block_type: return "invalid block type";
0070 case error::invalid_stored_length: return "invalid stored block length";
0071 case error::too_many_symbols: return "too many symbols";
0072 case error::invalid_code_lengths: return "invalid code lengths";
0073 case error::invalid_bit_length_repeat: return "invalid bit length repeat";
0074 case error::missing_eob: return "missing end of block code";
0075 case error::invalid_literal_length: return "invalid literal/length code";
0076 case error::invalid_distance_code: return "invalid distance code";
0077 case error::invalid_distance: return "invalid distance";
0078
0079 case error::over_subscribed_length: return "over-subscribed length";
0080 case error::incomplete_length_set: return "incomplete length set";
0081
0082 case error::general:
0083 default:
0084 return "beast.zlib error";
0085 }
0086 }
0087
0088 std::string
0089 message(int ev) const override
0090 {
0091 return message(ev, nullptr, 0);
0092 }
0093
0094 error_condition
0095 default_error_condition(int ev) const noexcept override
0096 {
0097 return error_condition{ev, *this};
0098 }
0099
0100 bool
0101 equivalent(int ev,
0102 error_condition const& condition
0103 ) const noexcept override
0104 {
0105 return condition.value() == ev &&
0106 &condition.category() == this;
0107 }
0108
0109 bool
0110 equivalent(error_code const& error, int ev) const noexcept override
0111 {
0112 return error.value() == ev &&
0113 &error.category() == this;
0114 }
0115 };
0116
0117 }
0118
0119 error_code
0120 make_error_code(error ev)
0121 {
0122 static detail::error_codes const cat{};
0123 return error_code{static_cast<
0124 std::underlying_type<error>::type>(ev), cat};
0125 }
0126
0127 }
0128 }
0129 }
0130
0131 #endif