From 7e2a02b16d2ae71c7df5c1cf9251efd396ee5904 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 27 Aug 2020 17:31:52 +0300 Subject: [PATCH] Rename system_category_posix.hpp to is_generic_value.hpp --- ...ategory_posix.hpp => is_generic_value.hpp} | 21 +++++++------------ .../system/detail/system_category_impl.hpp | 15 +++++++++---- 2 files changed, 18 insertions(+), 18 deletions(-) rename include/boost/system/detail/{system_category_posix.hpp => is_generic_value.hpp} (89%) diff --git a/include/boost/system/detail/system_category_posix.hpp b/include/boost/system/detail/is_generic_value.hpp similarity index 89% rename from include/boost/system/detail/system_category_posix.hpp rename to include/boost/system/detail/is_generic_value.hpp index 9a40623..8ed3e26 100644 --- a/include/boost/system/detail/system_category_posix.hpp +++ b/include/boost/system/detail/is_generic_value.hpp @@ -1,5 +1,6 @@ -// POSIX-specific implementation details of system_error_category -// +#ifndef BOOST_SYSTEM_DETAIL_IS_GENERIC_VALUE_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_IS_GENERIC_VALUE_HPP_INCLUDED + // Copyright 2018 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -7,6 +8,8 @@ // // See library home page at http://www.boost.org/libs/system +#include + namespace boost { @@ -113,20 +116,10 @@ inline bool is_generic_value( int ev ) BOOST_NOEXCEPT return false; } -inline error_condition system_category_default_error_condition_posix( int ev ) BOOST_NOEXCEPT -{ - if( is_generic_value( ev ) ) - { - return error_condition( ev, generic_category() ); - } - else - { - return error_condition( ev, system_category() ); - } -} - } // namespace detail } // namespace system } // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_IS_GENERIC_VALUE_HPP_INCLUDED diff --git a/include/boost/system/detail/system_category_impl.hpp b/include/boost/system/detail/system_category_impl.hpp index 60ddeda..544438e 100644 --- a/include/boost/system/detail/system_category_impl.hpp +++ b/include/boost/system/detail/system_category_impl.hpp @@ -3,7 +3,7 @@ // Copyright Beman Dawes 2006, 2007 // Copyright Christoper Kohlhoff 2007 -// Copyright Peter Dimov 2017, 2018 +// Copyright Peter Dimov 2017, 2018, 2020 // // 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) @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -25,7 +26,6 @@ #include #include -#include inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT { @@ -54,11 +54,18 @@ inline char const * boost::system::detail::system_error_category::message( int e #else // #if defined(BOOST_WINDOWS_API) #include -#include +#include inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT { - return system_category_default_error_condition_posix( ev ); + if( is_generic_value( ev ) ) + { + return error_condition( ev, generic_category() ); + } + else + { + return error_condition( ev, *this ); + } } inline std::string boost::system::detail::system_error_category::message( int ev ) const