forked from boostorg/system
Extract system_error_category into its own header
This commit is contained in:
65
include/boost/system/detail/system_category.hpp
Normal file
65
include/boost/system/detail/system_category.hpp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_HPP_INCLUDED
|
||||||
|
#define BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_HPP_INCLUDED
|
||||||
|
|
||||||
|
// Copyright Beman Dawes 2006, 2007
|
||||||
|
// Copyright Christoper Kohlhoff 2007
|
||||||
|
// Copyright Peter Dimov 2017, 2018
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
//
|
||||||
|
// See library home page at http://www.boost.org/libs/system
|
||||||
|
|
||||||
|
#include <boost/system/detail/error_category.hpp>
|
||||||
|
#include <boost/system/detail/config.hpp>
|
||||||
|
#include <boost/cstdint.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace system
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
// system_error_category
|
||||||
|
|
||||||
|
#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG )
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class BOOST_SYMBOL_VISIBLE system_error_category: public error_category
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
BOOST_SYSTEM_CONSTEXPR system_error_category() BOOST_NOEXCEPT:
|
||||||
|
error_category( ( boost::ulong_long_type( 0x8FAFD21E ) << 32 ) + 0x25C5E09B )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const char * name() const BOOST_NOEXCEPT BOOST_OVERRIDE
|
||||||
|
{
|
||||||
|
return "system";
|
||||||
|
}
|
||||||
|
|
||||||
|
error_condition default_error_condition( int ev ) const BOOST_NOEXCEPT BOOST_OVERRIDE;
|
||||||
|
|
||||||
|
std::string message( int ev ) const BOOST_OVERRIDE;
|
||||||
|
char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT BOOST_OVERRIDE;
|
||||||
|
};
|
||||||
|
|
||||||
|
#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG )
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
} // namespace system
|
||||||
|
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_HPP_INCLUDED
|
@ -15,6 +15,7 @@
|
|||||||
#include <boost/system/detail/errc.hpp>
|
#include <boost/system/detail/errc.hpp>
|
||||||
#include <boost/system/detail/error_category.hpp>
|
#include <boost/system/detail/error_category.hpp>
|
||||||
#include <boost/system/detail/generic_category.hpp>
|
#include <boost/system/detail/generic_category.hpp>
|
||||||
|
#include <boost/system/detail/system_category.hpp>
|
||||||
#include <boost/system/api_config.hpp>
|
#include <boost/system/api_config.hpp>
|
||||||
#include <boost/system/detail/config.hpp>
|
#include <boost/system/detail/config.hpp>
|
||||||
#include <boost/cstdint.hpp>
|
#include <boost/cstdint.hpp>
|
||||||
@ -42,42 +43,6 @@ class error_code; // values defined by the operating system
|
|||||||
class error_condition; // portable generic values defined below, but ultimately
|
class error_condition; // portable generic values defined below, but ultimately
|
||||||
// based on the POSIX standard
|
// based on the POSIX standard
|
||||||
|
|
||||||
// predefined error categories
|
|
||||||
|
|
||||||
#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG )
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace detail
|
|
||||||
{
|
|
||||||
|
|
||||||
class BOOST_SYMBOL_VISIBLE system_error_category: public error_category
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
BOOST_SYSTEM_CONSTEXPR system_error_category() BOOST_NOEXCEPT:
|
|
||||||
error_category( ( boost::ulong_long_type( 0x8FAFD21E ) << 32 ) + 0x25C5E09B )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
const char * name() const BOOST_NOEXCEPT BOOST_OVERRIDE
|
|
||||||
{
|
|
||||||
return "system";
|
|
||||||
}
|
|
||||||
|
|
||||||
error_condition default_error_condition( int ev ) const BOOST_NOEXCEPT BOOST_OVERRIDE;
|
|
||||||
|
|
||||||
std::string message( int ev ) const BOOST_OVERRIDE;
|
|
||||||
char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT BOOST_OVERRIDE;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace detail
|
|
||||||
|
|
||||||
#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG )
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// generic_category(), system_category()
|
// generic_category(), system_category()
|
||||||
|
|
||||||
#if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
|
#if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
|
||||||
|
Reference in New Issue
Block a user