File indexing completed on 2025-01-18 09:52:35
0001 #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_HPP_INCLUDED
0002 #define BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_HPP_INCLUDED
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <boost/system/detail/error_category.hpp>
0014 #include <boost/system/detail/config.hpp>
0015 #include <boost/config.hpp>
0016
0017 namespace boost
0018 {
0019
0020 namespace system
0021 {
0022
0023 namespace detail
0024 {
0025
0026
0027
0028 #if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG )
0029 #pragma GCC diagnostic push
0030 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
0031 #endif
0032
0033 class BOOST_SYMBOL_VISIBLE system_error_category: public error_category
0034 {
0035 public:
0036
0037 BOOST_SYSTEM_CONSTEXPR system_error_category() BOOST_NOEXCEPT:
0038 error_category( detail::system_category_id )
0039 {
0040 }
0041
0042 const char * name() const BOOST_NOEXCEPT BOOST_OVERRIDE
0043 {
0044 return "system";
0045 }
0046
0047 error_condition default_error_condition( int ev ) const BOOST_NOEXCEPT BOOST_OVERRIDE;
0048
0049 std::string message( int ev ) const BOOST_OVERRIDE;
0050 char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT BOOST_OVERRIDE;
0051 };
0052
0053 #if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG )
0054 #pragma GCC diagnostic pop
0055 #endif
0056
0057 }
0058
0059
0060
0061 #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
0062
0063 namespace detail
0064 {
0065
0066 template<class T> struct BOOST_SYMBOL_VISIBLE system_cat_holder
0067 {
0068 static constexpr system_error_category instance{};
0069 };
0070
0071
0072 #if defined(BOOST_NO_CXX17_INLINE_VARIABLES)
0073 template<class T> constexpr system_error_category system_cat_holder<T>::instance;
0074 #endif
0075
0076 }
0077
0078 constexpr error_category const & system_category() BOOST_NOEXCEPT
0079 {
0080 return detail::system_cat_holder<void>::instance;
0081 }
0082
0083 #else
0084
0085 #if !defined(__SUNPRO_CC)
0086 inline error_category const & system_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE;
0087 #endif
0088
0089 inline error_category const & system_category() BOOST_NOEXCEPT
0090 {
0091 static const detail::system_error_category instance;
0092 return instance;
0093 }
0094
0095 #endif
0096
0097
0098
0099 #ifdef BOOST_SYSTEM_ENABLE_DEPRECATED
0100
0101 BOOST_SYSTEM_DEPRECATED("please use system_category()") inline const error_category & get_system_category() { return system_category(); }
0102 BOOST_SYSTEM_DEPRECATED("please use system_category()") static const error_category & native_ecat BOOST_ATTRIBUTE_UNUSED = system_category();
0103
0104 #endif
0105
0106 }
0107
0108 }
0109
0110 #endif