diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2009-10-27 14:14:25 -0200 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2009-10-27 16:48:23 -0200 |
commit | 215779a303932c36012f38dda6996f9782d6b2be (patch) | |
tree | 26a8da4d1234daab4fabe59598baf7d90c2d2a00 | |
parent | 8782c39052ead7300ed621a3c91905c674c37927 (diff) |
Use the converter inside the rich comparison function, because if the
type is convertible to X, does not mean that the type is X.
-rw-r--r-- | cppgenerator.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp index 3ea7f765e..62a78f1bc 100644 --- a/cppgenerator.cpp +++ b/cppgenerator.cpp @@ -1208,17 +1208,14 @@ void CppGenerator::writeRichCompareFunction(QTextStream& s, const AbstractMetaCl s << INDENT; } + // TODO: Optimize this method: When the "other" type IS a QString, we dont need to call the converter, + // we just need to get the cptr and avoid object copying. s << "if (" << cpythonCheckFunction(type, numberType) << "(other)) {" << endl; { Indentation indent(INDENT); s << INDENT; - if (type->isValue() || type->isObject()) { - s << arg0TypeName << "& cpp_other = *"; - s << cpythonWrapperCPtr(metaClass, "other"); - } else { - s << translateTypeForWrapperMethod(type, metaClass) << " cpp_other = "; - writeToCppConversion(s, type, metaClass, "other"); - } + s << translateTypeForWrapperMethod(type, metaClass) << " cpp_other = "; + writeToCppConversion(s, type, metaClass, "other"); s << ';' << endl; s << INDENT << "result = (cpp_self " << op << " cpp_other);" << endl; } |