Added sequence and mapping support for builtin types.
Fixed object ownership in %pyswigbinoperator. Test suite now fails on li_std_vector_extra. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12346 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b1682d4d80
commit
8a7ad756d0
4 changed files with 212 additions and 82 deletions
|
|
@ -599,7 +599,6 @@ namespace swig
|
|||
|
||||
/**** The python container methods ****/
|
||||
|
||||
|
||||
%define %swig_container_methods(Container...)
|
||||
|
||||
%newobject __getslice__;
|
||||
|
|
@ -618,8 +617,16 @@ namespace swig
|
|||
return self->size();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%pybinoperator(__nonzero__, __nonzero__, unaryfunc, nb_nonzero);
|
||||
%pybinoperator(__len__, __len__, lenfunc, sq_length);
|
||||
#endif // SWIGPYTHON_BUILTIN
|
||||
|
||||
%enddef
|
||||
|
||||
|
||||
|
||||
%define %swig_sequence_methods_common(Sequence...)
|
||||
%swig_sequence_iterator(%arg(Sequence))
|
||||
%swig_container_methods(%arg(Sequence))
|
||||
|
|
@ -697,6 +704,14 @@ namespace swig
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%pybinoperator(__getitem__, __getitem__, ssizeargfunc, sq_item);
|
||||
%pybinoperator(__getslice__, __getslice__, ssizessizeargfunc, sq_slice);
|
||||
%pybinoperator(__setitem__, __setitem__, ssizeobjargproc, sq_ass_item);
|
||||
%pybinoperator(__setslice__, __setslice__, ssizessizeobjargproc, sq_ass_slice);
|
||||
#endif // SWIGPYTHON_BUILTIN
|
||||
|
||||
%enddef
|
||||
|
||||
%define %swig_sequence_methods(Sequence...)
|
||||
|
|
@ -714,6 +729,7 @@ namespace swig
|
|||
self->push_back(x);
|
||||
}
|
||||
}
|
||||
|
||||
%enddef
|
||||
|
||||
%define %swig_sequence_methods_val(Sequence...)
|
||||
|
|
@ -731,6 +747,7 @@ namespace swig
|
|||
self->push_back(x);
|
||||
}
|
||||
}
|
||||
|
||||
%enddef
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue