1 | // Copyright David Abrahams 2002.
|
---|
2 | // Distributed under the Boost Software License, Version 1.0. (See
|
---|
3 | // accompanying file LICENSE_1_0.txt or copy at
|
---|
4 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
5 | #ifndef EXCEPTION_HANDLER_DWA2002810_HPP
|
---|
6 | # define EXCEPTION_HANDLER_DWA2002810_HPP
|
---|
7 |
|
---|
8 | # include <boost/python/detail/config.hpp>
|
---|
9 | # include <boost/function/function0.hpp>
|
---|
10 | # include <boost/function/function2.hpp>
|
---|
11 |
|
---|
12 | namespace boost { namespace python { namespace detail {
|
---|
13 |
|
---|
14 | struct BOOST_PYTHON_DECL exception_handler;
|
---|
15 |
|
---|
16 | typedef function2<bool, exception_handler const&, function0<void> const&> handler_function;
|
---|
17 |
|
---|
18 | struct BOOST_PYTHON_DECL exception_handler
|
---|
19 | {
|
---|
20 | private: // types
|
---|
21 |
|
---|
22 | public:
|
---|
23 | explicit exception_handler(handler_function const& impl);
|
---|
24 |
|
---|
25 | inline bool handle(function0<void> const& f) const;
|
---|
26 |
|
---|
27 | bool operator()(function0<void> const& f) const;
|
---|
28 |
|
---|
29 | static exception_handler* chain;
|
---|
30 |
|
---|
31 | private:
|
---|
32 | static exception_handler* tail;
|
---|
33 |
|
---|
34 | handler_function m_impl;
|
---|
35 | exception_handler* m_next;
|
---|
36 | };
|
---|
37 |
|
---|
38 |
|
---|
39 | inline bool exception_handler::handle(function0<void> const& f) const
|
---|
40 | {
|
---|
41 | return this->m_impl(*this, f);
|
---|
42 | }
|
---|
43 |
|
---|
44 | BOOST_PYTHON_DECL void register_exception_handler(handler_function const& f);
|
---|
45 |
|
---|
46 | }}} // namespace boost::python::detail
|
---|
47 |
|
---|
48 | #endif // EXCEPTION_HANDLER_DWA2002810_HPP
|
---|