From 95b0ce06a5e19e945bbe1d8a4ec482da3896f10b Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Sat, 30 Aug 2008 02:57:12 +0000 Subject: [PATCH] decoupled boost/exception/exception.hpp from boost/exception/detail/type_info.hpp diagnostic_information improvements documentation update [SVN r48469] --- include/boost/exception/exception.hpp | 54 ++++++++++----------------- 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp index 8ea1d7e..b3a754d 100644 --- a/include/boost/exception/exception.hpp +++ b/include/boost/exception/exception.hpp @@ -6,11 +6,8 @@ #ifndef UUID_274DA366004E11DCB1DDFE2E56D89593 #define UUID_274DA366004E11DCB1DDFE2E56D89593 -#include -#include #include #include -#include namespace boost @@ -24,12 +21,13 @@ boost exception_detail { class error_info_base; + struct type_info_; struct error_info_container: public exception_detail::counted_base { - virtual char const * diagnostic_information( char const *, char const * ) const = 0; + virtual char const * diagnostic_information() const = 0; virtual shared_ptr get( type_info_ const & ) const = 0; virtual void set( shared_ptr const &, type_info_ const & ) = 0; }; @@ -37,7 +35,7 @@ boost template shared_ptr get_data( exception const & ); - void set_data( exception const *, shared_ptr const &, exception_detail::type_info_ const & ); + void set_data( exception const *, shared_ptr const &, type_info_ const & ); } class @@ -49,7 +47,7 @@ boost char const * diagnostic_information() const throw() { - return _diagnostic_information(0); + return _diagnostic_information(); } protected: @@ -63,22 +61,6 @@ boost { } - char const * - _diagnostic_information( char const * std_what ) const throw() - { - if( data_ ) - try - { - char const * w = data_->diagnostic_information(std_what,dynamic_type_name()); - BOOST_ASSERT(w!=0); - return w; - } - catch(...) - { - } - return std_what ? std_what : dynamic_type_name(); - } - #if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1500) ) //Force class exception to be abstract. //Otherwise, MSVC bug allows throw exception(), even though the copy constructor is protected. @@ -92,6 +74,22 @@ boost } #endif + char const * + _diagnostic_information() const throw() + { + if( data_ ) + try + { + char const * w = data_->diagnostic_information(); + BOOST_ASSERT(w!=0); + return w; + } + catch(...) + { + } + return ""; + } + private: friend void exception_detail::set_data( exception const *, shared_ptr const &, exception_detail::type_info_ const & ); @@ -99,18 +97,6 @@ boost template friend shared_ptr exception_detail::get_data( exception const & ); - char const * - dynamic_type_name() const - { - return -#if defined(BOOST_NO_RTTI) || defined(BOOST_NO_TYPEID) - "Unknown type deriving from boost::exception" -#else - typeid(*this).name() -#endif - ; - } - mutable intrusive_ptr data_; };