template <typename R, typename... Args>

class Action

Defined at line 732 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h

An Action

<R

(Args...)> is a copyable and IMMUTABLE (except by assignment)

object that represents an action to be taken when a mock function of type

R(Args...) is called. The implementation of Action

<T

> is just a

std::shared_ptr to const ActionInterface

<T

>. Don't inherit from Action! You

can view an object implementing ActionInterface

<F

> as a concrete action

(including its current state), and an Action

<F

> object as a handle to it.

Public Methods

void Action<R (Args...)> ()

Constructs a null Action. Needed for storing Action objects in

STL containers.

Defined at line 759 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h

template <typename G, typename = typename std::enable_if<internal::disjunction<
                              IsCompatibleFunctor<G>, std::is_constructible<std::function<Result()>,
                                                                            G>>::value>::type>
void Action<R (Args...)> (G && fun)

Construct an Action from a specified callable.

This cannot take std::function directly, because then Action would not be

directly constructible from lambda (it would require two conversions).

Defined at line 769 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h

void Action<R (Args...)> (ActionInterface<F> * impl)

Constructs an Action from its implementation.

Defined at line 774 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h

template <typename Func>
void Action<R (Args...)> (const Action<Func> & action)

This constructor allows us to turn an Action

<Func

> object into an

Action

<F

>, as long as F's arguments can be implicitly converted

to Func's and Func's return type can be implicitly converted to F's.

Defined at line 781 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h

bool IsDoDefault ()

Returns true if and only if this is the DoDefault() action.

Defined at line 785 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h

Result Perform (ArgumentTuple args)

Performs the action. Note that this method is const even though

the corresponding method in ActionInterface is not. The reason

is that a const Action

<F

> means that it cannot be re-bound to

another concrete action, not that the concrete action it binds to

cannot change state. (Think of the difference between a const

pointer and a pointer to const.)

Defined at line 793 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h

OnceAction<F> operator testing::OnceAction<type-parameter-0-0 (type-parameter-0-1...)> ()

An action can be used as a OnceAction, since it's obviously safe to call it

once.

Defined at line 802 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h

Records

Friends

template <typename G>
class Action