Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 1 | //Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc. |
| 2 | |
| 3 | //Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 4 | //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 5 | |
| 6 | #ifndef UUID_C3E1741C754311DDB2834CCA55D89593 |
| 7 | #define UUID_C3E1741C754311DDB2834CCA55D89593 |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 8 | #if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(NDNBOOST_EXCEPTION_ENABLE_WARNINGS) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 9 | #pragma GCC system_header |
| 10 | #endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 11 | #if defined(_MSC_VER) && !defined(NDNBOOST_EXCEPTION_ENABLE_WARNINGS) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 12 | #pragma warning(push,1) |
| 13 | #endif |
| 14 | |
| 15 | #include <ndnboost/detail/sp_typeinfo.hpp> |
| 16 | #include <ndnboost/current_function.hpp> |
| 17 | #include <ndnboost/config.hpp> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 18 | #ifndef NDNBOOST_NO_TYPEID |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 19 | #include <ndnboost/units/detail/utility.hpp> |
| 20 | #endif |
| 21 | #include <string> |
| 22 | |
| 23 | namespace |
| 24 | ndnboost |
| 25 | { |
| 26 | template <class T> |
| 27 | inline |
| 28 | std::string |
| 29 | tag_type_name() |
| 30 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 31 | #ifdef NDNBOOST_NO_TYPEID |
| 32 | return NDNBOOST_CURRENT_FUNCTION; |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 33 | #else |
| 34 | return units::detail::demangle(typeid(T*).name()); |
| 35 | #endif |
| 36 | } |
| 37 | |
| 38 | template <class T> |
| 39 | inline |
| 40 | std::string |
| 41 | type_name() |
| 42 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 43 | #ifdef NDNBOOST_NO_TYPEID |
| 44 | return NDNBOOST_CURRENT_FUNCTION; |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 45 | #else |
| 46 | return units::detail::demangle(typeid(T).name()); |
| 47 | #endif |
| 48 | } |
| 49 | |
| 50 | namespace |
| 51 | exception_detail |
| 52 | { |
| 53 | struct |
| 54 | type_info_ |
| 55 | { |
| 56 | detail::sp_typeinfo const * type_; |
| 57 | |
| 58 | explicit |
| 59 | type_info_( detail::sp_typeinfo const & type ): |
| 60 | type_(&type) |
| 61 | { |
| 62 | } |
| 63 | |
| 64 | friend |
| 65 | bool |
| 66 | operator<( type_info_ const & a, type_info_ const & b ) |
| 67 | { |
| 68 | return 0!=(a.type_->before(*b.type_)); |
| 69 | } |
| 70 | }; |
| 71 | } |
| 72 | } |
| 73 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 74 | #define NDNBOOST_EXCEPTION_STATIC_TYPEID(T) ::ndnboost::exception_detail::type_info_(NDNBOOST_SP_TYPEID(T)) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 75 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 76 | #ifndef NDNBOOST_NO_RTTI |
| 77 | #define NDNBOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::ndnboost::exception_detail::type_info_(typeid(x)) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 78 | #endif |
| 79 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 80 | #if defined(_MSC_VER) && !defined(NDNBOOST_EXCEPTION_ENABLE_WARNINGS) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 81 | #pragma warning(pop) |
| 82 | #endif |
| 83 | #endif |