Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-07 08:19:50

0001 // This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
0002 
0003 // Copyright 2007, Google Inc.
0004 // All rights reserved.
0005 //
0006 // Redistribution and use in source and binary forms, with or without
0007 // modification, are permitted provided that the following conditions are
0008 // met:
0009 //
0010 //     * Redistributions of source code must retain the above copyright
0011 // notice, this list of conditions and the following disclaimer.
0012 //     * Redistributions in binary form must reproduce the above
0013 // copyright notice, this list of conditions and the following disclaimer
0014 // in the documentation and/or other materials provided with the
0015 // distribution.
0016 //     * Neither the name of Google Inc. nor the names of its
0017 // contributors may be used to endorse or promote products derived from
0018 // this software without specific prior written permission.
0019 //
0020 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0021 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0022 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0023 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0024 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0025 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0026 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0027 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0028 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0029 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0030 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0031 //
0032 // Author: wan@google.com (Zhanyong Wan)
0033 
0034 // Google Mock - a framework for writing C++ mock classes.
0035 //
0036 // This file implements some commonly used variadic actions.
0037 
0038 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
0039 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
0040 
0041 #include "gmock/gmock-actions.h"
0042 #include "gmock/internal/gmock-port.h"
0043 
0044 namespace testing {
0045 namespace internal {
0046 
0047 // InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
0048 // function or method with the unpacked values, where F is a function
0049 // type that takes N arguments.
0050 template <typename Result, typename ArgumentTuple>
0051 class InvokeHelper;
0052 
0053 template <typename R>
0054 class InvokeHelper<R, ::testing::tuple<> > {
0055  public:
0056   template <typename Function>
0057   static R Invoke(Function function, const ::testing::tuple<>&) {
0058            return function();
0059   }
0060 
0061   template <class Class, typename MethodPtr>
0062   static R InvokeMethod(Class* obj_ptr,
0063                         MethodPtr method_ptr,
0064                         const ::testing::tuple<>&) {
0065            return (obj_ptr->*method_ptr)();
0066   }
0067 };
0068 
0069 template <typename R, typename A1>
0070 class InvokeHelper<R, ::testing::tuple<A1> > {
0071  public:
0072   template <typename Function>
0073   static R Invoke(Function function, const ::testing::tuple<A1>& args) {
0074            return function(get<0>(args));
0075   }
0076 
0077   template <class Class, typename MethodPtr>
0078   static R InvokeMethod(Class* obj_ptr,
0079                         MethodPtr method_ptr,
0080                         const ::testing::tuple<A1>& args) {
0081            return (obj_ptr->*method_ptr)(get<0>(args));
0082   }
0083 };
0084 
0085 template <typename R, typename A1, typename A2>
0086 class InvokeHelper<R, ::testing::tuple<A1, A2> > {
0087  public:
0088   template <typename Function>
0089   static R Invoke(Function function, const ::testing::tuple<A1, A2>& args) {
0090            return function(get<0>(args), get<1>(args));
0091   }
0092 
0093   template <class Class, typename MethodPtr>
0094   static R InvokeMethod(Class* obj_ptr,
0095                         MethodPtr method_ptr,
0096                         const ::testing::tuple<A1, A2>& args) {
0097            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
0098   }
0099 };
0100 
0101 template <typename R, typename A1, typename A2, typename A3>
0102 class InvokeHelper<R, ::testing::tuple<A1, A2, A3> > {
0103  public:
0104   template <typename Function>
0105   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3>& args) {
0106            return function(get<0>(args), get<1>(args), get<2>(args));
0107   }
0108 
0109   template <class Class, typename MethodPtr>
0110   static R InvokeMethod(Class* obj_ptr,
0111                         MethodPtr method_ptr,
0112                         const ::testing::tuple<A1, A2, A3>& args) {
0113            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
0114                get<2>(args));
0115   }
0116 };
0117 
0118 template <typename R, typename A1, typename A2, typename A3, typename A4>
0119 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4> > {
0120  public:
0121   template <typename Function>
0122   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3,
0123       A4>& args) {
0124            return function(get<0>(args), get<1>(args), get<2>(args),
0125                get<3>(args));
0126   }
0127 
0128   template <class Class, typename MethodPtr>
0129   static R InvokeMethod(Class* obj_ptr,
0130                         MethodPtr method_ptr,
0131                         const ::testing::tuple<A1, A2, A3, A4>& args) {
0132            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
0133                get<2>(args), get<3>(args));
0134   }
0135 };
0136 
0137 template <typename R, typename A1, typename A2, typename A3, typename A4,
0138     typename A5>
0139 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5> > {
0140  public:
0141   template <typename Function>
0142   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4,
0143       A5>& args) {
0144            return function(get<0>(args), get<1>(args), get<2>(args),
0145                get<3>(args), get<4>(args));
0146   }
0147 
0148   template <class Class, typename MethodPtr>
0149   static R InvokeMethod(Class* obj_ptr,
0150                         MethodPtr method_ptr,
0151                         const ::testing::tuple<A1, A2, A3, A4, A5>& args) {
0152            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
0153                get<2>(args), get<3>(args), get<4>(args));
0154   }
0155 };
0156 
0157 template <typename R, typename A1, typename A2, typename A3, typename A4,
0158     typename A5, typename A6>
0159 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
0160  public:
0161   template <typename Function>
0162   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
0163       A6>& args) {
0164            return function(get<0>(args), get<1>(args), get<2>(args),
0165                get<3>(args), get<4>(args), get<5>(args));
0166   }
0167 
0168   template <class Class, typename MethodPtr>
0169   static R InvokeMethod(Class* obj_ptr,
0170                         MethodPtr method_ptr,
0171                         const ::testing::tuple<A1, A2, A3, A4, A5, A6>& args) {
0172            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
0173                get<2>(args), get<3>(args), get<4>(args), get<5>(args));
0174   }
0175 };
0176 
0177 template <typename R, typename A1, typename A2, typename A3, typename A4,
0178     typename A5, typename A6, typename A7>
0179 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
0180  public:
0181   template <typename Function>
0182   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
0183       A6, A7>& args) {
0184            return function(get<0>(args), get<1>(args), get<2>(args),
0185                get<3>(args), get<4>(args), get<5>(args), get<6>(args));
0186   }
0187 
0188   template <class Class, typename MethodPtr>
0189   static R InvokeMethod(Class* obj_ptr,
0190                         MethodPtr method_ptr,
0191                         const ::testing::tuple<A1, A2, A3, A4, A5, A6,
0192                             A7>& args) {
0193            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
0194                get<2>(args), get<3>(args), get<4>(args), get<5>(args),
0195                get<6>(args));
0196   }
0197 };
0198 
0199 template <typename R, typename A1, typename A2, typename A3, typename A4,
0200     typename A5, typename A6, typename A7, typename A8>
0201 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
0202  public:
0203   template <typename Function>
0204   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
0205       A6, A7, A8>& args) {
0206            return function(get<0>(args), get<1>(args), get<2>(args),
0207                get<3>(args), get<4>(args), get<5>(args), get<6>(args),
0208                get<7>(args));
0209   }
0210 
0211   template <class Class, typename MethodPtr>
0212   static R InvokeMethod(Class* obj_ptr,
0213                         MethodPtr method_ptr,
0214                         const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7,
0215                             A8>& args) {
0216            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
0217                get<2>(args), get<3>(args), get<4>(args), get<5>(args),
0218                get<6>(args), get<7>(args));
0219   }
0220 };
0221 
0222 template <typename R, typename A1, typename A2, typename A3, typename A4,
0223     typename A5, typename A6, typename A7, typename A8, typename A9>
0224 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
0225  public:
0226   template <typename Function>
0227   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
0228       A6, A7, A8, A9>& args) {
0229            return function(get<0>(args), get<1>(args), get<2>(args),
0230                get<3>(args), get<4>(args), get<5>(args), get<6>(args),
0231                get<7>(args), get<8>(args));
0232   }
0233 
0234   template <class Class, typename MethodPtr>
0235   static R InvokeMethod(Class* obj_ptr,
0236                         MethodPtr method_ptr,
0237                         const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
0238                             A9>& args) {
0239            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
0240                get<2>(args), get<3>(args), get<4>(args), get<5>(args),
0241                get<6>(args), get<7>(args), get<8>(args));
0242   }
0243 };
0244 
0245 template <typename R, typename A1, typename A2, typename A3, typename A4,
0246     typename A5, typename A6, typename A7, typename A8, typename A9,
0247     typename A10>
0248 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
0249     A10> > {
0250  public:
0251   template <typename Function>
0252   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
0253       A6, A7, A8, A9, A10>& args) {
0254            return function(get<0>(args), get<1>(args), get<2>(args),
0255                get<3>(args), get<4>(args), get<5>(args), get<6>(args),
0256                get<7>(args), get<8>(args), get<9>(args));
0257   }
0258 
0259   template <class Class, typename MethodPtr>
0260   static R InvokeMethod(Class* obj_ptr,
0261                         MethodPtr method_ptr,
0262                         const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
0263                             A9, A10>& args) {
0264            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
0265                get<2>(args), get<3>(args), get<4>(args), get<5>(args),
0266                get<6>(args), get<7>(args), get<8>(args), get<9>(args));
0267   }
0268 };
0269 
0270 // An INTERNAL macro for extracting the type of a tuple field.  It's
0271 // subject to change without notice - DO NOT USE IN USER CODE!
0272 #define GMOCK_FIELD_(Tuple, N) \
0273     typename ::testing::tuple_element<N, Tuple>::type
0274 
0275 // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
0276 // type of an n-ary function whose i-th (1-based) argument type is the
0277 // k{i}-th (0-based) field of ArgumentTuple, which must be a tuple
0278 // type, and whose return type is Result.  For example,
0279 //   SelectArgs<int, ::testing::tuple<bool, char, double, long>, 0, 3>::type
0280 // is int(bool, long).
0281 //
0282 // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
0283 // returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
0284 // For example,
0285 //   SelectArgs<int, tuple<bool, char, double>, 2, 0>::Select(
0286 //       ::testing::make_tuple(true, 'a', 2.5))
0287 // returns tuple (2.5, true).
0288 //
0289 // The numbers in list k1, k2, ..., k_n must be >= 0, where n can be
0290 // in the range [0, 10].  Duplicates are allowed and they don't have
0291 // to be in an ascending or descending order.
0292 
0293 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
0294     int k4, int k5, int k6, int k7, int k8, int k9, int k10>
0295 class SelectArgs {
0296  public:
0297   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
0298       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
0299       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
0300       GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
0301       GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9),
0302       GMOCK_FIELD_(ArgumentTuple, k10));
0303   typedef typename Function<type>::ArgumentTuple SelectedArgs;
0304   static SelectedArgs Select(const ArgumentTuple& args) {
0305     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
0306         get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
0307         get<k8>(args), get<k9>(args), get<k10>(args));
0308   }
0309 };
0310 
0311 template <typename Result, typename ArgumentTuple>
0312 class SelectArgs<Result, ArgumentTuple,
0313                  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
0314  public:
0315   typedef Result type();
0316   typedef typename Function<type>::ArgumentTuple SelectedArgs;
0317   static SelectedArgs Select(const ArgumentTuple& /* args */) {
0318     return SelectedArgs();
0319   }
0320 };
0321 
0322 template <typename Result, typename ArgumentTuple, int k1>
0323 class SelectArgs<Result, ArgumentTuple,
0324                  k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
0325  public:
0326   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1));
0327   typedef typename Function<type>::ArgumentTuple SelectedArgs;
0328   static SelectedArgs Select(const ArgumentTuple& args) {
0329     return SelectedArgs(get<k1>(args));
0330   }
0331 };
0332 
0333 template <typename Result, typename ArgumentTuple, int k1, int k2>
0334 class SelectArgs<Result, ArgumentTuple,
0335                  k1, k2, -1, -1, -1, -1, -1, -1, -1, -1> {
0336  public:
0337   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
0338       GMOCK_FIELD_(ArgumentTuple, k2));
0339   typedef typename Function<type>::ArgumentTuple SelectedArgs;
0340   static SelectedArgs Select(const ArgumentTuple& args) {
0341     return SelectedArgs(get<k1>(args), get<k2>(args));
0342   }
0343 };
0344 
0345 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3>
0346 class SelectArgs<Result, ArgumentTuple,
0347                  k1, k2, k3, -1, -1, -1, -1, -1, -1, -1> {
0348  public:
0349   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
0350       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3));
0351   typedef typename Function<type>::ArgumentTuple SelectedArgs;
0352   static SelectedArgs Select(const ArgumentTuple& args) {
0353     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args));
0354   }
0355 };
0356 
0357 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
0358     int k4>
0359 class SelectArgs<Result, ArgumentTuple,
0360                  k1, k2, k3, k4, -1, -1, -1, -1, -1, -1> {
0361  public:
0362   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
0363       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
0364       GMOCK_FIELD_(ArgumentTuple, k4));
0365   typedef typename Function<type>::ArgumentTuple SelectedArgs;
0366   static SelectedArgs Select(const ArgumentTuple& args) {
0367     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
0368         get<k4>(args));
0369   }
0370 };
0371 
0372 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
0373     int k4, int k5>
0374 class SelectArgs<Result, ArgumentTuple,
0375                  k1, k2, k3, k4, k5, -1, -1, -1, -1, -1> {
0376  public:
0377   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
0378       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
0379       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5));
0380   typedef typename Function<type>::ArgumentTuple SelectedArgs;
0381   static SelectedArgs Select(const ArgumentTuple& args) {
0382     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
0383         get<k4>(args), get<k5>(args));
0384   }
0385 };
0386 
0387 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
0388     int k4, int k5, int k6>
0389 class SelectArgs<Result, ArgumentTuple,
0390                  k1, k2, k3, k4, k5, k6, -1, -1, -1, -1> {
0391  public:
0392   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
0393       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
0394       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
0395       GMOCK_FIELD_(ArgumentTuple, k6));
0396   typedef typename Function<type>::ArgumentTuple SelectedArgs;
0397   static SelectedArgs Select(const ArgumentTuple& args) {
0398     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
0399         get<k4>(args), get<k5>(args), get<k6>(args));
0400   }
0401 };
0402 
0403 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
0404     int k4, int k5, int k6, int k7>
0405 class SelectArgs<Result, ArgumentTuple,
0406                  k1, k2, k3, k4, k5, k6, k7, -1, -1, -1> {
0407  public:
0408   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
0409       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
0410       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
0411       GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7));
0412   typedef typename Function<type>::ArgumentTuple SelectedArgs;
0413   static SelectedArgs Select(const ArgumentTuple& args) {
0414     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
0415         get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args));
0416   }
0417 };
0418 
0419 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
0420     int k4, int k5, int k6, int k7, int k8>
0421 class SelectArgs<Result, ArgumentTuple,
0422                  k1, k2, k3, k4, k5, k6, k7, k8, -1, -1> {
0423  public:
0424   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
0425       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
0426       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
0427       GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
0428       GMOCK_FIELD_(ArgumentTuple, k8));
0429   typedef typename Function<type>::ArgumentTuple SelectedArgs;
0430   static SelectedArgs Select(const ArgumentTuple& args) {
0431     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
0432         get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
0433         get<k8>(args));
0434   }
0435 };
0436 
0437 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
0438     int k4, int k5, int k6, int k7, int k8, int k9>
0439 class SelectArgs<Result, ArgumentTuple,
0440                  k1, k2, k3, k4, k5, k6, k7, k8, k9, -1> {
0441  public:
0442   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
0443       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
0444       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
0445       GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
0446       GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9));
0447   typedef typename Function<type>::ArgumentTuple SelectedArgs;
0448   static SelectedArgs Select(const ArgumentTuple& args) {
0449     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
0450         get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
0451         get<k8>(args), get<k9>(args));
0452   }
0453 };
0454 
0455 #undef GMOCK_FIELD_
0456 
0457 // Implements the WithArgs action.
0458 template <typename InnerAction, int k1 = -1, int k2 = -1, int k3 = -1,
0459     int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
0460     int k9 = -1, int k10 = -1>
0461 class WithArgsAction {
0462  public:
0463   explicit WithArgsAction(const InnerAction& action) : action_(action) {}
0464 
0465   template <typename F>
0466   operator Action<F>() const { return MakeAction(new Impl<F>(action_)); }
0467 
0468  private:
0469   template <typename F>
0470   class Impl : public ActionInterface<F> {
0471    public:
0472     typedef typename Function<F>::Result Result;
0473     typedef typename Function<F>::ArgumentTuple ArgumentTuple;
0474 
0475     explicit Impl(const InnerAction& action) : action_(action) {}
0476 
0477     virtual Result Perform(const ArgumentTuple& args) {
0478       return action_.Perform(SelectArgs<Result, ArgumentTuple, k1, k2, k3, k4,
0479           k5, k6, k7, k8, k9, k10>::Select(args));
0480     }
0481 
0482    private:
0483     typedef typename SelectArgs<Result, ArgumentTuple,
0484         k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType;
0485 
0486     Action<InnerFunctionType> action_;
0487   };
0488 
0489   const InnerAction action_;
0490 
0491   GTEST_DISALLOW_ASSIGN_(WithArgsAction);
0492 };
0493 
0494 // A macro from the ACTION* family (defined later in this file)
0495 // defines an action that can be used in a mock function.  Typically,
0496 // these actions only care about a subset of the arguments of the mock
0497 // function.  For example, if such an action only uses the second
0498 // argument, it can be used in any mock function that takes >= 2
0499 // arguments where the type of the second argument is compatible.
0500 //
0501 // Therefore, the action implementation must be prepared to take more
0502 // arguments than it needs.  The ExcessiveArg type is used to
0503 // represent those excessive arguments.  In order to keep the compiler
0504 // error messages tractable, we define it in the testing namespace
0505 // instead of testing::internal.  However, this is an INTERNAL TYPE
0506 // and subject to change without notice, so a user MUST NOT USE THIS
0507 // TYPE DIRECTLY.
0508 struct ExcessiveArg {};
0509 
0510 // A helper class needed for implementing the ACTION* macros.
0511 template <typename Result, class Impl>
0512 class ActionHelper {
0513  public:
0514   static Result Perform(Impl* impl, const ::testing::tuple<>& args) {
0515     return impl->template gmock_PerformImpl<>(args, ExcessiveArg(),
0516         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
0517         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
0518         ExcessiveArg());
0519   }
0520 
0521   template <typename A0>
0522   static Result Perform(Impl* impl, const ::testing::tuple<A0>& args) {
0523     return impl->template gmock_PerformImpl<A0>(args, get<0>(args),
0524         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
0525         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
0526         ExcessiveArg());
0527   }
0528 
0529   template <typename A0, typename A1>
0530   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1>& args) {
0531     return impl->template gmock_PerformImpl<A0, A1>(args, get<0>(args),
0532         get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
0533         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
0534         ExcessiveArg());
0535   }
0536 
0537   template <typename A0, typename A1, typename A2>
0538   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2>& args) {
0539     return impl->template gmock_PerformImpl<A0, A1, A2>(args, get<0>(args),
0540         get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(),
0541         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
0542         ExcessiveArg());
0543   }
0544 
0545   template <typename A0, typename A1, typename A2, typename A3>
0546   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2,
0547       A3>& args) {
0548     return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, get<0>(args),
0549         get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(),
0550         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
0551         ExcessiveArg());
0552   }
0553 
0554   template <typename A0, typename A1, typename A2, typename A3, typename A4>
0555   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3,
0556       A4>& args) {
0557     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args,
0558         get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
0559         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
0560         ExcessiveArg());
0561   }
0562 
0563   template <typename A0, typename A1, typename A2, typename A3, typename A4,
0564       typename A5>
0565   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
0566       A5>& args) {
0567     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args,
0568         get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
0569         get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
0570         ExcessiveArg());
0571   }
0572 
0573   template <typename A0, typename A1, typename A2, typename A3, typename A4,
0574       typename A5, typename A6>
0575   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
0576       A5, A6>& args) {
0577     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args,
0578         get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
0579         get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(),
0580         ExcessiveArg());
0581   }
0582 
0583   template <typename A0, typename A1, typename A2, typename A3, typename A4,
0584       typename A5, typename A6, typename A7>
0585   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
0586       A5, A6, A7>& args) {
0587     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6,
0588         A7>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
0589         get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(),
0590         ExcessiveArg());
0591   }
0592 
0593   template <typename A0, typename A1, typename A2, typename A3, typename A4,
0594       typename A5, typename A6, typename A7, typename A8>
0595   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
0596       A5, A6, A7, A8>& args) {
0597     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7,
0598         A8>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
0599         get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
0600         ExcessiveArg());
0601   }
0602 
0603   template <typename A0, typename A1, typename A2, typename A3, typename A4,
0604       typename A5, typename A6, typename A7, typename A8, typename A9>
0605   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
0606       A5, A6, A7, A8, A9>& args) {
0607     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8,
0608         A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
0609         get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
0610         get<9>(args));
0611   }
0612 };
0613 
0614 }  // namespace internal
0615 
0616 // Various overloads for Invoke().
0617 
0618 // WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes
0619 // the selected arguments of the mock function to an_action and
0620 // performs it.  It serves as an adaptor between actions with
0621 // different argument lists.  C++ doesn't support default arguments for
0622 // function templates, so we have to overload it.
0623 template <int k1, typename InnerAction>
0624 inline internal::WithArgsAction<InnerAction, k1>
0625 WithArgs(const InnerAction& action) {
0626   return internal::WithArgsAction<InnerAction, k1>(action);
0627 }
0628 
0629 template <int k1, int k2, typename InnerAction>
0630 inline internal::WithArgsAction<InnerAction, k1, k2>
0631 WithArgs(const InnerAction& action) {
0632   return internal::WithArgsAction<InnerAction, k1, k2>(action);
0633 }
0634 
0635 template <int k1, int k2, int k3, typename InnerAction>
0636 inline internal::WithArgsAction<InnerAction, k1, k2, k3>
0637 WithArgs(const InnerAction& action) {
0638   return internal::WithArgsAction<InnerAction, k1, k2, k3>(action);
0639 }
0640 
0641 template <int k1, int k2, int k3, int k4, typename InnerAction>
0642 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4>
0643 WithArgs(const InnerAction& action) {
0644   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4>(action);
0645 }
0646 
0647 template <int k1, int k2, int k3, int k4, int k5, typename InnerAction>
0648 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>
0649 WithArgs(const InnerAction& action) {
0650   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>(action);
0651 }
0652 
0653 template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerAction>
0654 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>
0655 WithArgs(const InnerAction& action) {
0656   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>(action);
0657 }
0658 
0659 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
0660     typename InnerAction>
0661 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7>
0662 WithArgs(const InnerAction& action) {
0663   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6,
0664       k7>(action);
0665 }
0666 
0667 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
0668     typename InnerAction>
0669 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8>
0670 WithArgs(const InnerAction& action) {
0671   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7,
0672       k8>(action);
0673 }
0674 
0675 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
0676     int k9, typename InnerAction>
0677 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, k9>
0678 WithArgs(const InnerAction& action) {
0679   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
0680       k9>(action);
0681 }
0682 
0683 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
0684     int k9, int k10, typename InnerAction>
0685 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
0686     k9, k10>
0687 WithArgs(const InnerAction& action) {
0688   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
0689       k9, k10>(action);
0690 }
0691 
0692 // Creates an action that does actions a1, a2, ..., sequentially in
0693 // each invocation.
0694 template <typename Action1, typename Action2>
0695 inline internal::DoBothAction<Action1, Action2>
0696 DoAll(Action1 a1, Action2 a2) {
0697   return internal::DoBothAction<Action1, Action2>(a1, a2);
0698 }
0699 
0700 template <typename Action1, typename Action2, typename Action3>
0701 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
0702     Action3> >
0703 DoAll(Action1 a1, Action2 a2, Action3 a3) {
0704   return DoAll(a1, DoAll(a2, a3));
0705 }
0706 
0707 template <typename Action1, typename Action2, typename Action3,
0708     typename Action4>
0709 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
0710     internal::DoBothAction<Action3, Action4> > >
0711 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) {
0712   return DoAll(a1, DoAll(a2, a3, a4));
0713 }
0714 
0715 template <typename Action1, typename Action2, typename Action3,
0716     typename Action4, typename Action5>
0717 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
0718     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
0719     Action5> > > >
0720 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) {
0721   return DoAll(a1, DoAll(a2, a3, a4, a5));
0722 }
0723 
0724 template <typename Action1, typename Action2, typename Action3,
0725     typename Action4, typename Action5, typename Action6>
0726 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
0727     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
0728     internal::DoBothAction<Action5, Action6> > > > >
0729 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) {
0730   return DoAll(a1, DoAll(a2, a3, a4, a5, a6));
0731 }
0732 
0733 template <typename Action1, typename Action2, typename Action3,
0734     typename Action4, typename Action5, typename Action6, typename Action7>
0735 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
0736     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
0737     internal::DoBothAction<Action5, internal::DoBothAction<Action6,
0738     Action7> > > > > >
0739 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
0740     Action7 a7) {
0741   return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7));
0742 }
0743 
0744 template <typename Action1, typename Action2, typename Action3,
0745     typename Action4, typename Action5, typename Action6, typename Action7,
0746     typename Action8>
0747 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
0748     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
0749     internal::DoBothAction<Action5, internal::DoBothAction<Action6,
0750     internal::DoBothAction<Action7, Action8> > > > > > >
0751 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
0752     Action7 a7, Action8 a8) {
0753   return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8));
0754 }
0755 
0756 template <typename Action1, typename Action2, typename Action3,
0757     typename Action4, typename Action5, typename Action6, typename Action7,
0758     typename Action8, typename Action9>
0759 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
0760     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
0761     internal::DoBothAction<Action5, internal::DoBothAction<Action6,
0762     internal::DoBothAction<Action7, internal::DoBothAction<Action8,
0763     Action9> > > > > > > >
0764 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
0765     Action7 a7, Action8 a8, Action9 a9) {
0766   return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9));
0767 }
0768 
0769 template <typename Action1, typename Action2, typename Action3,
0770     typename Action4, typename Action5, typename Action6, typename Action7,
0771     typename Action8, typename Action9, typename Action10>
0772 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
0773     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
0774     internal::DoBothAction<Action5, internal::DoBothAction<Action6,
0775     internal::DoBothAction<Action7, internal::DoBothAction<Action8,
0776     internal::DoBothAction<Action9, Action10> > > > > > > > >
0777 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
0778     Action7 a7, Action8 a8, Action9 a9, Action10 a10) {
0779   return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10));
0780 }
0781 
0782 }  // namespace testing
0783 
0784 // The ACTION* family of macros can be used in a namespace scope to
0785 // define custom actions easily.  The syntax:
0786 //
0787 //   ACTION(name) { statements; }
0788 //
0789 // will define an action with the given name that executes the
0790 // statements.  The value returned by the statements will be used as
0791 // the return value of the action.  Inside the statements, you can
0792 // refer to the K-th (0-based) argument of the mock function by
0793 // 'argK', and refer to its type by 'argK_type'.  For example:
0794 //
0795 //   ACTION(IncrementArg1) {
0796 //     arg1_type temp = arg1;
0797 //     return ++(*temp);
0798 //   }
0799 //
0800 // allows you to write
0801 //
0802 //   ...WillOnce(IncrementArg1());
0803 //
0804 // You can also refer to the entire argument tuple and its type by
0805 // 'args' and 'args_type', and refer to the mock function type and its
0806 // return type by 'function_type' and 'return_type'.
0807 //
0808 // Note that you don't need to specify the types of the mock function
0809 // arguments.  However rest assured that your code is still type-safe:
0810 // you'll get a compiler error if *arg1 doesn't support the ++
0811 // operator, or if the type of ++(*arg1) isn't compatible with the
0812 // mock function's return type, for example.
0813 //
0814 // Sometimes you'll want to parameterize the action.   For that you can use
0815 // another macro:
0816 //
0817 //   ACTION_P(name, param_name) { statements; }
0818 //
0819 // For example:
0820 //
0821 //   ACTION_P(Add, n) { return arg0 + n; }
0822 //
0823 // will allow you to write:
0824 //
0825 //   ...WillOnce(Add(5));
0826 //
0827 // Note that you don't need to provide the type of the parameter
0828 // either.  If you need to reference the type of a parameter named
0829 // 'foo', you can write 'foo_type'.  For example, in the body of
0830 // ACTION_P(Add, n) above, you can write 'n_type' to refer to the type
0831 // of 'n'.
0832 //
0833 // We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support
0834 // multi-parameter actions.
0835 //
0836 // For the purpose of typing, you can view
0837 //
0838 //   ACTION_Pk(Foo, p1, ..., pk) { ... }
0839 //
0840 // as shorthand for
0841 //
0842 //   template <typename p1_type, ..., typename pk_type>
0843 //   FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
0844 //
0845 // In particular, you can provide the template type arguments
0846 // explicitly when invoking Foo(), as in Foo<long, bool>(5, false);
0847 // although usually you can rely on the compiler to infer the types
0848 // for you automatically.  You can assign the result of expression
0849 // Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ...,
0850 // pk_type>.  This can be useful when composing actions.
0851 //
0852 // You can also overload actions with different numbers of parameters:
0853 //
0854 //   ACTION_P(Plus, a) { ... }
0855 //   ACTION_P2(Plus, a, b) { ... }
0856 //
0857 // While it's tempting to always use the ACTION* macros when defining
0858 // a new action, you should also consider implementing ActionInterface
0859 // or using MakePolymorphicAction() instead, especially if you need to
0860 // use the action a lot.  While these approaches require more work,
0861 // they give you more control on the types of the mock function
0862 // arguments and the action parameters, which in general leads to
0863 // better compiler error messages that pay off in the long run.  They
0864 // also allow overloading actions based on parameter types (as opposed
0865 // to just based on the number of parameters).
0866 //
0867 // CAVEAT:
0868 //
0869 // ACTION*() can only be used in a namespace scope.  The reason is
0870 // that C++ doesn't yet allow function-local types to be used to
0871 // instantiate templates.  The up-coming C++0x standard will fix this.
0872 // Once that's done, we'll consider supporting using ACTION*() inside
0873 // a function.
0874 //
0875 // MORE INFORMATION:
0876 //
0877 // To learn more about using these macros, please search for 'ACTION'
0878 // on http://code.google.com/p/googlemock/wiki/CookBook.
0879 
0880 // An internal macro needed for implementing ACTION*().
0881 #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\
0882     const args_type& args GTEST_ATTRIBUTE_UNUSED_, \
0883     arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_, \
0884     arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_, \
0885     arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_, \
0886     arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_, \
0887     arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_, \
0888     arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_, \
0889     arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_, \
0890     arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_, \
0891     arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_, \
0892     arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_
0893 
0894 // Sometimes you want to give an action explicit template parameters
0895 // that cannot be inferred from its value parameters.  ACTION() and
0896 // ACTION_P*() don't support that.  ACTION_TEMPLATE() remedies that
0897 // and can be viewed as an extension to ACTION() and ACTION_P*().
0898 //
0899 // The syntax:
0900 //
0901 //   ACTION_TEMPLATE(ActionName,
0902 //                   HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m),
0903 //                   AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; }
0904 //
0905 // defines an action template that takes m explicit template
0906 // parameters and n value parameters.  name_i is the name of the i-th
0907 // template parameter, and kind_i specifies whether it's a typename,
0908 // an integral constant, or a template.  p_i is the name of the i-th
0909 // value parameter.
0910 //
0911 // Example:
0912 //
0913 //   // DuplicateArg<k, T>(output) converts the k-th argument of the mock
0914 //   // function to type T and copies it to *output.
0915 //   ACTION_TEMPLATE(DuplicateArg,
0916 //                   HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
0917 //                   AND_1_VALUE_PARAMS(output)) {
0918 //     *output = T(::testing::get<k>(args));
0919 //   }
0920 //   ...
0921 //     int n;
0922 //     EXPECT_CALL(mock, Foo(_, _))
0923 //         .WillOnce(DuplicateArg<1, unsigned char>(&n));
0924 //
0925 // To create an instance of an action template, write:
0926 //
0927 //   ActionName<t1, ..., t_m>(v1, ..., v_n)
0928 //
0929 // where the ts are the template arguments and the vs are the value
0930 // arguments.  The value argument types are inferred by the compiler.
0931 // If you want to explicitly specify the value argument types, you can
0932 // provide additional template arguments:
0933 //
0934 //   ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n)
0935 //
0936 // where u_i is the desired type of v_i.
0937 //
0938 // ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the
0939 // number of value parameters, but not on the number of template
0940 // parameters.  Without the restriction, the meaning of the following
0941 // is unclear:
0942 //
0943 //   OverloadedAction<int, bool>(x);
0944 //
0945 // Are we using a single-template-parameter action where 'bool' refers
0946 // to the type of x, or are we using a two-template-parameter action
0947 // where the compiler is asked to infer the type of x?
0948 //
0949 // Implementation notes:
0950 //
0951 // GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and
0952 // GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for
0953 // implementing ACTION_TEMPLATE.  The main trick we use is to create
0954 // new macro invocations when expanding a macro.  For example, we have
0955 //
0956 //   #define ACTION_TEMPLATE(name, template_params, value_params)
0957 //       ... GMOCK_INTERNAL_DECL_##template_params ...
0958 //
0959 // which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...)
0960 // to expand to
0961 //
0962 //       ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ...
0963 //
0964 // Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the
0965 // preprocessor will continue to expand it to
0966 //
0967 //       ... typename T ...
0968 //
0969 // This technique conforms to the C++ standard and is portable.  It
0970 // allows us to implement action templates using O(N) code, where N is
0971 // the maximum number of template/value parameters supported.  Without
0972 // using it, we'd have to devote O(N^2) amount of code to implement all
0973 // combinations of m and n.
0974 
0975 // Declares the template parameters.
0976 #define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0
0977 #define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
0978     name1) kind0 name0, kind1 name1
0979 #define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
0980     kind2, name2) kind0 name0, kind1 name1, kind2 name2
0981 #define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
0982     kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \
0983     kind3 name3
0984 #define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
0985     kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \
0986     kind2 name2, kind3 name3, kind4 name4
0987 #define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
0988     kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \
0989     kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5
0990 #define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
0991     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
0992     name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \
0993     kind5 name5, kind6 name6
0994 #define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
0995     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
0996     kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \
0997     kind4 name4, kind5 name5, kind6 name6, kind7 name7
0998 #define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
0999     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
1000     kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \
1001     kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \
1002     kind8 name8
1003 #define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
1004     name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
1005     name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \
1006     kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \
1007     kind6 name6, kind7 name7, kind8 name8, kind9 name9
1008 
1009 // Lists the template parameters.
1010 #define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0
1011 #define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
1012     name1) name0, name1
1013 #define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1014     kind2, name2) name0, name1, name2
1015 #define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1016     kind2, name2, kind3, name3) name0, name1, name2, name3
1017 #define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1018     kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \
1019     name4
1020 #define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1021     kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \
1022     name2, name3, name4, name5
1023 #define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1024     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
1025     name6) name0, name1, name2, name3, name4, name5, name6
1026 #define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1027     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
1028     kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7
1029 #define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1030     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
1031     kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \
1032     name6, name7, name8
1033 #define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
1034     name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
1035     name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \
1036     name3, name4, name5, name6, name7, name8, name9
1037 
1038 // Declares the types of value parameters.
1039 #define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS()
1040 #define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type
1041 #define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \
1042     typename p0##_type, typename p1##_type
1043 #define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \
1044     typename p0##_type, typename p1##_type, typename p2##_type
1045 #define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
1046     typename p0##_type, typename p1##_type, typename p2##_type, \
1047     typename p3##_type
1048 #define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
1049     typename p0##_type, typename p1##_type, typename p2##_type, \
1050     typename p3##_type, typename p4##_type
1051 #define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
1052     typename p0##_type, typename p1##_type, typename p2##_type, \
1053     typename p3##_type, typename p4##_type, typename p5##_type
1054 #define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1055     p6) , typename p0##_type, typename p1##_type, typename p2##_type, \
1056     typename p3##_type, typename p4##_type, typename p5##_type, \
1057     typename p6##_type
1058 #define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1059     p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \
1060     typename p3##_type, typename p4##_type, typename p5##_type, \
1061     typename p6##_type, typename p7##_type
1062 #define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1063     p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \
1064     typename p3##_type, typename p4##_type, typename p5##_type, \
1065     typename p6##_type, typename p7##_type, typename p8##_type
1066 #define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1067     p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \
1068     typename p2##_type, typename p3##_type, typename p4##_type, \
1069     typename p5##_type, typename p6##_type, typename p7##_type, \
1070     typename p8##_type, typename p9##_type
1071 
1072 // Initializes the value parameters.
1073 #define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\
1074     ()
1075 #define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\
1076     (p0##_type gmock_p0) : p0(gmock_p0)
1077 #define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\
1078     (p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1)
1079 #define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\
1080     (p0##_type gmock_p0, p1##_type gmock_p1, \
1081         p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2)
1082 #define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\
1083     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1084         p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1085         p3(gmock_p3)
1086 #define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\
1087     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1088         p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), \
1089         p2(gmock_p2), p3(gmock_p3), p4(gmock_p4)
1090 #define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\
1091     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1092         p3##_type gmock_p3, p4##_type gmock_p4, \
1093         p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1094         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5)
1095 #define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\
1096     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1097         p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1098         p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1099         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6)
1100 #define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\
1101     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1102         p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1103         p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \
1104         p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
1105         p7(gmock_p7)
1106 #define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1107     p7, p8)\
1108     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1109         p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1110         p6##_type gmock_p6, p7##_type gmock_p7, \
1111         p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1112         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
1113         p8(gmock_p8)
1114 #define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1115     p7, p8, p9)\
1116     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1117         p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1118         p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
1119         p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1120         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
1121         p8(gmock_p8), p9(gmock_p9)
1122 
1123 // Declares the fields for storing the value parameters.
1124 #define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS()
1125 #define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0;
1126 #define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \
1127     p1##_type p1;
1128 #define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \
1129     p1##_type p1; p2##_type p2;
1130 #define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \
1131     p1##_type p1; p2##_type p2; p3##_type p3;
1132 #define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
1133     p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4;
1134 #define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
1135     p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
1136     p5##_type p5;
1137 #define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1138     p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
1139     p5##_type p5; p6##_type p6;
1140 #define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1141     p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
1142     p5##_type p5; p6##_type p6; p7##_type p7;
1143 #define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1144     p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
1145     p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8;
1146 #define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1147     p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
1148     p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \
1149     p9##_type p9;
1150 
1151 // Lists the value parameters.
1152 #define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS()
1153 #define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0
1154 #define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1
1155 #define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2
1156 #define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3
1157 #define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \
1158     p2, p3, p4
1159 #define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \
1160     p1, p2, p3, p4, p5
1161 #define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1162     p6) p0, p1, p2, p3, p4, p5, p6
1163 #define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1164     p7) p0, p1, p2, p3, p4, p5, p6, p7
1165 #define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1166     p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8
1167 #define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1168     p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9
1169 
1170 // Lists the value parameter types.
1171 #define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS()
1172 #define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type
1173 #define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \
1174     p1##_type
1175 #define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \
1176     p1##_type, p2##_type
1177 #define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
1178     p0##_type, p1##_type, p2##_type, p3##_type
1179 #define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
1180     p0##_type, p1##_type, p2##_type, p3##_type, p4##_type
1181 #define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
1182     p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type
1183 #define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1184     p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \
1185     p6##_type
1186 #define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1187     p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1188     p5##_type, p6##_type, p7##_type
1189 #define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1190     p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1191     p5##_type, p6##_type, p7##_type, p8##_type
1192 #define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1193     p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1194     p5##_type, p6##_type, p7##_type, p8##_type, p9##_type
1195 
1196 // Declares the value parameters.
1197 #define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS()
1198 #define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0
1199 #define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \
1200     p1##_type p1
1201 #define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \
1202     p1##_type p1, p2##_type p2
1203 #define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \
1204     p1##_type p1, p2##_type p2, p3##_type p3
1205 #define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
1206     p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4
1207 #define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
1208     p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
1209     p5##_type p5
1210 #define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1211     p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
1212     p5##_type p5, p6##_type p6
1213 #define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1214     p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
1215     p5##_type p5, p6##_type p6, p7##_type p7
1216 #define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1217     p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1218     p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8
1219 #define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1220     p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1221     p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
1222     p9##_type p9
1223 
1224 // The suffix of the class template implementing the action template.
1225 #define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS()
1226 #define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P
1227 #define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2
1228 #define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3
1229 #define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4
1230 #define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5
1231 #define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6
1232 #define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7
1233 #define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1234     p7) P8
1235 #define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1236     p7, p8) P9
1237 #define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1238     p7, p8, p9) P10
1239 
1240 // The name of the class template implementing the action template.
1241 #define GMOCK_ACTION_CLASS_(name, value_params)\
1242     GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params)
1243 
1244 #define ACTION_TEMPLATE(name, template_params, value_params)\
1245   template <GMOCK_INTERNAL_DECL_##template_params\
1246             GMOCK_INTERNAL_DECL_TYPE_##value_params>\
1247   class GMOCK_ACTION_CLASS_(name, value_params) {\
1248    public:\
1249     explicit GMOCK_ACTION_CLASS_(name, value_params)\
1250         GMOCK_INTERNAL_INIT_##value_params {}\
1251     template <typename F>\
1252     class gmock_Impl : public ::testing::ActionInterface<F> {\
1253      public:\
1254       typedef F function_type;\
1255       typedef typename ::testing::internal::Function<F>::Result return_type;\
1256       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1257           args_type;\
1258       explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\
1259       virtual return_type Perform(const args_type& args) {\
1260         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1261             Perform(this, args);\
1262       }\
1263       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1264           typename arg3_type, typename arg4_type, typename arg5_type, \
1265           typename arg6_type, typename arg7_type, typename arg8_type, \
1266           typename arg9_type>\
1267       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1268           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1269           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1270           arg9_type arg9) const;\
1271       GMOCK_INTERNAL_DEFN_##value_params\
1272      private:\
1273       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1274     };\
1275     template <typename F> operator ::testing::Action<F>() const {\
1276       return ::testing::Action<F>(\
1277           new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
1278     }\
1279     GMOCK_INTERNAL_DEFN_##value_params\
1280    private:\
1281     GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\
1282   };\
1283   template <GMOCK_INTERNAL_DECL_##template_params\
1284             GMOCK_INTERNAL_DECL_TYPE_##value_params>\
1285   inline GMOCK_ACTION_CLASS_(name, value_params)<\
1286       GMOCK_INTERNAL_LIST_##template_params\
1287       GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\
1288           GMOCK_INTERNAL_DECL_##value_params) {\
1289     return GMOCK_ACTION_CLASS_(name, value_params)<\
1290         GMOCK_INTERNAL_LIST_##template_params\
1291         GMOCK_INTERNAL_LIST_TYPE_##value_params>(\
1292             GMOCK_INTERNAL_LIST_##value_params);\
1293   }\
1294   template <GMOCK_INTERNAL_DECL_##template_params\
1295             GMOCK_INTERNAL_DECL_TYPE_##value_params>\
1296   template <typename F>\
1297   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1298       typename arg3_type, typename arg4_type, typename arg5_type, \
1299       typename arg6_type, typename arg7_type, typename arg8_type, \
1300       typename arg9_type>\
1301   typename ::testing::internal::Function<F>::Result\
1302       GMOCK_ACTION_CLASS_(name, value_params)<\
1303           GMOCK_INTERNAL_LIST_##template_params\
1304           GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
1305               gmock_PerformImpl(\
1306           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1307 
1308 #define ACTION(name)\
1309   class name##Action {\
1310    public:\
1311     name##Action() {}\
1312     template <typename F>\
1313     class gmock_Impl : public ::testing::ActionInterface<F> {\
1314      public:\
1315       typedef F function_type;\
1316       typedef typename ::testing::internal::Function<F>::Result return_type;\
1317       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1318           args_type;\
1319       gmock_Impl() {}\
1320       virtual return_type Perform(const args_type& args) {\
1321         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1322             Perform(this, args);\
1323       }\
1324       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1325           typename arg3_type, typename arg4_type, typename arg5_type, \
1326           typename arg6_type, typename arg7_type, typename arg8_type, \
1327           typename arg9_type>\
1328       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1329           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1330           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1331           arg9_type arg9) const;\
1332      private:\
1333       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1334     };\
1335     template <typename F> operator ::testing::Action<F>() const {\
1336       return ::testing::Action<F>(new gmock_Impl<F>());\
1337     }\
1338    private:\
1339     GTEST_DISALLOW_ASSIGN_(name##Action);\
1340   };\
1341   inline name##Action name() {\
1342     return name##Action();\
1343   }\
1344   template <typename F>\
1345   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1346       typename arg3_type, typename arg4_type, typename arg5_type, \
1347       typename arg6_type, typename arg7_type, typename arg8_type, \
1348       typename arg9_type>\
1349   typename ::testing::internal::Function<F>::Result\
1350       name##Action::gmock_Impl<F>::gmock_PerformImpl(\
1351           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1352 
1353 #define ACTION_P(name, p0)\
1354   template <typename p0##_type>\
1355   class name##ActionP {\
1356    public:\
1357     explicit name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\
1358     template <typename F>\
1359     class gmock_Impl : public ::testing::ActionInterface<F> {\
1360      public:\
1361       typedef F function_type;\
1362       typedef typename ::testing::internal::Function<F>::Result return_type;\
1363       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1364           args_type;\
1365       explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\
1366       virtual return_type Perform(const args_type& args) {\
1367         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1368             Perform(this, args);\
1369       }\
1370       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1371           typename arg3_type, typename arg4_type, typename arg5_type, \
1372           typename arg6_type, typename arg7_type, typename arg8_type, \
1373           typename arg9_type>\
1374       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1375           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1376           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1377           arg9_type arg9) const;\
1378       p0##_type p0;\
1379      private:\
1380       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1381     };\
1382     template <typename F> operator ::testing::Action<F>() const {\
1383       return ::testing::Action<F>(new gmock_Impl<F>(p0));\
1384     }\
1385     p0##_type p0;\
1386    private:\
1387     GTEST_DISALLOW_ASSIGN_(name##ActionP);\
1388   };\
1389   template <typename p0##_type>\
1390   inline name##ActionP<p0##_type> name(p0##_type p0) {\
1391     return name##ActionP<p0##_type>(p0);\
1392   }\
1393   template <typename p0##_type>\
1394   template <typename F>\
1395   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1396       typename arg3_type, typename arg4_type, typename arg5_type, \
1397       typename arg6_type, typename arg7_type, typename arg8_type, \
1398       typename arg9_type>\
1399   typename ::testing::internal::Function<F>::Result\
1400       name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1401           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1402 
1403 #define ACTION_P2(name, p0, p1)\
1404   template <typename p0##_type, typename p1##_type>\
1405   class name##ActionP2 {\
1406    public:\
1407     name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
1408         p1(gmock_p1) {}\
1409     template <typename F>\
1410     class gmock_Impl : public ::testing::ActionInterface<F> {\
1411      public:\
1412       typedef F function_type;\
1413       typedef typename ::testing::internal::Function<F>::Result return_type;\
1414       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1415           args_type;\
1416       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
1417           p1(gmock_p1) {}\
1418       virtual return_type Perform(const args_type& args) {\
1419         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1420             Perform(this, args);\
1421       }\
1422       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1423           typename arg3_type, typename arg4_type, typename arg5_type, \
1424           typename arg6_type, typename arg7_type, typename arg8_type, \
1425           typename arg9_type>\
1426       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1427           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1428           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1429           arg9_type arg9) const;\
1430       p0##_type p0;\
1431       p1##_type p1;\
1432      private:\
1433       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1434     };\
1435     template <typename F> operator ::testing::Action<F>() const {\
1436       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
1437     }\
1438     p0##_type p0;\
1439     p1##_type p1;\
1440    private:\
1441     GTEST_DISALLOW_ASSIGN_(name##ActionP2);\
1442   };\
1443   template <typename p0##_type, typename p1##_type>\
1444   inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
1445       p1##_type p1) {\
1446     return name##ActionP2<p0##_type, p1##_type>(p0, p1);\
1447   }\
1448   template <typename p0##_type, typename p1##_type>\
1449   template <typename F>\
1450   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1451       typename arg3_type, typename arg4_type, typename arg5_type, \
1452       typename arg6_type, typename arg7_type, typename arg8_type, \
1453       typename arg9_type>\
1454   typename ::testing::internal::Function<F>::Result\
1455       name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1456           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1457 
1458 #define ACTION_P3(name, p0, p1, p2)\
1459   template <typename p0##_type, typename p1##_type, typename p2##_type>\
1460   class name##ActionP3 {\
1461    public:\
1462     name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \
1463         p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
1464     template <typename F>\
1465     class gmock_Impl : public ::testing::ActionInterface<F> {\
1466      public:\
1467       typedef F function_type;\
1468       typedef typename ::testing::internal::Function<F>::Result return_type;\
1469       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1470           args_type;\
1471       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \
1472           p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
1473       virtual return_type Perform(const args_type& args) {\
1474         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1475             Perform(this, args);\
1476       }\
1477       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1478           typename arg3_type, typename arg4_type, typename arg5_type, \
1479           typename arg6_type, typename arg7_type, typename arg8_type, \
1480           typename arg9_type>\
1481       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1482           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1483           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1484           arg9_type arg9) const;\
1485       p0##_type p0;\
1486       p1##_type p1;\
1487       p2##_type p2;\
1488      private:\
1489       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1490     };\
1491     template <typename F> operator ::testing::Action<F>() const {\
1492       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
1493     }\
1494     p0##_type p0;\
1495     p1##_type p1;\
1496     p2##_type p2;\
1497    private:\
1498     GTEST_DISALLOW_ASSIGN_(name##ActionP3);\
1499   };\
1500   template <typename p0##_type, typename p1##_type, typename p2##_type>\
1501   inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
1502       p1##_type p1, p2##_type p2) {\
1503     return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
1504   }\
1505   template <typename p0##_type, typename p1##_type, typename p2##_type>\
1506   template <typename F>\
1507   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1508       typename arg3_type, typename arg4_type, typename arg5_type, \
1509       typename arg6_type, typename arg7_type, typename arg8_type, \
1510       typename arg9_type>\
1511   typename ::testing::internal::Function<F>::Result\
1512       name##ActionP3<p0##_type, p1##_type, \
1513           p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1514           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1515 
1516 #define ACTION_P4(name, p0, p1, p2, p3)\
1517   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1518       typename p3##_type>\
1519   class name##ActionP4 {\
1520    public:\
1521     name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \
1522         p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \
1523         p2(gmock_p2), p3(gmock_p3) {}\
1524     template <typename F>\
1525     class gmock_Impl : public ::testing::ActionInterface<F> {\
1526      public:\
1527       typedef F function_type;\
1528       typedef typename ::testing::internal::Function<F>::Result return_type;\
1529       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1530           args_type;\
1531       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1532           p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1533           p3(gmock_p3) {}\
1534       virtual return_type Perform(const args_type& args) {\
1535         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1536             Perform(this, args);\
1537       }\
1538       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1539           typename arg3_type, typename arg4_type, typename arg5_type, \
1540           typename arg6_type, typename arg7_type, typename arg8_type, \
1541           typename arg9_type>\
1542       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1543           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1544           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1545           arg9_type arg9) const;\
1546       p0##_type p0;\
1547       p1##_type p1;\
1548       p2##_type p2;\
1549       p3##_type p3;\
1550      private:\
1551       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1552     };\
1553     template <typename F> operator ::testing::Action<F>() const {\
1554       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
1555     }\
1556     p0##_type p0;\
1557     p1##_type p1;\
1558     p2##_type p2;\
1559     p3##_type p3;\
1560    private:\
1561     GTEST_DISALLOW_ASSIGN_(name##ActionP4);\
1562   };\
1563   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1564       typename p3##_type>\
1565   inline name##ActionP4<p0##_type, p1##_type, p2##_type, \
1566       p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
1567       p3##_type p3) {\
1568     return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \
1569         p2, p3);\
1570   }\
1571   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1572       typename p3##_type>\
1573   template <typename F>\
1574   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1575       typename arg3_type, typename arg4_type, typename arg5_type, \
1576       typename arg6_type, typename arg7_type, typename arg8_type, \
1577       typename arg9_type>\
1578   typename ::testing::internal::Function<F>::Result\
1579       name##ActionP4<p0##_type, p1##_type, p2##_type, \
1580           p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1581           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1582 
1583 #define ACTION_P5(name, p0, p1, p2, p3, p4)\
1584   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1585       typename p3##_type, typename p4##_type>\
1586   class name##ActionP5 {\
1587    public:\
1588     name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \
1589         p2##_type gmock_p2, p3##_type gmock_p3, \
1590         p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1591         p3(gmock_p3), p4(gmock_p4) {}\
1592     template <typename F>\
1593     class gmock_Impl : public ::testing::ActionInterface<F> {\
1594      public:\
1595       typedef F function_type;\
1596       typedef typename ::testing::internal::Function<F>::Result return_type;\
1597       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1598           args_type;\
1599       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1600           p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \
1601           p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\
1602       virtual return_type Perform(const args_type& args) {\
1603         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1604             Perform(this, args);\
1605       }\
1606       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1607           typename arg3_type, typename arg4_type, typename arg5_type, \
1608           typename arg6_type, typename arg7_type, typename arg8_type, \
1609           typename arg9_type>\
1610       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1611           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1612           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1613           arg9_type arg9) const;\
1614       p0##_type p0;\
1615       p1##_type p1;\
1616       p2##_type p2;\
1617       p3##_type p3;\
1618       p4##_type p4;\
1619      private:\
1620       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1621     };\
1622     template <typename F> operator ::testing::Action<F>() const {\
1623       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\
1624     }\
1625     p0##_type p0;\
1626     p1##_type p1;\
1627     p2##_type p2;\
1628     p3##_type p3;\
1629     p4##_type p4;\
1630    private:\
1631     GTEST_DISALLOW_ASSIGN_(name##ActionP5);\
1632   };\
1633   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1634       typename p3##_type, typename p4##_type>\
1635   inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1636       p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1637       p4##_type p4) {\
1638     return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1639         p4##_type>(p0, p1, p2, p3, p4);\
1640   }\
1641   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1642       typename p3##_type, typename p4##_type>\
1643   template <typename F>\
1644   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1645       typename arg3_type, typename arg4_type, typename arg5_type, \
1646       typename arg6_type, typename arg7_type, typename arg8_type, \
1647       typename arg9_type>\
1648   typename ::testing::internal::Function<F>::Result\
1649       name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1650           p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1651           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1652 
1653 #define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\
1654   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1655       typename p3##_type, typename p4##_type, typename p5##_type>\
1656   class name##ActionP6 {\
1657    public:\
1658     name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \
1659         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1660         p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1661         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\
1662     template <typename F>\
1663     class gmock_Impl : public ::testing::ActionInterface<F> {\
1664      public:\
1665       typedef F function_type;\
1666       typedef typename ::testing::internal::Function<F>::Result return_type;\
1667       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1668           args_type;\
1669       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1670           p3##_type gmock_p3, p4##_type gmock_p4, \
1671           p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1672           p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\
1673       virtual return_type Perform(const args_type& args) {\
1674         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1675             Perform(this, args);\
1676       }\
1677       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1678           typename arg3_type, typename arg4_type, typename arg5_type, \
1679           typename arg6_type, typename arg7_type, typename arg8_type, \
1680           typename arg9_type>\
1681       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1682           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1683           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1684           arg9_type arg9) const;\
1685       p0##_type p0;\
1686       p1##_type p1;\
1687       p2##_type p2;\
1688       p3##_type p3;\
1689       p4##_type p4;\
1690       p5##_type p5;\
1691      private:\
1692       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1693     };\
1694     template <typename F> operator ::testing::Action<F>() const {\
1695       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\
1696     }\
1697     p0##_type p0;\
1698     p1##_type p1;\
1699     p2##_type p2;\
1700     p3##_type p3;\
1701     p4##_type p4;\
1702     p5##_type p5;\
1703    private:\
1704     GTEST_DISALLOW_ASSIGN_(name##ActionP6);\
1705   };\
1706   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1707       typename p3##_type, typename p4##_type, typename p5##_type>\
1708   inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
1709       p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
1710       p3##_type p3, p4##_type p4, p5##_type p5) {\
1711     return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
1712         p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
1713   }\
1714   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1715       typename p3##_type, typename p4##_type, typename p5##_type>\
1716   template <typename F>\
1717   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1718       typename arg3_type, typename arg4_type, typename arg5_type, \
1719       typename arg6_type, typename arg7_type, typename arg8_type, \
1720       typename arg9_type>\
1721   typename ::testing::internal::Function<F>::Result\
1722       name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1723           p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1724           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1725 
1726 #define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\
1727   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1728       typename p3##_type, typename p4##_type, typename p5##_type, \
1729       typename p6##_type>\
1730   class name##ActionP7 {\
1731    public:\
1732     name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \
1733         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1734         p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \
1735         p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \
1736         p6(gmock_p6) {}\
1737     template <typename F>\
1738     class gmock_Impl : public ::testing::ActionInterface<F> {\
1739      public:\
1740       typedef F function_type;\
1741       typedef typename ::testing::internal::Function<F>::Result return_type;\
1742       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1743           args_type;\
1744       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1745           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1746           p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1747           p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\
1748       virtual return_type Perform(const args_type& args) {\
1749         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1750             Perform(this, args);\
1751       }\
1752       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1753           typename arg3_type, typename arg4_type, typename arg5_type, \
1754           typename arg6_type, typename arg7_type, typename arg8_type, \
1755           typename arg9_type>\
1756       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1757           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1758           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1759           arg9_type arg9) const;\
1760       p0##_type p0;\
1761       p1##_type p1;\
1762       p2##_type p2;\
1763       p3##_type p3;\
1764       p4##_type p4;\
1765       p5##_type p5;\
1766       p6##_type p6;\
1767      private:\
1768       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1769     };\
1770     template <typename F> operator ::testing::Action<F>() const {\
1771       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
1772           p6));\
1773     }\
1774     p0##_type p0;\
1775     p1##_type p1;\
1776     p2##_type p2;\
1777     p3##_type p3;\
1778     p4##_type p4;\
1779     p5##_type p5;\
1780     p6##_type p6;\
1781    private:\
1782     GTEST_DISALLOW_ASSIGN_(name##ActionP7);\
1783   };\
1784   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1785       typename p3##_type, typename p4##_type, typename p5##_type, \
1786       typename p6##_type>\
1787   inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
1788       p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
1789       p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
1790       p6##_type p6) {\
1791     return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
1792         p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
1793   }\
1794   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1795       typename p3##_type, typename p4##_type, typename p5##_type, \
1796       typename p6##_type>\
1797   template <typename F>\
1798   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1799       typename arg3_type, typename arg4_type, typename arg5_type, \
1800       typename arg6_type, typename arg7_type, typename arg8_type, \
1801       typename arg9_type>\
1802   typename ::testing::internal::Function<F>::Result\
1803       name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1804           p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1805           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1806 
1807 #define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\
1808   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1809       typename p3##_type, typename p4##_type, typename p5##_type, \
1810       typename p6##_type, typename p7##_type>\
1811   class name##ActionP8 {\
1812    public:\
1813     name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \
1814         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1815         p5##_type gmock_p5, p6##_type gmock_p6, \
1816         p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1817         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
1818         p7(gmock_p7) {}\
1819     template <typename F>\
1820     class gmock_Impl : public ::testing::ActionInterface<F> {\
1821      public:\
1822       typedef F function_type;\
1823       typedef typename ::testing::internal::Function<F>::Result return_type;\
1824       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1825           args_type;\
1826       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1827           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1828           p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \
1829           p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \
1830           p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\
1831       virtual return_type Perform(const args_type& args) {\
1832         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1833             Perform(this, args);\
1834       }\
1835       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1836           typename arg3_type, typename arg4_type, typename arg5_type, \
1837           typename arg6_type, typename arg7_type, typename arg8_type, \
1838           typename arg9_type>\
1839       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1840           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1841           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1842           arg9_type arg9) const;\
1843       p0##_type p0;\
1844       p1##_type p1;\
1845       p2##_type p2;\
1846       p3##_type p3;\
1847       p4##_type p4;\
1848       p5##_type p5;\
1849       p6##_type p6;\
1850       p7##_type p7;\
1851      private:\
1852       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1853     };\
1854     template <typename F> operator ::testing::Action<F>() const {\
1855       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
1856           p6, p7));\
1857     }\
1858     p0##_type p0;\
1859     p1##_type p1;\
1860     p2##_type p2;\
1861     p3##_type p3;\
1862     p4##_type p4;\
1863     p5##_type p5;\
1864     p6##_type p6;\
1865     p7##_type p7;\
1866    private:\
1867     GTEST_DISALLOW_ASSIGN_(name##ActionP8);\
1868   };\
1869   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1870       typename p3##_type, typename p4##_type, typename p5##_type, \
1871       typename p6##_type, typename p7##_type>\
1872   inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
1873       p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
1874       p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
1875       p6##_type p6, p7##_type p7) {\
1876     return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
1877         p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
1878         p6, p7);\
1879   }\
1880   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1881       typename p3##_type, typename p4##_type, typename p5##_type, \
1882       typename p6##_type, typename p7##_type>\
1883   template <typename F>\
1884   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1885       typename arg3_type, typename arg4_type, typename arg5_type, \
1886       typename arg6_type, typename arg7_type, typename arg8_type, \
1887       typename arg9_type>\
1888   typename ::testing::internal::Function<F>::Result\
1889       name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1890           p5##_type, p6##_type, \
1891           p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1892           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1893 
1894 #define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\
1895   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1896       typename p3##_type, typename p4##_type, typename p5##_type, \
1897       typename p6##_type, typename p7##_type, typename p8##_type>\
1898   class name##ActionP9 {\
1899    public:\
1900     name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \
1901         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1902         p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
1903         p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1904         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
1905         p8(gmock_p8) {}\
1906     template <typename F>\
1907     class gmock_Impl : public ::testing::ActionInterface<F> {\
1908      public:\
1909       typedef F function_type;\
1910       typedef typename ::testing::internal::Function<F>::Result return_type;\
1911       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1912           args_type;\
1913       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1914           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1915           p6##_type gmock_p6, p7##_type gmock_p7, \
1916           p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1917           p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
1918           p7(gmock_p7), p8(gmock_p8) {}\
1919       virtual return_type Perform(const args_type& args) {\
1920         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1921             Perform(this, args);\
1922       }\
1923       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1924           typename arg3_type, typename arg4_type, typename arg5_type, \
1925           typename arg6_type, typename arg7_type, typename arg8_type, \
1926           typename arg9_type>\
1927       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1928           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1929           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1930           arg9_type arg9) const;\
1931       p0##_type p0;\
1932       p1##_type p1;\
1933       p2##_type p2;\
1934       p3##_type p3;\
1935       p4##_type p4;\
1936       p5##_type p5;\
1937       p6##_type p6;\
1938       p7##_type p7;\
1939       p8##_type p8;\
1940      private:\
1941       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1942     };\
1943     template <typename F> operator ::testing::Action<F>() const {\
1944       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
1945           p6, p7, p8));\
1946     }\
1947     p0##_type p0;\
1948     p1##_type p1;\
1949     p2##_type p2;\
1950     p3##_type p3;\
1951     p4##_type p4;\
1952     p5##_type p5;\
1953     p6##_type p6;\
1954     p7##_type p7;\
1955     p8##_type p8;\
1956    private:\
1957     GTEST_DISALLOW_ASSIGN_(name##ActionP9);\
1958   };\
1959   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1960       typename p3##_type, typename p4##_type, typename p5##_type, \
1961       typename p6##_type, typename p7##_type, typename p8##_type>\
1962   inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
1963       p4##_type, p5##_type, p6##_type, p7##_type, \
1964       p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1965       p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
1966       p8##_type p8) {\
1967     return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
1968         p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
1969         p3, p4, p5, p6, p7, p8);\
1970   }\
1971   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1972       typename p3##_type, typename p4##_type, typename p5##_type, \
1973       typename p6##_type, typename p7##_type, typename p8##_type>\
1974   template <typename F>\
1975   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1976       typename arg3_type, typename arg4_type, typename arg5_type, \
1977       typename arg6_type, typename arg7_type, typename arg8_type, \
1978       typename arg9_type>\
1979   typename ::testing::internal::Function<F>::Result\
1980       name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1981           p5##_type, p6##_type, p7##_type, \
1982           p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1983           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1984 
1985 #define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\
1986   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1987       typename p3##_type, typename p4##_type, typename p5##_type, \
1988       typename p6##_type, typename p7##_type, typename p8##_type, \
1989       typename p9##_type>\
1990   class name##ActionP10 {\
1991    public:\
1992     name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \
1993         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1994         p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
1995         p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \
1996         p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
1997         p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\
1998     template <typename F>\
1999     class gmock_Impl : public ::testing::ActionInterface<F> {\
2000      public:\
2001       typedef F function_type;\
2002       typedef typename ::testing::internal::Function<F>::Result return_type;\
2003       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
2004           args_type;\
2005       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
2006           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
2007           p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
2008           p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
2009           p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
2010           p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\
2011       virtual return_type Perform(const args_type& args) {\
2012         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
2013             Perform(this, args);\
2014       }\
2015       template <typename arg0_type, typename arg1_type, typename arg2_type, \
2016           typename arg3_type, typename arg4_type, typename arg5_type, \
2017           typename arg6_type, typename arg7_type, typename arg8_type, \
2018           typename arg9_type>\
2019       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
2020           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
2021           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
2022           arg9_type arg9) const;\
2023       p0##_type p0;\
2024       p1##_type p1;\
2025       p2##_type p2;\
2026       p3##_type p3;\
2027       p4##_type p4;\
2028       p5##_type p5;\
2029       p6##_type p6;\
2030       p7##_type p7;\
2031       p8##_type p8;\
2032       p9##_type p9;\
2033      private:\
2034       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
2035     };\
2036     template <typename F> operator ::testing::Action<F>() const {\
2037       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
2038           p6, p7, p8, p9));\
2039     }\
2040     p0##_type p0;\
2041     p1##_type p1;\
2042     p2##_type p2;\
2043     p3##_type p3;\
2044     p4##_type p4;\
2045     p5##_type p5;\
2046     p6##_type p6;\
2047     p7##_type p7;\
2048     p8##_type p8;\
2049     p9##_type p9;\
2050    private:\
2051     GTEST_DISALLOW_ASSIGN_(name##ActionP10);\
2052   };\
2053   template <typename p0##_type, typename p1##_type, typename p2##_type, \
2054       typename p3##_type, typename p4##_type, typename p5##_type, \
2055       typename p6##_type, typename p7##_type, typename p8##_type, \
2056       typename p9##_type>\
2057   inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
2058       p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
2059       p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
2060       p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
2061       p9##_type p9) {\
2062     return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
2063         p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
2064         p1, p2, p3, p4, p5, p6, p7, p8, p9);\
2065   }\
2066   template <typename p0##_type, typename p1##_type, typename p2##_type, \
2067       typename p3##_type, typename p4##_type, typename p5##_type, \
2068       typename p6##_type, typename p7##_type, typename p8##_type, \
2069       typename p9##_type>\
2070   template <typename F>\
2071   template <typename arg0_type, typename arg1_type, typename arg2_type, \
2072       typename arg3_type, typename arg4_type, typename arg5_type, \
2073       typename arg6_type, typename arg7_type, typename arg8_type, \
2074       typename arg9_type>\
2075   typename ::testing::internal::Function<F>::Result\
2076       name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
2077           p5##_type, p6##_type, p7##_type, p8##_type, \
2078           p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\
2079           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
2080 
2081 namespace testing {
2082 
2083 
2084 // The ACTION*() macros trigger warning C4100 (unreferenced formal
2085 // parameter) in MSVC with -W4.  Unfortunately they cannot be fixed in
2086 // the macro definition, as the warnings are generated when the macro
2087 // is expanded and macro expansion cannot contain #pragma.  Therefore
2088 // we suppress them here.
2089 #ifdef _MSC_VER
2090 # pragma warning(push)
2091 # pragma warning(disable:4100)
2092 #endif
2093 
2094 // Various overloads for InvokeArgument<N>().
2095 //
2096 // The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
2097 // (0-based) argument, which must be a k-ary callable, of the mock
2098 // function, with arguments a1, a2, ..., a_k.
2099 //
2100 // Notes:
2101 //
2102 //   1. The arguments are passed by value by default.  If you need to
2103 //   pass an argument by reference, wrap it inside ByRef().  For
2104 //   example,
2105 //
2106 //     InvokeArgument<1>(5, string("Hello"), ByRef(foo))
2107 //
2108 //   passes 5 and string("Hello") by value, and passes foo by
2109 //   reference.
2110 //
2111 //   2. If the callable takes an argument by reference but ByRef() is
2112 //   not used, it will receive the reference to a copy of the value,
2113 //   instead of the original value.  For example, when the 0-th
2114 //   argument of the mock function takes a const string&, the action
2115 //
2116 //     InvokeArgument<0>(string("Hello"))
2117 //
2118 //   makes a copy of the temporary string("Hello") object and passes a
2119 //   reference of the copy, instead of the original temporary object,
2120 //   to the callable.  This makes it easy for a user to define an
2121 //   InvokeArgument action from temporary values and have it performed
2122 //   later.
2123 
2124 namespace internal {
2125 namespace invoke_argument {
2126 
2127 // Appears in InvokeArgumentAdl's argument list to help avoid
2128 // accidental calls to user functions of the same name.
2129 struct AdlTag {};
2130 
2131 // InvokeArgumentAdl - a helper for InvokeArgument.
2132 // The basic overloads are provided here for generic functors.
2133 // Overloads for other custom-callables are provided in the
2134 // internal/custom/callback-actions.h header.
2135 
2136 template <typename R, typename F>
2137 R InvokeArgumentAdl(AdlTag, F f) {
2138   return f();
2139 }
2140 template <typename R, typename F, typename A1>
2141 R InvokeArgumentAdl(AdlTag, F f, A1 a1) {
2142   return f(a1);
2143 }
2144 template <typename R, typename F, typename A1, typename A2>
2145 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2) {
2146   return f(a1, a2);
2147 }
2148 template <typename R, typename F, typename A1, typename A2, typename A3>
2149 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3) {
2150   return f(a1, a2, a3);
2151 }
2152 template <typename R, typename F, typename A1, typename A2, typename A3,
2153     typename A4>
2154 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4) {
2155   return f(a1, a2, a3, a4);
2156 }
2157 template <typename R, typename F, typename A1, typename A2, typename A3,
2158     typename A4, typename A5>
2159 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
2160   return f(a1, a2, a3, a4, a5);
2161 }
2162 template <typename R, typename F, typename A1, typename A2, typename A3,
2163     typename A4, typename A5, typename A6>
2164 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
2165   return f(a1, a2, a3, a4, a5, a6);
2166 }
2167 template <typename R, typename F, typename A1, typename A2, typename A3,
2168     typename A4, typename A5, typename A6, typename A7>
2169 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
2170     A7 a7) {
2171   return f(a1, a2, a3, a4, a5, a6, a7);
2172 }
2173 template <typename R, typename F, typename A1, typename A2, typename A3,
2174     typename A4, typename A5, typename A6, typename A7, typename A8>
2175 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
2176     A7 a7, A8 a8) {
2177   return f(a1, a2, a3, a4, a5, a6, a7, a8);
2178 }
2179 template <typename R, typename F, typename A1, typename A2, typename A3,
2180     typename A4, typename A5, typename A6, typename A7, typename A8,
2181     typename A9>
2182 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
2183     A7 a7, A8 a8, A9 a9) {
2184   return f(a1, a2, a3, a4, a5, a6, a7, a8, a9);
2185 }
2186 template <typename R, typename F, typename A1, typename A2, typename A3,
2187     typename A4, typename A5, typename A6, typename A7, typename A8,
2188     typename A9, typename A10>
2189 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
2190     A7 a7, A8 a8, A9 a9, A10 a10) {
2191   return f(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
2192 }
2193 }  // namespace invoke_argument
2194 }  // namespace internal
2195 
2196 ACTION_TEMPLATE(InvokeArgument,
2197                 HAS_1_TEMPLATE_PARAMS(int, k),
2198                 AND_0_VALUE_PARAMS()) {
2199   using internal::invoke_argument::InvokeArgumentAdl;
2200   return InvokeArgumentAdl<return_type>(
2201       internal::invoke_argument::AdlTag(),
2202       ::testing::get<k>(args));
2203 }
2204 
2205 ACTION_TEMPLATE(InvokeArgument,
2206                 HAS_1_TEMPLATE_PARAMS(int, k),
2207                 AND_1_VALUE_PARAMS(p0)) {
2208   using internal::invoke_argument::InvokeArgumentAdl;
2209   return InvokeArgumentAdl<return_type>(
2210       internal::invoke_argument::AdlTag(),
2211       ::testing::get<k>(args), p0);
2212 }
2213 
2214 ACTION_TEMPLATE(InvokeArgument,
2215                 HAS_1_TEMPLATE_PARAMS(int, k),
2216                 AND_2_VALUE_PARAMS(p0, p1)) {
2217   using internal::invoke_argument::InvokeArgumentAdl;
2218   return InvokeArgumentAdl<return_type>(
2219       internal::invoke_argument::AdlTag(),
2220       ::testing::get<k>(args), p0, p1);
2221 }
2222 
2223 ACTION_TEMPLATE(InvokeArgument,
2224                 HAS_1_TEMPLATE_PARAMS(int, k),
2225                 AND_3_VALUE_PARAMS(p0, p1, p2)) {
2226   using internal::invoke_argument::InvokeArgumentAdl;
2227   return InvokeArgumentAdl<return_type>(
2228       internal::invoke_argument::AdlTag(),
2229       ::testing::get<k>(args), p0, p1, p2);
2230 }
2231 
2232 ACTION_TEMPLATE(InvokeArgument,
2233                 HAS_1_TEMPLATE_PARAMS(int, k),
2234                 AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
2235   using internal::invoke_argument::InvokeArgumentAdl;
2236   return InvokeArgumentAdl<return_type>(
2237       internal::invoke_argument::AdlTag(),
2238       ::testing::get<k>(args), p0, p1, p2, p3);
2239 }
2240 
2241 ACTION_TEMPLATE(InvokeArgument,
2242                 HAS_1_TEMPLATE_PARAMS(int, k),
2243                 AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
2244   using internal::invoke_argument::InvokeArgumentAdl;
2245   return InvokeArgumentAdl<return_type>(
2246       internal::invoke_argument::AdlTag(),
2247       ::testing::get<k>(args), p0, p1, p2, p3, p4);
2248 }
2249 
2250 ACTION_TEMPLATE(InvokeArgument,
2251                 HAS_1_TEMPLATE_PARAMS(int, k),
2252                 AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
2253   using internal::invoke_argument::InvokeArgumentAdl;
2254   return InvokeArgumentAdl<return_type>(
2255       internal::invoke_argument::AdlTag(),
2256       ::testing::get<k>(args), p0, p1, p2, p3, p4, p5);
2257 }
2258 
2259 ACTION_TEMPLATE(InvokeArgument,
2260                 HAS_1_TEMPLATE_PARAMS(int, k),
2261                 AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
2262   using internal::invoke_argument::InvokeArgumentAdl;
2263   return InvokeArgumentAdl<return_type>(
2264       internal::invoke_argument::AdlTag(),
2265       ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6);
2266 }
2267 
2268 ACTION_TEMPLATE(InvokeArgument,
2269                 HAS_1_TEMPLATE_PARAMS(int, k),
2270                 AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
2271   using internal::invoke_argument::InvokeArgumentAdl;
2272   return InvokeArgumentAdl<return_type>(
2273       internal::invoke_argument::AdlTag(),
2274       ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7);
2275 }
2276 
2277 ACTION_TEMPLATE(InvokeArgument,
2278                 HAS_1_TEMPLATE_PARAMS(int, k),
2279                 AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
2280   using internal::invoke_argument::InvokeArgumentAdl;
2281   return InvokeArgumentAdl<return_type>(
2282       internal::invoke_argument::AdlTag(),
2283       ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8);
2284 }
2285 
2286 ACTION_TEMPLATE(InvokeArgument,
2287                 HAS_1_TEMPLATE_PARAMS(int, k),
2288                 AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
2289   using internal::invoke_argument::InvokeArgumentAdl;
2290   return InvokeArgumentAdl<return_type>(
2291       internal::invoke_argument::AdlTag(),
2292       ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
2293 }
2294 
2295 // Various overloads for ReturnNew<T>().
2296 //
2297 // The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new
2298 // instance of type T, constructed on the heap with constructor arguments
2299 // a1, a2, ..., and a_k. The caller assumes ownership of the returned value.
2300 ACTION_TEMPLATE(ReturnNew,
2301                 HAS_1_TEMPLATE_PARAMS(typename, T),
2302                 AND_0_VALUE_PARAMS()) {
2303   return new T();
2304 }
2305 
2306 ACTION_TEMPLATE(ReturnNew,
2307                 HAS_1_TEMPLATE_PARAMS(typename, T),
2308                 AND_1_VALUE_PARAMS(p0)) {
2309   return new T(p0);
2310 }
2311 
2312 ACTION_TEMPLATE(ReturnNew,
2313                 HAS_1_TEMPLATE_PARAMS(typename, T),
2314                 AND_2_VALUE_PARAMS(p0, p1)) {
2315   return new T(p0, p1);
2316 }
2317 
2318 ACTION_TEMPLATE(ReturnNew,
2319                 HAS_1_TEMPLATE_PARAMS(typename, T),
2320                 AND_3_VALUE_PARAMS(p0, p1, p2)) {
2321   return new T(p0, p1, p2);
2322 }
2323 
2324 ACTION_TEMPLATE(ReturnNew,
2325                 HAS_1_TEMPLATE_PARAMS(typename, T),
2326                 AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
2327   return new T(p0, p1, p2, p3);
2328 }
2329 
2330 ACTION_TEMPLATE(ReturnNew,
2331                 HAS_1_TEMPLATE_PARAMS(typename, T),
2332                 AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
2333   return new T(p0, p1, p2, p3, p4);
2334 }
2335 
2336 ACTION_TEMPLATE(ReturnNew,
2337                 HAS_1_TEMPLATE_PARAMS(typename, T),
2338                 AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
2339   return new T(p0, p1, p2, p3, p4, p5);
2340 }
2341 
2342 ACTION_TEMPLATE(ReturnNew,
2343                 HAS_1_TEMPLATE_PARAMS(typename, T),
2344                 AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
2345   return new T(p0, p1, p2, p3, p4, p5, p6);
2346 }
2347 
2348 ACTION_TEMPLATE(ReturnNew,
2349                 HAS_1_TEMPLATE_PARAMS(typename, T),
2350                 AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
2351   return new T(p0, p1, p2, p3, p4, p5, p6, p7);
2352 }
2353 
2354 ACTION_TEMPLATE(ReturnNew,
2355                 HAS_1_TEMPLATE_PARAMS(typename, T),
2356                 AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
2357   return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8);
2358 }
2359 
2360 ACTION_TEMPLATE(ReturnNew,
2361                 HAS_1_TEMPLATE_PARAMS(typename, T),
2362                 AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
2363   return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
2364 }
2365 
2366 #ifdef _MSC_VER
2367 # pragma warning(pop)
2368 #endif
2369 
2370 }  // namespace testing
2371 
2372 // Include any custom actions added by the local installation.
2373 // We must include this header at the end to make sure it can use the
2374 // declarations from this file.
2375 #include "gmock/internal/custom/gmock-generated-actions.h"
2376 
2377 #endif  // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_