workaround for enumeration python binding issue::

allow implicit conversion from long
This commit is contained in:
David 2007-10-14 13:39:11 +00:00
parent f736196cb4
commit 1c5bbea587
2 changed files with 7 additions and 2 deletions

View file

@ -30,12 +30,12 @@ void export_stroke ()
using namespace mapnik;
using namespace boost::python;
enum_<line_cap_enum>("line_cap")
enum_<line_cap_e>("line_cap")
.value("BUTT_CAP",BUTT_CAP)
.value("SQUARE_CAP",SQUARE_CAP)
.value("ROUND_CAP",ROUND_CAP)
;
enum_<line_join_enum>("line_join")
enum_<line_join_e>("line_join")
.value("MITER_JOIN",MITER_JOIN)
.value("MITER_REVERT_JOIN",MITER_REVERT_JOIN)
.value("ROUND_JOIN",ROUND_JOIN)

View file

@ -134,6 +134,7 @@ class enumeration {
typedef ENUM Native;
enumeration() {};
enumeration( ENUM v ) : value_(v) {}
enumeration( long v ) : value_(ENUM(v)) {}
enumeration( const enumeration & other ) : value_(other.value_) {}
/** Assignment operator for native enum values. */
@ -141,6 +142,10 @@ class enumeration {
{
value_ = v;
}
void operator=(long v)
{
value_ = ENUM(v);
}
/** Assignment operator. */
void operator=(const enumeration & other)