more fixes for pointer

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5824 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-04-03 08:36:08 +00:00
commit 49a09a63fb
6 changed files with 27 additions and 5 deletions

View file

@ -7,7 +7,7 @@
/* in */
%define PYVAL_IN_TYPEMAP(as_meth,pyfrag,...)
%typemap(in,fragment=pyfrag) __VA_ARGS__
%typemap(in,fragment=pyfrag) __VA_ARGS__
"$1 = ($ltype)as_meth($input);
if (PyErr_Occurred()) SWIG_fail;";
%typemap(in,fragment=pyfrag) const __VA_ARGS__ & ($basetype temp)

View file

@ -113,7 +113,10 @@ namespace std {
typedef value_type reference;
typedef value_type const_reference;
%traits_swigtype(T);
%fragment(SWIG_Traits_frag(std::deque<T* >), "header",
fragment=SWIG_Traits_frag(T),
fragment="StdDequeTraits") {
namespace swigpy {
template <> struct traits<std::deque<T* > > {

View file

@ -124,7 +124,10 @@ namespace std {
typedef value_type reference;
typedef value_type const_reference;
%traits_swigtype(T);
%fragment(SWIG_Traits_frag(std::list<T* >), "header",
fragment=SWIG_Traits_frag(T),
fragment="StdListTraits") {
namespace swigpy {
template <> struct traits<std::list<T* > > {

View file

@ -138,7 +138,7 @@ namespace std {
%typemap_traits_ptr(SWIG_CCode(PAIR), std::pair<T,U* >);
pair();
pair(const T& __a, U* __b);
pair(T __a, U* __b);
pair(const pair& __p);
T first;
@ -171,7 +171,7 @@ namespace std {
%typemap_traits_ptr(SWIG_CCode(PAIR), std::pair<T*,U >);
pair();
pair(T* __a, const U& __b);
pair(T* __a, U __b);
pair(const pair& __p);
T* first;

View file

@ -30,10 +30,26 @@
%define %std_set_methods(set)
%std_set_methods_common(set);
#ifdef SWIG_EXPORT_ITERATOR_METHODS
pair<iterator,bool> insert(const value_type& __x);
iterator insert(iterator pos);
#endif
%enddef
%define %pyset_methods(set)
%pycontainer_methods(set);
%extend {
void append(value_type x) {
self->insert(x);
}
bool __contains__(value_type x) {
return self->find(x) != self->end();
}
};
%enddef
// ------------------------------------------------------------------------
// std::set
//
@ -121,9 +137,8 @@ namespace std {
%typemap_traits_ptr(SWIG_CCode(SET), std::set<T >);
%std_set_methods(set);
%pycontainer_methods(std::set<T >);
%pyset_methods(std::set<T >);
};
}
%define %std_set_ptypen(...)

View file

@ -132,6 +132,7 @@ namespace std {
%traits_swigtype(T);
%fragment(SWIG_Traits_frag(std::vector<T* >), "header",
fragment=SWIG_Traits_frag(T),
fragment="StdVectorTraits") {
namespace swigpy {
template <> struct traits<std::vector<T* > > {