summaryrefslogtreecommitdiff
path: root/libs/python/pyste/tests/virtual.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-06-25 22:59:01 +0000
committer <>2013-09-27 11:49:28 +0000
commit8c4528713d907ee2cfd3bfcbbad272c749867f84 (patch)
treec09e2ce80f47b90c85cc720f5139089ad9c8cfff /libs/python/pyste/tests/virtual.cpp
downloadboost-tarball-baserock/morph.tar.gz
Imported from /home/lorry/working-area/delta_boost-tarball/boost_1_54_0.tar.bz2.boost_1_54_0baserock/morph
Diffstat (limited to 'libs/python/pyste/tests/virtual.cpp')
-rw-r--r--libs/python/pyste/tests/virtual.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/libs/python/pyste/tests/virtual.cpp b/libs/python/pyste/tests/virtual.cpp
new file mode 100644
index 000000000..070d9d346
--- /dev/null
+++ b/libs/python/pyste/tests/virtual.cpp
@@ -0,0 +1,75 @@
+/* Copyright Bruno da Silva de Oliveira 2003. Use, modification and
+ distribution is subject to the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+// Includes ====================================================================
+#include <boost/python.hpp>
+#include <virtual.h>
+
+// Using =======================================================================
+using namespace boost::python;
+
+// Declarations ================================================================
+
+
+namespace {
+
+
+struct virtual_C_Wrapper: virtual_::C
+{
+ virtual_C_Wrapper(PyObject* self_, const virtual_::C & p0):
+ virtual_::C(p0), self(self_) {}
+
+ virtual_C_Wrapper(PyObject* self_):
+ virtual_::C(), self(self_) {}
+
+ int f() {
+ return call_method< int >(self, "f");
+ }
+
+ int default_f() {
+ return virtual_::C::f();
+ }
+
+ void bar(int p0) {
+ call_method< void >(self, "bar", p0);
+ }
+
+ void default_bar(int p0) {
+ virtual_::C::bar(p0);
+ }
+
+ void bar(char * p0) {
+ call_method< void >(self, "bar", p0);
+ }
+
+ void default_bar(char * p0) {
+ virtual_::C::bar(p0);
+ }
+
+ int f_abs() {
+ return call_method< int >(self, "f_abs");
+ }
+
+ PyObject* self;
+};
+
+
+
+}// namespace
+
+
+// Module ======================================================================
+BOOST_PYTHON_MODULE(virtual)
+{
+ class_< virtual_::C, boost::noncopyable, virtual_C_Wrapper >("C", init< >())
+ .def("get_name", &virtual_::C::get_name)
+ .def("f", &virtual_::C::f, &virtual_C_Wrapper::default_f)
+ .def("bar", (void (virtual_::C::*)(int) )&virtual_::C::bar, (void (virtual_C_Wrapper::*)(int))&virtual_C_Wrapper::default_bar)
+ .def("bar", (void (virtual_::C::*)(char *) )&virtual_::C::bar, (void (virtual_C_Wrapper::*)(char *))&virtual_C_Wrapper::default_bar)
+ ;
+
+ def("call_f", &virtual_::call_f);
+}