aboutsummaryrefslogtreecommitdiffstats
path: root/cppgenerator.cpp
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2010-03-16 13:43:27 -0300
committerHugo Lima <hugo.lima@openbossa.org>2010-03-18 19:45:07 -0300
commit94e1c785c8d6f3dca195f1005fe0c3ee0f02ead5 (patch)
treed40240a164344f43281e270dd72ff15617cbd4f3 /cppgenerator.cpp
parent59c0dc6bd2a86207d5f500d767bea98c8c16d3e9 (diff)
Move the checks to verify if an object is invalid to Shiboken::cppObjectIsInvalid function.
Diffstat (limited to 'cppgenerator.cpp')
-rw-r--r--cppgenerator.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp
index 749fa001a..a4e43042c 100644
--- a/cppgenerator.cpp
+++ b/cppgenerator.cpp
@@ -1029,30 +1029,9 @@ void CppGenerator::writeErrorSection(QTextStream& s, OverloadData& overloadData)
void CppGenerator::writeInvalidCppObjectCheck(QTextStream& s, QString pyArgName, const TypeEntry* type)
{
- s << INDENT << "if (";
- if (type) {
- QString implicitChecks;
- QTextStream ic(&implicitChecks);
- foreach (const AbstractMetaFunction* ctor, implicitConversions(type)) {
- const TypeEntry* te;
- if (ctor->isConversionOperator())
- te = ctor->ownerClass()->typeEntry();
- else
- te = ctor->arguments().first()->type()->typeEntry();
- if (te->isValue() || te->isObject())
- ic << " || " << cpythonCheckFunction(te) << '(' << pyArgName << ')';
- }
- s << (!implicitChecks.isEmpty() ? "(" : "");
- s << cpythonCheckFunction(type) << '(' << pyArgName << ')';
- if (!implicitChecks.isEmpty())
- s << implicitChecks << ')';
- s << " && ";
- }
- s << "Shiboken::cppObjectIsInvalid(" << pyArgName << "))" << endl;
- {
- Indentation indent(INDENT);
- s << INDENT << "return " << m_currentErrorCode << ';' << endl;
- }
+ s << INDENT << "if (Shiboken::cppObjectIsInvalid(" << pyArgName << "))" << endl;
+ Indentation indent(INDENT);
+ s << INDENT << "return " << m_currentErrorCode << ';' << endl;
}
void CppGenerator::writeTypeCheck(QTextStream& s, const AbstractMetaType* argType, QString argumentName, bool isNumber, QString customType)