/* * 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/Destructible.hpp" #include "mockutils/type_utils.hpp" #include "fakeit/argument_matchers.hpp" namespace fakeit { template class MatchersCollector { std::vector &_matchers; public: // Fetch the Nth type from arglist... template using ArgType = typename std::tuple_element>::type; template using NakedArgType = typename naked_type>::type; template using ArgMatcherCreatorType = decltype(std::declval>>()); MatchersCollector(std::vector &matchers) : _matchers(matchers) { } void CollectMatchers() { } template typename std::enable_if< // std::is_constructible, Head>::value, void> // ::type CollectMatchers(const Head &value) { TypedMatcher> *d = Eq>(value).createMatcher(); _matchers.push_back(d); } template typename std::enable_if< // std::is_constructible, Head>::value // , void> // ::type CollectMatchers(const Head &head, const Tail &... tail) { CollectMatchers(head); MatchersCollector c(_matchers); c.CollectMatchers(tail...); } template typename std::enable_if< // std::is_base_of>, Head>::value, void> // ::type CollectMatchers(const Head &creator) { TypedMatcher> *d = creator.createMatcher(); _matchers.push_back(d); } template // typename std::enable_if< // std::is_base_of>, Head>::value, void> // ::type CollectMatchers(const Head &head, const Tail &... tail) { CollectMatchers(head); MatchersCollector c(_matchers); c.CollectMatchers(tail...); } template typename std::enable_if::value, void> // ::type CollectMatchers(const Head &) { TypedMatcher> *d = Any>().createMatcher(); _matchers.push_back(d); } template typename std::enable_if< // std::is_same::value, void> // ::type CollectMatchers(const Head &head, const Tail &... tail) { CollectMatchers(head); MatchersCollector c(_matchers); c.CollectMatchers(tail...); } }; }