Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:26

0001 //
0002 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/beast
0008 //
0009 
0010 #ifndef BOOST_BEAST_IMPL_ERROR_IPP
0011 #define BOOST_BEAST_IMPL_ERROR_IPP
0012 
0013 #include <boost/beast/core/error.hpp>
0014 
0015 namespace boost {
0016 namespace beast {
0017 
0018 namespace detail {
0019 
0020 class error_codes : public error_category
0021 {
0022 public:
0023     const char*
0024     name() const noexcept override
0025     {
0026         return "boost.beast";
0027     }
0028 
0029     error_codes() : error_category(0x002f6e94401c6e8bu)  {}
0030 
0031 
0032     BOOST_BEAST_DECL
0033     std::string
0034     message(int ev) const override
0035     {
0036         switch(static_cast<error>(ev))
0037         {
0038         default:
0039         case error::timeout: return
0040             "The socket was closed due to a timeout";
0041         }
0042     }
0043 
0044     BOOST_BEAST_DECL
0045     error_condition
0046     default_error_condition(int ev) const noexcept override
0047     {
0048         switch(static_cast<error>(ev))
0049         {
0050         default:
0051     //        return {ev, *this};
0052         case error::timeout:
0053             return condition::timeout;
0054         }
0055     }
0056 };
0057 
0058 class error_conditions : public error_category
0059 {
0060 public:
0061     BOOST_BEAST_DECL
0062     const char*
0063     name() const noexcept override
0064     {
0065         return "boost.beast";
0066     }
0067 
0068     error_conditions() : error_category(0x3dd0b0ce843c5b10u)  {}
0069 
0070 
0071     BOOST_BEAST_DECL
0072     std::string
0073     message(int cv) const override
0074     {
0075         switch(static_cast<condition>(cv))
0076         {
0077         default:
0078         case condition::timeout:
0079             return "The operation timed out";
0080         }
0081     }
0082 };
0083 
0084 } // detail
0085 
0086 error_code
0087 make_error_code(error e)
0088 {
0089     static detail::error_codes const cat{};
0090     return error_code{static_cast<
0091         std::underlying_type<error>::type>(e), cat};
0092 }
0093 
0094 error_condition
0095 make_error_condition(condition c)
0096 {
0097     static detail::error_conditions const cat{};
0098     return error_condition{static_cast<
0099         std::underlying_type<condition>::type>(c), cat};
0100 }
0101 
0102 } // beast
0103 } // boost
0104 
0105 #endif