2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-24 18:12:43 +00:00

Integrated Scott Snyder's nested class patch

[SVN r12080]
This commit is contained in:
Dave Abrahams
2001-12-17 05:49:24 +00:00
parent bed2c8a371
commit 291c36df05
5 changed files with 55 additions and 1 deletions

View File

@@ -67,6 +67,16 @@ Foo::PythonClass::PythonClass(boost::python::module_builder& m)
def(&Foo::add_len, "add_len", &FooCallback::default_add_len);
// Since pure() is pure virtual, we are leaving it undefined.
// And the nested classes.
boost::python::class_builder<Foo::Foo_A> foo_a(*this, "Foo_A");
foo_a.def(boost::python::constructor<>());
foo_a.def(&Foo::Foo_A::mumble, "mumble");
boost::python::class_builder<Foo::Foo_B> foo_b(get_extension_class(),
"Foo_B");
foo_b.def(boost::python::constructor<>());
foo_b.def(&Foo::Foo_B::mumble, "mumble");
}
BarPythonClass::BarPythonClass(boost::python::module_builder& m)
@@ -223,6 +233,16 @@ const char* Foo::mumble()
return "mumble";
}
const char* Foo::Foo_A::mumble()
{
return "mumble a";
}
const char* Foo::Foo_B::mumble()
{
return "mumble b";
}
void Foo::set(long x)
{
m_x = x;