File indexing completed on 2025-01-18 09:52:35
0001 #ifndef BOOST_SYSTEM_DETAIL_GENERIC_CATEGORY_HPP_INCLUDED
0002 #define BOOST_SYSTEM_DETAIL_GENERIC_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/generic_category_message.hpp>
0015 #include <boost/system/detail/config.hpp>
0016 #include <boost/config.hpp>
0017
0018 namespace boost
0019 {
0020
0021 namespace system
0022 {
0023
0024 namespace detail
0025 {
0026
0027
0028
0029 #if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG )
0030 #pragma GCC diagnostic push
0031 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
0032 #endif
0033
0034 class BOOST_SYMBOL_VISIBLE generic_error_category: public error_category
0035 {
0036 public:
0037
0038 BOOST_SYSTEM_CONSTEXPR generic_error_category() BOOST_NOEXCEPT:
0039 error_category( detail::generic_category_id )
0040 {
0041 }
0042
0043 const char * name() const BOOST_NOEXCEPT BOOST_OVERRIDE
0044 {
0045 return "generic";
0046 }
0047
0048 std::string message( int ev ) const BOOST_OVERRIDE;
0049 char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT BOOST_OVERRIDE;
0050 };
0051
0052 #if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG )
0053 #pragma GCC diagnostic pop
0054 #endif
0055
0056
0057
0058 inline char const * generic_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
0059 {
0060 return generic_error_category_message( ev, buffer, len );
0061 }
0062
0063 inline std::string generic_error_category::message( int ev ) const
0064 {
0065 return generic_error_category_message( ev );
0066 }
0067
0068 }
0069
0070
0071
0072 #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
0073
0074 namespace detail
0075 {
0076
0077 template<class T> struct BOOST_SYMBOL_VISIBLE generic_cat_holder
0078 {
0079 static constexpr generic_error_category instance{};
0080 };
0081
0082
0083 #if defined(BOOST_NO_CXX17_INLINE_VARIABLES)
0084 template<class T> constexpr generic_error_category generic_cat_holder<T>::instance;
0085 #endif
0086
0087 }
0088
0089 constexpr error_category const & generic_category() BOOST_NOEXCEPT
0090 {
0091 return detail::generic_cat_holder<void>::instance;
0092 }
0093
0094 #else
0095
0096 #if !defined(__SUNPRO_CC)
0097 inline error_category const & generic_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE;
0098 #endif
0099
0100 inline error_category const & generic_category() BOOST_NOEXCEPT
0101 {
0102 static const detail::generic_error_category instance;
0103 return instance;
0104 }
0105
0106 #endif
0107
0108
0109
0110 #ifdef BOOST_SYSTEM_ENABLE_DEPRECATED
0111
0112 BOOST_SYSTEM_DEPRECATED("please use generic_category()") inline const error_category & get_generic_category() { return generic_category(); }
0113 BOOST_SYSTEM_DEPRECATED("please use generic_category()") inline const error_category & get_posix_category() { return generic_category(); }
0114 BOOST_SYSTEM_DEPRECATED("please use generic_category()") static const error_category & posix_category BOOST_ATTRIBUTE_UNUSED = generic_category();
0115 BOOST_SYSTEM_DEPRECATED("please use generic_category()") static const error_category & errno_ecat BOOST_ATTRIBUTE_UNUSED = generic_category();
0116
0117 #endif
0118
0119 }
0120
0121 }
0122
0123 #endif