Mercurial > mm7
comparison lib/swig/swigwin-2.0.11/Lib/std/std_pair.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 %include <std_common.i> | |
2 | |
3 %{ | |
4 #include <utility> | |
5 %} | |
6 | |
7 | |
8 namespace std { | |
9 template <class T, class U > struct pair { | |
10 typedef T first_type; | |
11 typedef U second_type; | |
12 | |
13 %traits_swigtype(T); | |
14 %traits_swigtype(U); | |
15 | |
16 %fragment(SWIG_Traits_frag(std::pair<T,U >), "header", | |
17 fragment=SWIG_Traits_frag(T), | |
18 fragment=SWIG_Traits_frag(U), | |
19 fragment="StdPairTraits") { | |
20 namespace swig { | |
21 template <> struct traits<std::pair<T,U > > { | |
22 typedef pointer_category category; | |
23 static const char* type_name() { | |
24 return "std::pair<" #T "," #U " >"; | |
25 } | |
26 }; | |
27 } | |
28 } | |
29 | |
30 #ifndef SWIG_STD_PAIR_ASVAL | |
31 %typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair<T,U >); | |
32 #else | |
33 %typemap_traits(SWIG_TYPECHECK_PAIR, std::pair<T,U >); | |
34 #endif | |
35 | |
36 pair(); | |
37 pair(T first, U second); | |
38 pair(const pair& p); | |
39 | |
40 template <class U1, class U2> pair(const pair<U1, U2> &p); | |
41 | |
42 T first; | |
43 U second; | |
44 | |
45 #ifdef %swig_pair_methods | |
46 // Add swig/language extra methods | |
47 %swig_pair_methods(std::pair<T,U >) | |
48 #endif | |
49 }; | |
50 | |
51 // *** | |
52 // The following specializations should disappear or get | |
53 // simplified when a 'const SWIGTYPE*&' can be defined | |
54 // *** | |
55 template <class T, class U > struct pair<T, U*> { | |
56 typedef T first_type; | |
57 typedef U* second_type; | |
58 | |
59 %traits_swigtype(T); | |
60 %traits_swigtype(U); | |
61 | |
62 %fragment(SWIG_Traits_frag(std::pair<T,U* >), "header", | |
63 fragment=SWIG_Traits_frag(T), | |
64 fragment=SWIG_Traits_frag(U), | |
65 fragment="StdPairTraits") { | |
66 namespace swig { | |
67 template <> struct traits<std::pair<T,U* > > { | |
68 typedef pointer_category category; | |
69 static const char* type_name() { | |
70 return "std::pair<" #T "," #U " * >"; | |
71 } | |
72 }; | |
73 } | |
74 } | |
75 | |
76 %typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair<T,U* >); | |
77 | |
78 pair(); | |
79 pair(T __a, U* __b); | |
80 pair(const pair& __p); | |
81 | |
82 T first; | |
83 U* second; | |
84 | |
85 #ifdef %swig_pair_methods | |
86 // Add swig/language extra methods | |
87 %swig_pair_methods(std::pair<T,U*>) | |
88 #endif | |
89 }; | |
90 | |
91 template <class T, class U > struct pair<T*, U> { | |
92 typedef T* first_type; | |
93 typedef U second_type; | |
94 | |
95 %traits_swigtype(T); | |
96 %traits_swigtype(U); | |
97 | |
98 %fragment(SWIG_Traits_frag(std::pair<T*,U >), "header", | |
99 fragment=SWIG_Traits_frag(T), | |
100 fragment=SWIG_Traits_frag(U), | |
101 fragment="StdPairTraits") { | |
102 namespace swig { | |
103 template <> struct traits<std::pair<T*,U > > { | |
104 typedef pointer_category category; | |
105 static const char* type_name() { | |
106 return "std::pair<" #T " *," #U " >"; | |
107 } | |
108 }; | |
109 } | |
110 } | |
111 | |
112 %typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair<T*,U >); | |
113 | |
114 pair(); | |
115 pair(T* __a, U __b); | |
116 pair(const pair& __p); | |
117 | |
118 T* first; | |
119 U second; | |
120 | |
121 #ifdef %swig_pair_methods | |
122 // Add swig/language extra methods | |
123 %swig_pair_methods(std::pair<T*,U >) | |
124 #endif | |
125 }; | |
126 | |
127 template <class T, class U > struct pair<T*, U*> { | |
128 typedef T* first_type; | |
129 typedef U* second_type; | |
130 | |
131 %traits_swigtype(T); | |
132 %traits_swigtype(U); | |
133 | |
134 %fragment(SWIG_Traits_frag(std::pair<T*,U* >), "header", | |
135 fragment=SWIG_Traits_frag(T), | |
136 fragment=SWIG_Traits_frag(U), | |
137 fragment="StdPairTraits") { | |
138 namespace swig { | |
139 template <> struct traits<std::pair<T*,U* > > { | |
140 typedef pointer_category category; | |
141 static const char* type_name() { | |
142 return "std::pair<" #T " *," #U " * >"; | |
143 } | |
144 }; | |
145 } | |
146 } | |
147 | |
148 %typemap_traits(SWIG_TYPECHECK_PAIR, std::pair<T*,U* >); | |
149 | |
150 pair(); | |
151 pair(T* __a, U* __b); | |
152 pair(const pair& __p); | |
153 | |
154 T* first; | |
155 U* second; | |
156 | |
157 #ifdef %swig_pair_methods | |
158 // Add swig/language extra methods | |
159 %swig_pair_methods(std::pair<T*,U*>) | |
160 #endif | |
161 }; | |
162 | |
163 } |