]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | * Copyright Andrey Semashev 2007 - 2015. | |
3 | * Distributed under the Boost Software License, Version 1.0. | |
4 | * (See accompanying file LICENSE_1_0.txt or copy at | |
5 | * http://www.boost.org/LICENSE_1_0.txt) | |
6 | */ | |
7 | /*! | |
8 | * \file support/exception.hpp | |
9 | * \author Andrey Semashev | |
10 | * \date 18.07.2009 | |
11 | * | |
12 | * This header enables Boost.Exception support for Boost.Log. | |
13 | */ | |
14 | ||
15 | #ifndef BOOST_LOG_SUPPORT_EXCEPTION_HPP_INCLUDED_ | |
16 | #define BOOST_LOG_SUPPORT_EXCEPTION_HPP_INCLUDED_ | |
17 | ||
18 | #include <string> | |
19 | #include <boost/type_index.hpp> | |
20 | #include <boost/exception/info.hpp> | |
21 | #include <boost/log/detail/config.hpp> | |
22 | #include <boost/log/attributes/attribute_name.hpp> | |
23 | #include <boost/log/attributes/named_scope.hpp> | |
24 | #include <boost/log/detail/header.hpp> | |
25 | ||
26 | #ifdef BOOST_HAS_PRAGMA_ONCE | |
27 | #pragma once | |
28 | #endif | |
29 | ||
30 | namespace boost { | |
31 | ||
32 | BOOST_LOG_OPEN_NAMESPACE | |
33 | ||
34 | /*! | |
35 | * Attribute name exception information | |
36 | */ | |
37 | typedef error_info< struct attribute_name_info_tag, attribute_name > attribute_name_info; | |
38 | ||
39 | /*! | |
40 | * Type info exception information | |
41 | */ | |
42 | typedef error_info< struct type_info_info_tag, typeindex::type_index > type_info_info; | |
43 | ||
44 | /*! | |
45 | * Parse position exception information | |
46 | */ | |
47 | typedef error_info< struct position_info_tag, unsigned int > position_info; | |
48 | ||
49 | /*! | |
50 | * Current scope exception information | |
51 | */ | |
52 | typedef error_info< struct current_scope_info_tag, attributes::named_scope_list > current_scope_info; | |
53 | ||
54 | /*! | |
55 | * The function returns an error information object that contains current stack of scopes. | |
56 | * This information can then be attached to an exception and extracted at the catch site. | |
57 | * The extracted scope list won't be affected by any scope changes that may happen during | |
58 | * the exception propagation. | |
59 | * | |
60 | * \note See the \c named_scope attribute documentation on how to maintain scope list. | |
61 | */ | |
62 | inline current_scope_info current_scope() | |
63 | { | |
64 | return current_scope_info(attributes::named_scope::get_scopes()); | |
65 | } | |
66 | ||
67 | namespace ipc { | |
68 | ||
69 | class object_name; | |
70 | ||
71 | /*! | |
72 | * System resource name | |
73 | */ | |
74 | typedef error_info< struct object_name_tag, object_name > object_name_info; | |
75 | ||
76 | } // namespace ipc | |
77 | ||
78 | BOOST_LOG_CLOSE_NAMESPACE // namespace log | |
79 | ||
80 | } // namespace boost | |
81 | ||
82 | #include <boost/log/detail/footer.hpp> | |
83 | ||
84 | #endif // BOOST_LOG_SUPPORT_EXCEPTION_HPP_INCLUDED_ |