Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:35

0001 #ifndef BOOST_SYSTEM_DETAIL_STD_CATEGORY_HPP_INCLUDED
0002 #define BOOST_SYSTEM_DETAIL_STD_CATEGORY_HPP_INCLUDED
0003 
0004 // Support for interoperability between Boost.System and <system_error>
0005 //
0006 // Copyright 2018, 2021 Peter Dimov
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/config.hpp>
0015 #include <system_error>
0016 
0017 //
0018 
0019 namespace boost
0020 {
0021 
0022 namespace system
0023 {
0024 
0025 namespace detail
0026 {
0027 
0028 template<unsigned Id> struct id_wrapper {};
0029 
0030 class BOOST_SYMBOL_VISIBLE std_category: public std::error_category
0031 {
0032 private:
0033 
0034     boost::system::error_category const * pc_;
0035 
0036 public:
0037 
0038     boost::system::error_category const & original_category() const BOOST_NOEXCEPT
0039     {
0040         return *pc_;
0041     }
0042 
0043 public:
0044 
0045     template<unsigned Id>
0046     explicit std_category( boost::system::error_category const * pc, id_wrapper<Id> ): pc_( pc )
0047     {
0048 #if defined(_MSC_VER) && defined(_CPPLIB_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000
0049 
0050         // We used to assign to the protected _Addr member of std::error_category
0051         // here when Id != 0, but this should never happen now because this code
0052         // path is no longer used
0053 
0054 #if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
0055 
0056         static_assert( Id == 0, "This constructor should only be called with Id == 0 under MS STL 14.0+" );
0057 
0058 #endif
0059 
0060 #endif
0061     }
0062 
0063     const char * name() const BOOST_NOEXCEPT BOOST_OVERRIDE
0064     {
0065         return pc_->name();
0066     }
0067 
0068     std::string message( int ev ) const BOOST_OVERRIDE
0069     {
0070         return pc_->message( ev );
0071     }
0072 
0073     std::error_condition default_error_condition( int ev ) const BOOST_NOEXCEPT BOOST_OVERRIDE
0074     {
0075         return pc_->default_error_condition( ev );
0076     }
0077 
0078     inline bool equivalent( int code, const std::error_condition & condition ) const BOOST_NOEXCEPT BOOST_OVERRIDE;
0079     inline bool equivalent( const std::error_code & code, int condition ) const BOOST_NOEXCEPT BOOST_OVERRIDE;
0080 };
0081 
0082 } // namespace detail
0083 
0084 } // namespace system
0085 
0086 } // namespace boost
0087 
0088 #endif // #ifndef BOOST_SYSTEM_DETAIL_STD_CATEGORY_HPP_INCLUDED