annotate DEPENDENCIES/generic/include/boost/python/errors.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // (C) Copyright David Abrahams 2000.
Chris@16 2 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 3 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 4 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 5 //
Chris@16 6 // The author gratefully acknowleges the support of Dragon Systems, Inc., in
Chris@16 7 // producing this work.
Chris@16 8
Chris@16 9 #ifndef ERRORS_DWA052500_H_
Chris@16 10 # define ERRORS_DWA052500_H_
Chris@16 11
Chris@16 12 # include <boost/python/detail/prefix.hpp>
Chris@16 13 # include <boost/function/function0.hpp>
Chris@16 14
Chris@16 15 namespace boost { namespace python {
Chris@16 16
Chris@16 17 struct BOOST_PYTHON_DECL_EXCEPTION error_already_set
Chris@16 18 {
Chris@16 19 virtual ~error_already_set();
Chris@16 20 };
Chris@16 21
Chris@16 22 // Handles exceptions caught just before returning to Python code.
Chris@16 23 // Returns true iff an exception was caught.
Chris@16 24 BOOST_PYTHON_DECL bool handle_exception_impl(function0<void>);
Chris@16 25
Chris@16 26 template <class T>
Chris@16 27 bool handle_exception(T f)
Chris@16 28 {
Chris@16 29 return handle_exception_impl(function0<void>(boost::ref(f)));
Chris@16 30 }
Chris@16 31
Chris@16 32 namespace detail { inline void rethrow() { throw; } }
Chris@16 33
Chris@16 34 inline void handle_exception()
Chris@16 35 {
Chris@16 36 handle_exception(detail::rethrow);
Chris@16 37 }
Chris@16 38
Chris@16 39 BOOST_PYTHON_DECL void throw_error_already_set();
Chris@16 40
Chris@16 41 template <class T>
Chris@16 42 inline T* expect_non_null(T* x)
Chris@16 43 {
Chris@16 44 if (x == 0)
Chris@16 45 throw_error_already_set();
Chris@16 46 return x;
Chris@16 47 }
Chris@16 48
Chris@16 49 // Return source if it is an instance of pytype; throw an appropriate
Chris@16 50 // exception otherwise.
Chris@16 51 BOOST_PYTHON_DECL PyObject* pytype_check(PyTypeObject* pytype, PyObject* source);
Chris@16 52
Chris@16 53 }} // namespace boost::python
Chris@16 54
Chris@16 55 #endif // ERRORS_DWA052500_H_