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 BOOST_EXCEPTION_C3E1741C754311DDB2834CCA55D89593
7#define BOOST_EXCEPTION_C3E1741C754311DDB2834CCA55D89593
8
9#include <boost/config.hpp>
10#include <boost/core/typeinfo.hpp>
11#include <boost/core/demangle.hpp>
12#include <boost/current_function.hpp>
13#include <string>
14#include <string.h>
15
16#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS
17#if __GNUC__*100+__GNUC_MINOR__>301
18#pragma GCC system_header
19#endif
20#ifdef __clang__
21#pragma clang system_header
22#endif
23#ifdef _MSC_VER
24#pragma warning(push,1)
25#endif
26#endif
27
28namespace
29boost
30 {
31 template <class T>
32 inline
33 std::string
34 tag_type_name()
35 {
36#ifdef BOOST_NO_TYPEID
37 return BOOST_CURRENT_FUNCTION;
38#else
39 return core::demangle(name: typeid(T*).name());
40#endif
41 }
42
43 template <class T>
44 inline
45 std::string
46 type_name()
47 {
48#ifdef BOOST_NO_TYPEID
49 return BOOST_CURRENT_FUNCTION;
50#else
51 return core::demangle(name: typeid(T).name());
52#endif
53 }
54
55 namespace
56 exception_detail
57 {
58 struct
59 type_info_
60 {
61 core::typeinfo const * type_;
62
63 explicit
64 type_info_( core::typeinfo const & type ):
65 type_(&type)
66 {
67 }
68
69 friend
70 bool
71 operator<( type_info_ const & a, type_info_ const & b )
72 {
73 return a.type_!=b.type_ && strcmp(s1: a.type_->name(), s2: b.type_->name()) < 0;
74 }
75 };
76 }
77 }
78
79#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_CORE_TYPEID(T))
80
81#ifndef BOOST_NO_RTTI
82#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
83#endif
84
85#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
86#pragma warning(pop)
87#endif
88#endif
89

source code of include/boost/exception/detail/type_info.hpp