summaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-10-18 09:48:49 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2011-12-09 20:28:07 -0300
commit333703fd5adf573808a81ab190b393ff121de0bc (patch)
treeb4f2f94f00ce041ff7162896786c1fcea12813e7 /libshiboken
parent3a89431b24352c28fc62b669a0b153498b9e254d (diff)
downloadshiboken-333703fd5adf573808a81ab190b393ff121de0bc.tar.gz
shiboken-333703fd5adf573808a81ab190b393ff121de0bc.tar.xz
shiboken-333703fd5adf573808a81ab190b393ff121de0bc.zip
New converters for C++ enum and qflags types.
Also removed a lot of unused and commented code.
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/sbkenum.cpp12
-rw-r--r--libshiboken/sbkenum.h6
2 files changed, 18 insertions, 0 deletions
diff --git a/libshiboken/sbkenum.cpp b/libshiboken/sbkenum.cpp
index 39ffb348..c2f6ce0c 100644
--- a/libshiboken/sbkenum.cpp
+++ b/libshiboken/sbkenum.cpp
@@ -550,6 +550,18 @@ long int getValue(PyObject* enumItem)
return reinterpret_cast<SbkEnumObject*>(enumItem)->ob_value;
}
+void setTypeConverter(PyTypeObject* enumType, SbkConverter* converter)
+{
+ //reinterpret_cast<SbkEnumType*>(enumType)->converter = converter;
+ SBK_CONVERTER(enumType) = converter;
+}
+
+SbkConverter* getTypeConverter(PyTypeObject* enumType)
+{
+ //return reinterpret_cast<SbkEnumType*>(enumType)->converter;
+ return SBK_CONVERTER(enumType);
+}
+
} // namespace Enum
DeclaredEnumTypes& DeclaredEnumTypes::instance()
diff --git a/libshiboken/sbkenum.h b/libshiboken/sbkenum.h
index afe91416..b0ff2695 100644
--- a/libshiboken/sbkenum.h
+++ b/libshiboken/sbkenum.h
@@ -31,6 +31,7 @@ extern "C"
extern LIBSHIBOKEN_API PyTypeObject SbkEnumType_Type;
struct SbkObjectType;
+struct SbkConverter;
} // extern "C"
@@ -88,6 +89,11 @@ namespace Enum
LIBSHIBOKEN_API long getValue(PyObject* enumItem);
LIBSHIBOKEN_API PyObject* getEnumItemFromValue(PyTypeObject* enumType, long itemValue);
+
+ /// Sets the enum's type converter.
+ LIBSHIBOKEN_API void setTypeConverter(PyTypeObject* enumType, SbkConverter* converter);
+ /// Returns the converter assigned to the enum \p type.
+ LIBSHIBOKEN_API SbkConverter* getTypeConverter(PyTypeObject* enumType);
}
} // namespace Shiboken