Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:45:10

0001 
0002 //          Copyright Oliver Kowalke 2009.
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //    (See accompanying file LICENSE_1_0.txt or copy at
0005 //          http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_COROUTINES_EXCEPTIONS_H
0008 #define BOOST_COROUTINES_EXCEPTIONS_H
0009 
0010 #include <stdexcept>
0011 #include <string>
0012 
0013 #include <boost/config.hpp>
0014 #include <boost/core/scoped_enum.hpp>
0015 #include <boost/system/error_code.hpp>
0016 #include <boost/system/system_error.hpp>
0017 #include <boost/type_traits/integral_constant.hpp>
0018 
0019 #include <boost/coroutine/detail/config.hpp>
0020 
0021 #ifdef BOOST_HAS_ABI_HEADERS
0022 #  include BOOST_ABI_PREFIX
0023 #endif
0024 
0025 namespace boost {
0026 namespace coroutines {
0027 namespace detail {
0028 
0029 struct forced_unwind {};
0030 
0031 }
0032 
0033 BOOST_SCOPED_ENUM_DECLARE_BEGIN(coroutine_errc)
0034 {
0035   no_data = 1
0036 }
0037 BOOST_SCOPED_ENUM_DECLARE_END(coroutine_errc)
0038 
0039 BOOST_COROUTINES_DECL
0040 system::error_category const& coroutine_category() BOOST_NOEXCEPT;
0041 
0042 }
0043 
0044 namespace system {
0045 
0046 template<>
0047 struct is_error_code_enum< coroutines::coroutine_errc > : public true_type
0048 {};
0049 
0050 #ifdef BOOST_NO_CXX11_SCOPED_ENUMS
0051 template<>
0052 struct is_error_code_enum< coroutines::coroutine_errc::enum_type > : public true_type
0053 {};
0054 #endif
0055 
0056 inline
0057 error_code make_error_code( coroutines::coroutine_errc e) //BOOST_NOEXCEPT
0058 {
0059     return error_code( underlying_cast< int >( e), coroutines::coroutine_category() );
0060 }
0061 
0062 inline
0063 error_condition make_error_condition( coroutines::coroutine_errc e) //BOOST_NOEXCEPT
0064 {
0065     return error_condition( underlying_cast< int >( e), coroutines::coroutine_category() );
0066 }
0067 
0068 }
0069 
0070 namespace coroutines {
0071 
0072 class coroutine_error : public std::logic_error
0073 {
0074 private:
0075     system::error_code  ec_;
0076 
0077 public:
0078     coroutine_error( system::error_code ec) :
0079         logic_error( ec.message() ),
0080         ec_( ec)
0081     {}
0082 
0083     system::error_code const& code() const BOOST_NOEXCEPT
0084     { return ec_; }
0085 };
0086 
0087 class invalid_result : public coroutine_error
0088 {
0089 public:
0090     invalid_result() :
0091         coroutine_error(
0092             system::make_error_code(
0093                 coroutine_errc::no_data) )
0094     {}
0095 };
0096 
0097 }}
0098 
0099 #ifdef BOOST_HAS_ABI_HEADERS
0100 #  include BOOST_ABI_SUFFIX
0101 #endif
0102 
0103 #endif // BOOST_COROUTINES_EXCEPTIONS_H