PageRenderTime 44ms CodeModel.GetById 38ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Lib/ruby/std_vector.i

#
Swig | 52 lines | 36 code | 13 blank | 3 comment | 0 complexity | 56f3416d0f06186fd53462720d0c642d MD5 | raw file
 1/*
 2  Vectors
 3*/
 4
 5%fragment("StdVectorTraits","header",fragment="StdSequenceTraits")
 6%{
 7  namespace swig {
 8    template <class T>
 9    struct traits_asptr<std::vector<T> >  {
10      static int asptr(VALUE obj, std::vector<T> **vec) {
11	return traits_asptr_stdseq<std::vector<T> >::asptr(obj, vec);
12      }
13    };
14    
15    template <class T>
16    struct traits_from<std::vector<T> > {
17      static VALUE from(const std::vector<T>& vec) {
18	return traits_from_stdseq<std::vector<T> >::from(vec);
19      }
20    };
21  }
22%}
23
24
25
26%define %swig_vector_methods(Type...) 
27  %swig_sequence_methods(Type)
28  %swig_sequence_front_inserters(Type);
29%enddef
30
31%define %swig_vector_methods_val(Type...) 
32  %swig_sequence_methods_val(Type);
33  %swig_sequence_front_inserters(Type);
34%enddef
35
36
37%mixin std::vector "Enumerable";
38%ignore std::vector::push_back;
39%ignore std::vector::pop_back;
40
41
42%rename("delete")     std::vector::__delete__;
43%rename("reject!")    std::vector::reject_bang;
44%rename("map!")       std::vector::map_bang;
45%rename("empty?")     std::vector::empty;
46%rename("include?" )  std::vector::__contains__ const;
47%rename("has_key?" )  std::vector::has_key const;
48
49%alias  std::vector::push          "<<";
50
51%include <std/std_vector.i>
52