| 1 | #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_IMPL_HPP_INCLUDED |
|---|---|
| 2 | #define BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_IMPL_HPP_INCLUDED |
| 3 | |
| 4 | // Copyright Beman Dawes 2006, 2007 |
| 5 | // Copyright Christoper Kohlhoff 2007 |
| 6 | // Copyright Peter Dimov 2017, 2018, 2020 |
| 7 | // |
| 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 10 | // |
| 11 | // See library home page at http://www.boost.org/libs/system |
| 12 | |
| 13 | #include <boost/system/detail/system_category.hpp> |
| 14 | #include <boost/system/detail/system_category_message.hpp> |
| 15 | #include <boost/system/detail/error_condition.hpp> |
| 16 | #include <boost/system/api_config.hpp> |
| 17 | |
| 18 | #if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API) |
| 19 | # error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined |
| 20 | #endif |
| 21 | |
| 22 | // system_error_category implementation |
| 23 | |
| 24 | #if defined(BOOST_WINDOWS_API) |
| 25 | |
| 26 | #include <boost/system/detail/system_category_condition_win32.hpp> |
| 27 | |
| 28 | inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const noexcept |
| 29 | { |
| 30 | int e2 = system_category_condition_win32( ev ); |
| 31 | |
| 32 | if( e2 == -1 ) |
| 33 | { |
| 34 | return error_condition( ev, *this ); |
| 35 | } |
| 36 | else |
| 37 | { |
| 38 | return error_condition( boost::system::detail::generic_value_tag( e2 ) ); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | #else // #if defined(BOOST_WINDOWS_API) |
| 43 | |
| 44 | inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const noexcept |
| 45 | { |
| 46 | return error_condition( boost::system::detail::generic_value_tag( ev ) ); |
| 47 | } |
| 48 | |
| 49 | #endif // #if defined(BOOST_WINDOWS_API) |
| 50 | |
| 51 | inline std::string boost::system::detail::system_error_category::message( int ev ) const |
| 52 | { |
| 53 | return system_error_category_message( ev ); |
| 54 | } |
| 55 | |
| 56 | inline char const * boost::system::detail::system_error_category::message( int ev, char * buffer, std::size_t len ) const noexcept |
| 57 | { |
| 58 | return system_error_category_message( ev, buffer, len ); |
| 59 | } |
| 60 | |
| 61 | #endif // #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_IMPL_HPP_INCLUDED |
| 62 |
