mimic++ v9.2.1
Loading...
Searching...
No Matches
CallReport.hpp
Go to the documentation of this file.
1// Copyright Dominic (DNKpp) Koepke 2024 - 2025.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// https://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef MIMICPP_REPORTING_CALL_REPORT_HPP
7#define MIMICPP_REPORTING_CALL_REPORT_HPP
8
9#pragma once
10
11#include "mimic++/Call.hpp"
12#include "mimic++/Fwd.hpp"
19
20#ifndef MIMICPP_DETAIL_IS_MODULE
21 #include <tuple>
22 #include <utility>
23 #include <vector>
24#endif
25
27{
38
43 {
44 public:
45 class Arg
46 {
47 public:
50
51 [[nodiscard]]
52 friend bool operator==(const Arg&, const Arg&) = default;
53 };
54
57 std::vector<Arg> argDetails{};
62
63 [[nodiscard]]
64 friend bool operator==(CallReport const&, CallReport const&) = default;
65 };
66
77 template <typename Return, typename... Params>
78 [[nodiscard]]
80 {
81 return CallReport{
82 .target{std::move(target)},
83 .returnTypeInfo{TypeReport::make<Return>()},
84 .argDetails = std::apply(
85 [](auto&... args) {
86 return std::vector<CallReport::Arg>{
88 .typeInfo = TypeReport::make<Params>(),
89 .stateString = mimicpp::print(args.get())}
90 ...
91 };
92 },
93 callInfo.args),
94 .fromLoc{std::move(callInfo.fromSourceLocation)},
95 .stacktrace{std::move(stacktrace)},
96 .fromCategory{callInfo.fromCategory},
97 .fromConstness{callInfo.fromConstness}};
98 }
99
103}
104
105#endif
#define MIMICPP_DETAIL_MODULE_EXPORT
Definition Config.hpp:19
Definition Call.hpp:27
ValueCategory fromCategory
Definition Call.hpp:32
util::SourceLocation fromSourceLocation
Definition Call.hpp:34
ArgListT args
Definition Call.hpp:31
Constness fromConstness
Definition Call.hpp:33
Definition CallReport.hpp:46
friend bool operator==(const Arg &, const Arg &)=default
StringT stateString
Definition CallReport.hpp:49
TypeReport typeInfo
Definition CallReport.hpp:48
Contains the extracted info from a typed call::Info.
Definition CallReport.hpp:43
TargetReport target
Definition CallReport.hpp:55
util::Stacktrace stacktrace
Definition CallReport.hpp:59
friend bool operator==(CallReport const &, CallReport const &)=default
std::vector< Arg > argDetails
Definition CallReport.hpp:57
Constness fromConstness
Definition CallReport.hpp:61
TypeReport returnTypeInfo
Definition CallReport.hpp:56
ValueCategory fromCategory
Definition CallReport.hpp:60
util::SourceLocation fromLoc
Definition CallReport.hpp:58
Contains the extracted mock info.
Definition TargetReport.hpp:22
Contains information about a specific (potentially cv-ref-qualified) type.
Definition TypeReport.hpp:25
static constexpr TypeReport make() noexcept
Definition TypeReport.hpp:39
A thin wrapper around general source-location info.
Definition SourceLocation.hpp:38
A simple type-erased stacktrace abstraction.
Definition Stacktrace.hpp:196
constexpr printing::PrintFn print
Functional object, converting the given object to its textual representation.
Definition Print.hpp:183
CallReport make_call_report(TargetReport target, call::Info< Return, Params... > callInfo, util::Stacktrace stacktrace)
Generates the call report for a given call info.
Definition CallReport.hpp:79
Definition BasicReporter.hpp:27
ValueCategory
Definition Fwd.hpp:34
Constness
Definition Fwd.hpp:27
std::basic_string< CharT, CharTraitsT > StringT
Definition Fwd.hpp:391