blob: d1c671f9d9dc9e37b020d931d85f51fb4160f161 [file] [log] [blame]
Jeff Thompsonef2d5a42013-08-22 19:09:24 -07001//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
8#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
9#pragma GCC system_header
10#endif
11#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
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>
18#ifndef BOOST_NO_TYPEID
19#include <ndnboost/units/detail/utility.hpp>
20#endif
21#include <string>
22
23namespace
24ndnboost
25 {
26 template <class T>
27 inline
28 std::string
29 tag_type_name()
30 {
31#ifdef BOOST_NO_TYPEID
32 return BOOST_CURRENT_FUNCTION;
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 {
43#ifdef BOOST_NO_TYPEID
44 return BOOST_CURRENT_FUNCTION;
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
74#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::ndnboost::exception_detail::type_info_(BOOST_SP_TYPEID(T))
75
76#ifndef BOOST_NO_RTTI
77#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::ndnboost::exception_detail::type_info_(typeid(x))
78#endif
79
80#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
81#pragma warning(pop)
82#endif
83#endif