Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-01 08:32:22

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 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         static_assert( Id == 0, "This constructor should only be called with Id == 0 under MS STL 14.0+" );
0055 
0056 #endif
0057     }
0058 
0059     const char * name() const noexcept BOOST_OVERRIDE
0060     {
0061         return pc_->name();
0062     }
0063 
0064     std::string message( int ev ) const BOOST_OVERRIDE
0065     {
0066         return pc_->message( ev );
0067     }
0068 
0069     std::error_condition default_error_condition( int ev ) const noexcept BOOST_OVERRIDE
0070     {
0071         return pc_->default_error_condition( ev );
0072     }
0073 
0074     inline bool equivalent( int code, const std::error_condition & condition ) const noexcept BOOST_OVERRIDE;
0075     inline bool equivalent( const std::error_code & code, int condition ) const noexcept BOOST_OVERRIDE;
0076 };
0077 
0078 } // namespace detail
0079 
0080 } // namespace system
0081 
0082 } // namespace boost
0083 
0084 #endif // #ifndef BOOST_SYSTEM_DETAIL_STD_CATEGORY_HPP_INCLUDED