gmock-generated-internal-utils.h.pump revision 13481
113481Sgiacomo.travaglini@arm.com$$ -*- mode: c++; -*- 213481Sgiacomo.travaglini@arm.com$$ This is a Pump source file. Please use Pump to convert it to 313481Sgiacomo.travaglini@arm.com$$ gmock-generated-function-mockers.h. 413481Sgiacomo.travaglini@arm.com$$ 513481Sgiacomo.travaglini@arm.com$var n = 10 $$ The maximum arity we support. 613481Sgiacomo.travaglini@arm.com// Copyright 2007, Google Inc. 713481Sgiacomo.travaglini@arm.com// All rights reserved. 813481Sgiacomo.travaglini@arm.com// 913481Sgiacomo.travaglini@arm.com// Redistribution and use in source and binary forms, with or without 1013481Sgiacomo.travaglini@arm.com// modification, are permitted provided that the following conditions are 1113481Sgiacomo.travaglini@arm.com// met: 1213481Sgiacomo.travaglini@arm.com// 1313481Sgiacomo.travaglini@arm.com// * Redistributions of source code must retain the above copyright 1413481Sgiacomo.travaglini@arm.com// notice, this list of conditions and the following disclaimer. 1513481Sgiacomo.travaglini@arm.com// * Redistributions in binary form must reproduce the above 1613481Sgiacomo.travaglini@arm.com// copyright notice, this list of conditions and the following disclaimer 1713481Sgiacomo.travaglini@arm.com// in the documentation and/or other materials provided with the 1813481Sgiacomo.travaglini@arm.com// distribution. 1913481Sgiacomo.travaglini@arm.com// * Neither the name of Google Inc. nor the names of its 2013481Sgiacomo.travaglini@arm.com// contributors may be used to endorse or promote products derived from 2113481Sgiacomo.travaglini@arm.com// this software without specific prior written permission. 2213481Sgiacomo.travaglini@arm.com// 2313481Sgiacomo.travaglini@arm.com// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2413481Sgiacomo.travaglini@arm.com// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2513481Sgiacomo.travaglini@arm.com// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 2613481Sgiacomo.travaglini@arm.com// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2713481Sgiacomo.travaglini@arm.com// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2813481Sgiacomo.travaglini@arm.com// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2913481Sgiacomo.travaglini@arm.com// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3013481Sgiacomo.travaglini@arm.com// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3113481Sgiacomo.travaglini@arm.com// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3213481Sgiacomo.travaglini@arm.com// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3313481Sgiacomo.travaglini@arm.com// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3413481Sgiacomo.travaglini@arm.com// 3513481Sgiacomo.travaglini@arm.com// Author: wan@google.com (Zhanyong Wan) 3613481Sgiacomo.travaglini@arm.com 3713481Sgiacomo.travaglini@arm.com// Google Mock - a framework for writing C++ mock classes. 3813481Sgiacomo.travaglini@arm.com// 3913481Sgiacomo.travaglini@arm.com// This file contains template meta-programming utility classes needed 4013481Sgiacomo.travaglini@arm.com// for implementing Google Mock. 4113481Sgiacomo.travaglini@arm.com 4213481Sgiacomo.travaglini@arm.com#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ 4313481Sgiacomo.travaglini@arm.com#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ 4413481Sgiacomo.travaglini@arm.com 4513481Sgiacomo.travaglini@arm.com#include "gmock/internal/gmock-port.h" 4613481Sgiacomo.travaglini@arm.com 4713481Sgiacomo.travaglini@arm.comnamespace testing { 4813481Sgiacomo.travaglini@arm.com 4913481Sgiacomo.travaglini@arm.comtemplate <typename T> 5013481Sgiacomo.travaglini@arm.comclass Matcher; 5113481Sgiacomo.travaglini@arm.com 5213481Sgiacomo.travaglini@arm.comnamespace internal { 5313481Sgiacomo.travaglini@arm.com 5413481Sgiacomo.travaglini@arm.com// An IgnoredValue object can be implicitly constructed from ANY value. 5513481Sgiacomo.travaglini@arm.com// This is used in implementing the IgnoreResult(a) action. 5613481Sgiacomo.travaglini@arm.comclass IgnoredValue { 5713481Sgiacomo.travaglini@arm.com public: 5813481Sgiacomo.travaglini@arm.com // This constructor template allows any value to be implicitly 5913481Sgiacomo.travaglini@arm.com // converted to IgnoredValue. The object has no data member and 6013481Sgiacomo.travaglini@arm.com // doesn't try to remember anything about the argument. We 6113481Sgiacomo.travaglini@arm.com // deliberately omit the 'explicit' keyword in order to allow the 6213481Sgiacomo.travaglini@arm.com // conversion to be implicit. 6313481Sgiacomo.travaglini@arm.com template <typename T> 6413481Sgiacomo.travaglini@arm.com IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit) 6513481Sgiacomo.travaglini@arm.com}; 6613481Sgiacomo.travaglini@arm.com 6713481Sgiacomo.travaglini@arm.com// MatcherTuple<T>::type is a tuple type where each field is a Matcher 6813481Sgiacomo.travaglini@arm.com// for the corresponding field in tuple type T. 6913481Sgiacomo.travaglini@arm.comtemplate <typename Tuple> 7013481Sgiacomo.travaglini@arm.comstruct MatcherTuple; 7113481Sgiacomo.travaglini@arm.com 7213481Sgiacomo.travaglini@arm.com 7313481Sgiacomo.travaglini@arm.com$range i 0..n 7413481Sgiacomo.travaglini@arm.com$for i [[ 7513481Sgiacomo.travaglini@arm.com$range j 1..i 7613481Sgiacomo.travaglini@arm.com$var typename_As = [[$for j, [[typename A$j]]]] 7713481Sgiacomo.travaglini@arm.com$var As = [[$for j, [[A$j]]]] 7813481Sgiacomo.travaglini@arm.com$var matcher_As = [[$for j, [[Matcher<A$j>]]]] 7913481Sgiacomo.travaglini@arm.comtemplate <$typename_As> 8013481Sgiacomo.travaglini@arm.comstruct MatcherTuple< ::testing::tuple<$As> > { 8113481Sgiacomo.travaglini@arm.com typedef ::testing::tuple<$matcher_As > type; 8213481Sgiacomo.travaglini@arm.com}; 8313481Sgiacomo.travaglini@arm.com 8413481Sgiacomo.travaglini@arm.com 8513481Sgiacomo.travaglini@arm.com]] 8613481Sgiacomo.travaglini@arm.com// Template struct Function<F>, where F must be a function type, contains 8713481Sgiacomo.travaglini@arm.com// the following typedefs: 8813481Sgiacomo.travaglini@arm.com// 8913481Sgiacomo.travaglini@arm.com// Result: the function's return type. 9013481Sgiacomo.travaglini@arm.com// ArgumentN: the type of the N-th argument, where N starts with 1. 9113481Sgiacomo.travaglini@arm.com// ArgumentTuple: the tuple type consisting of all parameters of F. 9213481Sgiacomo.travaglini@arm.com// ArgumentMatcherTuple: the tuple type consisting of Matchers for all 9313481Sgiacomo.travaglini@arm.com// parameters of F. 9413481Sgiacomo.travaglini@arm.com// MakeResultVoid: the function type obtained by substituting void 9513481Sgiacomo.travaglini@arm.com// for the return type of F. 9613481Sgiacomo.travaglini@arm.com// MakeResultIgnoredValue: 9713481Sgiacomo.travaglini@arm.com// the function type obtained by substituting Something 9813481Sgiacomo.travaglini@arm.com// for the return type of F. 9913481Sgiacomo.travaglini@arm.comtemplate <typename F> 10013481Sgiacomo.travaglini@arm.comstruct Function; 10113481Sgiacomo.travaglini@arm.com 10213481Sgiacomo.travaglini@arm.comtemplate <typename R> 10313481Sgiacomo.travaglini@arm.comstruct Function<R()> { 10413481Sgiacomo.travaglini@arm.com typedef R Result; 10513481Sgiacomo.travaglini@arm.com typedef ::testing::tuple<> ArgumentTuple; 10613481Sgiacomo.travaglini@arm.com typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; 10713481Sgiacomo.travaglini@arm.com typedef void MakeResultVoid(); 10813481Sgiacomo.travaglini@arm.com typedef IgnoredValue MakeResultIgnoredValue(); 10913481Sgiacomo.travaglini@arm.com}; 11013481Sgiacomo.travaglini@arm.com 11113481Sgiacomo.travaglini@arm.com 11213481Sgiacomo.travaglini@arm.com$range i 1..n 11313481Sgiacomo.travaglini@arm.com$for i [[ 11413481Sgiacomo.travaglini@arm.com$range j 1..i 11513481Sgiacomo.travaglini@arm.com$var typename_As = [[$for j [[, typename A$j]]]] 11613481Sgiacomo.travaglini@arm.com$var As = [[$for j, [[A$j]]]] 11713481Sgiacomo.travaglini@arm.com$var matcher_As = [[$for j, [[Matcher<A$j>]]]] 11813481Sgiacomo.travaglini@arm.com$range k 1..i-1 11913481Sgiacomo.travaglini@arm.com$var prev_As = [[$for k, [[A$k]]]] 12013481Sgiacomo.travaglini@arm.comtemplate <typename R$typename_As> 12113481Sgiacomo.travaglini@arm.comstruct Function<R($As)> 12213481Sgiacomo.travaglini@arm.com : Function<R($prev_As)> { 12313481Sgiacomo.travaglini@arm.com typedef A$i Argument$i; 12413481Sgiacomo.travaglini@arm.com typedef ::testing::tuple<$As> ArgumentTuple; 12513481Sgiacomo.travaglini@arm.com typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; 12613481Sgiacomo.travaglini@arm.com typedef void MakeResultVoid($As); 12713481Sgiacomo.travaglini@arm.com typedef IgnoredValue MakeResultIgnoredValue($As); 12813481Sgiacomo.travaglini@arm.com}; 12913481Sgiacomo.travaglini@arm.com 13013481Sgiacomo.travaglini@arm.com 13113481Sgiacomo.travaglini@arm.com]] 13213481Sgiacomo.travaglini@arm.com} // namespace internal 13313481Sgiacomo.travaglini@arm.com 13413481Sgiacomo.travaglini@arm.com} // namespace testing 13513481Sgiacomo.travaglini@arm.com 13613481Sgiacomo.travaglini@arm.com#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ 137