aboutsummaryrefslogtreecommitdiffstats
path: root/headergenerator.cpp
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 /headergenerator.cpp
parent2d462f1397e87ee929b795ba896ca3d5344c2583 (diff)
Export converters when needed.
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'headergenerator.cpp')
-rw-r--r--headergenerator.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/headergenerator.cpp b/headergenerator.cpp
index ce4542abf..b955ee79e 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;
}