| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com) | ||
| 3 | // Copyright (c) 2024 Mohammad Nejati | ||
| 4 | // | ||
| 5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
| 6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
| 7 | // | ||
| 8 | // Official repository: https://github.com/cppalliance/capy | ||
| 9 | // | ||
| 10 | |||
| 11 | #ifndef BOOST_CAPY_BROTLI_IMPL_ERROR_HPP | ||
| 12 | #define BOOST_CAPY_BROTLI_IMPL_ERROR_HPP | ||
| 13 | |||
| 14 | #include <boost/capy/detail/config.hpp> | ||
| 15 | |||
| 16 | #include <boost/system/error_category.hpp> | ||
| 17 | #include <boost/system/is_error_code_enum.hpp> | ||
| 18 | |||
| 19 | namespace boost { | ||
| 20 | |||
| 21 | namespace system { | ||
| 22 | template<> | ||
| 23 | struct is_error_code_enum< | ||
| 24 | ::boost::capy::brotli::error> | ||
| 25 | { | ||
| 26 | static bool const value = true; | ||
| 27 | }; | ||
| 28 | } // system | ||
| 29 | |||
| 30 | namespace capy { | ||
| 31 | namespace brotli { | ||
| 32 | |||
| 33 | namespace detail { | ||
| 34 | |||
| 35 | struct BOOST_SYMBOL_VISIBLE | ||
| 36 | error_cat_type | ||
| 37 | : system::error_category | ||
| 38 | { | ||
| 39 | BOOST_CAPY_DECL const char* name( | ||
| 40 | ) const noexcept override; | ||
| 41 | BOOST_CAPY_DECL bool failed( | ||
| 42 | int) const noexcept override; | ||
| 43 | BOOST_CAPY_DECL std::string message( | ||
| 44 | int) const override; | ||
| 45 | BOOST_CAPY_DECL char const* message( | ||
| 46 | int, char*, std::size_t | ||
| 47 | ) const noexcept override; | ||
| 48 | 5 | BOOST_SYSTEM_CONSTEXPR error_cat_type() | |
| 49 | 5 | : error_category(0xc38951ab8832fb6f) | |
| 50 | { | ||
| 51 | 5 | } | |
| 52 | }; | ||
| 53 | |||
| 54 | BOOST_CAPY_DECL extern | ||
| 55 | error_cat_type error_cat; | ||
| 56 | |||
| 57 | } // detail | ||
| 58 | |||
| 59 | inline | ||
| 60 | BOOST_SYSTEM_CONSTEXPR | ||
| 61 | system::error_code | ||
| 62 | 1 | make_error_code( | |
| 63 | error ev) noexcept | ||
| 64 | { | ||
| 65 | return system::error_code{ | ||
| 66 | static_cast<std::underlying_type< | ||
| 67 | error>::type>(ev), | ||
| 68 | 1 | detail::error_cat}; | |
| 69 | } | ||
| 70 | |||
| 71 | } // brotli | ||
| 72 | } // capy | ||
| 73 | } // boost | ||
| 74 | |||
| 75 | #endif | ||
| 76 |