File indexing completed on 2025-01-18 09:52:35
0001 #ifndef BOOST_SYSTEM_DETAIL_STD_CATEGORY_IMPL_HPP_INCLUDED
0002 #define BOOST_SYSTEM_DETAIL_STD_CATEGORY_IMPL_HPP_INCLUDED
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <boost/system/detail/std_category.hpp>
0014 #include <boost/system/detail/error_condition.hpp>
0015 #include <boost/system/detail/error_code.hpp>
0016 #include <boost/system/detail/generic_category.hpp>
0017
0018
0019
0020 namespace boost
0021 {
0022
0023 namespace system
0024 {
0025
0026 namespace detail
0027 {
0028
0029 inline bool std_category::equivalent( int code, const std::error_condition & condition ) const BOOST_NOEXCEPT
0030 {
0031 if( condition.category() == *this )
0032 {
0033 boost::system::error_condition bn( condition.value(), *pc_ );
0034 return pc_->equivalent( code, bn );
0035 }
0036 else if( condition.category() == std::generic_category() || condition.category() == boost::system::generic_category() )
0037 {
0038 boost::system::error_condition bn( condition.value(), boost::system::generic_category() );
0039 return pc_->equivalent( code, bn );
0040 }
0041
0042 #ifndef BOOST_NO_RTTI
0043
0044 else if( std_category const* pc2 = dynamic_cast< std_category const* >( &condition.category() ) )
0045 {
0046 boost::system::error_condition bn( condition.value(), *pc2->pc_ );
0047 return pc_->equivalent( code, bn );
0048 }
0049
0050 #endif
0051
0052 else
0053 {
0054 return default_error_condition( code ) == condition;
0055 }
0056 }
0057
0058 inline bool std_category::equivalent( const std::error_code & code, int condition ) const BOOST_NOEXCEPT
0059 {
0060 if( code.category() == *this )
0061 {
0062 boost::system::error_code bc( code.value(), *pc_ );
0063 return pc_->equivalent( bc, condition );
0064 }
0065 else if( code.category() == std::generic_category() || code.category() == boost::system::generic_category() )
0066 {
0067 boost::system::error_code bc( code.value(), boost::system::generic_category() );
0068 return pc_->equivalent( bc, condition );
0069 }
0070
0071 #ifndef BOOST_NO_RTTI
0072
0073 else if( std_category const* pc2 = dynamic_cast< std_category const* >( &code.category() ) )
0074 {
0075 boost::system::error_code bc( code.value(), *pc2->pc_ );
0076 return pc_->equivalent( bc, condition );
0077 }
0078
0079 #endif
0080
0081 else if( *pc_ == boost::system::generic_category() )
0082 {
0083 return std::generic_category().equivalent( code, condition );
0084 }
0085 else
0086 {
0087 return false;
0088 }
0089 }
0090
0091 }
0092
0093 }
0094
0095 }
0096
0097 #endif