Mercurial > mm7
comparison lib/swig/swigwin-2.0.11/Lib/std/std_deque.i @ 1899:b3009adc0e2f
Adding swig, gitignore, hgignore
author | Nomad |
---|---|
date | Mon, 21 Oct 2013 10:42:27 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1867:eb580660bbbb | 1899:b3009adc0e2f |
---|---|
1 // | |
2 // std::deque | |
3 | |
4 %include <std_container.i> | |
5 | |
6 // Deque | |
7 | |
8 %define %std_deque_methods(deque...) | |
9 %std_sequence_methods(deque) | |
10 | |
11 void pop_front(); | |
12 void push_front(const value_type& x); | |
13 %enddef | |
14 | |
15 %define %std_deque_methods_val(deque...) | |
16 %std_sequence_methods_val(deque) | |
17 | |
18 void pop_front(); | |
19 void push_front(value_type x); | |
20 %enddef | |
21 | |
22 // ------------------------------------------------------------------------ | |
23 // std::deque | |
24 // | |
25 // const declarations are used to guess the intent of the function being | |
26 // exported; therefore, the following rationale is applied: | |
27 // | |
28 // -- f(std::deque<T>), f(const std::deque<T>&): | |
29 // the parameter being read-only, either a sequence or a | |
30 // previously wrapped std::deque<T> can be passed. | |
31 // -- f(std::deque<T>&), f(std::deque<T>*): | |
32 // the parameter may be modified; therefore, only a wrapped std::deque | |
33 // can be passed. | |
34 // -- std::deque<T> f(), const std::deque<T>& f(): | |
35 // the deque is returned by copy; therefore, a sequence of T:s | |
36 // is returned which is most easily used in other functions | |
37 // -- std::deque<T>& f(), std::deque<T>* f(): | |
38 // the deque is returned by reference; therefore, a wrapped std::deque | |
39 // is returned | |
40 // -- const std::deque<T>* f(), f(const std::deque<T>*): | |
41 // for consistency, they expect and return a plain deque pointer. | |
42 // ------------------------------------------------------------------------ | |
43 | |
44 %{ | |
45 #include <deque> | |
46 %} | |
47 | |
48 // exported classes | |
49 | |
50 namespace std { | |
51 | |
52 template<class _Tp, class _Alloc = allocator<_Tp> > | |
53 class deque { | |
54 public: | |
55 typedef size_t size_type; | |
56 typedef ptrdiff_t difference_type; | |
57 typedef _Tp value_type; | |
58 typedef value_type* pointer; | |
59 typedef const value_type* const_pointer; | |
60 typedef value_type& reference; | |
61 typedef const value_type& const_reference; | |
62 typedef _Alloc allocator_type; | |
63 | |
64 %traits_swigtype(_Tp); | |
65 | |
66 %fragment(SWIG_Traits_frag(std::deque<_Tp, _Alloc >), "header", | |
67 fragment=SWIG_Traits_frag(_Tp), | |
68 fragment="StdDequeTraits") { | |
69 namespace swig { | |
70 template <> struct traits<std::deque<_Tp, _Alloc > > { | |
71 typedef pointer_category category; | |
72 static const char* type_name() { | |
73 return "std::deque<" #_Tp " >"; | |
74 } | |
75 }; | |
76 } | |
77 } | |
78 | |
79 %typemap_traits_ptr(SWIG_TYPECHECK_DEQUE, std::deque<_Tp, _Alloc >); | |
80 | |
81 #ifdef %swig_deque_methods | |
82 // Add swig/language extra methods | |
83 %swig_deque_methods(std::deque<_Tp, _Alloc >); | |
84 #endif | |
85 | |
86 %std_deque_methods(deque); | |
87 }; | |
88 | |
89 template<class _Tp, class _Alloc > | |
90 class deque<_Tp*, _Alloc > { | |
91 public: | |
92 typedef size_t size_type; | |
93 typedef ptrdiff_t difference_type; | |
94 typedef _Tp* value_type; | |
95 typedef value_type* pointer; | |
96 typedef const value_type* const_pointer; | |
97 typedef value_type reference; | |
98 typedef value_type const_reference; | |
99 typedef _Alloc allocator_type; | |
100 | |
101 %traits_swigtype(_Tp); | |
102 | |
103 %fragment(SWIG_Traits_frag(std::deque<_Tp*, _Alloc >), "header", | |
104 fragment=SWIG_Traits_frag(_Tp), | |
105 fragment="StdDequeTraits") { | |
106 namespace swig { | |
107 template <> struct traits<std::deque<_Tp*, _Alloc > > { | |
108 typedef value_category category; | |
109 static const char* type_name() { | |
110 return "std::deque<" #_Tp " * >"; | |
111 } | |
112 }; | |
113 } | |
114 } | |
115 | |
116 %typemap_traits_ptr(SWIG_TYPECHECK_DEQUE, std::deque<_Tp*, _Alloc >); | |
117 | |
118 #ifdef %swig_deque_methods_val | |
119 // Add swig/language extra methods | |
120 %swig_deque_methods_val(std::deque<_Tp*, _Alloc >); | |
121 #endif | |
122 | |
123 %std_deque_methods_val(std::deque<_Tp*, _Alloc >); | |
124 }; | |
125 | |
126 } | |
127 |