aboutsummaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2013-12-31 14:30:53 -0500
committerJohn Cummings <jcummings2@users.sf.net>2014-01-07 21:48:39 +0100
commita527dd51e69b80c2d5be3a1d8cd60ab2b2616fa5 (patch)
treef0cfee0759f3e6b0547655b887646db1b9869a04 /generator
parentfaa44f349170667fb918fc25e51cc5f392bfc6ad (diff)
Fix for containers with 'const' values
Fix omission of 'const' specifier when generating binding code for containers whose value type is 'const', which would lead to binding code that does not compile due to 'const' mismatch. Includes test case. Change-Id: Iff99a16ee071bb255f78e86e2456e5206cc00cfb Reviewed-by: John Cummings <jcummings2@users.sf.net>
Diffstat (limited to 'generator')
-rw-r--r--generator/shiboken/cppgenerator.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/generator/shiboken/cppgenerator.cpp b/generator/shiboken/cppgenerator.cpp
index e2ebc59bb..4fbc134c1 100644
--- a/generator/shiboken/cppgenerator.cpp
+++ b/generator/shiboken/cppgenerator.cpp
@@ -2422,8 +2422,13 @@ void CppGenerator::writeCppToPythonFunction(QTextStream& s, const AbstractMetaTy
return;
}
QString code = customConversion->nativeToTargetConversion();
- for (int i = 0; i < containerType->instantiations().count(); ++i)
- code.replace(QString("%INTYPE_%1").arg(i), getFullTypeName(containerType->instantiations().at(i)));
+ for (int i = 0; i < containerType->instantiations().count(); ++i) {
+ AbstractMetaType* type = containerType->instantiations().at(i);
+ QString typeName = getFullTypeName(type);
+ if (type->isConstant())
+ typeName = "const " + typeName;
+ code.replace(QString("%INTYPE_%1").arg(i), typeName);
+ }
replaceCppToPythonVariables(code, getFullTypeNameWithoutModifiers(containerType));
processCodeSnip(code);
writeCppToPythonFunction(s, code, fixedCppTypeName(containerType));