summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2011-02-09 14:22:12 -0300
committerRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2011-02-09 15:44:04 -0300
commit6bafe84c86b70ad9fd1e62dbe0405175d34e8912 (patch)
tree64d4422f3002a0d225759e8cc1ed5616cd03e88f
parent61035b494dd0b5d13ea8cd7f4af7e62b36bb27b8 (diff)
downloadshiboken-6bafe84c86b70ad9fd1e62dbe0405175d34e8912.tar.gz
shiboken-6bafe84c86b70ad9fd1e62dbe0405175d34e8912.tar.xz
shiboken-6bafe84c86b70ad9fd1e62dbe0405175d34e8912.zip
Implemented support to iterator function generation.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r--generator/cppgenerator.cpp4
-rw-r--r--generator/shibokengenerator.cpp2
2 files changed, 4 insertions, 2 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index 95143371..70d4388a 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -2534,8 +2534,8 @@ void CppGenerator::writeClassDefinition(QTextStream& s, const AbstractMetaClass*
s << INDENT << "/*tp_clear*/ 0," << endl;
s << INDENT << "/*tp_richcompare*/ " << tp_richcompare << ',' << endl;
s << INDENT << "/*tp_weaklistoffset*/ 0," << endl;
- s << INDENT << "/*tp_iter*/ 0," << endl;
- s << INDENT << "/*tp_iternext*/ 0," << endl;
+ s << INDENT << "/*tp_iter*/ " << m_tpFuncs["__iter__"] << ',' << endl;
+ s << INDENT << "/*tp_iternext*/ " << m_tpFuncs["__next__"] << ',' << endl;
s << INDENT << "/*tp_methods*/ " << className << "_methods," << endl;
s << INDENT << "/*tp_members*/ 0," << endl;
s << INDENT << "/*tp_getset*/ " << tp_getset << ',' << endl;
diff --git a/generator/shibokengenerator.cpp b/generator/shibokengenerator.cpp
index 387a8769..381e99e0 100644
--- a/generator/shibokengenerator.cpp
+++ b/generator/shibokengenerator.cpp
@@ -75,6 +75,8 @@ void ShibokenGenerator::clearTpFuncs()
{
m_tpFuncs["__str__"] = QString("0");
m_tpFuncs["__repr__"] = QString("0");
+ m_tpFuncs["__iter__"] = QString("0");
+ m_tpFuncs["__next__"] = QString("0");
}
void ShibokenGenerator::initPrimitiveTypesCorrespondences()