diff options
Diffstat (limited to 'shibokengenerator.cpp')
-rw-r--r-- | shibokengenerator.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp index 64976d3dd..5b85ef43a 100644 --- a/shibokengenerator.cpp +++ b/shibokengenerator.cpp @@ -157,10 +157,19 @@ QString ShibokenGenerator::translateTypeForWrapperMethod(const AbstractMetaType* { QString result; - if (cType->isArray()) + if (cType->isArray()) { result = translateTypeForWrapperMethod(cType->arrayElementType(), context) + "[]"; - else - result = translateType(cType, context); + } else { +#ifdef AVOID_PROTECTED_HACK + if (cType->isEnum()) { + const AbstractMetaEnum* metaEnum = findAbstractMetaEnum(cType); + if (metaEnum && metaEnum->isProtected()) + result = protectedEnumSurrogateName(metaEnum); + } + if (result.isEmpty()) +#endif + result = translateType(cType, context); + } return result; } @@ -188,6 +197,11 @@ QString ShibokenGenerator::wrapperName(const AbstractMetaClass* metaClass) } } +QString ShibokenGenerator::protectedEnumSurrogateName(const AbstractMetaEnum* metaEnum) +{ + return metaEnum->fullName().replace(".", "_") + "_Surrogate"; +} + QString ShibokenGenerator::cpythonFunctionName(const AbstractMetaFunction* func) { QString result; @@ -299,6 +313,13 @@ void ShibokenGenerator::writeBaseConversion(QTextStream& s, const TypeEntry* typ QString typeName = type->name(); if (type->isObject()) typeName.append('*'); +#ifdef AVOID_PROTECTED_HACK + if (type->isEnum()) { + const AbstractMetaEnum* metaEnum = findAbstractMetaEnum(type); + if (metaEnum && metaEnum->isProtected()) + typeName = protectedEnumSurrogateName(metaEnum); + } +#endif s << baseConversionString(typeName); } |