diff options
Diffstat (limited to 'generator')
-rw-r--r-- | generator/cppgenerator.cpp | 8 | ||||
-rw-r--r-- | generator/shibokengenerator.cpp | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp index cef8523be..7cb67253a 100644 --- a/generator/cppgenerator.cpp +++ b/generator/cppgenerator.cpp @@ -2091,7 +2091,13 @@ void CppGenerator::writeMethodCall(QTextStream& s, const AbstractMetaFunction* f if (func->isBinaryOperator()) { if (func->isReverseOperator()) std::swap(firstArg, secondArg); - mc << firstArg << ' ' << op << ' ' << secondArg; + + if (((op == "++") || (op == "--")) && !func->isReverseOperator()) { + s << endl << INDENT << "for(int i=0; i < " << secondArg << "; i++, " << firstArg << "++);" << endl; + mc << firstArg; + } else { + mc << firstArg << ' ' << op << ' ' << secondArg; + } } else { mc << op << ' ' << secondArg; } diff --git a/generator/shibokengenerator.cpp b/generator/shibokengenerator.cpp index 43f4192d2..da48a8519 100644 --- a/generator/shibokengenerator.cpp +++ b/generator/shibokengenerator.cpp @@ -128,6 +128,8 @@ void ShibokenGenerator::initPrimitiveTypesCorrespondences() // Inplace arithmetic operators m_pythonOperators["operator+="] = "iadd"; m_pythonOperators["operator-="] = "isub"; + m_pythonOperators["operator++"] = "iadd"; + m_pythonOperators["operator--"] = "isub"; m_pythonOperators["operator*="] = "imul"; m_pythonOperators["operator/="] = "idiv"; m_pythonOperators["operator%="] = "imod"; |