| 1 | // (C) Copyright 2008-10 Anthony Williams |
|---|---|
| 2 | // (C) Copyright 2011-2012,2015 Vicente J. Botet Escriba |
| 3 | // |
| 4 | // Distributed under the Boost Software License, Version 1.0. (See |
| 5 | // accompanying file LICENSE_1_0.txt or copy at |
| 6 | // http://www.boost.org/LICENSE_1_0.txt) |
| 7 | |
| 8 | #ifndef BOOST_THREAD_FUTURES_FUTURE_ERROR_CODE_HPP |
| 9 | #define BOOST_THREAD_FUTURES_FUTURE_ERROR_CODE_HPP |
| 10 | |
| 11 | #include <boost/thread/detail/config.hpp> |
| 12 | #include <boost/core/scoped_enum.hpp> |
| 13 | #include <boost/system/error_code.hpp> |
| 14 | #include <boost/type_traits/integral_constant.hpp> |
| 15 | |
| 16 | namespace boost |
| 17 | { |
| 18 | |
| 19 | //enum class future_errc |
| 20 | BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_errc) |
| 21 | { |
| 22 | broken_promise = 1, |
| 23 | future_already_retrieved, |
| 24 | promise_already_satisfied, |
| 25 | no_state |
| 26 | } |
| 27 | BOOST_SCOPED_ENUM_DECLARE_END(future_errc) |
| 28 | |
| 29 | namespace system |
| 30 | { |
| 31 | template <> |
| 32 | struct BOOST_SYMBOL_VISIBLE is_error_code_enum< ::boost::future_errc> : public true_type {}; |
| 33 | |
| 34 | #ifdef BOOST_NO_CXX11_SCOPED_ENUMS |
| 35 | template <> |
| 36 | struct BOOST_SYMBOL_VISIBLE is_error_code_enum< ::boost::future_errc::enum_type> : public true_type { }; |
| 37 | #endif |
| 38 | } // system |
| 39 | |
| 40 | BOOST_THREAD_DECL |
| 41 | const system::error_category& future_category() BOOST_NOEXCEPT; |
| 42 | |
| 43 | namespace system |
| 44 | { |
| 45 | inline |
| 46 | error_code |
| 47 | make_error_code(future_errc e) BOOST_NOEXCEPT |
| 48 | { |
| 49 | return error_code(underlying_cast<int>(e), boost::future_category()); |
| 50 | } |
| 51 | |
| 52 | inline |
| 53 | error_condition |
| 54 | make_error_condition(future_errc e) BOOST_NOEXCEPT |
| 55 | { |
| 56 | return error_condition(underlying_cast<int>(e), boost::future_category()); |
| 57 | } |
| 58 | } // system |
| 59 | } // boost |
| 60 | |
| 61 | #endif // header |
| 62 |