aboutsummaryrefslogtreecommitdiffstats
path: root/generators
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2009-08-25 19:58:33 -0300
committerRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2009-08-26 15:11:41 -0300
commit5a193b528142b15d2af726d0f2ab49f9aca258c3 (patch)
treebdbccbfedcba181ec9edc122b2d8e557b2048a0e /generators
parent4fca6cf851dbec9c0ea7c930e7d519bdf3d8964e (diff)
Skip native types using only inNativePointer.
with this new isNativePointer, the generator can avoid create useless return policies. Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'generators')
-rw-r--r--generators/boostpython/cppgenerator.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/generators/boostpython/cppgenerator.cpp b/generators/boostpython/cppgenerator.cpp
index fb68a0e86..1b51b4561 100644
--- a/generators/boostpython/cppgenerator.cpp
+++ b/generators/boostpython/cppgenerator.cpp
@@ -246,11 +246,7 @@ QString CppGenerator::verifyDefaultReturnPolicy(const AbstractMetaFunction *cppF
AbstractMetaType *type = cppFunction->type();
//If return type replaced, the return policy need be set manually.
- if (!type || !cppFunction->typeReplaced(0).isEmpty())
- return QString();
-
- //avoid natives types
- if (!type->name().startsWith("Q"))
+ if (!type || !cppFunction->typeReplaced(0).isEmpty() || type->isNativePointer())
return QString();
QString returnPolicy;
@@ -260,7 +256,7 @@ QString CppGenerator::verifyDefaultReturnPolicy(const AbstractMetaFunction *cppF
if (!callPolicy.isEmpty())
returnPolicy += ", " + callPolicy;
returnPolicy += " >()";
- } else if (type->isReference() || type->isQObject() || type->isObject() || type->isNativePointer()) {
+ } else if (type->isReference() || type->isQObject() || type->isObject() || type->isValuePointer()) {
bool cppOwnership = type->isConstant();
if (cppFunction->isStatic() || cppOwnership) {
returnPolicy = QString("python::return_value_policy<PySide::return_ptr_object<")
@@ -1074,7 +1070,7 @@ void CppGenerator::writeFunctionArgsDef(QTextStream &sOut,
QString defaultValue = arg->defaultValueExpression();
bool isPointer = arg->type()->isObject() ||
arg->type()->isQObject() ||
- arg->type()->isNativePointer();
+ arg->type()->isValuePointer();
if (isPointer && defaultValue == "0") {
defaultValue = "python::object()";