annotate lib/swig/swigwin-2.0.11/Lib/std/std_list.i @ 1899:b3009adc0e2f

Adding swig, gitignore, hgignore
author Nomad
date Mon, 21 Oct 2013 10:42:27 +0200
parents
children
rev   line source
1899
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
1 //
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
2 // std::list
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
3 //
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
4
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
5 %include <std_container.i>
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
7 // List
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
8
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
9 %define %std_list_methods(list)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
10 %std_sequence_methods(list)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
11
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
12 void pop_front();
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
13 void push_front(const value_type& x);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
14
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
15 void reverse();
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
16
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
17 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
18
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
19
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
20 %define %std_list_methods_val(list)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
21 %std_sequence_methods_val(list)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
22
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
23 void pop_front();
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
24 void push_front(value_type x);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
25
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
26 void remove(value_type x);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
27 void unique();
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
28 void reverse();
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
29 void sort();
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
30
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
31 void merge(list& x);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
32 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
33
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
34 // ------------------------------------------------------------------------
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
35 // std::list
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
36 //
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
37 // const declarations are used to guess the intent of the function being
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
38 // exported; therefore, the following rationale is applied:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
39 //
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
40 // -- f(std::list<T>), f(const std::list<T>&):
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
41 // the parameter being read-only, either a sequence or a
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
42 // previously wrapped std::list<T> can be passed.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
43 // -- f(std::list<T>&), f(std::list<T>*):
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
44 // the parameter may be modified; therefore, only a wrapped std::list
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
45 // can be passed.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
46 // -- std::list<T> f(), const std::list<T>& f():
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
47 // the list is returned by copy; therefore, a sequence of T:s
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
48 // is returned which is most easily used in other functions
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
49 // -- std::list<T>& f(), std::list<T>* f():
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
50 // the list is returned by reference; therefore, a wrapped std::list
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
51 // is returned
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
52 // -- const std::list<T>* f(), f(const std::list<T>*):
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
53 // for consistency, they expect and return a plain list pointer.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
54 // ------------------------------------------------------------------------
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
55
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
56 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
57 #include <list>
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
58 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
59
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
60 // exported classes
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
61
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
62 namespace std {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
63
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
64 template<class _Tp, class _Alloc = allocator<_Tp> >
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
65 class list {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
66 public:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
67 typedef size_t size_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
68 typedef ptrdiff_t difference_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
69 typedef _Tp value_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
70 typedef value_type* pointer;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
71 typedef const value_type* const_pointer;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
72 typedef value_type& reference;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
73 typedef const value_type& const_reference;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
74 typedef _Alloc allocator_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
75
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
76 %traits_swigtype(_Tp);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
77
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
78 %fragment(SWIG_Traits_frag(std::list<_Tp, _Alloc >), "header",
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
79 fragment=SWIG_Traits_frag(_Tp),
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
80 fragment="StdListTraits") {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
81 namespace swig {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
82 template <> struct traits<std::list<_Tp, _Alloc > > {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
83 typedef pointer_category category;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
84 static const char* type_name() {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
85 return "std::list<" #_Tp ", " #_Alloc " >";
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
86 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
87 };
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
88 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
89 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
90
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
91 %typemap_traits_ptr(SWIG_TYPECHECK_LIST, std::list<_Tp, _Alloc >);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
92
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
93 #ifdef %swig_list_methods
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
94 // Add swig/language extra methods
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
95 %swig_list_methods(std::list<_Tp, _Alloc >);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
96 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
97
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
98 %std_list_methods(list);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
99 };
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
100
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
101 template<class _Tp, class _Alloc >
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
102 class list<_Tp*, _Alloc> {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
103 public:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
104 typedef size_t size_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
105 typedef ptrdiff_t difference_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
106 typedef _Tp* value_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
107 typedef value_type* pointer;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
108 typedef const value_type* const_pointer;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
109 typedef value_type reference;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
110 typedef value_type const_reference;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
111 typedef _Alloc allocator_type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
112
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
113 %traits_swigtype(_Tp);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
114
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
115 %fragment(SWIG_Traits_frag(std::list<_Tp*, _Alloc >), "header",
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
116 fragment=SWIG_Traits_frag(_Tp),
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
117 fragment="StdListTraits") {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
118 namespace swig {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
119 template <> struct traits<std::list<_Tp*, _Alloc > > {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
120 typedef value_category category;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
121 static const char* type_name() {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
122 return "std::list<" #_Tp " *," #_Alloc " >";
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
123 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
124 };
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
125 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
126 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
127
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
128 %typemap_traits_ptr(SWIG_TYPECHECK_LIST, std::list<_Tp*, _Alloc >);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
129
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
130 #ifdef %swig_list_methods_val
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
131 // Add swig/language extra methods
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
132 %swig_list_methods_val(std::list<_Tp*, _Alloc >);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
133 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
134
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
135 %std_list_methods_val(list);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
136 };
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
137
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
138 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
139
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
140 %define %std_extequal_list(...)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
141 %extend std::list<__VA_ARGS__ > {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
142 void remove(const value_type& x) { self->remove(x); }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
143 void merge(std::list<__VA_ARGS__ >& x){ self->merge(x); }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
144 void unique() { self->unique(); }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
145 void sort() { self->sort(); }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
146 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
147 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
148