/Src/Dependencies/Boost/boost/exception/detail/type_info.hpp

http://hadesmem.googlecode.com/ · C++ Header · 83 lines · 69 code · 11 blank · 3 comment · 3 complexity · 63438717a875f8711cedeb1379372315 MD5 · raw file

  1. //Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
  2. //Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #ifndef UUID_C3E1741C754311DDB2834CCA55D89593
  5. #define UUID_C3E1741C754311DDB2834CCA55D89593
  6. #if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
  7. #pragma GCC system_header
  8. #endif
  9. #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
  10. #pragma warning(push,1)
  11. #endif
  12. #include <boost/detail/sp_typeinfo.hpp>
  13. #include <boost/current_function.hpp>
  14. #include <boost/config.hpp>
  15. #ifndef BOOST_NO_TYPEID
  16. #include <boost/units/detail/utility.hpp>
  17. #endif
  18. #include <string>
  19. namespace
  20. boost
  21. {
  22. template <class T>
  23. inline
  24. std::string
  25. tag_type_name()
  26. {
  27. #ifdef BOOST_NO_TYPEID
  28. return BOOST_CURRENT_FUNCTION;
  29. #else
  30. return units::detail::demangle(typeid(T*).name());
  31. #endif
  32. }
  33. template <class T>
  34. inline
  35. std::string
  36. type_name()
  37. {
  38. #ifdef BOOST_NO_TYPEID
  39. return BOOST_CURRENT_FUNCTION;
  40. #else
  41. return units::detail::demangle(typeid(T).name());
  42. #endif
  43. }
  44. namespace
  45. exception_detail
  46. {
  47. struct
  48. type_info_
  49. {
  50. detail::sp_typeinfo const * type_;
  51. explicit
  52. type_info_( detail::sp_typeinfo const & type ):
  53. type_(&type)
  54. {
  55. }
  56. friend
  57. bool
  58. operator<( type_info_ const & a, type_info_ const & b )
  59. {
  60. return 0!=(a.type_->before(*b.type_));
  61. }
  62. };
  63. }
  64. }
  65. #define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T))
  66. #ifndef BOOST_NO_RTTI
  67. #define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
  68. #endif
  69. #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
  70. #pragma warning(pop)
  71. #endif
  72. #endif