From c901f67ddf8aab44443f1be3efe864cb3daa95af Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 9 Jan 2020 11:59:39 -0500 Subject: Googletest export Move part of functionality of Action* class to the base one. Reduce copypaste. Make constructor and conversion operator of Action* class independent of pump. PiperOrigin-RevId: 288907005 --- googlemock/include/gmock/gmock-actions.h | 37 ++++ googlemock/include/gmock/gmock-generated-actions.h | 235 +++++---------------- .../include/gmock/gmock-generated-actions.h.pump | 8 +- 3 files changed, 94 insertions(+), 186 deletions(-) (limited to 'googlemock') diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index 11223cf2..a7b84d1b 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -1222,6 +1222,43 @@ class ActionHelper { } }; +// A helper base class needed for implementing the ACTION* macros. +// Implements constructor and conversion operator for Action. +// +// Template specialization for parameterless Action. +template +class ActionImpl { + public: + ActionImpl() = default; + + template + operator ::testing::Action() const { // NOLINT(runtime/explicit) + return ::testing::Action(new typename Derived::template gmock_Impl()); + } +}; + +// Template specialization for parameterized Action. +template