forked from boostorg/system
Rename std_interoperability.hpp to to_std_category.hpp, make it self-contained
This commit is contained in:
@@ -38,6 +38,12 @@ namespace detail
|
|||||||
|
|
||||||
BOOST_SYSTEM_CONSTEXPR bool failed_impl( int ev, error_category const & cat );
|
BOOST_SYSTEM_CONSTEXPR bool failed_impl( int ev, error_category const & cat );
|
||||||
|
|
||||||
|
#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
|
||||||
|
|
||||||
|
std::error_category const & to_std_category( error_category const & cat );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG )
|
#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG )
|
||||||
@@ -52,6 +58,10 @@ private:
|
|||||||
friend std::size_t hash_value( error_code const & ec );
|
friend std::size_t hash_value( error_code const & ec );
|
||||||
friend BOOST_SYSTEM_CONSTEXPR bool detail::failed_impl( int ev, error_category const & cat );
|
friend BOOST_SYSTEM_CONSTEXPR bool detail::failed_impl( int ev, error_category const & cat );
|
||||||
|
|
||||||
|
#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
|
||||||
|
friend std::error_category const & detail::to_std_category( error_category const & cat );
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
|
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@@ -96,7 +96,7 @@ inline char const * error_category::message( int ev, char * buffer, std::size_t
|
|||||||
|
|
||||||
#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
|
#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
|
||||||
|
|
||||||
#include <boost/system/detail/std_interoperability.hpp>
|
#include <boost/system/detail/to_std_category.hpp>
|
||||||
|
|
||||||
inline boost::system::error_category::operator std::error_category const & () const
|
inline boost::system::error_category::operator std::error_category const & () const
|
||||||
{
|
{
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
|
#ifndef BOOST_SYSTEM_DETAIL_TO_STD_CATEGORY_HPP_INCLUDED
|
||||||
|
#define BOOST_SYSTEM_DETAIL_TO_STD_CATEGORY_HPP_INCLUDED
|
||||||
|
|
||||||
// Support for interoperability between Boost.System and <system_error>
|
// Support for interoperability between Boost.System and <system_error>
|
||||||
//
|
//
|
||||||
// Copyright 2018 Peter Dimov
|
// Copyright 2018 Peter Dimov
|
||||||
@@ -7,6 +10,10 @@
|
|||||||
//
|
//
|
||||||
// See library home page at http://www.boost.org/libs/system
|
// See library home page at http://www.boost.org/libs/system
|
||||||
|
|
||||||
|
#include <boost/system/detail/error_category.hpp>
|
||||||
|
#include <boost/system/detail/error_condition.hpp>
|
||||||
|
#include <boost/system/detail/error_code.hpp>
|
||||||
|
#include <boost/system/detail/generic_category.hpp>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -80,12 +87,12 @@ struct cat_ptr_less
|
|||||||
|
|
||||||
inline std::error_category const & to_std_category( boost::system::error_category const & cat )
|
inline std::error_category const & to_std_category( boost::system::error_category const & cat )
|
||||||
{
|
{
|
||||||
if( cat == boost::system::system_category() )
|
if( cat.id_ == boost::system::detail::system_category_id )
|
||||||
{
|
{
|
||||||
static const std_category system_instance( &cat, 0x1F4D7 );
|
static const std_category system_instance( &cat, 0x1F4D7 );
|
||||||
return system_instance;
|
return system_instance;
|
||||||
}
|
}
|
||||||
else if( cat == boost::system::generic_category() )
|
else if( cat.id_ == boost::system::detail::generic_category_id )
|
||||||
{
|
{
|
||||||
static const std_category generic_instance( &cat, 0x1F4D3 );
|
static const std_category generic_instance( &cat, 0x1F4D3 );
|
||||||
return generic_instance;
|
return generic_instance;
|
||||||
@@ -180,3 +187,5 @@ inline bool std_category::equivalent( const std::error_code & code, int conditio
|
|||||||
} // namespace system
|
} // namespace system
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_SYSTEM_DETAIL_TO_STD_CATEGORY_HPP_INCLUDED
|
Reference in New Issue
Block a user