aboutsummaryrefslogtreecommitdiffstats
path: root/cppgenerator.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-02-20 17:01:55 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-02-20 18:20:32 -0300
commit75507160e33339291d391cbdd0893fc0c9d4d3f5 (patch)
treefb6de78d3706a82fa6a555b0355f199f0a84e3bf /cppgenerator.cpp
parent4d89c3d81477a730b7d7ce6c9b5c062ee8cd1ec7 (diff)
Message for signature errors treats C++ null pointer as Python None.
C++ '0' (or 'NULL') default value is translated as Python 'None' in error message for wrong method calls.
Diffstat (limited to 'cppgenerator.cpp')
-rw-r--r--cppgenerator.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp
index 6b49939c7..fac317088 100644
--- a/cppgenerator.cpp
+++ b/cppgenerator.cpp
@@ -989,7 +989,8 @@ void CppGenerator::writeErrorSection(QTextStream& s, OverloadData& overloadData)
QStringList args;
foreach(AbstractMetaArgument* arg, f->arguments()) {
QString strArg;
- if (arg->type()->isNativePointer() && arg->type()->name() == "char") {
+ bool isCString = arg->type()->isNativePointer() && arg->type()->name() == "char";
+ if (isCString) {
strArg = "str";
} else if (arg->type()->isPrimitive()) {
const PrimitiveTypeEntry* ptp = reinterpret_cast<const PrimitiveTypeEntry*>(arg->type()->typeEntry());
@@ -1003,7 +1004,11 @@ void CppGenerator::writeErrorSection(QTextStream& s, OverloadData& overloadData)
}
if (!arg->defaultValueExpression().isEmpty()) {
strArg += " = ";
- strArg += arg->defaultValueExpression().replace("::", ".").replace("\"", "\\\"");
+ if ((isCString || arg->type()->isValuePointer() || arg->type()->typeEntry()->isObject())
+ && arg->defaultValueExpression() == "0")
+ strArg += "None";
+ else
+ strArg += arg->defaultValueExpression().replace("::", ".").replace("\"", "\\\"");
}
args << strArg;
}