Class ActualCall¶
Defined in File ActualCall.hpp
Class Documentation¶
-
class ActualCall¶
[source] Abstract interface for reporting an actual call and its parameters.
Each method returns
*thisso that parameter reporting can be chained. Concrete implementations are created internally by Support.Public Types
-
using FunctionPointerReturnValue = void (*)()¶
Function pointer return type alias for readability.
Public Functions
-
inline virtual ActualCall &with_name(StringView)¶
Report the function name for this call (used internally).
- Returns:
*this.
-
inline virtual ActualCall &with_call_order(unsigned int)¶
Set the call order index for strict-ordering checks.
- Returns:
*this.
-
template<typename T>
inline ActualCall &with_parameter(StringView name, T value)¶ Report a parameter of any supported type.
The template creates a NamedValue and passes it to the single with_typed_parameter() virtual method. Overload resolution for NamedValue::set_value() selects the correct storage type.
- Template Parameters:
T – Parameter type (deduced).
- Parameters:
name – Parameter name, must match the expectation.
value – Parameter value.
- Returns:
*this for chaining.
-
inline ActualCall &with_parameter(StringView name, const unsigned char *value, size_t size)¶
Report a memory buffer parameter.
- Parameters:
name – Parameter name.
value – Pointer to the buffer.
size – Buffer size in bytes.
- Returns:
*this for chaining.
-
virtual ActualCall &with_typed_parameter(NamedValue parameter) = 0¶
Type-erased virtual entry point for parameter reporting.
All non-virtual with_parameter() overloads delegate here after constructing a NamedValue. Subclasses override this single method instead of one method per type.
- Parameters:
parameter – Named, typed parameter value.
- Returns:
*this for chaining.
-
virtual ActualCall &with_parameter_of_type(StringView type_name, StringView name, const void *value) = 0¶
Report an object parameter identified by a type name string.
The mock framework uses the installed NamedValueComparator for
type_nameto compare against the expectation.- Parameters:
type_name – Type name, must match the one used in the expectation.
name – Parameter name.
value – Const pointer to the object.
- Returns:
*this for chaining.
-
virtual ActualCall &with_output_parameter(StringView name, void *output) = 0¶
Report an output parameter by name.
The framework copies the value configured in the expectation into
output(using the installed copier if the type is non-native).- Parameters:
name – Parameter name.
output – Pointer to the caller’s output buffer.
- Returns:
*this for chaining.
-
virtual ActualCall &with_output_parameter_of_type(StringView type_name, StringView name, void *output) = 0¶
Report an output parameter with a custom object type.
- Parameters:
type_name – Type name; must match the copier installed via Support::install_copier().
name – Parameter name.
output – Pointer to the caller’s output buffer.
- Returns:
*this for chaining.
-
virtual bool has_return_value() = 0¶
[source] - Returns:
true if the matching expectation set a return value.
-
virtual NamedValue return_value() = 0¶
[source] - Returns:
The configured return value as a generic NamedValue.
-
template<typename T>
inline T return_value()¶ Type-safe return-value accessor template.
Returns the mock return value converted to
T. Because fixed-width types from<stdint.h>are typedefs for fundamental types, writingautomatically dispatches to the correct getter on every platform.return_value<int32_t>()
- Template Parameters:
T – The type to retrieve.
- Returns:
The stored return value converted to
T.
-
template<typename T>
inline T return_value_or_default(T default_value)¶ Type-safe return-value accessor with a fallback default.
- Template Parameters:
T – The type to retrieve.
- Parameters:
default_value – Value returned when no return value was configured.
- Returns:
The stored return value or
default_value.
-
virtual ActualCall &on_object(const void *object_ptr) = 0¶
Restrict this actual call to a specific object instance.
Matches only the expectation set with the same
object_ptrvia ExpectedCall::on_object().- Parameters:
object_ptr – Pointer to the object on which the method was called.
- Returns:
*this for chaining.
-
using FunctionPointerReturnValue = void (*)()¶