libs/url/include/boost/url/impl/error.hpp
100.0% Lines (5/5)
100.0% Functions (2/2)
-% Branches (0/0)
libs/url/include/boost/url/impl/error.hpp
| Line | Hits | Source Code |
|---|---|---|
| 1 | // | |
| 2 | // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) | |
| 3 | // | |
| 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) | |
| 6 | // | |
| 7 | // Official repository: https://github.com/boostorg/url | |
| 8 | // | |
| 9 | ||
| 10 | #ifndef BOOST_URL_IMPL_ERROR_HPP | |
| 11 | #define BOOST_URL_IMPL_ERROR_HPP | |
| 12 | ||
| 13 | #include <type_traits> | |
| 14 | ||
| 15 | namespace boost { | |
| 16 | ||
| 17 | //----------------------------------------------- | |
| 18 | namespace system { | |
| 19 | template<> | |
| 20 | struct is_error_code_enum<::boost::urls::error> | |
| 21 | { | |
| 22 | static bool const value = true; | |
| 23 | }; | |
| 24 | } // system | |
| 25 | //----------------------------------------------- | |
| 26 | ||
| 27 | namespace urls { | |
| 28 | ||
| 29 | namespace detail { | |
| 30 | ||
| 31 | struct BOOST_SYMBOL_VISIBLE | |
| 32 | error_cat_type | |
| 33 | : system::error_category | |
| 34 | { | |
| 35 | BOOST_URL_DECL | |
| 36 | const char* name( | |
| 37 | ) const noexcept override; | |
| 38 | ||
| 39 | BOOST_URL_DECL | |
| 40 | std::string message( | |
| 41 | int) const override; | |
| 42 | ||
| 43 | BOOST_URL_DECL | |
| 44 | char const* message( | |
| 45 | int, char*, std::size_t | |
| 46 | ) const noexcept override; | |
| 47 | ||
| 48 | BOOST_URL_DECL | |
| 49 | system::error_condition | |
| 50 | default_error_condition( | |
| 51 | int code) const noexcept override; | |
| 52 | ||
| 53 | 72 | BOOST_SYSTEM_CONSTEXPR error_cat_type() noexcept |
| 54 | 72 | : error_category(0xbc15399d7a4ce829) |
| 55 | { | |
| 56 | 72 | } |
| 57 | }; | |
| 58 | ||
| 59 | BOOST_URL_DECL extern | |
| 60 | error_cat_type error_cat; | |
| 61 | ||
| 62 | } // detail | |
| 63 | ||
| 64 | inline | |
| 65 | BOOST_SYSTEM_CONSTEXPR | |
| 66 | system::error_code | |
| 67 | 98 | make_error_code( |
| 68 | error ev) noexcept | |
| 69 | { | |
| 70 | return system::error_code{ | |
| 71 | static_cast<std::underlying_type< | |
| 72 | error>::type>(ev), | |
| 73 | 98 | detail::error_cat}; |
| 74 | } | |
| 75 | ||
| 76 | } // urls | |
| 77 | } // boost | |
| 78 | ||
| 79 | #endif | |
| 80 |