[C++-sig] enums and structs
David Abrahams
david.abrahams at rcn.com
Sat May 18 20:49:45 CEST 2002
----- Original Message -----
From: "Achim Domma" <achim.domma at syynx.de>
> Hi,
>
> in ./test/comprehensiv.cpp I found the following example for
> exposing enums:
>
> namespace boost { namespace python {
> template class enum_as_int_converters<bpl_test::EnumOwner::enum_type>;
> using bpl_test::pow;
> }} // namespace boost::python
>
> in Daves progress report from march he mentioned a new interface
> for exposing enums.
Yes, as described in
http://mail.python.org/pipermail/c++-sig/2002-April/000907.html
> Is the code above the right one
No, the above is a v1 interface.
> or will the
> interface change in V2 ?
The link tells all.
> comprehensive.cpp was the only example
> concerning enums I could find in the testfolder.
You can always use the following until we get the nice interface:
module("my_module")
.setattr("enum_value_1", PyInt_FromLong(enum_value_1))
...
> I also have to expose structs with char* members. Is that
> possible ?
Why not?
> It would be no problem to make a copy of the string
> passed from python, but how/when will this copy be destroyed ?
I don't understand what you mean, sorry. Are you concerned about how to
*construct* these structs, or is it something else?
-Dave
> greetings
> Achim
>
> PS.: I'm trying to make ImageMagick accessible from Python, which
> is much more work than I expected, but I'm also learning much
> more than I expected! ;-)
Nifty!
-Dave
More information about the Cplusplus-sig
mailing list