Back to home page

EIC code displayed by LXR

 
 

    


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 //  Copyright Beman Dawes 2006, 2007
0005 //  Copyright Christoper Kohlhoff 2007
0006 //  Copyright Peter Dimov 2017, 2018
0007 //
0008 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
0009 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 //  See library home page at http://www.boost.org/libs/system
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 // system_error_category
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 } // namespace detail
0058 
0059 // system_category()
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 // Before C++17 it was mandatory to redeclare all static constexpr
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 } // namespace detail
0077 
0078 constexpr error_category const & system_category() BOOST_NOEXCEPT
0079 {
0080     return detail::system_cat_holder<void>::instance;
0081 }
0082 
0083 #else // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
0084 
0085 #if !defined(__SUNPRO_CC) // trailing __global is not supported
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 // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
0096 
0097 // deprecated synonyms
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 } // namespace system
0107 
0108 } // namespace boost
0109 
0110 #endif // #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_HPP_INCLUDED