100.00% Lines (6/6)
100.00% Functions (2/2)
| TLA | Baseline | Branch | ||||||
|---|---|---|---|---|---|---|---|---|
| Line | Hits | Code | Line | Hits | Code | |||
| 1 | // | 1 | // | |||||
| 2 | // Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com) | 2 | // Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com) | |||||
| 3 | // | 3 | // | |||||
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |||||
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |||||
| 6 | // | 6 | // | |||||
| 7 | // Official repository: https://github.com/cppalliance/http | 7 | // Official repository: https://github.com/cppalliance/http | |||||
| 8 | // | 8 | // | |||||
| 9 | 9 | |||||||
| 10 | #ifndef BOOST_HTTP_IMPL_ERROR_HPP | 10 | #ifndef BOOST_HTTP_IMPL_ERROR_HPP | |||||
| 11 | #define BOOST_HTTP_IMPL_ERROR_HPP | 11 | #define BOOST_HTTP_IMPL_ERROR_HPP | |||||
| 12 | 12 | |||||||
| 13 | #include <system_error> | 13 | #include <system_error> | |||||
| 14 | 14 | |||||||
| 15 | namespace std { | 15 | namespace std { | |||||
| 16 | template<> | 16 | template<> | |||||
| 17 | struct is_error_code_enum< | 17 | struct is_error_code_enum< | |||||
| 18 | ::boost::http::error> | 18 | ::boost::http::error> | |||||
| 19 | : std::true_type {}; | 19 | : std::true_type {}; | |||||
| 20 | 20 | |||||||
| 21 | template<> | 21 | template<> | |||||
| 22 | struct is_error_condition_enum< | 22 | struct is_error_condition_enum< | |||||
| 23 | ::boost::http::condition> | 23 | ::boost::http::condition> | |||||
| 24 | : std::true_type {}; | 24 | : std::true_type {}; | |||||
| 25 | } // std | 25 | } // std | |||||
| 26 | 26 | |||||||
| 27 | namespace boost { | 27 | namespace boost { | |||||
| 28 | 28 | |||||||
| 29 | //----------------------------------------------- | 29 | //----------------------------------------------- | |||||
| 30 | 30 | |||||||
| 31 | namespace http { | 31 | namespace http { | |||||
| 32 | 32 | |||||||
| 33 | namespace detail { | 33 | namespace detail { | |||||
| 34 | 34 | |||||||
| 35 | struct BOOST_HTTP_SYMBOL_VISIBLE | 35 | struct BOOST_HTTP_SYMBOL_VISIBLE | |||||
| 36 | error_cat_type | 36 | error_cat_type | |||||
| 37 | : std::error_category | 37 | : std::error_category | |||||
| 38 | { | 38 | { | |||||
| 39 | BOOST_HTTP_DECL const char* name( | 39 | BOOST_HTTP_DECL const char* name( | |||||
| 40 | ) const noexcept override; | 40 | ) const noexcept override; | |||||
| 41 | BOOST_HTTP_DECL std::string message( | 41 | BOOST_HTTP_DECL std::string message( | |||||
| 42 | int) const override; | 42 | int) const override; | |||||
| 43 | constexpr error_cat_type() noexcept = default; | 43 | constexpr error_cat_type() noexcept = default; | |||||
| 44 | }; | 44 | }; | |||||
| 45 | 45 | |||||||
| 46 | struct BOOST_HTTP_SYMBOL_VISIBLE | 46 | struct BOOST_HTTP_SYMBOL_VISIBLE | |||||
| 47 | condition_cat_type | 47 | condition_cat_type | |||||
| 48 | : std::error_category | 48 | : std::error_category | |||||
| 49 | { | 49 | { | |||||
| 50 | BOOST_HTTP_DECL const char* name( | 50 | BOOST_HTTP_DECL const char* name( | |||||
| 51 | ) const noexcept override; | 51 | ) const noexcept override; | |||||
| 52 | BOOST_HTTP_DECL std::string message( | 52 | BOOST_HTTP_DECL std::string message( | |||||
| 53 | int) const override; | 53 | int) const override; | |||||
| 54 | BOOST_HTTP_DECL bool equivalent( | 54 | BOOST_HTTP_DECL bool equivalent( | |||||
| 55 | std::error_code const&, int | 55 | std::error_code const&, int | |||||
| 56 | ) const noexcept override; | 56 | ) const noexcept override; | |||||
| 57 | constexpr condition_cat_type() noexcept = default; | 57 | constexpr condition_cat_type() noexcept = default; | |||||
| 58 | }; | 58 | }; | |||||
| 59 | 59 | |||||||
| 60 | BOOST_HTTP_DECL extern | 60 | BOOST_HTTP_DECL extern | |||||
| 61 | error_cat_type error_cat; | 61 | error_cat_type error_cat; | |||||
| 62 | BOOST_HTTP_DECL extern | 62 | BOOST_HTTP_DECL extern | |||||
| 63 | condition_cat_type condition_cat; | 63 | condition_cat_type condition_cat; | |||||
| 64 | 64 | |||||||
| 65 | } // detail | 65 | } // detail | |||||
| 66 | 66 | |||||||
| 67 | inline | 67 | inline | |||||
| 68 | std::error_code | 68 | std::error_code | |||||
| HITCBC | 69 | 120678 | make_error_code( | 69 | 316518 | make_error_code( | ||
| 70 | error ev) noexcept | 70 | error ev) noexcept | |||||
| 71 | { | 71 | { | |||||
| HITCBC | 72 | 120678 | return std::error_code{ | 72 | 316518 | return std::error_code{ | ||
| 73 | static_cast<std::underlying_type< | 73 | static_cast<std::underlying_type< | |||||
| 74 | error>::type>(ev), | 74 | error>::type>(ev), | |||||
| HITCBC | 75 | 120678 | detail::error_cat}; | 75 | 316518 | detail::error_cat}; | ||
| 76 | } | 76 | } | |||||
| 77 | 77 | |||||||
| 78 | inline | 78 | inline | |||||
| 79 | std::error_condition | 79 | std::error_condition | |||||
| HITCBC | 80 | 154847 | make_error_condition( | 80 | 154840 | make_error_condition( | ||
| 81 | condition c) noexcept | 81 | condition c) noexcept | |||||
| 82 | { | 82 | { | |||||
| HITCBC | 83 | 154847 | return std::error_condition{ | 83 | 154840 | return std::error_condition{ | ||
| 84 | static_cast<std::underlying_type< | 84 | static_cast<std::underlying_type< | |||||
| 85 | condition>::type>(c), | 85 | condition>::type>(c), | |||||
| HITCBC | 86 | 154847 | detail::condition_cat}; | 86 | 154840 | detail::condition_cat}; | ||
| 87 | } | 87 | } | |||||
| 88 | 88 | |||||||
| 89 | } // http | 89 | } // http | |||||
| 90 | } // boost | 90 | } // boost | |||||
| 91 | 91 | |||||||
| 92 | #endif | 92 | #endif | |||||