summaryrefslogtreecommitdiffstats
path: root/libshiboken/sbkenum.h
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-11-08 17:04:58 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2010-11-10 15:36:28 -0200
commitd5630195312a4eb107cb6f48aae54038a9ca4681 (patch)
tree2f66c8a42ec7a4234d04c6d235bcda8d40a0064e /libshiboken/sbkenum.h
parent95bc879ad706a47c965b2a62dd5b758cbd796b3d (diff)
downloadshiboken-d5630195312a4eb107cb6f48aae54038a9ca4681.tar.gz
shiboken-d5630195312a4eb107cb6f48aae54038a9ca4681.tar.xz
shiboken-d5630195312a4eb107cb6f48aae54038a9ca4681.zip
Create enum python types on the fly, avoiding generation of structs and duplication of many C functions.
Diffstat (limited to 'libshiboken/sbkenum.h')
-rw-r--r--libshiboken/sbkenum.h27
1 files changed, 9 insertions, 18 deletions
diff --git a/libshiboken/sbkenum.h b/libshiboken/sbkenum.h
index 447997e7..50ac9220 100644
--- a/libshiboken/sbkenum.h
+++ b/libshiboken/sbkenum.h
@@ -26,36 +26,27 @@
#include <Python.h>
#include "shibokenmacros.h"
-namespace Shiboken
-{
-
extern "C"
{
-typedef struct {
- PyObject_HEAD
- long ob_ival;
- PyObject* ob_name;
-} SbkEnumObject;
-
extern LIBSHIBOKEN_API PyTypeObject SbkEnumType_Type;
-LIBSHIBOKEN_API PyObject* SbkEnumObject_repr(PyObject* self);
-LIBSHIBOKEN_API PyObject* SbkEnumObject_name(PyObject* self);
-
} // extern "C"
+namespace Shiboken
+{
+
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);
-LIBSHIBOKEN_API PyObject* SbkEnumObject_New(PyTypeObject *instanceType,
- long item_value,
- PyObject* item_name = 0);
+namespace Enum
+{
+ LIBSHIBOKEN_API PyObject* newItem(PyTypeObject* enumType, long itemValue, const char* itemName = 0);
+ LIBSHIBOKEN_API PyTypeObject* newType(const char* name);
+ LIBSHIBOKEN_API long getValue(PyObject* enumItem);
+}
} // namespace Shiboken