aboutsummaryrefslogtreecommitdiffstats
path: root/generator/cppgenerator.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-08-03 14:35:35 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:17:08 -0300
commitf2e0002c8ebc7a68fca731bfbde1d32415f5a240 (patch)
tree54bd01c50ada4bb89e71f24a2dedb7cb7c91dc64 /generator/cppgenerator.cpp
parent699f6db172df37631dec7a884a25df8cc62343b8 (diff)
Fixed type system variable replacement for arguments removed with conversion rule.
Also added an array argument modification test, and moved AutoArrayPointer from libpyside to libshiboken. Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'generator/cppgenerator.cpp')
-rw-r--r--generator/cppgenerator.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index 827ec28e3..efbf6ef96 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -726,7 +726,7 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
ac << INDENT;
if (!func->conversionRule(TypeSystem::TargetLangCode, arg->argumentIndex() + 1).isEmpty()) {
// Has conversion rule.
- ac << arg->name() << "_out";
+ ac << QString("%1"CONV_RULE_OUT_VAR_SUFFIX).arg(arg->name());
} else {
QString argName = arg->name();
if (avoidProtectedHack()) {
@@ -2021,17 +2021,16 @@ void CppGenerator::writeMethodCall(QTextStream& s, const AbstractMetaFunction* f
int removedArgs = 0;
for (int i = 0; i < maxArgs + removedArgs; i++) {
const AbstractMetaArgument* arg = func->arguments().at(i);
+ bool hasConversionRule = !func->conversionRule(TypeSystem::NativeCode, arg->argumentIndex() + 1).isEmpty();
if (func->argumentRemoved(i + 1)) {
-
// If some argument with default value is removed from a
// method signature, the said value must be explicitly
// added to the method call.
removedArgs++;
// If have conversion rules I will use this for removed args
- bool hasConversionRule = !func->conversionRule(TypeSystem::NativeCode, arg->argumentIndex() + 1).isEmpty();
if (hasConversionRule) {
- userArgs << arg->name() + "_out";
+ userArgs << QString("%1"CONV_RULE_OUT_VAR_SUFFIX).arg(arg->name());
} else {
if (arg->defaultValueExpression().isEmpty())
badModifications = true;
@@ -2040,14 +2039,9 @@ void CppGenerator::writeMethodCall(QTextStream& s, const AbstractMetaFunction* f
}
} else {
int idx = arg->argumentIndex() - removedArgs;
- QString argName;
-
- bool hasConversionRule = !func->conversionRule(TypeSystem::NativeCode, arg->argumentIndex() + 1).isEmpty();
- if (hasConversionRule) {
- argName = arg->name() + "_out";
- } else {
- argName = QString(CPP_ARG"%1").arg(idx);
- }
+ QString argName = hasConversionRule
+ ? QString("%1"CONV_RULE_OUT_VAR_SUFFIX).arg(arg->name())
+ : QString(CPP_ARG"%1").arg(idx);
userArgs << argName;
}
}
@@ -2073,7 +2067,7 @@ void CppGenerator::writeMethodCall(QTextStream& s, const AbstractMetaFunction* f
if (!arg->defaultValueExpression().isEmpty())
otherArgs.prepend(guessScopeForDefaultValue(func, arg));
else if (hasConversionRule)
- otherArgs.prepend(arg->name() + "_out");
+ otherArgs.prepend(QString("%1"CONV_RULE_OUT_VAR_SUFFIX).arg(arg->name()));
else
badModifications = true;
}