Back to home page

EIC code displayed by LXR

 
 

    


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 //  Copyright Beman Dawes 2006, 2007
0005 //  Copyright Christoper Kohlhoff 2007
0006 //  Copyright Peter Dimov 2017, 2018, 2021
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/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 // interop_error_category, used for std::error_code
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 // interop_category()
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 // Before C++17 it was mandatory to redeclare all static constexpr
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 // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
0088 
0089 #if !defined(__SUNPRO_CC) // trailing __global is not supported
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 // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
0100 
0101 } // namespace detail
0102 
0103 } // namespace system
0104 
0105 } // namespace boost
0106 
0107 #endif // #ifndef BOOST_SYSTEM_DETAIL_INTEROP_CATEGORY_HPP_INCLUDED