template <typename T>
class DefaultValue
Defined at line 577 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h
When an unexpected function call is encountered, Google Mock will
let it return a default value if the user has specified one for its
return type, or if the return type has a built-in default value;
otherwise Google Mock won't know what value to return and will have
to abort the process.
The DefaultValue
<T
> class allows a user to specify the
default value for a type T that is both copyable and publicly
destructible (i.e. anything that can be used as a function return
type). The usage is:
// Sets the default value for type T to be foo.
DefaultValue
<T
>::Set(foo);
Public Methods
void Set (T x)
Sets the default value for type T; requires T to be
copy-constructable and have a public destructor.
Defined at line 581 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h
void SetFactory (FactoryFunction factory)
Defined at line 590 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h
void Clear ()
Unsets the default value for type T.
Defined at line 596 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h
bool IsSet ()
Returns true if and only if the user has set the default value for type T.
Defined at line 602 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h
bool Exists ()
Returns true if T has a default return value set by the user or there
exists a built-in default value.
Defined at line 606 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h
T Get ()
Returns the default value for type T if the user has set one;
otherwise returns the built-in default value. Requires that Exists()
is true, which ensures that the return value is well-defined.
Defined at line 613 of file ../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h