]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/system/detail/system_category_impl.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / system / detail / system_category_impl.hpp
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/error_condition.hpp>
15 #include <boost/system/detail/generic_category.hpp>
16 #include <boost/system/api_config.hpp>
17 #include <boost/config.hpp>
18
19 #if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API)
20 # error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined
21 #endif
22
23 // system_error_category implementation
24
25 #if defined(BOOST_WINDOWS_API)
26
27 #include <boost/system/detail/system_category_message_win32.hpp>
28 #include <boost/system/detail/system_category_condition_win32.hpp>
29
30 inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT
31 {
32 int e2 = system_category_condition_win32( ev );
33
34 if( e2 == -1 )
35 {
36 return error_condition( ev, *this );
37 }
38 else
39 {
40 return error_condition( e2, generic_category() );
41 }
42 }
43
44 inline std::string boost::system::detail::system_error_category::message( int ev ) const
45 {
46 return system_category_message_win32( ev );
47 }
48
49 inline char const * boost::system::detail::system_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
50 {
51 return system_category_message_win32( ev, buffer, len );
52 }
53
54 #else // #if defined(BOOST_WINDOWS_API)
55
56 #include <boost/system/detail/generic_category_message.hpp>
57 #include <boost/system/detail/is_generic_value.hpp>
58
59 inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT
60 {
61 if( is_generic_value( ev ) )
62 {
63 return error_condition( ev, generic_category() );
64 }
65 else
66 {
67 return error_condition( ev, *this );
68 }
69 }
70
71 inline std::string boost::system::detail::system_error_category::message( int ev ) const
72 {
73 return generic_error_category_message( ev );
74 }
75
76 inline char const * boost::system::detail::system_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
77 {
78 return generic_error_category_message( ev, buffer, len );
79 }
80
81 #endif // #if defined(BOOST_WINDOWS_API)
82
83 #endif // #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_IMPL_HPP_INCLUDED