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_TRANSLATOR_DWA2002810_HPP 6 # define EXCEPTION_TRANSLATOR_DWA2002810_HPP 7 8 # include <boost/python/detail/prefix.hpp> 9 10 # include <boost/bind.hpp> 11 # include <boost/type.hpp> 12 # include <boost/python/detail/translate_exception.hpp> 13 # include <boost/python/detail/exception_handler.hpp> 14 15 namespace boost { namespace python { 16 17 template <class ExceptionType, class Translate> register_exception_translator(Translate translate,boost::type<ExceptionType> * =0)18void register_exception_translator(Translate translate, boost::type<ExceptionType>* = 0) 19 { 20 detail::register_exception_handler( 21 bind<bool>(detail::translate_exception<ExceptionType,Translate>(), _1, _2, translate) 22 ); 23 } 24 25 }} // namespace boost::python 26 27 #endif // EXCEPTION_TRANSLATOR_DWA2002810_HPP 28