File indexing completed on 2025-01-18 09:52:35
0001 #ifndef BOOST_SYSTEM_DETAIL_INTEROP_CATEGORY_HPP_INCLUDED
0002 #define BOOST_SYSTEM_DETAIL_INTEROP_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/snprintf.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 interop_error_category: public error_category
0035 {
0036 public:
0037
0038 BOOST_SYSTEM_CONSTEXPR interop_error_category() BOOST_NOEXCEPT:
0039 error_category( detail::interop_category_id )
0040 {
0041 }
0042
0043 const char * name() const BOOST_NOEXCEPT BOOST_OVERRIDE
0044 {
0045 return "std:unknown";
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 inline char const * interop_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
0057 {
0058 detail::snprintf( buffer, len, "Unknown interop error %d", ev );
0059 return buffer;
0060 }
0061
0062 inline std::string interop_error_category::message( int ev ) const
0063 {
0064 char buffer[ 48 ];
0065 return message( ev, buffer, sizeof( buffer ) );
0066 }
0067
0068
0069
0070 #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
0071
0072 template<class T> struct BOOST_SYMBOL_VISIBLE interop_cat_holder
0073 {
0074 static constexpr interop_error_category instance{};
0075 };
0076
0077
0078 #if defined(BOOST_NO_CXX17_INLINE_VARIABLES)
0079 template<class T> constexpr interop_error_category interop_cat_holder<T>::instance;
0080 #endif
0081
0082 constexpr error_category const & interop_category() BOOST_NOEXCEPT
0083 {
0084 return interop_cat_holder<void>::instance;
0085 }
0086
0087 #else
0088
0089 #if !defined(__SUNPRO_CC)
0090 inline error_category const & interop_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE;
0091 #endif
0092
0093 inline error_category const & interop_category() BOOST_NOEXCEPT
0094 {
0095 static const detail::interop_error_category instance;
0096 return instance;
0097 }
0098
0099 #endif
0100
0101 }
0102
0103 }
0104
0105 }
0106
0107 #endif