OLD | NEW |
1 #ifndef GOOGLE_PROTOBUF_STUBS_CALLBACK_H_ | 1 #ifndef GOOGLE_PROTOBUF_STUBS_CALLBACK_H_ |
2 #define GOOGLE_PROTOBUF_STUBS_CALLBACK_H_ | 2 #define GOOGLE_PROTOBUF_STUBS_CALLBACK_H_ |
3 | 3 |
4 #include <google/protobuf/stubs/macros.h> | 4 #include <google/protobuf/stubs/macros.h> |
5 #include <google/protobuf/stubs/type_traits.h> | 5 #include <google/protobuf/stubs/type_traits.h> |
6 | 6 |
7 // =================================================================== | 7 // =================================================================== |
8 // emulates google3/base/callback.h | 8 // emulates google3/base/callback.h |
9 | 9 |
10 namespace google { | 10 namespace google { |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 T* object_; | 374 T* object_; |
375 MethodType method_; | 375 MethodType method_; |
376 bool self_deleting_; | 376 bool self_deleting_; |
377 typename remove_reference<P1>::type p1_; | 377 typename remove_reference<P1>::type p1_; |
378 typename remove_reference<P2>::type p2_; | 378 typename remove_reference<P2>::type p2_; |
379 typename remove_reference<P3>::type p3_; | 379 typename remove_reference<P3>::type p3_; |
380 typename remove_reference<P4>::type p4_; | 380 typename remove_reference<P4>::type p4_; |
381 typename remove_reference<P5>::type p5_; | 381 typename remove_reference<P5>::type p5_; |
382 }; | 382 }; |
383 | 383 |
| 384 } // namespace internal |
| 385 |
384 // See Closure. | 386 // See Closure. |
385 inline Closure* NewCallback(void (*function)()) { | 387 inline Closure* NewCallback(void (*function)()) { |
386 return new internal::FunctionClosure0(function, true); | 388 return new internal::FunctionClosure0(function, true); |
387 } | 389 } |
388 | 390 |
389 // See Closure. | 391 // See Closure. |
390 inline Closure* NewPermanentCallback(void (*function)()) { | 392 inline Closure* NewPermanentCallback(void (*function)()) { |
391 return new internal::FunctionClosure0(function, false); | 393 return new internal::FunctionClosure0(function, false); |
392 } | 394 } |
393 | 395 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 typename internal::InternalConstRef<P1>::type p1, | 528 typename internal::InternalConstRef<P1>::type p1, |
527 typename internal::InternalConstRef<P2>::type p2, | 529 typename internal::InternalConstRef<P2>::type p2, |
528 typename internal::InternalConstRef<P3>::type p3, | 530 typename internal::InternalConstRef<P3>::type p3, |
529 typename internal::InternalConstRef<P4>::type p4, | 531 typename internal::InternalConstRef<P4>::type p4, |
530 typename internal::InternalConstRef<P5>::type p5) { | 532 typename internal::InternalConstRef<P5>::type p5) { |
531 return new internal::MethodResultCallback_5_2<R, T, P1, P2, P3, P4, P5, A1, | 533 return new internal::MethodResultCallback_5_2<R, T, P1, P2, P3, P4, P5, A1, |
532 A2>(object, function, false, p1, | 534 A2>(object, function, false, p1, |
533 p2, p3, p4, p5); | 535 p2, p3, p4, p5); |
534 } | 536 } |
535 | 537 |
536 } // namespace internal | |
537 | |
538 // A function which does nothing. Useful for creating no-op callbacks, e.g.: | 538 // A function which does nothing. Useful for creating no-op callbacks, e.g.: |
539 // Closure* nothing = NewCallback(&DoNothing); | 539 // Closure* nothing = NewCallback(&DoNothing); |
540 void LIBPROTOBUF_EXPORT DoNothing(); | 540 void LIBPROTOBUF_EXPORT DoNothing(); |
541 | 541 |
542 | 542 |
543 } // namespace protobuf | 543 } // namespace protobuf |
544 } // namespace google | 544 } // namespace google |
545 | 545 |
546 #endif // GOOGLE_PROTOBUF_STUBS_CALLBACK_H_ | 546 #endif // GOOGLE_PROTOBUF_STUBS_CALLBACK_H_ |
OLD | NEW |