ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/callback.h
(Generate patch)

Comparing rxvt-unicode/src/callback.h (file contents):
Revision 1.11 by root, Tue Dec 4 16:57:54 2007 UTC vs.
Revision 1.14 by root, Thu May 22 18:54:32 2014 UTC

2// THIS IS A GENERATED FILE: callback.pl is part of the GVPE 2// THIS IS A GENERATED FILE: callback.pl is part of the GVPE
3// THIS IS A GENERATED FILE: distribution. 3// THIS IS A GENERATED FILE: distribution.
4 4
5/* 5/*
6 callback.h -- C++ callback mechanism 6 callback.h -- C++ callback mechanism
7 Copyright (C) 2003-2007 Marc Lehmann <pcg@goof.com> 7 Copyright (C) 2003-2007 Marc Lehmann <schmorp@schmorp.de>
8 8
9 This file is part of GVPE. 9 This file is part of GVPE.
10 10
11 GVPE is free software; you can redistribute it and/or modify 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 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 13 the Free Software Foundation; either version 3 of the License, or
14 (at your option) any later version. 14 (at your option) any later version.
15 15
16 This program is distributed in the hope that it will be useful, 16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34template<class R> 34template<class R>
35struct callback<R ()> 35struct callback<R ()>
36{ 36{
37 typedef R (*ptr_type)(void *self); 37 typedef R (*ptr_type)(void *self);
38 38
39private: 39 template<class K, R (K::*method)()>
40 40 void set (K *object)
41 void *self;
42 ptr_type func;
43
44protected:
45
46 template<typename method>
47 struct thunktype;
48
49 template<class klass>
50 struct thunktype<R (klass::*)>
51 { 41 {
52 typedef klass K; 42 self = object;
43 func = thunk<K, method>;
53 }; 44 }
45
46 R call () const
47 {
48 return func (self);
49 }
50
51 R operator ()() const
52 {
53 return call ();
54 }
55
56private:
57
58 void *self;
59 ptr_type func;
54 60
55 template<class klass, R (klass::*method)()> 61 template<class klass, R (klass::*method)()>
56 static R thunk (void *self) 62 static R thunk (void *self)
57 { 63 {
58 klass *obj = static_cast<klass *>(self); 64 klass *obj = static_cast<klass *>(self);
59 return (obj->*method) (); 65 return (obj->*method) ();
60 } 66 }
61
62public:
63 template<class K, R (K::*method)()>
64 void set (K *object)
65 {
66 self = object;
67 func = thunk<K, method>;
68 }
69
70 R call () const
71 {
72 return func (self);
73 }
74
75 R operator ()() const
76 {
77 return call ();
78 }
79}; 67};
80 68
81template<class R, class A1> 69template<class R, class A1>
82struct callback<R (A1)> 70struct callback<R (A1)>
83{ 71{
84 typedef R (*ptr_type)(void *self, A1); 72 typedef R (*ptr_type)(void *self, A1);
85 73
86private: 74 template<class K, R (K::*method)(A1)>
87 75 void set (K *object)
88 void *self;
89 ptr_type func;
90
91protected:
92
93 template<typename method>
94 struct thunktype;
95
96 template<class klass>
97 struct thunktype<R (klass::*)>
98 { 76 {
99 typedef klass K; 77 self = object;
78 func = thunk<K, method>;
100 }; 79 }
80
81 R call (A1 a1) const
82 {
83 return func (self, a1);
84 }
85
86 R operator ()(A1 a1) const
87 {
88 return call (a1);
89 }
90
91private:
92
93 void *self;
94 ptr_type func;
101 95
102 template<class klass, R (klass::*method)(A1)> 96 template<class klass, R (klass::*method)(A1)>
103 static R thunk (void *self, A1 a1) 97 static R thunk (void *self, A1 a1)
104 { 98 {
105 klass *obj = static_cast<klass *>(self); 99 klass *obj = static_cast<klass *>(self);
106 return (obj->*method) (a1); 100 return (obj->*method) (a1);
107 } 101 }
108
109public:
110 template<class K, R (K::*method)(A1)>
111 void set (K *object)
112 {
113 self = object;
114 func = thunk<K, method>;
115 }
116
117 R call (A1 a1) const
118 {
119 return func (self, a1);
120 }
121
122 R operator ()(A1 a1) const
123 {
124 return call (a1);
125 }
126}; 102};
127 103
128template<class R, class A1, class A2> 104template<class R, class A1, class A2>
129struct callback<R (A1, A2)> 105struct callback<R (A1, A2)>
130{ 106{
131 typedef R (*ptr_type)(void *self, A1, A2); 107 typedef R (*ptr_type)(void *self, A1, A2);
132 108
133private: 109 template<class K, R (K::*method)(A1, A2)>
134 110 void set (K *object)
135 void *self;
136 ptr_type func;
137
138protected:
139
140 template<typename method>
141 struct thunktype;
142
143 template<class klass>
144 struct thunktype<R (klass::*)>
145 { 111 {
146 typedef klass K; 112 self = object;
113 func = thunk<K, method>;
147 }; 114 }
115
116 R call (A1 a1, A2 a2) const
117 {
118 return func (self, a1, a2);
119 }
120
121 R operator ()(A1 a1, A2 a2) const
122 {
123 return call (a1, a2);
124 }
125
126private:
127
128 void *self;
129 ptr_type func;
148 130
149 template<class klass, R (klass::*method)(A1, A2)> 131 template<class klass, R (klass::*method)(A1, A2)>
150 static R thunk (void *self, A1 a1, A2 a2) 132 static R thunk (void *self, A1 a1, A2 a2)
151 { 133 {
152 klass *obj = static_cast<klass *>(self); 134 klass *obj = static_cast<klass *>(self);
153 return (obj->*method) (a1, a2); 135 return (obj->*method) (a1, a2);
154 } 136 }
155
156public:
157 template<class K, R (K::*method)(A1, A2)>
158 void set (K *object)
159 {
160 self = object;
161 func = thunk<K, method>;
162 }
163
164 R call (A1 a1, A2 a2) const
165 {
166 return func (self, a1, a2);
167 }
168
169 R operator ()(A1 a1, A2 a2) const
170 {
171 return call (a1, a2);
172 }
173}; 137};
174 138
175template<class R, class A1, class A2, class A3> 139template<class R, class A1, class A2, class A3>
176struct callback<R (A1, A2, A3)> 140struct callback<R (A1, A2, A3)>
177{ 141{
178 typedef R (*ptr_type)(void *self, A1, A2, A3); 142 typedef R (*ptr_type)(void *self, A1, A2, A3);
179 143
180private: 144 template<class K, R (K::*method)(A1, A2, A3)>
181 145 void set (K *object)
182 void *self;
183 ptr_type func;
184
185protected:
186
187 template<typename method>
188 struct thunktype;
189
190 template<class klass>
191 struct thunktype<R (klass::*)>
192 { 146 {
193 typedef klass K; 147 self = object;
148 func = thunk<K, method>;
194 }; 149 }
150
151 R call (A1 a1, A2 a2, A3 a3) const
152 {
153 return func (self, a1, a2, a3);
154 }
155
156 R operator ()(A1 a1, A2 a2, A3 a3) const
157 {
158 return call (a1, a2, a3);
159 }
160
161private:
162
163 void *self;
164 ptr_type func;
195 165
196 template<class klass, R (klass::*method)(A1, A2, A3)> 166 template<class klass, R (klass::*method)(A1, A2, A3)>
197 static R thunk (void *self, A1 a1, A2 a2, A3 a3) 167 static R thunk (void *self, A1 a1, A2 a2, A3 a3)
198 { 168 {
199 klass *obj = static_cast<klass *>(self); 169 klass *obj = static_cast<klass *>(self);
200 return (obj->*method) (a1, a2, a3); 170 return (obj->*method) (a1, a2, a3);
201 } 171 }
202
203public:
204 template<class K, R (K::*method)(A1, A2, A3)>
205 void set (K *object)
206 {
207 self = object;
208 func = thunk<K, method>;
209 }
210
211 R call (A1 a1, A2 a2, A3 a3) const
212 {
213 return func (self, a1, a2, a3);
214 }
215
216 R operator ()(A1 a1, A2 a2, A3 a3) const
217 {
218 return call (a1, a2, a3);
219 }
220}; 172};
221 173
222template<class R, class A1, class A2, class A3, class A4> 174template<class R, class A1, class A2, class A3, class A4>
223struct callback<R (A1, A2, A3, A4)> 175struct callback<R (A1, A2, A3, A4)>
224{ 176{
225 typedef R (*ptr_type)(void *self, A1, A2, A3, A4); 177 typedef R (*ptr_type)(void *self, A1, A2, A3, A4);
226 178
227private: 179 template<class K, R (K::*method)(A1, A2, A3, A4)>
228 180 void set (K *object)
229 void *self;
230 ptr_type func;
231
232protected:
233
234 template<typename method>
235 struct thunktype;
236
237 template<class klass>
238 struct thunktype<R (klass::*)>
239 { 181 {
240 typedef klass K; 182 self = object;
183 func = thunk<K, method>;
241 }; 184 }
185
186 R call (A1 a1, A2 a2, A3 a3, A4 a4) const
187 {
188 return func (self, a1, a2, a3, a4);
189 }
190
191 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4) const
192 {
193 return call (a1, a2, a3, a4);
194 }
195
196private:
197
198 void *self;
199 ptr_type func;
242 200
243 template<class klass, R (klass::*method)(A1, A2, A3, A4)> 201 template<class klass, R (klass::*method)(A1, A2, A3, A4)>
244 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4) 202 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4)
245 { 203 {
246 klass *obj = static_cast<klass *>(self); 204 klass *obj = static_cast<klass *>(self);
247 return (obj->*method) (a1, a2, a3, a4); 205 return (obj->*method) (a1, a2, a3, a4);
248 } 206 }
249
250public:
251 template<class K, R (K::*method)(A1, A2, A3, A4)>
252 void set (K *object)
253 {
254 self = object;
255 func = thunk<K, method>;
256 }
257
258 R call (A1 a1, A2 a2, A3 a3, A4 a4) const
259 {
260 return func (self, a1, a2, a3, a4);
261 }
262
263 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4) const
264 {
265 return call (a1, a2, a3, a4);
266 }
267}; 207};
268 208
269template<class R, class A1, class A2, class A3, class A4, class A5> 209template<class R, class A1, class A2, class A3, class A4, class A5>
270struct callback<R (A1, A2, A3, A4, A5)> 210struct callback<R (A1, A2, A3, A4, A5)>
271{ 211{
272 typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5); 212 typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5);
273 213
274private: 214 template<class K, R (K::*method)(A1, A2, A3, A4, A5)>
275 215 void set (K *object)
276 void *self;
277 ptr_type func;
278
279protected:
280
281 template<typename method>
282 struct thunktype;
283
284 template<class klass>
285 struct thunktype<R (klass::*)>
286 { 216 {
287 typedef klass K; 217 self = object;
218 func = thunk<K, method>;
288 }; 219 }
220
221 R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
222 {
223 return func (self, a1, a2, a3, a4, a5);
224 }
225
226 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
227 {
228 return call (a1, a2, a3, a4, a5);
229 }
230
231private:
232
233 void *self;
234 ptr_type func;
289 235
290 template<class klass, R (klass::*method)(A1, A2, A3, A4, A5)> 236 template<class klass, R (klass::*method)(A1, A2, A3, A4, A5)>
291 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) 237 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
292 { 238 {
293 klass *obj = static_cast<klass *>(self); 239 klass *obj = static_cast<klass *>(self);
294 return (obj->*method) (a1, a2, a3, a4, a5); 240 return (obj->*method) (a1, a2, a3, a4, a5);
295 } 241 }
296
297public:
298 template<class K, R (K::*method)(A1, A2, A3, A4, A5)>
299 void set (K *object)
300 {
301 self = object;
302 func = thunk<K, method>;
303 }
304
305 R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
306 {
307 return func (self, a1, a2, a3, a4, a5);
308 }
309
310 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
311 {
312 return call (a1, a2, a3, a4, a5);
313 }
314}; 242};
315 243
316template<class R, class A1, class A2, class A3, class A4, class A5, class A6> 244template<class R, class A1, class A2, class A3, class A4, class A5, class A6>
317struct callback<R (A1, A2, A3, A4, A5, A6)> 245struct callback<R (A1, A2, A3, A4, A5, A6)>
318{ 246{
319 typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6); 247 typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6);
320 248
321private: 249 template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6)>
322 250 void set (K *object)
323 void *self;
324 ptr_type func;
325
326protected:
327
328 template<typename method>
329 struct thunktype;
330
331 template<class klass>
332 struct thunktype<R (klass::*)>
333 { 251 {
334 typedef klass K; 252 self = object;
253 func = thunk<K, method>;
335 }; 254 }
255
256 R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
257 {
258 return func (self, a1, a2, a3, a4, a5, a6);
259 }
260
261 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
262 {
263 return call (a1, a2, a3, a4, a5, a6);
264 }
265
266private:
267
268 void *self;
269 ptr_type func;
336 270
337 template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6)> 271 template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6)>
338 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) 272 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
339 { 273 {
340 klass *obj = static_cast<klass *>(self); 274 klass *obj = static_cast<klass *>(self);
341 return (obj->*method) (a1, a2, a3, a4, a5, a6); 275 return (obj->*method) (a1, a2, a3, a4, a5, a6);
342 } 276 }
343
344public:
345 template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6)>
346 void set (K *object)
347 {
348 self = object;
349 func = thunk<K, method>;
350 }
351
352 R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
353 {
354 return func (self, a1, a2, a3, a4, a5, a6);
355 }
356
357 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
358 {
359 return call (a1, a2, a3, a4, a5, a6);
360 }
361}; 277};
362 278
363template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7> 279template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
364struct callback<R (A1, A2, A3, A4, A5, A6, A7)> 280struct callback<R (A1, A2, A3, A4, A5, A6, A7)>
365{ 281{
366 typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7); 282 typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7);
367 283
368private: 284 template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6, A7)>
369 285 void set (K *object)
370 void *self;
371 ptr_type func;
372
373protected:
374
375 template<typename method>
376 struct thunktype;
377
378 template<class klass>
379 struct thunktype<R (klass::*)>
380 { 286 {
381 typedef klass K; 287 self = object;
288 func = thunk<K, method>;
382 }; 289 }
290
291 R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
292 {
293 return func (self, a1, a2, a3, a4, a5, a6, a7);
294 }
295
296 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
297 {
298 return call (a1, a2, a3, a4, a5, a6, a7);
299 }
300
301private:
302
303 void *self;
304 ptr_type func;
383 305
384 template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6, A7)> 306 template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6, A7)>
385 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) 307 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
386 { 308 {
387 klass *obj = static_cast<klass *>(self); 309 klass *obj = static_cast<klass *>(self);
388 return (obj->*method) (a1, a2, a3, a4, a5, a6, a7); 310 return (obj->*method) (a1, a2, a3, a4, a5, a6, a7);
389 } 311 }
390
391public:
392 template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6, A7)>
393 void set (K *object)
394 {
395 self = object;
396 func = thunk<K, method>;
397 }
398
399 R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
400 {
401 return func (self, a1, a2, a3, a4, a5, a6, a7);
402 }
403
404 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
405 {
406 return call (a1, a2, a3, a4, a5, a6, a7);
407 }
408}; 312};
409 313
410template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> 314template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
411struct callback<R (A1, A2, A3, A4, A5, A6, A7, A8)> 315struct callback<R (A1, A2, A3, A4, A5, A6, A7, A8)>
412{ 316{
413 typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8); 317 typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8);
414 318
415private: 319 template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6, A7, A8)>
416 320 void set (K *object)
417 void *self;
418 ptr_type func;
419
420protected:
421
422 template<typename method>
423 struct thunktype;
424
425 template<class klass>
426 struct thunktype<R (klass::*)>
427 { 321 {
428 typedef klass K; 322 self = object;
323 func = thunk<K, method>;
429 }; 324 }
325
326 R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
327 {
328 return func (self, a1, a2, a3, a4, a5, a6, a7, a8);
329 }
330
331 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
332 {
333 return call (a1, a2, a3, a4, a5, a6, a7, a8);
334 }
335
336private:
337
338 void *self;
339 ptr_type func;
430 340
431 template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6, A7, A8)> 341 template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6, A7, A8)>
432 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) 342 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
433 { 343 {
434 klass *obj = static_cast<klass *>(self); 344 klass *obj = static_cast<klass *>(self);
435 return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8); 345 return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8);
436 } 346 }
437
438public:
439 template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6, A7, A8)>
440 void set (K *object)
441 {
442 self = object;
443 func = thunk<K, method>;
444 }
445
446 R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
447 {
448 return func (self, a1, a2, a3, a4, a5, a6, a7, a8);
449 }
450
451 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
452 {
453 return call (a1, a2, a3, a4, a5, a6, a7, a8);
454 }
455}; 347};
456 348
457template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> 349template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
458struct callback<R (A1, A2, A3, A4, A5, A6, A7, A8, A9)> 350struct callback<R (A1, A2, A3, A4, A5, A6, A7, A8, A9)>
459{ 351{
460 typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8, A9); 352 typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8, A9);
461 353
462private: 354 template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
463 355 void set (K *object)
464 void *self;
465 ptr_type func;
466
467protected:
468
469 template<typename method>
470 struct thunktype;
471
472 template<class klass>
473 struct thunktype<R (klass::*)>
474 { 356 {
475 typedef klass K; 357 self = object;
358 func = thunk<K, method>;
476 }; 359 }
360
361 R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) const
362 {
363 return func (self, a1, a2, a3, a4, a5, a6, a7, a8, a9);
364 }
365
366 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) const
367 {
368 return call (a1, a2, a3, a4, a5, a6, a7, a8, a9);
369 }
370
371private:
372
373 void *self;
374 ptr_type func;
477 375
478 template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9)> 376 template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
479 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) 377 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
480 { 378 {
481 klass *obj = static_cast<klass *>(self); 379 klass *obj = static_cast<klass *>(self);
482 return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8, a9); 380 return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8, a9);
483 } 381 }
484
485public:
486 template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
487 void set (K *object)
488 {
489 self = object;
490 func = thunk<K, method>;
491 }
492
493 R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) const
494 {
495 return func (self, a1, a2, a3, a4, a5, a6, a7, a8, a9);
496 }
497
498 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) const
499 {
500 return call (a1, a2, a3, a4, a5, a6, a7, a8, a9);
501 }
502}; 382};
503 383
504template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10> 384template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10>
505struct callback<R (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> 385struct callback<R (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
506{ 386{
507 typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); 387 typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
508 388
509private: 389 template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
510 390 void set (K *object)
511 void *self;
512 ptr_type func;
513
514protected:
515
516 template<typename method>
517 struct thunktype;
518
519 template<class klass>
520 struct thunktype<R (klass::*)>
521 { 391 {
522 typedef klass K; 392 self = object;
393 func = thunk<K, method>;
523 }; 394 }
395
396 R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) const
397 {
398 return func (self, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
399 }
400
401 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) const
402 {
403 return call (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
404 }
405
406private:
407
408 void *self;
409 ptr_type func;
524 410
525 template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> 411 template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
526 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) 412 static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10)
527 { 413 {
528 klass *obj = static_cast<klass *>(self); 414 klass *obj = static_cast<klass *>(self);
529 return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); 415 return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
530 } 416 }
531
532public:
533 template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
534 void set (K *object)
535 {
536 self = object;
537 func = thunk<K, method>;
538 }
539
540 R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) const
541 {
542 return func (self, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
543 }
544
545 R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) const
546 {
547 return call (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
548 }
549}; 417};
550 418
551 419
552#endif 420#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines