Lines Matching refs:Action
51 // To implement an action Foo, define:
53 // 2. a factory function that creates an Action object from a
58 // management as Action objects can now be copied like plain values.
77 "Default action undefined for the function return type.");
122 // There's no need for a default action for signed wchar_t, as that
125 // There's also no need for a default action for unsigned wchar_t, as
250 // Implement this interface to define an action for function type F.
260 // Performs the action. This method is not const, as in general an
261 // action can have side effects and be stateful. For example, a
262 // get-the-next-element-from-the-collection action will need to
270 // An Action<F> is a copyable and IMMUTABLE (except by assignment)
271 // object that represents an action to be taken when a mock function
272 // of type F is called. The implementation of Action<T> is just a
274 // Don't inherit from Action!
277 // concrete action (including its current state), and an Action<F>
280 class Action {
285 // Constructs a null Action. Needed for storing Action objects in
287 Action() : impl_(NULL) {}
289 // Constructs an Action from its implementation. A NULL impl is
290 // used to represent the "do-default" action.
291 explicit Action(ActionInterface<F>* impl) : impl_(impl) {}
294 Action(const Action& action) : impl_(action.impl_) {}
296 // This constructor allows us to turn an Action<Func> object into an
297 // Action<F>, as long as F's arguments can be implicitly converted
301 explicit Action(const Action<Func>& action);
303 // Returns true iff this is the DoDefault() action.
306 // Performs the action. Note that this method is const even though
308 // is that a const Action<F> means that it cannot be re-bound to
309 // another concrete action, not that the concrete action it binds to
315 "You are using DoDefault() inside a composite action like "
317 "reasons. Please instead spell out the default action, or "
318 "assign the default action to an Action variable and use "
331 // polymorphic action (i.e. an action that can be used in mock
334 // To define a polymorphic action, a user first provides a COPYABLE
347 // Then the user creates the polymorphic action using
357 operator Action<F>() const {
358 return Action<F>(new MonomorphicImpl<F>(impl_));
385 // Creates an Action from its implementation and returns it. The
386 // created Action object owns the implementation.
388 Action<F> MakeAction(ActionInterface<F>* impl) {
389 return Action<F>(impl);
392 // Creates a polymorphic action from its implementation. This is
406 // Allows an Action<F2> object to pose as an Action<F1>, as long as F2
414 explicit ActionAdaptor(const Action<F2>& from) : impl_(from.impl_) {}
426 // Implements the polymorphic Return(x) action, which can be used in
431 // Function<F>::Result when this action is cast to Action<F> rather than
432 // when that action is performed. This is important in scenarios like
447 // statement, and conversion of the result of Return to Action<T(U)> is a
461 operator Action<F>() const {
474 return Action<F>(new Impl<F>(value_));
478 // Implements the Return(x) action for a particular function type F.
510 // Implements the ReturnNull() action.
522 // Implements the Return() action.
532 // Implements the polymorphic ReturnRef(x) action, which can be used
544 operator Action<F>() const {
551 return Action<F>(new Impl<F>(ref_));
555 // Implements the ReturnRef(x) action for a particular function type F.
579 // Implements the polymorphic ReturnRefOfCopy(x) action, which can be
592 operator Action<F>() const {
600 return Action<F>(new Impl<F>(value_));
604 // Implements the ReturnRefOfCopy(x) action for a particular function type F.
628 // Implements the polymorphic DoDefault() action.
634 operator Action<F>() const { return Action<F>(NULL); }
637 // Implements the Assign action to set a given pointer referent to a
658 // Implements the SetErrnoAndReturn action to simulate return from
681 // Implements the SetArgumentPointee<N>(x) action for any function
688 // Constructs an action that sets the variable pointed to by the
707 // Constructs an action that sets the variable pointed to by the
727 // Implements the InvokeWithoutArgs(f) action. The template argument
730 // Action<F> as long as f's type is compatible with F (i.e. f can be
740 // Allows InvokeWithoutArgs(f) to be used as any action whose type is
751 // Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action.
770 // Implements the IgnoreResult(action) action.
774 explicit IgnoreResultAction(const A& action) : action_(action) {}
777 operator Action<F>() const {
791 return Action<F>(new Impl<F>(action_));
801 explicit Impl(const A& action) : action_(action) {}
804 // Performs the action and ignores its result.
814 const Action<OriginalFunction> action_;
829 // InvokeArgument<N>(...) action. The idea was from "reference
852 // a2, ...) action.
862 operator Action<F>() const {
863 return Action<F>(new Impl<F>(action1_, action2_));
867 // Implements the DoAll(...) action for a particular function type F.
875 Impl(const Action<VoidResult>& action1, const Action<F>& action2)
884 const Action<VoidResult> action1_;
885 const Action<F> action2_;
930 // This constructor allows us to turn an Action<From> object into an
931 // Action<To>, as long as To's arguments can be implicitly converted
936 Action<To>::Action(const Action<From>& from)
939 // Creates an action that returns 'value'. 'value' is passed by value
947 // Creates an action that returns NULL.
952 // Creates an action that returns from a void function.
957 // Creates an action that returns the reference to a variable.
963 // Creates an action that returns the reference to a copy of the
964 // argument. The copy is created when the action is constructed and
965 // lives as long as the action.
971 // Creates an action that does the default action for the give mock function.
976 // Creates an action that sets the variable pointed by the N-th
1018 // Creates an action that sets a pointer referent to a given value.
1026 // Creates an action that sets errno and returns the appropriate error.
1038 // Creates an action that invokes 'function_impl' with no argument.
1046 // Creates an action that invokes the given method on the given object
1056 // Creates an action that performs an_action and throws away its