ut: sync with gtest branch
[platform/core/uifw/libtdm.git] / ut / gtest / googlemock / include / gmock / gmock-generated-actions.h
1 // This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
2
3 // Copyright 2007, Google Inc.
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
8 // met:
9 //
10 //     * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 //     * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following disclaimer
14 // in the documentation and/or other materials provided with the
15 // distribution.
16 //     * Neither the name of Google Inc. nor the names of its
17 // contributors may be used to endorse or promote products derived from
18 // this software without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 //
32 // Author: wan@google.com (Zhanyong Wan)
33
34 // Google Mock - a framework for writing C++ mock classes.
35 //
36 // This file implements some commonly used variadic actions.
37
38 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
39 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
40
41 #include "gmock/gmock-actions.h"
42 #include "gmock/internal/gmock-port.h"
43
44 namespace testing {
45 namespace internal {
46
47 // InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
48 // function or method with the unpacked values, where F is a function
49 // type that takes N arguments.
50 template <typename Result, typename ArgumentTuple>
51 class InvokeHelper;
52
53 template <typename R>
54 class InvokeHelper<R, ::testing::tuple<> > {
55  public:
56   template <typename Function>
57   static R Invoke(Function function, const ::testing::tuple<>&) {
58            return function();
59   }
60
61   template <class Class, typename MethodPtr>
62   static R InvokeMethod(Class* obj_ptr,
63                         MethodPtr method_ptr,
64                         const ::testing::tuple<>&) {
65            return (obj_ptr->*method_ptr)();
66   }
67 };
68
69 template <typename R, typename A1>
70 class InvokeHelper<R, ::testing::tuple<A1> > {
71  public:
72   template <typename Function>
73   static R Invoke(Function function, const ::testing::tuple<A1>& args) {
74            return function(get<0>(args));
75   }
76
77   template <class Class, typename MethodPtr>
78   static R InvokeMethod(Class* obj_ptr,
79                         MethodPtr method_ptr,
80                         const ::testing::tuple<A1>& args) {
81            return (obj_ptr->*method_ptr)(get<0>(args));
82   }
83 };
84
85 template <typename R, typename A1, typename A2>
86 class InvokeHelper<R, ::testing::tuple<A1, A2> > {
87  public:
88   template <typename Function>
89   static R Invoke(Function function, const ::testing::tuple<A1, A2>& args) {
90            return function(get<0>(args), get<1>(args));
91   }
92
93   template <class Class, typename MethodPtr>
94   static R InvokeMethod(Class* obj_ptr,
95                         MethodPtr method_ptr,
96                         const ::testing::tuple<A1, A2>& args) {
97            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
98   }
99 };
100
101 template <typename R, typename A1, typename A2, typename A3>
102 class InvokeHelper<R, ::testing::tuple<A1, A2, A3> > {
103  public:
104   template <typename Function>
105   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3>& args) {
106            return function(get<0>(args), get<1>(args), get<2>(args));
107   }
108
109   template <class Class, typename MethodPtr>
110   static R InvokeMethod(Class* obj_ptr,
111                         MethodPtr method_ptr,
112                         const ::testing::tuple<A1, A2, A3>& args) {
113            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
114                get<2>(args));
115   }
116 };
117
118 template <typename R, typename A1, typename A2, typename A3, typename A4>
119 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4> > {
120  public:
121   template <typename Function>
122   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3,
123       A4>& args) {
124            return function(get<0>(args), get<1>(args), get<2>(args),
125                get<3>(args));
126   }
127
128   template <class Class, typename MethodPtr>
129   static R InvokeMethod(Class* obj_ptr,
130                         MethodPtr method_ptr,
131                         const ::testing::tuple<A1, A2, A3, A4>& args) {
132            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
133                get<2>(args), get<3>(args));
134   }
135 };
136
137 template <typename R, typename A1, typename A2, typename A3, typename A4,
138     typename A5>
139 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5> > {
140  public:
141   template <typename Function>
142   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4,
143       A5>& args) {
144            return function(get<0>(args), get<1>(args), get<2>(args),
145                get<3>(args), get<4>(args));
146   }
147
148   template <class Class, typename MethodPtr>
149   static R InvokeMethod(Class* obj_ptr,
150                         MethodPtr method_ptr,
151                         const ::testing::tuple<A1, A2, A3, A4, A5>& args) {
152            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
153                get<2>(args), get<3>(args), get<4>(args));
154   }
155 };
156
157 template <typename R, typename A1, typename A2, typename A3, typename A4,
158     typename A5, typename A6>
159 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
160  public:
161   template <typename Function>
162   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
163       A6>& args) {
164            return function(get<0>(args), get<1>(args), get<2>(args),
165                get<3>(args), get<4>(args), get<5>(args));
166   }
167
168   template <class Class, typename MethodPtr>
169   static R InvokeMethod(Class* obj_ptr,
170                         MethodPtr method_ptr,
171                         const ::testing::tuple<A1, A2, A3, A4, A5, A6>& args) {
172            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
173                get<2>(args), get<3>(args), get<4>(args), get<5>(args));
174   }
175 };
176
177 template <typename R, typename A1, typename A2, typename A3, typename A4,
178     typename A5, typename A6, typename A7>
179 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
180  public:
181   template <typename Function>
182   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
183       A6, A7>& args) {
184            return function(get<0>(args), get<1>(args), get<2>(args),
185                get<3>(args), get<4>(args), get<5>(args), get<6>(args));
186   }
187
188   template <class Class, typename MethodPtr>
189   static R InvokeMethod(Class* obj_ptr,
190                         MethodPtr method_ptr,
191                         const ::testing::tuple<A1, A2, A3, A4, A5, A6,
192                             A7>& args) {
193            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
194                get<2>(args), get<3>(args), get<4>(args), get<5>(args),
195                get<6>(args));
196   }
197 };
198
199 template <typename R, typename A1, typename A2, typename A3, typename A4,
200     typename A5, typename A6, typename A7, typename A8>
201 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
202  public:
203   template <typename Function>
204   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
205       A6, A7, A8>& args) {
206            return function(get<0>(args), get<1>(args), get<2>(args),
207                get<3>(args), get<4>(args), get<5>(args), get<6>(args),
208                get<7>(args));
209   }
210
211   template <class Class, typename MethodPtr>
212   static R InvokeMethod(Class* obj_ptr,
213                         MethodPtr method_ptr,
214                         const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7,
215                             A8>& args) {
216            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
217                get<2>(args), get<3>(args), get<4>(args), get<5>(args),
218                get<6>(args), get<7>(args));
219   }
220 };
221
222 template <typename R, typename A1, typename A2, typename A3, typename A4,
223     typename A5, typename A6, typename A7, typename A8, typename A9>
224 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
225  public:
226   template <typename Function>
227   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
228       A6, A7, A8, A9>& args) {
229            return function(get<0>(args), get<1>(args), get<2>(args),
230                get<3>(args), get<4>(args), get<5>(args), get<6>(args),
231                get<7>(args), get<8>(args));
232   }
233
234   template <class Class, typename MethodPtr>
235   static R InvokeMethod(Class* obj_ptr,
236                         MethodPtr method_ptr,
237                         const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
238                             A9>& args) {
239            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
240                get<2>(args), get<3>(args), get<4>(args), get<5>(args),
241                get<6>(args), get<7>(args), get<8>(args));
242   }
243 };
244
245 template <typename R, typename A1, typename A2, typename A3, typename A4,
246     typename A5, typename A6, typename A7, typename A8, typename A9,
247     typename A10>
248 class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
249     A10> > {
250  public:
251   template <typename Function>
252   static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
253       A6, A7, A8, A9, A10>& args) {
254            return function(get<0>(args), get<1>(args), get<2>(args),
255                get<3>(args), get<4>(args), get<5>(args), get<6>(args),
256                get<7>(args), get<8>(args), get<9>(args));
257   }
258
259   template <class Class, typename MethodPtr>
260   static R InvokeMethod(Class* obj_ptr,
261                         MethodPtr method_ptr,
262                         const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
263                             A9, A10>& args) {
264            return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
265                get<2>(args), get<3>(args), get<4>(args), get<5>(args),
266                get<6>(args), get<7>(args), get<8>(args), get<9>(args));
267   }
268 };
269
270 // An INTERNAL macro for extracting the type of a tuple field.  It's
271 // subject to change without notice - DO NOT USE IN USER CODE!
272 #define GMOCK_FIELD_(Tuple, N) \
273     typename ::testing::tuple_element<N, Tuple>::type
274
275 // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
276 // type of an n-ary function whose i-th (1-based) argument type is the
277 // k{i}-th (0-based) field of ArgumentTuple, which must be a tuple
278 // type, and whose return type is Result.  For example,
279 //   SelectArgs<int, ::testing::tuple<bool, char, double, long>, 0, 3>::type
280 // is int(bool, long).
281 //
282 // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
283 // returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
284 // For example,
285 //   SelectArgs<int, tuple<bool, char, double>, 2, 0>::Select(
286 //       ::testing::make_tuple(true, 'a', 2.5))
287 // returns tuple (2.5, true).
288 //
289 // The numbers in list k1, k2, ..., k_n must be >= 0, where n can be
290 // in the range [0, 10].  Duplicates are allowed and they don't have
291 // to be in an ascending or descending order.
292
293 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
294     int k4, int k5, int k6, int k7, int k8, int k9, int k10>
295 class SelectArgs {
296  public:
297   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
298       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
299       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
300       GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
301       GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9),
302       GMOCK_FIELD_(ArgumentTuple, k10));
303   typedef typename Function<type>::ArgumentTuple SelectedArgs;
304   static SelectedArgs Select(const ArgumentTuple& args) {
305     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
306         get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
307         get<k8>(args), get<k9>(args), get<k10>(args));
308   }
309 };
310
311 template <typename Result, typename ArgumentTuple>
312 class SelectArgs<Result, ArgumentTuple,
313                  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
314  public:
315   typedef Result type();
316   typedef typename Function<type>::ArgumentTuple SelectedArgs;
317   static SelectedArgs Select(const ArgumentTuple& /* args */) {
318     return SelectedArgs();
319   }
320 };
321
322 template <typename Result, typename ArgumentTuple, int k1>
323 class SelectArgs<Result, ArgumentTuple,
324                  k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
325  public:
326   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1));
327   typedef typename Function<type>::ArgumentTuple SelectedArgs;
328   static SelectedArgs Select(const ArgumentTuple& args) {
329     return SelectedArgs(get<k1>(args));
330   }
331 };
332
333 template <typename Result, typename ArgumentTuple, int k1, int k2>
334 class SelectArgs<Result, ArgumentTuple,
335                  k1, k2, -1, -1, -1, -1, -1, -1, -1, -1> {
336  public:
337   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
338       GMOCK_FIELD_(ArgumentTuple, k2));
339   typedef typename Function<type>::ArgumentTuple SelectedArgs;
340   static SelectedArgs Select(const ArgumentTuple& args) {
341     return SelectedArgs(get<k1>(args), get<k2>(args));
342   }
343 };
344
345 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3>
346 class SelectArgs<Result, ArgumentTuple,
347                  k1, k2, k3, -1, -1, -1, -1, -1, -1, -1> {
348  public:
349   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
350       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3));
351   typedef typename Function<type>::ArgumentTuple SelectedArgs;
352   static SelectedArgs Select(const ArgumentTuple& args) {
353     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args));
354   }
355 };
356
357 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
358     int k4>
359 class SelectArgs<Result, ArgumentTuple,
360                  k1, k2, k3, k4, -1, -1, -1, -1, -1, -1> {
361  public:
362   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
363       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
364       GMOCK_FIELD_(ArgumentTuple, k4));
365   typedef typename Function<type>::ArgumentTuple SelectedArgs;
366   static SelectedArgs Select(const ArgumentTuple& args) {
367     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
368         get<k4>(args));
369   }
370 };
371
372 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
373     int k4, int k5>
374 class SelectArgs<Result, ArgumentTuple,
375                  k1, k2, k3, k4, k5, -1, -1, -1, -1, -1> {
376  public:
377   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
378       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
379       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5));
380   typedef typename Function<type>::ArgumentTuple SelectedArgs;
381   static SelectedArgs Select(const ArgumentTuple& args) {
382     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
383         get<k4>(args), get<k5>(args));
384   }
385 };
386
387 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
388     int k4, int k5, int k6>
389 class SelectArgs<Result, ArgumentTuple,
390                  k1, k2, k3, k4, k5, k6, -1, -1, -1, -1> {
391  public:
392   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
393       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
394       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
395       GMOCK_FIELD_(ArgumentTuple, k6));
396   typedef typename Function<type>::ArgumentTuple SelectedArgs;
397   static SelectedArgs Select(const ArgumentTuple& args) {
398     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
399         get<k4>(args), get<k5>(args), get<k6>(args));
400   }
401 };
402
403 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
404     int k4, int k5, int k6, int k7>
405 class SelectArgs<Result, ArgumentTuple,
406                  k1, k2, k3, k4, k5, k6, k7, -1, -1, -1> {
407  public:
408   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
409       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
410       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
411       GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7));
412   typedef typename Function<type>::ArgumentTuple SelectedArgs;
413   static SelectedArgs Select(const ArgumentTuple& args) {
414     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
415         get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args));
416   }
417 };
418
419 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
420     int k4, int k5, int k6, int k7, int k8>
421 class SelectArgs<Result, ArgumentTuple,
422                  k1, k2, k3, k4, k5, k6, k7, k8, -1, -1> {
423  public:
424   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
425       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
426       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
427       GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
428       GMOCK_FIELD_(ArgumentTuple, k8));
429   typedef typename Function<type>::ArgumentTuple SelectedArgs;
430   static SelectedArgs Select(const ArgumentTuple& args) {
431     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
432         get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
433         get<k8>(args));
434   }
435 };
436
437 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
438     int k4, int k5, int k6, int k7, int k8, int k9>
439 class SelectArgs<Result, ArgumentTuple,
440                  k1, k2, k3, k4, k5, k6, k7, k8, k9, -1> {
441  public:
442   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
443       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
444       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
445       GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
446       GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9));
447   typedef typename Function<type>::ArgumentTuple SelectedArgs;
448   static SelectedArgs Select(const ArgumentTuple& args) {
449     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
450         get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
451         get<k8>(args), get<k9>(args));
452   }
453 };
454
455 #undef GMOCK_FIELD_
456
457 // Implements the WithArgs action.
458 template <typename InnerAction, int k1 = -1, int k2 = -1, int k3 = -1,
459     int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
460     int k9 = -1, int k10 = -1>
461 class WithArgsAction {
462  public:
463   explicit WithArgsAction(const InnerAction& action) : action_(action) {}
464
465   template <typename F>
466   operator Action<F>() const { return MakeAction(new Impl<F>(action_)); }
467
468  private:
469   template <typename F>
470   class Impl : public ActionInterface<F> {
471    public:
472     typedef typename Function<F>::Result Result;
473     typedef typename Function<F>::ArgumentTuple ArgumentTuple;
474
475     explicit Impl(const InnerAction& action) : action_(action) {}
476
477     virtual Result Perform(const ArgumentTuple& args) {
478       return action_.Perform(SelectArgs<Result, ArgumentTuple, k1, k2, k3, k4,
479           k5, k6, k7, k8, k9, k10>::Select(args));
480     }
481
482    private:
483     typedef typename SelectArgs<Result, ArgumentTuple,
484         k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType;
485
486     Action<InnerFunctionType> action_;
487   };
488
489   const InnerAction action_;
490
491   GTEST_DISALLOW_ASSIGN_(WithArgsAction);
492 };
493
494 // A macro from the ACTION* family (defined later in this file)
495 // defines an action that can be used in a mock function.  Typically,
496 // these actions only care about a subset of the arguments of the mock
497 // function.  For example, if such an action only uses the second
498 // argument, it can be used in any mock function that takes >= 2
499 // arguments where the type of the second argument is compatible.
500 //
501 // Therefore, the action implementation must be prepared to take more
502 // arguments than it needs.  The ExcessiveArg type is used to
503 // represent those excessive arguments.  In order to keep the compiler
504 // error messages tractable, we define it in the testing namespace
505 // instead of testing::internal.  However, this is an INTERNAL TYPE
506 // and subject to change without notice, so a user MUST NOT USE THIS
507 // TYPE DIRECTLY.
508 struct ExcessiveArg {};
509
510 // A helper class needed for implementing the ACTION* macros.
511 template <typename Result, class Impl>
512 class ActionHelper {
513  public:
514   static Result Perform(Impl* impl, const ::testing::tuple<>& args) {
515     return impl->template gmock_PerformImpl<>(args, ExcessiveArg(),
516         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
517         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
518         ExcessiveArg());
519   }
520
521   template <typename A0>
522   static Result Perform(Impl* impl, const ::testing::tuple<A0>& args) {
523     return impl->template gmock_PerformImpl<A0>(args, get<0>(args),
524         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
525         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
526         ExcessiveArg());
527   }
528
529   template <typename A0, typename A1>
530   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1>& args) {
531     return impl->template gmock_PerformImpl<A0, A1>(args, get<0>(args),
532         get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
533         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
534         ExcessiveArg());
535   }
536
537   template <typename A0, typename A1, typename A2>
538   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2>& args) {
539     return impl->template gmock_PerformImpl<A0, A1, A2>(args, get<0>(args),
540         get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(),
541         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
542         ExcessiveArg());
543   }
544
545   template <typename A0, typename A1, typename A2, typename A3>
546   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2,
547       A3>& args) {
548     return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, get<0>(args),
549         get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(),
550         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
551         ExcessiveArg());
552   }
553
554   template <typename A0, typename A1, typename A2, typename A3, typename A4>
555   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3,
556       A4>& args) {
557     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args,
558         get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
559         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
560         ExcessiveArg());
561   }
562
563   template <typename A0, typename A1, typename A2, typename A3, typename A4,
564       typename A5>
565   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
566       A5>& args) {
567     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args,
568         get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
569         get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
570         ExcessiveArg());
571   }
572
573   template <typename A0, typename A1, typename A2, typename A3, typename A4,
574       typename A5, typename A6>
575   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
576       A5, A6>& args) {
577     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args,
578         get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
579         get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(),
580         ExcessiveArg());
581   }
582
583   template <typename A0, typename A1, typename A2, typename A3, typename A4,
584       typename A5, typename A6, typename A7>
585   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
586       A5, A6, A7>& args) {
587     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6,
588         A7>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
589         get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(),
590         ExcessiveArg());
591   }
592
593   template <typename A0, typename A1, typename A2, typename A3, typename A4,
594       typename A5, typename A6, typename A7, typename A8>
595   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
596       A5, A6, A7, A8>& args) {
597     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7,
598         A8>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
599         get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
600         ExcessiveArg());
601   }
602
603   template <typename A0, typename A1, typename A2, typename A3, typename A4,
604       typename A5, typename A6, typename A7, typename A8, typename A9>
605   static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
606       A5, A6, A7, A8, A9>& args) {
607     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8,
608         A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
609         get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
610         get<9>(args));
611   }
612 };
613
614 }  // namespace internal
615
616 // Various overloads for Invoke().
617
618 // WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes
619 // the selected arguments of the mock function to an_action and
620 // performs it.  It serves as an adaptor between actions with
621 // different argument lists.  C++ doesn't support default arguments for
622 // function templates, so we have to overload it.
623 template <int k1, typename InnerAction>
624 inline internal::WithArgsAction<InnerAction, k1>
625 WithArgs(const InnerAction& action) {
626   return internal::WithArgsAction<InnerAction, k1>(action);
627 }
628
629 template <int k1, int k2, typename InnerAction>
630 inline internal::WithArgsAction<InnerAction, k1, k2>
631 WithArgs(const InnerAction& action) {
632   return internal::WithArgsAction<InnerAction, k1, k2>(action);
633 }
634
635 template <int k1, int k2, int k3, typename InnerAction>
636 inline internal::WithArgsAction<InnerAction, k1, k2, k3>
637 WithArgs(const InnerAction& action) {
638   return internal::WithArgsAction<InnerAction, k1, k2, k3>(action);
639 }
640
641 template <int k1, int k2, int k3, int k4, typename InnerAction>
642 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4>
643 WithArgs(const InnerAction& action) {
644   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4>(action);
645 }
646
647 template <int k1, int k2, int k3, int k4, int k5, typename InnerAction>
648 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>
649 WithArgs(const InnerAction& action) {
650   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>(action);
651 }
652
653 template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerAction>
654 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>
655 WithArgs(const InnerAction& action) {
656   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>(action);
657 }
658
659 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
660     typename InnerAction>
661 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7>
662 WithArgs(const InnerAction& action) {
663   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6,
664       k7>(action);
665 }
666
667 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
668     typename InnerAction>
669 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8>
670 WithArgs(const InnerAction& action) {
671   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7,
672       k8>(action);
673 }
674
675 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
676     int k9, typename InnerAction>
677 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, k9>
678 WithArgs(const InnerAction& action) {
679   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
680       k9>(action);
681 }
682
683 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
684     int k9, int k10, typename InnerAction>
685 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
686     k9, k10>
687 WithArgs(const InnerAction& action) {
688   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
689       k9, k10>(action);
690 }
691
692 // Creates an action that does actions a1, a2, ..., sequentially in
693 // each invocation.
694 template <typename Action1, typename Action2>
695 inline internal::DoBothAction<Action1, Action2>
696 DoAll(Action1 a1, Action2 a2) {
697   return internal::DoBothAction<Action1, Action2>(a1, a2);
698 }
699
700 template <typename Action1, typename Action2, typename Action3>
701 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
702     Action3> >
703 DoAll(Action1 a1, Action2 a2, Action3 a3) {
704   return DoAll(a1, DoAll(a2, a3));
705 }
706
707 template <typename Action1, typename Action2, typename Action3,
708     typename Action4>
709 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
710     internal::DoBothAction<Action3, Action4> > >
711 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) {
712   return DoAll(a1, DoAll(a2, a3, a4));
713 }
714
715 template <typename Action1, typename Action2, typename Action3,
716     typename Action4, typename Action5>
717 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
718     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
719     Action5> > > >
720 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) {
721   return DoAll(a1, DoAll(a2, a3, a4, a5));
722 }
723
724 template <typename Action1, typename Action2, typename Action3,
725     typename Action4, typename Action5, typename Action6>
726 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
727     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
728     internal::DoBothAction<Action5, Action6> > > > >
729 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) {
730   return DoAll(a1, DoAll(a2, a3, a4, a5, a6));
731 }
732
733 template <typename Action1, typename Action2, typename Action3,
734     typename Action4, typename Action5, typename Action6, typename Action7>
735 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
736     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
737     internal::DoBothAction<Action5, internal::DoBothAction<Action6,
738     Action7> > > > > >
739 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
740     Action7 a7) {
741   return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7));
742 }
743
744 template <typename Action1, typename Action2, typename Action3,
745     typename Action4, typename Action5, typename Action6, typename Action7,
746     typename Action8>
747 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
748     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
749     internal::DoBothAction<Action5, internal::DoBothAction<Action6,
750     internal::DoBothAction<Action7, Action8> > > > > > >
751 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
752     Action7 a7, Action8 a8) {
753   return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8));
754 }
755
756 template <typename Action1, typename Action2, typename Action3,
757     typename Action4, typename Action5, typename Action6, typename Action7,
758     typename Action8, typename Action9>
759 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
760     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
761     internal::DoBothAction<Action5, internal::DoBothAction<Action6,
762     internal::DoBothAction<Action7, internal::DoBothAction<Action8,
763     Action9> > > > > > > >
764 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
765     Action7 a7, Action8 a8, Action9 a9) {
766   return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9));
767 }
768
769 template <typename Action1, typename Action2, typename Action3,
770     typename Action4, typename Action5, typename Action6, typename Action7,
771     typename Action8, typename Action9, typename Action10>
772 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
773     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
774     internal::DoBothAction<Action5, internal::DoBothAction<Action6,
775     internal::DoBothAction<Action7, internal::DoBothAction<Action8,
776     internal::DoBothAction<Action9, Action10> > > > > > > > >
777 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
778     Action7 a7, Action8 a8, Action9 a9, Action10 a10) {
779   return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10));
780 }
781
782 }  // namespace testing
783
784 // The ACTION* family of macros can be used in a namespace scope to
785 // define custom actions easily.  The syntax:
786 //
787 //   ACTION(name) { statements; }
788 //
789 // will define an action with the given name that executes the
790 // statements.  The value returned by the statements will be used as
791 // the return value of the action.  Inside the statements, you can
792 // refer to the K-th (0-based) argument of the mock function by
793 // 'argK', and refer to its type by 'argK_type'.  For example:
794 //
795 //   ACTION(IncrementArg1) {
796 //     arg1_type temp = arg1;
797 //     return ++(*temp);
798 //   }
799 //
800 // allows you to write
801 //
802 //   ...WillOnce(IncrementArg1());
803 //
804 // You can also refer to the entire argument tuple and its type by
805 // 'args' and 'args_type', and refer to the mock function type and its
806 // return type by 'function_type' and 'return_type'.
807 //
808 // Note that you don't need to specify the types of the mock function
809 // arguments.  However rest assured that your code is still type-safe:
810 // you'll get a compiler error if *arg1 doesn't support the ++
811 // operator, or if the type of ++(*arg1) isn't compatible with the
812 // mock function's return type, for example.
813 //
814 // Sometimes you'll want to parameterize the action.   For that you can use
815 // another macro:
816 //
817 //   ACTION_P(name, param_name) { statements; }
818 //
819 // For example:
820 //
821 //   ACTION_P(Add, n) { return arg0 + n; }
822 //
823 // will allow you to write:
824 //
825 //   ...WillOnce(Add(5));
826 //
827 // Note that you don't need to provide the type of the parameter
828 // either.  If you need to reference the type of a parameter named
829 // 'foo', you can write 'foo_type'.  For example, in the body of
830 // ACTION_P(Add, n) above, you can write 'n_type' to refer to the type
831 // of 'n'.
832 //
833 // We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support
834 // multi-parameter actions.
835 //
836 // For the purpose of typing, you can view
837 //
838 //   ACTION_Pk(Foo, p1, ..., pk) { ... }
839 //
840 // as shorthand for
841 //
842 //   template <typename p1_type, ..., typename pk_type>
843 //   FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
844 //
845 // In particular, you can provide the template type arguments
846 // explicitly when invoking Foo(), as in Foo<long, bool>(5, false);
847 // although usually you can rely on the compiler to infer the types
848 // for you automatically.  You can assign the result of expression
849 // Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ...,
850 // pk_type>.  This can be useful when composing actions.
851 //
852 // You can also overload actions with different numbers of parameters:
853 //
854 //   ACTION_P(Plus, a) { ... }
855 //   ACTION_P2(Plus, a, b) { ... }
856 //
857 // While it's tempting to always use the ACTION* macros when defining
858 // a new action, you should also consider implementing ActionInterface
859 // or using MakePolymorphicAction() instead, especially if you need to
860 // use the action a lot.  While these approaches require more work,
861 // they give you more control on the types of the mock function
862 // arguments and the action parameters, which in general leads to
863 // better compiler error messages that pay off in the long run.  They
864 // also allow overloading actions based on parameter types (as opposed
865 // to just based on the number of parameters).
866 //
867 // CAVEAT:
868 //
869 // ACTION*() can only be used in a namespace scope.  The reason is
870 // that C++ doesn't yet allow function-local types to be used to
871 // instantiate templates.  The up-coming C++0x standard will fix this.
872 // Once that's done, we'll consider supporting using ACTION*() inside
873 // a function.
874 //
875 // MORE INFORMATION:
876 //
877 // To learn more about using these macros, please search for 'ACTION'
878 // on http://code.google.com/p/googlemock/wiki/CookBook.
879
880 // An internal macro needed for implementing ACTION*().
881 #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\
882     const args_type& args GTEST_ATTRIBUTE_UNUSED_, \
883     arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_, \
884     arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_, \
885     arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_, \
886     arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_, \
887     arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_, \
888     arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_, \
889     arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_, \
890     arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_, \
891     arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_, \
892     arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_
893
894 // Sometimes you want to give an action explicit template parameters
895 // that cannot be inferred from its value parameters.  ACTION() and
896 // ACTION_P*() don't support that.  ACTION_TEMPLATE() remedies that
897 // and can be viewed as an extension to ACTION() and ACTION_P*().
898 //
899 // The syntax:
900 //
901 //   ACTION_TEMPLATE(ActionName,
902 //                   HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m),
903 //                   AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; }
904 //
905 // defines an action template that takes m explicit template
906 // parameters and n value parameters.  name_i is the name of the i-th
907 // template parameter, and kind_i specifies whether it's a typename,
908 // an integral constant, or a template.  p_i is the name of the i-th
909 // value parameter.
910 //
911 // Example:
912 //
913 //   // DuplicateArg<k, T>(output) converts the k-th argument of the mock
914 //   // function to type T and copies it to *output.
915 //   ACTION_TEMPLATE(DuplicateArg,
916 //                   HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
917 //                   AND_1_VALUE_PARAMS(output)) {
918 //     *output = T(::testing::get<k>(args));
919 //   }
920 //   ...
921 //     int n;
922 //     EXPECT_CALL(mock, Foo(_, _))
923 //         .WillOnce(DuplicateArg<1, unsigned char>(&n));
924 //
925 // To create an instance of an action template, write:
926 //
927 //   ActionName<t1, ..., t_m>(v1, ..., v_n)
928 //
929 // where the ts are the template arguments and the vs are the value
930 // arguments.  The value argument types are inferred by the compiler.
931 // If you want to explicitly specify the value argument types, you can
932 // provide additional template arguments:
933 //
934 //   ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n)
935 //
936 // where u_i is the desired type of v_i.
937 //
938 // ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the
939 // number of value parameters, but not on the number of template
940 // parameters.  Without the restriction, the meaning of the following
941 // is unclear:
942 //
943 //   OverloadedAction<int, bool>(x);
944 //
945 // Are we using a single-template-parameter action where 'bool' refers
946 // to the type of x, or are we using a two-template-parameter action
947 // where the compiler is asked to infer the type of x?
948 //
949 // Implementation notes:
950 //
951 // GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and
952 // GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for
953 // implementing ACTION_TEMPLATE.  The main trick we use is to create
954 // new macro invocations when expanding a macro.  For example, we have
955 //
956 //   #define ACTION_TEMPLATE(name, template_params, value_params)
957 //       ... GMOCK_INTERNAL_DECL_##template_params ...
958 //
959 // which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...)
960 // to expand to
961 //
962 //       ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ...
963 //
964 // Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the
965 // preprocessor will continue to expand it to
966 //
967 //       ... typename T ...
968 //
969 // This technique conforms to the C++ standard and is portable.  It
970 // allows us to implement action templates using O(N) code, where N is
971 // the maximum number of template/value parameters supported.  Without
972 // using it, we'd have to devote O(N^2) amount of code to implement all
973 // combinations of m and n.
974
975 // Declares the template parameters.
976 #define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0
977 #define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
978     name1) kind0 name0, kind1 name1
979 #define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
980     kind2, name2) kind0 name0, kind1 name1, kind2 name2
981 #define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
982     kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \
983     kind3 name3
984 #define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
985     kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \
986     kind2 name2, kind3 name3, kind4 name4
987 #define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
988     kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \
989     kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5
990 #define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
991     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
992     name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \
993     kind5 name5, kind6 name6
994 #define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
995     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
996     kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \
997     kind4 name4, kind5 name5, kind6 name6, kind7 name7
998 #define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
999     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_