//
-// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
+// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/boostorg/beast
//
+
// This is a derivative work based on Zlib, copyright below:
/*
Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
#ifndef BOOST_BEAST_ZLIB_IMPL_ERROR_IPP
#define BOOST_BEAST_ZLIB_IMPL_ERROR_IPP
-#include <boost/beast/core/error.hpp>
+#include <boost/beast/zlib/error.hpp>
#include <type_traits>
namespace boost {
-
-namespace system {
-template<>
-struct is_error_code_enum<beast::zlib::error>
-{
- static bool const value = true;
-};
-} // system
-
namespace beast {
namespace zlib {
namespace detail {
-class zlib_error_category : public error_category
+class error_codes : public error_category
{
public:
const char*
name() const noexcept override
{
- return "beast.zlib";
+ return "boost.beast.zlib";
}
std::string
{
case error::need_buffers: return "need buffers";
case error::end_of_stream: return "unexpected end of deflate stream";
+ case error::need_dict: return "need dict";
case error::stream_error: return "stream error";
case error::invalid_block_type: return "invalid block type";
case error::invalid_stored_length: return "invalid stored block length";
case error::too_many_symbols: return "too many symbols";
- case error::invalid_code_lenths: return "invalid code lengths";
+ case error::invalid_code_lengths: return "invalid code lengths";
case error::invalid_bit_length_repeat: return "invalid bit length repeat";
case error::missing_eob: return "missing end of block code";
case error::invalid_literal_length: return "invalid literal/length code";
}
};
-inline
-error_category const&
-get_error_category()
-{
- static zlib_error_category const cat{};
- return cat;
-}
-
} // detail
-inline
error_code
make_error_code(error ev)
{
- return error_code{
- static_cast<std::underlying_type<error>::type>(ev),
- detail::get_error_category()};
+ static detail::error_codes const cat{};
+ return error_code{static_cast<
+ std::underlying_type<error>::type>(ev), cat};
}
} // zlib