summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2010-01-26 21:54:15 -0200
committerHugo Lima <hugo.lima@openbossa.org>2010-01-26 22:15:53 -0200
commit35cb2ccfbae93645f357dc83e13a4882eff80d23 (patch)
tree62855bf92b29e4ef9b9cc44eea215ae53accd710
parent2d462f1397e87ee929b795ba896ca3d5344c2583 (diff)
downloadshiboken-35cb2ccfbae93645f357dc83e13a4882eff80d23.tar.gz
shiboken-35cb2ccfbae93645f357dc83e13a4882eff80d23.tar.xz
shiboken-35cb2ccfbae93645f357dc83e13a4882eff80d23.zip
Export converters when needed.
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r--headergenerator.cpp9
-rw-r--r--tests/libother/otherderived.h6
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