Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #ifndef UUID_C3E1741C754311DDB2834CCA55D89593
00007 #define UUID_C3E1741C754311DDB2834CCA55D89593
00008
00009 #include <boost/detail/sp_typeinfo.hpp>
00010 #include <boost/current_function.hpp>
00011
00012 namespace
00013 boost
00014 {
00015 template <class T>
00016 inline
00017 char const *
00018 tag_type_name()
00019 {
00020 #ifdef BOOST_NO_TYPEID
00021 return BOOST_CURRENT_FUNCTION;
00022 #else
00023 return typeid(T*).name();
00024 #endif
00025 }
00026
00027 template <class T>
00028 inline
00029 char const *
00030 type_name()
00031 {
00032 #ifdef BOOST_NO_TYPEID
00033 return BOOST_CURRENT_FUNCTION;
00034 #else
00035 return typeid(T).name();
00036 #endif
00037 }
00038
00039 namespace
00040 exception_detail
00041 {
00042 #ifdef BOOST_NO_TYPEID
00043 struct
00044 type_info_
00045 {
00046 detail::sp_typeinfo type_;
00047 char const * name_;
00048
00049 explicit
00050 type_info_( detail::sp_typeinfo type, char const * name ):
00051 type_(type),
00052 name_(name)
00053 {
00054 }
00055
00056 friend
00057 bool
00058 operator==( type_info_ const & a, type_info_ const & b )
00059 {
00060 return a.type_==b.type_;
00061 }
00062
00063 friend
00064 bool
00065 operator<( type_info_ const & a, type_info_ const & b )
00066 {
00067 return a.type_<b.type_;
00068 }
00069
00070 char const *
00071 name() const
00072 {
00073 return name_;
00074 }
00075 };
00076 #else
00077 struct
00078 type_info_
00079 {
00080 detail::sp_typeinfo const * type_;
00081
00082 explicit
00083 type_info_( detail::sp_typeinfo const & type ):
00084 type_(&type)
00085 {
00086 }
00087
00088 type_info_( detail::sp_typeinfo const & type, char const * ):
00089 type_(&type)
00090 {
00091 }
00092
00093 friend
00094 bool
00095 operator==( type_info_ const & a, type_info_ const & b )
00096 {
00097 return (*a.type_)==(*b.type_);
00098 }
00099
00100 friend
00101 bool
00102 operator<( type_info_ const & a, type_info_ const & b )
00103 {
00104 return 0!=(a.type_->before(*b.type_));
00105 }
00106
00107 char const *
00108 name() const
00109 {
00110 return type_->name();
00111 }
00112 };
00113 #endif
00114
00115 inline
00116 bool
00117 operator!=( type_info_ const & a, type_info_ const & b )
00118 {
00119 return !(a==b);
00120 }
00121 }
00122 }
00123
00124 #define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T),::boost::tag_type_name<T>())
00125
00126 #ifndef BOOST_NO_RTTI
00127 #define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
00128 #endif
00129
00130 #endif