diff options
-rw-r--r-- | headergenerator.cpp | 9 | ||||
-rw-r--r-- | tests/libother/otherderived.h | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/headergenerator.cpp b/headergenerator.cpp index ce4542ab..b955ee79 100644 --- a/headergenerator.cpp +++ b/headergenerator.cpp @@ -160,14 +160,19 @@ void HeaderGenerator::writeTypeConverterDecl(QTextStream& s, const TypeEntry* ty const AbstractMetaClass* metaClass = classes().findClass(type->name()); bool isAbstractOrObjectType = (metaClass && metaClass->isAbstract()) || type->isObject(); - s << "struct Converter<" << type->name() << (isAbstractOrObjectType ? "*" : "") << " > : "; + bool isValueTypeWithImplConversions = type->isValue() && !implicitConversions(type).isEmpty(); + + s << "struct "; + if (isValueTypeWithImplConversions) + s << getApiExportMacro() << ' '; + s << "Converter<" << type->name() << (isAbstractOrObjectType ? "*" : "") << " > : "; if (type->isEnum() || type->isFlags()) s << "Converter_CppEnum"; else s << "ConverterBase"; s << '<' << type->name() << (isAbstractOrObjectType ? "*" : "") << " >" << endl; s << '{' << endl; - if (type->isValue() && !implicitConversions(type).isEmpty()) { + if (isValueTypeWithImplConversions) { s << INDENT << "static " << type->name() << " toCpp(PyObject* pyobj);" << endl; s << INDENT << "static bool isConvertible(PyObject* pyobj);" << endl; } diff --git a/tests/libother/otherderived.h b/tests/libother/otherderived.h index d980ec78..447c6c56 100644 --- a/tests/libother/otherderived.h +++ b/tests/libother/otherderived.h @@ -38,9 +38,10 @@ #include "libsamplemacros.h" #include "abstract.h" #include "derived.h" +#include "objecttype.h" +#include "complex.h" class ObjectType; -class Complex; class LIBSAMPLE_API OtherDerived : public Abstract { @@ -52,7 +53,8 @@ public: virtual PrintFormat returnAnEnum() { return Short; } void useObjectTypeFromOtherModule(ObjectType*) {} - void useValueTypeFromOtherModule(const Complex&) {} + Event useValueTypeFromOtherModule(const Event& e) { return e; } + Complex useValueTypeFromOtherModule(const Complex& c) { return c; } void useEnumTypeFromOtherModule(OverloadedFuncEnum) {} // factory method |