OLD | NEW |
---|---|
1 $$ This is a pump file for generating file templates. Pump is a python | 1 $$ This is a pump file for generating file templates. Pump is a python |
2 $$ script that is part of the Google Test suite of utilities. Description | 2 $$ script that is part of the Google Test suite of utilities. Description |
3 $$ can be found here: | 3 $$ can be found here: |
4 $$ | 4 $$ |
5 $$ http://code.google.com/p/googletest/wiki/PumpManual | 5 $$ http://code.google.com/p/googletest/wiki/PumpManual |
6 $$ | 6 $$ |
7 | 7 |
8 $$ See comment for MAX_ARITY in base/bind.h.pump. | 8 $$ See comment for MAX_ARITY in base/bind.h.pump. |
9 $var MAX_ARITY = 7 | 9 $var MAX_ARITY = 7 |
10 $range ARITY 0..MAX_ARITY | 10 $range ARITY 0..MAX_ARITY |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 // from the invocation call. | 279 // from the invocation call. |
280 // | 280 // |
281 // WeakCalls similarly need special syntax that is applied to the first | 281 // WeakCalls similarly need special syntax that is applied to the first |
282 // argument to check if they should no-op themselves. | 282 // argument to check if they should no-op themselves. |
283 template <bool IsWeakCall, typename ReturnType, typename Runnable, | 283 template <bool IsWeakCall, typename ReturnType, typename Runnable, |
284 typename ArgsType> | 284 typename ArgsType> |
285 struct InvokeHelper; | 285 struct InvokeHelper; |
286 | 286 |
287 $for ARITY [[ | 287 $for ARITY [[ |
288 $range ARG 1..ARITY | 288 $range ARG 1..ARITY |
289 $range ARG2 2..ARITY | |
awong
2013/06/03 20:13:42
Can we call this ARG_FROM_2 or maybe even somethin
| |
289 | 290 |
290 template <typename ReturnType, typename Runnable[[]] | 291 template <typename ReturnType, typename Runnable[[]] |
291 $if ARITY > 0 [[,]] $for ARG , [[typename A$(ARG)]]> | 292 $if ARITY > 0 [[,]] $for ARG , [[typename A$(ARG)]]> |
292 struct InvokeHelper<false, ReturnType, Runnable, | 293 struct InvokeHelper<false, ReturnType, Runnable, |
293 void($for ARG , [[A$(ARG)]])> { | 294 void($for ARG , [[A$(ARG)]])> { |
294 static ReturnType MakeItSo(Runnable runnable[[]] | 295 static ReturnType MakeItSo(Runnable runnable[[]] |
295 $if ARITY > 0[[, ]] $for ARG , [[A$(ARG) a$(ARG)]]) { | 296 $if ARITY > 0[[, ]] $for ARG , [[A$(ARG) a$(ARG)]]) { |
296 return runnable.Run($for ARG , [[CallbackForward(a$(ARG))]]); | 297 return runnable.Run($for ARG , [[CallbackForward(a$(ARG))]]); |
297 } | 298 } |
298 }; | 299 }; |
299 | 300 |
300 template <typename Runnable[[]] | 301 template <typename Runnable[[]] |
301 $if ARITY > 0 [[,]] $for ARG , [[typename A$(ARG)]]> | 302 $if ARITY > 0 [[,]] $for ARG , [[typename A$(ARG)]]> |
302 struct InvokeHelper<false, void, Runnable, | 303 struct InvokeHelper<false, void, Runnable, |
303 void($for ARG , [[A$(ARG)]])> { | 304 void($for ARG , [[A$(ARG)]])> { |
304 static void MakeItSo(Runnable runnable[[]] | 305 static void MakeItSo(Runnable runnable[[]] |
305 $if ARITY > 0[[, ]] $for ARG , [[A$(ARG) a$(ARG)]]) { | 306 $if ARITY > 0[[, ]] $for ARG , [[A$(ARG) a$(ARG)]]) { |
306 runnable.Run($for ARG , [[CallbackForward(a$(ARG))]]); | 307 runnable.Run($for ARG , [[CallbackForward(a$(ARG))]]); |
307 } | 308 } |
308 }; | 309 }; |
309 | 310 |
310 $if ARITY > 0 [[ | 311 $if ARITY > 0 [[ |
311 | 312 |
312 template <typename Runnable[[]], $for ARG , [[typename A$(ARG)]]> | 313 template <typename Runnable[[]], $for ARG , [[typename A$(ARG)]]> |
313 struct InvokeHelper<true, void, Runnable, | 314 struct InvokeHelper<true, void, Runnable, |
314 void($for ARG , [[A$(ARG)]])> { | 315 void($for ARG , [[A$(ARG)]])> { |
awong
2013/06/03 20:13:42
If we're going to go with ARG2, for this invocatio
| |
315 static void MakeItSo(Runnable runnable[[]] | 316 static void MakeItSo(Runnable runnable[[]] |
316 $if ARITY > 0[[, ]] $for ARG , [[A$(ARG) a$(ARG)]]) { | 317 $if ARITY > 0[[, ]] $for ARG , [[A$(ARG) a$(ARG)]]) { |
317 if (!a1.get()) { | 318 if (!a1.get()) { |
318 return; | 319 return; |
319 } | 320 } |
320 | 321 |
321 runnable.Run($for ARG , [[CallbackForward(a$(ARG))]]); | 322 $if ARITY > 1 [[ |
323 runnable.Run(a1.get(), $for ARG2 , [[CallbackForward(a$(ARG2))]]); | |
324 | |
325 ]] $else [[ | |
326 runnable.Run(a1.get()); | |
327 | |
328 ]] | |
322 } | 329 } |
323 }; | 330 }; |
324 | 331 |
325 ]] | 332 ]] |
326 | 333 |
327 ]] $$ for ARITY | 334 ]] $$ for ARITY |
328 | 335 |
329 #if !defined(_MSC_VER) | 336 #if !defined(_MSC_VER) |
330 | 337 |
331 template <typename ReturnType, typename Runnable, typename ArgsType> | 338 template <typename ReturnType, typename Runnable, typename ArgsType> |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 | 495 |
489 ]] | 496 ]] |
490 }; | 497 }; |
491 | 498 |
492 ]] $$ for ARITY | 499 ]] $$ for ARITY |
493 | 500 |
494 } // namespace internal | 501 } // namespace internal |
495 } // namespace base | 502 } // namespace base |
496 | 503 |
497 #endif // BASE_BIND_INTERNAL_H_ | 504 #endif // BASE_BIND_INTERNAL_H_ |
OLD | NEW |