[C++-sig] scope / namespace question
Achim Domma
achim.domma at syynx.de
Sun Oct 27 19:11:46 CET 2002
Hi,
I'm exposing a lot of classes called DrawableXXX and PathXXX. I want to put
them in two sub-modules Drawable and Path, so that the python classes would
be called Drawable.XXX and Path.XXX. As far as I understand the
documentation of scope, I have to do something like this:
BOOST_PYTHON_MODULE(myModule)
{
// register classes which are not part
// of Drawable and Path
// ...
registerDrawableClasses();
registerPathClasses();
}
void registerDrawableClasses()
{
scope drawable = ???;
class_<DrawableXXX>("XXX")
.def(...
}
void registerPathClasses()
{
scope path = ???;
class_<PathXXX>("XXX")
.def(...
}
In the documentation nested classes are used, so should I use an empty class
like this?
struct drawable_place_holder {};
scope drawable = class_<drawable_place_holder>("Drawable",no_init);
Is that the way to go?
greetings
Achim
More information about the Cplusplus-sig
mailing list