stdexcept.cpp
Go to the documentation of this file.
1 #include <iterator>
2 #include <memory>
3 #include <sstream> // __str__
4 #include <stdexcept>
5 #include <string>
6 
7 #include <pybind11/pybind11.h>
8 #include <functional>
9 #include <string>
10 #include <pybind11/stl.h>
11 
12 
13 #ifndef BINDER_PYBIND11_TYPE_CASTER
14  #define BINDER_PYBIND11_TYPE_CASTER
15  PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);
17  PYBIND11_MAKE_OPAQUE(std::shared_ptr<void>);
18 #endif
19 
20 // std::runtime_error file:stdexcept line:219
21 struct PyCallBack_std_runtime_error : public std::runtime_error {
22  using std::runtime_error::runtime_error;
23 
24  const char * what() const noexcept override {
25  pybind11::gil_scoped_acquire gil;
26  pybind11::function overload = pybind11::get_overload(static_cast<const std::runtime_error *>(this), "what");
27  if (overload) {
28  auto o = overload.operator()<pybind11::return_value_policy::reference>();
29  if (pybind11::detail::cast_is_temporary_value_reference<const char *>::value) {
30  static pybind11::detail::overload_caster_t<const char *> caster;
31  return pybind11::detail::cast_ref<const char *>(std::move(o), caster);
32  }
33  else return pybind11::detail::cast_safe<const char *>(std::move(o));
34  }
35  return runtime_error::what();
36  }
37 };
38 
39 void bind_std_stdexcept(std::function< pybind11::module &(std::string const &namespace_) > &M)
40 {
41  { // std::runtime_error file:stdexcept line:219
42  pybind11::class_<std::runtime_error, std::shared_ptr<std::runtime_error>, PyCallBack_std_runtime_error, std::exception> cl(M("std"), "runtime_error", "");
43  cl.def( pybind11::init<const std::string &>(), pybind11::arg("__arg") );
44 
45  cl.def( pybind11::init<const char *>(), pybind11::arg("") );
46 
47  cl.def( pybind11::init( [](PyCallBack_std_runtime_error const &o){ return new PyCallBack_std_runtime_error(o); } ) );
48  cl.def( pybind11::init( [](std::runtime_error const &o){ return new std::runtime_error(o); } ) );
49  cl.def("assign", (class std::runtime_error & (std::runtime_error::*)(const class std::runtime_error &)) &std::runtime_error::operator=, "C++: std::runtime_error::operator=(const class std::runtime_error &) --> class std::runtime_error &", pybind11::return_value_policy::automatic, pybind11::arg(""));
50  cl.def("what", (const char * (std::runtime_error::*)() const) &std::runtime_error::what, "C++: std::runtime_error::what() const --> const char *", pybind11::return_value_policy::automatic);
51  }
52 }
const char * what() const noexceptoverride
Definition: stdexcept.cpp:24
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr< T >)
PYBIND11_MAKE_OPAQUE(std::shared_ptr< void >)
void bind_std_stdexcept(std::function< pybind11::module &(std::string const &namespace_) > &M)
Definition: stdexcept.cpp:39


mvsim
Author(s):
autogenerated on Fri May 7 2021 03:05:51