1 // THIS IS A GENERATED FILE: RUN callback.pl to regenerate it
2 // THIS IS A GENERATED FILE: callback.pl is part of the GVPE
3 // THIS IS A GENERATED FILE: distribution.
6 callback.h -- C++ callback mechanism
7 Copyright (C) 2003-2006 Marc Lehmann <pcg@goof.com>
9 This file is part of GVPE.
11 GVPE is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with gvpe; if not, write to the Free Software
23 Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
36 /* a proxy is a kind of recipe on how to call a specific class method */
38 virtual R call (void *obj, R (object::*meth)()) const = 0;
40 template<class O1, class O2>
41 struct proxy : proxy_base {
42 virtual R call (void *obj, R (object::*meth)()) const
44 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)()>(meth)))
52 template<class O1, class O2>
53 explicit callback0 (O1 *object, R (O2::*method)())
55 static proxy<O1,O2> p;
56 obj = reinterpret_cast<void *>(object);
57 meth = reinterpret_cast<R (object::*)()>(method);
63 return prxy->call (obj, meth);
72 template<class R, class A1>
77 R (object::*meth)(A1);
79 /* a proxy is a kind of recipe on how to call a specific class method */
81 virtual R call (void *obj, R (object::*meth)(A1), A1 a1) const = 0;
83 template<class O1, class O2>
84 struct proxy : proxy_base {
85 virtual R call (void *obj, R (object::*meth)(A1), A1 a1) const
87 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1)>(meth)))
95 template<class O1, class O2>
96 explicit callback1 (O1 *object, R (O2::*method)(A1))
98 static proxy<O1,O2> p;
99 obj = reinterpret_cast<void *>(object);
100 meth = reinterpret_cast<R (object::*)(A1)>(method);
106 return prxy->call (obj, meth, a1);
109 R operator ()(A1 a1) const
115 template<class R, class A1, class A2>
120 R (object::*meth)(A1, A2);
122 /* a proxy is a kind of recipe on how to call a specific class method */
124 virtual R call (void *obj, R (object::*meth)(A1, A2), A1 a1, A2 a2) const = 0;
126 template<class O1, class O2>
127 struct proxy : proxy_base {
128 virtual R call (void *obj, R (object::*meth)(A1, A2), A1 a1, A2 a2) const
130 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2)>(meth)))
138 template<class O1, class O2>
139 explicit callback2 (O1 *object, R (O2::*method)(A1, A2))
141 static proxy<O1,O2> p;
142 obj = reinterpret_cast<void *>(object);
143 meth = reinterpret_cast<R (object::*)(A1, A2)>(method);
147 R call(A1 a1, A2 a2) const
149 return prxy->call (obj, meth, a1, a2);
152 R operator ()(A1 a1, A2 a2) const
154 return call (a1, a2);
158 template<class R, class A1, class A2, class A3>
163 R (object::*meth)(A1, A2, A3);
165 /* a proxy is a kind of recipe on how to call a specific class method */
167 virtual R call (void *obj, R (object::*meth)(A1, A2, A3), A1 a1, A2 a2, A3 a3) const = 0;
169 template<class O1, class O2>
170 struct proxy : proxy_base {
171 virtual R call (void *obj, R (object::*meth)(A1, A2, A3), A1 a1, A2 a2, A3 a3) const
173 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3)>(meth)))
181 template<class O1, class O2>
182 explicit callback3 (O1 *object, R (O2::*method)(A1, A2, A3))
184 static proxy<O1,O2> p;
185 obj = reinterpret_cast<void *>(object);
186 meth = reinterpret_cast<R (object::*)(A1, A2, A3)>(method);
190 R call(A1 a1, A2 a2, A3 a3) const
192 return prxy->call (obj, meth, a1, a2, a3);
195 R operator ()(A1 a1, A2 a2, A3 a3) const
197 return call (a1, a2, a3);
201 template<class R, class A1, class A2, class A3, class A4>
206 R (object::*meth)(A1, A2, A3, A4);
208 /* a proxy is a kind of recipe on how to call a specific class method */
210 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4) const = 0;
212 template<class O1, class O2>
213 struct proxy : proxy_base {
214 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4) const
216 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4)>(meth)))
224 template<class O1, class O2>
225 explicit callback4 (O1 *object, R (O2::*method)(A1, A2, A3, A4))
227 static proxy<O1,O2> p;
228 obj = reinterpret_cast<void *>(object);
229 meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4)>(method);
233 R call(A1 a1, A2 a2, A3 a3, A4 a4) const
235 return prxy->call (obj, meth, a1, a2, a3, a4);
238 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4) const
240 return call (a1, a2, a3, a4);
244 template<class R, class A1, class A2, class A3, class A4, class A5>
249 R (object::*meth)(A1, A2, A3, A4, A5);
251 /* a proxy is a kind of recipe on how to call a specific class method */
253 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const = 0;
255 template<class O1, class O2>
256 struct proxy : proxy_base {
257 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
259 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5)>(meth)))
260 (a1, a2, a3, a4, a5);
267 template<class O1, class O2>
268 explicit callback5 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5))
270 static proxy<O1,O2> p;
271 obj = reinterpret_cast<void *>(object);
272 meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5)>(method);
276 R call(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
278 return prxy->call (obj, meth, a1, a2, a3, a4, a5);
281 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
283 return call (a1, a2, a3, a4, a5);
287 template<class R, class A1, class A2, class A3, class A4, class A5, class A6>
292 R (object::*meth)(A1, A2, A3, A4, A5, A6);
294 /* a proxy is a kind of recipe on how to call a specific class method */
296 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const = 0;
298 template<class O1, class O2>
299 struct proxy : proxy_base {
300 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
302 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5, A6)>(meth)))
303 (a1, a2, a3, a4, a5, a6);
310 template<class O1, class O2>
311 explicit callback6 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5, A6))
313 static proxy<O1,O2> p;
314 obj = reinterpret_cast<void *>(object);
315 meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5, A6)>(method);
319 R call(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
321 return prxy->call (obj, meth, a1, a2, a3, a4, a5, a6);
324 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
326 return call (a1, a2, a3, a4, a5, a6);
330 template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
335 R (object::*meth)(A1, A2, A3, A4, A5, A6, A7);
337 /* a proxy is a kind of recipe on how to call a specific class method */
339 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const = 0;
341 template<class O1, class O2>
342 struct proxy : proxy_base {
343 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
345 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5, A6, A7)>(meth)))
346 (a1, a2, a3, a4, a5, a6, a7);
353 template<class O1, class O2>
354 explicit callback7 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5, A6, A7))
356 static proxy<O1,O2> p;
357 obj = reinterpret_cast<void *>(object);
358 meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5, A6, A7)>(method);
362 R call(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
364 return prxy->call (obj, meth, a1, a2, a3, a4, a5, a6, a7);
367 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
369 return call (a1, a2, a3, a4, a5, a6, a7);