diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2010-04-01 18:10:37 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-04-05 18:39:52 -0300 |
commit | 319e5f2467e8682865f1206ae4ce4b3e2bdff147 (patch) | |
tree | 32ec9d4d6ba9c0b4e509db1e24043386cdc496fe /libshiboken/pyenum.h | |
parent | 9a5e72d08f908183d7bf8abcb3546cf509f9362d (diff) |
Added enum meta type, this will ease you to known if a PyObject is a Shiboken enum.
Diffstat (limited to 'libshiboken/pyenum.h')
-rw-r--r-- | libshiboken/pyenum.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libshiboken/pyenum.h b/libshiboken/pyenum.h index cb8bb48fb..a29a7f1c5 100644 --- a/libshiboken/pyenum.h +++ b/libshiboken/pyenum.h @@ -50,11 +50,18 @@ typedef struct { PyObject* ob_name; } SbkEnumObject; +LIBSHIBOKEN_API PyAPI_DATA(PyTypeObject) SbkEnumType_Type; + LIBSHIBOKEN_API PyAPI_FUNC(PyObject*) SbkEnumObject_repr(PyObject* self); LIBSHIBOKEN_API PyAPI_FUNC(PyObject*) SbkEnumObject_name(PyObject* self); } // extern "C" +inline bool isShibokenEnum(PyObject* pyObj) +{ + return pyObj->ob_type->ob_type == &SbkEnumType_Type; +} + LIBSHIBOKEN_API PyObject* SbkEnumObject_New(PyTypeObject *instanceType, long item_value, const char* item_name); |