1 #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_IMPL_HPP_INCLUDED
2 #define BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_IMPL_HPP_INCLUDED
4 // Copyright Beman Dawes 2006, 2007
5 // Copyright Christoper Kohlhoff 2007
6 // Copyright Peter Dimov 2017, 2018, 2020
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)
11 // See library home page at http://www.boost.org/libs/system
13 #include <boost/system/detail/system_category.hpp>
14 #include <boost/system/detail/error_condition.hpp>
15 #include <boost/system/detail/generic_category.hpp>
16 #include <boost/system/api_config.hpp>
17 #include <boost/config.hpp>
19 #if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API)
20 # error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined
23 // system_error_category implementation
25 #if defined(BOOST_WINDOWS_API)
27 #include <boost/system/detail/system_category_message_win32.hpp>
28 #include <boost/system/detail/system_category_condition_win32.hpp>
30 inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT
32 int e2 = system_category_condition_win32( ev );
36 return error_condition( ev, *this );
40 return error_condition( e2, generic_category() );
44 inline std::string boost::system::detail::system_error_category::message( int ev ) const
46 return system_category_message_win32( ev );
49 inline char const * boost::system::detail::system_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
51 return system_category_message_win32( ev, buffer, len );
54 #else // #if defined(BOOST_WINDOWS_API)
56 #include <boost/system/detail/generic_category_message.hpp>
57 #include <boost/system/detail/is_generic_value.hpp>
59 inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT
61 if( is_generic_value( ev ) )
63 return error_condition( ev, generic_category() );
67 return error_condition( ev, *this );
71 inline std::string boost::system::detail::system_error_category::message( int ev ) const
73 return generic_error_category_message( ev );
76 inline char const * boost::system::detail::system_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
78 return generic_error_category_message( ev, buffer, len );
81 #endif // #if defined(BOOST_WINDOWS_API)
83 #endif // #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_IMPL_HPP_INCLUDED