add iterator support

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7766 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-10-31 09:56:13 +00:00
commit cda225ea32
3 changed files with 363 additions and 66 deletions

View file

@ -58,6 +58,7 @@
}
%define %swig_map_methods(Map...)
%swig_sequence_iterator(Map);
%swig_container_methods(Map)
%extend {
@ -139,6 +140,7 @@
return self->find(key) != self->end();
}
#if !defined(SWIG_EXPORT_ITERATOR_METHODS) || defined(SWIG_USE_OLD_MAP_ITERATOR)
PyObject* __iter__() {
Map::size_type size = self->size();
int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
@ -160,6 +162,7 @@
return keyTuple;
%#endif
}
#endif
}
%enddef