/* * Copyright (c) 2014 Eran Pe'er. * * This program is made available under the terms of the MIT License. * * Created on Mar 10, 2014 */ #pragma once #include #include #include #include #include #include #include "mockutils/Macros.hpp" #include "fakeit/Invocation.hpp" #include "mockutils/TuplePrinter.hpp" namespace fakeit { template struct ActualInvocation : public Invocation { struct Matcher : public virtual Destructible { virtual bool matches(ActualInvocation &actualInvocation) = 0; virtual std::string format() const = 0; }; ActualInvocation(unsigned int ordinal, MethodInfo &method, const arglist &... args) : Invocation(ordinal, method), _matcher{nullptr}, actualArguments{args...} { } const std::tuple &getActualArguments() const { return actualArguments; } /** * The Matcher that was use to match this ActualInvocation. */ void setActualMatcher(Matcher *matcher) { this->_matcher = matcher; } Matcher *getActualMatcher() { return _matcher; } virtual std::string format() const { std::ostringstream out; out << getMethod().name(); print(out, actualArguments); return out.str(); } private: Matcher *_matcher; std::tuple actualArguments; }; template std::ostream &operator<<(std::ostream &strm, const ActualInvocation &ai) { strm << ai.format(); return strm; } }