diff options
Diffstat (limited to 'googlemock/include/gmock/gmock-generated-actions.h.pump')
-rw-r--r-- | googlemock/include/gmock/gmock-generated-actions.h.pump | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/googlemock/include/gmock/gmock-generated-actions.h.pump b/googlemock/include/gmock/gmock-generated-actions.h.pump index 27c96efc..1e9549f3 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h.pump +++ b/googlemock/include/gmock/gmock-generated-actions.h.pump @@ -52,76 +52,6 @@ $$}} This meta comment fixes auto-indentation in editors. namespace testing { namespace internal { -// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary -// function, method, or callback with the unpacked values, where F is -// a function type that takes N arguments. -template <typename Result, typename ArgumentTuple> -class InvokeHelper; - - -$var max_callback_arity = 5 -$range i 0..n -$for i [[ -$range j 1..i -$var types = [[$for j [[, typename A$j]]]] -$var as = [[$for j, [[A$j]]]] -$var args = [[$if i==0 [[]] $else [[ args]]]] -$var gets = [[$for j, [[std::get<$(j - 1)>(args)]]]] -template <typename R$types> -class InvokeHelper<R, ::std::tuple<$as> > { - public: - template <typename Function> - static R Invoke(Function function, const ::std::tuple<$as>&$args) { - return function($gets); - } - - template <class Class, typename MethodPtr> - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::std::tuple<$as>&$args) { - return (obj_ptr->*method_ptr)($gets); - } - - -$if i <= max_callback_arity [[ - template <typename CallbackType> - static R InvokeCallback(CallbackType* callback, - const ::std::tuple<$as>&$args) { - return callback->Run($gets); - } -]] $else [[ - // There is no InvokeCallback() for $i-tuples -]] - -}; - - -]] -// Implements the Invoke(callback) action. -template <typename CallbackType> -class InvokeCallbackAction { - public: - // The c'tor takes ownership of the callback. - explicit InvokeCallbackAction(CallbackType* callback) - : callback_(callback) { - callback->CheckIsRepeatable(); // Makes sure the callback is permanent. - } - - // This type conversion operator template allows Invoke(callback) to - // be used wherever the callback's type is compatible with that of - // the mock function, i.e. if the mock function's arguments can be - // implicitly converted to the callback's arguments and the - // callback's result can be implicitly converted to the mock - // function's result. - template <typename Result, typename ArgumentTuple> - Result Perform(const ArgumentTuple& args) const { - return InvokeHelper<Result, ArgumentTuple>::InvokeCallback( - callback_.get(), args); - } - private: - const std::shared_ptr<CallbackType> callback_; -}; - // A macro from the ACTION* family (defined later in this file) // defines an action that can be used in a mock function. Typically, // these actions only care about a subset of the arguments of the mock |