Index: error_code.hpp =================================================================== --- error_code.hpp (revision 80450) +++ error_code.hpp (working copy) @@ -23,7 +23,7 @@ #include // TODO: undef these macros if not already defined -#include +#include #if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API) # error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined @@ -187,7 +187,7 @@ virtual const char * name() const = 0; virtual std::string message( int ev ) const = 0; virtual error_condition default_error_condition( int ev ) const; - virtual bool equivalent( int code, + virtual bool equivalent( int code, const error_condition & condition ) const; virtual bool equivalent( const error_code & code, int condition ) const; @@ -202,9 +202,13 @@ // predefined error categories -----------------------------------------// +# ifdef BOOST_ERROR_CODE_HEADER_ONLY + inline const error_category & system_category(); + inline const error_category & generic_category(); +#else BOOST_SYSTEM_DECL const error_category & system_category(); BOOST_SYSTEM_DECL const error_category & generic_category(); - +#endif // deprecated synonyms --------------------------------------------------// # ifndef BOOST_SYSTEM_NO_DEPRECATED @@ -238,15 +242,15 @@ // modifiers: void assign( int val, const error_category & cat ) - { + { m_val = val; m_cat = &cat; } - + template typename boost::enable_if, error_condition>::type & operator=( ErrorConditionEnum val ) - { + { *this = make_error_condition(val); return *this; } @@ -266,7 +270,7 @@ static void unspecified_bool_true() {} operator unspecified_bool_type() const // true if error - { + { return m_val == 0 ? 0 : unspecified_bool_true; } @@ -282,7 +286,7 @@ const error_condition & rhs ) { return lhs.m_cat == rhs.m_cat && lhs.m_val == rhs.m_val; - } + } inline friend bool operator<( const error_condition & lhs, const error_condition & rhs ) @@ -324,15 +328,15 @@ // modifiers: void assign( int val, const error_category & cat ) - { + { m_val = val; m_cat = &cat; } - + template typename boost::enable_if, error_code>::type & operator=( ErrorCodeEnum val ) - { + { *this = make_error_code(val); return *this; } @@ -353,7 +357,7 @@ static void unspecified_bool_true() {} operator unspecified_bool_type() const // true if error - { + { return m_val == 0 ? 0 : unspecified_bool_true; } @@ -379,7 +383,7 @@ return lhs.m_cat < rhs.m_cat || (lhs.m_cat == rhs.m_cat && lhs.m_val < rhs.m_val); } - + private: int m_val; const error_category * m_cat; @@ -431,26 +435,26 @@ return code.category().equivalent( code.value(), condition ) || condition.category().equivalent( code, condition.value() ); } - + inline bool operator!=( const error_code & lhs, const error_condition & rhs ) { return !(lhs == rhs); } - + inline bool operator==( const error_condition & condition, const error_code & code ) { return condition.category().equivalent( code, condition.value() ) || code.category().equivalent( code.value(), condition ); } - + inline bool operator!=( const error_condition & lhs, const error_code & rhs ) { return !(lhs == rhs); } - + // TODO: both of these may move elsewhere, but the LWG hasn't spoken yet. template @@ -483,7 +487,7 @@ // error_category default implementation -------------------------------// inline error_condition error_category::default_error_condition( int ev ) const - { + { return error_condition( ev, *this ); }