Bump to gtest 1.10.0
[platform/upstream/gtest.git] / googlemock / include / gmock / gmock-generated-actions.h
1 // This file was GENERATED by command:
2 //     pump.py gmock-generated-actions.h.pump
3 // DO NOT EDIT BY HAND!!!
4
5 // Copyright 2007, Google Inc.
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions are
10 // met:
11 //
12 //     * Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 //     * Redistributions in binary form must reproduce the above
15 // copyright notice, this list of conditions and the following disclaimer
16 // in the documentation and/or other materials provided with the
17 // distribution.
18 //     * Neither the name of Google Inc. nor the names of its
19 // contributors may be used to endorse or promote products derived from
20 // this software without specific prior written permission.
21 //
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34
35 // Google Mock - a framework for writing C++ mock classes.
36 //
37 // This file implements some commonly used variadic actions.
38
39 // GOOGLETEST_CM0002 DO NOT DELETE
40
41 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
42 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
43
44 #include <memory>
45 #include <utility>
46
47 #include "gmock/gmock-actions.h"
48 #include "gmock/internal/gmock-port.h"
49
50 namespace testing {
51 namespace internal {
52
53 // A macro from the ACTION* family (defined later in this file)
54 // defines an action that can be used in a mock function.  Typically,
55 // these actions only care about a subset of the arguments of the mock
56 // function.  For example, if such an action only uses the second
57 // argument, it can be used in any mock function that takes >= 2
58 // arguments where the type of the second argument is compatible.
59 //
60 // Therefore, the action implementation must be prepared to take more
61 // arguments than it needs.  The ExcessiveArg type is used to
62 // represent those excessive arguments.  In order to keep the compiler
63 // error messages tractable, we define it in the testing namespace
64 // instead of testing::internal.  However, this is an INTERNAL TYPE
65 // and subject to change without notice, so a user MUST NOT USE THIS
66 // TYPE DIRECTLY.
67 struct ExcessiveArg {};
68
69 // A helper class needed for implementing the ACTION* macros.
70 template <typename Result, class Impl>
71 class ActionHelper {
72  public:
73   static Result Perform(Impl* impl, const ::std::tuple<>& args) {
74     return impl->template gmock_PerformImpl<>(args, ExcessiveArg(),
75         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
76         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
77         ExcessiveArg());
78   }
79
80   template <typename A0>
81   static Result Perform(Impl* impl, const ::std::tuple<A0>& args) {
82     return impl->template gmock_PerformImpl<A0>(args, std::get<0>(args),
83         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
84         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
85         ExcessiveArg());
86   }
87
88   template <typename A0, typename A1>
89   static Result Perform(Impl* impl, const ::std::tuple<A0, A1>& args) {
90     return impl->template gmock_PerformImpl<A0, A1>(args, std::get<0>(args),
91         std::get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
92         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
93         ExcessiveArg());
94   }
95
96   template <typename A0, typename A1, typename A2>
97   static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2>& args) {
98     return impl->template gmock_PerformImpl<A0, A1, A2>(args,
99         std::get<0>(args), std::get<1>(args), std::get<2>(args),
100         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
101         ExcessiveArg(), ExcessiveArg(), ExcessiveArg());
102   }
103
104   template <typename A0, typename A1, typename A2, typename A3>
105   static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3>& args) {
106     return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args,
107         std::get<0>(args), std::get<1>(args), std::get<2>(args),
108         std::get<3>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
109         ExcessiveArg(), ExcessiveArg(), ExcessiveArg());
110   }
111
112   template <typename A0, typename A1, typename A2, typename A3, typename A4>
113   static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3,
114       A4>& args) {
115     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args,
116         std::get<0>(args), std::get<1>(args), std::get<2>(args),
117         std::get<3>(args), std::get<4>(args), ExcessiveArg(), ExcessiveArg(),
118         ExcessiveArg(), ExcessiveArg(), ExcessiveArg());
119   }
120
121   template <typename A0, typename A1, typename A2, typename A3, typename A4,
122       typename A5>
123   static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3, A4,
124       A5>& args) {
125     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args,
126         std::get<0>(args), std::get<1>(args), std::get<2>(args),
127         std::get<3>(args), std::get<4>(args), std::get<5>(args),
128         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg());
129   }
130
131   template <typename A0, typename A1, typename A2, typename A3, typename A4,
132       typename A5, typename A6>
133   static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3, A4, A5,
134       A6>& args) {
135     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args,
136         std::get<0>(args), std::get<1>(args), std::get<2>(args),
137         std::get<3>(args), std::get<4>(args), std::get<5>(args),
138         std::get<6>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg());
139   }
140
141   template <typename A0, typename A1, typename A2, typename A3, typename A4,
142       typename A5, typename A6, typename A7>
143   static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3, A4, A5,
144       A6, A7>& args) {
145     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6,
146         A7>(args, std::get<0>(args), std::get<1>(args), std::get<2>(args),
147         std::get<3>(args), std::get<4>(args), std::get<5>(args),
148         std::get<6>(args), std::get<7>(args), ExcessiveArg(), ExcessiveArg());
149   }
150
151   template <typename A0, typename A1, typename A2, typename A3, typename A4,
152       typename A5, typename A6, typename A7, typename A8>
153   static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3, A4, A5,
154       A6, A7, A8>& args) {
155     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7,
156         A8>(args, std::get<0>(args), std::get<1>(args), std::get<2>(args),
157         std::get<3>(args), std::get<4>(args), std::get<5>(args),
158         std::get<6>(args), std::get<7>(args), std::get<8>(args),
159         ExcessiveArg());
160   }
161
162   template <typename A0, typename A1, typename A2, typename A3, typename A4,
163       typename A5, typename A6, typename A7, typename A8, typename A9>
164   static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3, A4, A5,
165       A6, A7, A8, A9>& args) {
166     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8,
167         A9>(args, std::get<0>(args), std::get<1>(args), std::get<2>(args),
168         std::get<3>(args), std::get<4>(args), std::get<5>(args),
169         std::get<6>(args), std::get<7>(args), std::get<8>(args),
170         std::get<9>(args));
171   }
172 };
173
174 }  // namespace internal
175 }  // namespace testing
176
177 // The ACTION* family of macros can be used in a namespace scope to
178 // define custom actions easily.  The syntax:
179 //
180 //   ACTION(name) { statements; }
181 //
182 // will define an action with the given name that executes the
183 // statements.  The value returned by the statements will be used as
184 // the return value of the action.  Inside the statements, you can
185 // refer to the K-th (0-based) argument of the mock function by
186 // 'argK', and refer to its type by 'argK_type'.  For example:
187 //
188 //   ACTION(IncrementArg1) {
189 //     arg1_type temp = arg1;
190 //     return ++(*temp);
191 //   }
192 //
193 // allows you to write
194 //
195 //   ...WillOnce(IncrementArg1());
196 //
197 // You can also refer to the entire argument tuple and its type by
198 // 'args' and 'args_type', and refer to the mock function type and its
199 // return type by 'function_type' and 'return_type'.
200 //
201 // Note that you don't need to specify the types of the mock function
202 // arguments.  However rest assured that your code is still type-safe:
203 // you'll get a compiler error if *arg1 doesn't support the ++
204 // operator, or if the type of ++(*arg1) isn't compatible with the
205 // mock function's return type, for example.
206 //
207 // Sometimes you'll want to parameterize the action.   For that you can use
208 // another macro:
209 //
210 //   ACTION_P(name, param_name) { statements; }
211 //
212 // For example:
213 //
214 //   ACTION_P(Add, n) { return arg0 + n; }
215 //
216 // will allow you to write:
217 //
218 //   ...WillOnce(Add(5));
219 //
220 // Note that you don't need to provide the type of the parameter
221 // either.  If you need to reference the type of a parameter named
222 // 'foo', you can write 'foo_type'.  For example, in the body of
223 // ACTION_P(Add, n) above, you can write 'n_type' to refer to the type
224 // of 'n'.
225 //
226 // We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support
227 // multi-parameter actions.
228 //
229 // For the purpose of typing, you can view
230 //
231 //   ACTION_Pk(Foo, p1, ..., pk) { ... }
232 //
233 // as shorthand for
234 //
235 //   template <typename p1_type, ..., typename pk_type>
236 //   FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
237 //
238 // In particular, you can provide the template type arguments
239 // explicitly when invoking Foo(), as in Foo<long, bool>(5, false);
240 // although usually you can rely on the compiler to infer the types
241 // for you automatically.  You can assign the result of expression
242 // Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ...,
243 // pk_type>.  This can be useful when composing actions.
244 //
245 // You can also overload actions with different numbers of parameters:
246 //
247 //   ACTION_P(Plus, a) { ... }
248 //   ACTION_P2(Plus, a, b) { ... }
249 //
250 // While it's tempting to always use the ACTION* macros when defining
251 // a new action, you should also consider implementing ActionInterface
252 // or using MakePolymorphicAction() instead, especially if you need to
253 // use the action a lot.  While these approaches require more work,
254 // they give you more control on the types of the mock function
255 // arguments and the action parameters, which in general leads to
256 // better compiler error messages that pay off in the long run.  They
257 // also allow overloading actions based on parameter types (as opposed
258 // to just based on the number of parameters).
259 //
260 // CAVEAT:
261 //
262 // ACTION*() can only be used in a namespace scope as templates cannot be
263 // declared inside of a local class.
264 // Users can, however, define any local functors (e.g. a lambda) that
265 // can be used as actions.
266 //
267 // MORE INFORMATION:
268 //
269 // To learn more about using these macros, please search for 'ACTION' on
270 // https://github.com/google/googletest/blob/master/googlemock/docs/cook_book.md
271
272 // An internal macro needed for implementing ACTION*().
273 #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\
274     const args_type& args GTEST_ATTRIBUTE_UNUSED_, \
275     const arg0_type& arg0 GTEST_ATTRIBUTE_UNUSED_, \
276     const arg1_type& arg1 GTEST_ATTRIBUTE_UNUSED_, \
277     const arg2_type& arg2 GTEST_ATTRIBUTE_UNUSED_, \
278     const arg3_type& arg3 GTEST_ATTRIBUTE_UNUSED_, \
279     const arg4_type& arg4 GTEST_ATTRIBUTE_UNUSED_, \
280     const arg5_type& arg5 GTEST_ATTRIBUTE_UNUSED_, \
281     const arg6_type& arg6 GTEST_ATTRIBUTE_UNUSED_, \
282     const arg7_type& arg7 GTEST_ATTRIBUTE_UNUSED_, \
283     const arg8_type& arg8 GTEST_ATTRIBUTE_UNUSED_, \
284     const arg9_type& arg9 GTEST_ATTRIBUTE_UNUSED_
285
286 // Sometimes you want to give an action explicit template parameters
287 // that cannot be inferred from its value parameters.  ACTION() and
288 // ACTION_P*() don't support that.  ACTION_TEMPLATE() remedies that
289 // and can be viewed as an extension to ACTION() and ACTION_P*().
290 //
291 // The syntax:
292 //
293 //   ACTION_TEMPLATE(ActionName,
294 //                   HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m),
295 //                   AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; }
296 //
297 // defines an action template that takes m explicit template
298 // parameters and n value parameters.  name_i is the name of the i-th
299 // template parameter, and kind_i specifies whether it's a typename,
300 // an integral constant, or a template.  p_i is the name of the i-th
301 // value parameter.
302 //
303 // Example:
304 //
305 //   // DuplicateArg<k, T>(output) converts the k-th argument of the mock
306 //   // function to type T and copies it to *output.
307 //   ACTION_TEMPLATE(DuplicateArg,
308 //                   HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
309 //                   AND_1_VALUE_PARAMS(output)) {
310 //     *output = T(::std::get<k>(args));
311 //   }
312 //   ...
313 //     int n;
314 //     EXPECT_CALL(mock, Foo(_, _))
315 //         .WillOnce(DuplicateArg<1, unsigned char>(&n));
316 //
317 // To create an instance of an action template, write:
318 //
319 //   ActionName<t1, ..., t_m>(v1, ..., v_n)
320 //
321 // where the ts are the template arguments and the vs are the value
322 // arguments.  The value argument types are inferred by the compiler.
323 // If you want to explicitly specify the value argument types, you can
324 // provide additional template arguments:
325 //
326 //   ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n)
327 //
328 // where u_i is the desired type of v_i.
329 //
330 // ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the
331 // number of value parameters, but not on the number of template
332 // parameters.  Without the restriction, the meaning of the following
333 // is unclear:
334 //
335 //   OverloadedAction<int, bool>(x);
336 //
337 // Are we using a single-template-parameter action where 'bool' refers
338 // to the type of x, or are we using a two-template-parameter action
339 // where the compiler is asked to infer the type of x?
340 //
341 // Implementation notes:
342 //
343 // GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and
344 // GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for
345 // implementing ACTION_TEMPLATE.  The main trick we use is to create
346 // new macro invocations when expanding a macro.  For example, we have
347 //
348 //   #define ACTION_TEMPLATE(name, template_params, value_params)
349 //       ... GMOCK_INTERNAL_DECL_##template_params ...
350 //
351 // which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...)
352 // to expand to
353 //
354 //       ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ...
355 //
356 // Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the
357 // preprocessor will continue to expand it to
358 //
359 //       ... typename T ...
360 //
361 // This technique conforms to the C++ standard and is portable.  It
362 // allows us to implement action templates using O(N) code, where N is
363 // the maximum number of template/value parameters supported.  Without
364 // using it, we'd have to devote O(N^2) amount of code to implement all
365 // combinations of m and n.
366
367 // Declares the template parameters.
368 #define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0
369 #define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
370     name1) kind0 name0, kind1 name1
371 #define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
372     kind2, name2) kind0 name0, kind1 name1, kind2 name2
373 #define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
374     kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \
375     kind3 name3
376 #define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
377     kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \
378     kind2 name2, kind3 name3, kind4 name4
379 #define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
380     kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \
381     kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5
382 #define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
383     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
384     name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \
385     kind5 name5, kind6 name6
386 #define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
387     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
388     kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \
389     kind4 name4, kind5 name5, kind6 name6, kind7 name7
390 #define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
391     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
392     kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \
393     kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \
394     kind8 name8
395 #define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
396     name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
397     name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \
398     kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \
399     kind6 name6, kind7 name7, kind8 name8, kind9 name9
400
401 // Lists the template parameters.
402 #define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0
403 #define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
404     name1) name0, name1
405 #define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
406     kind2, name2) name0, name1, name2
407 #define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
408     kind2, name2, kind3, name3) name0, name1, name2, name3
409 #define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
410     kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \
411     name4
412 #define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
413     kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \
414     name2, name3, name4, name5
415 #define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
416     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
417     name6) name0, name1, name2, name3, name4, name5, name6
418 #define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
419     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
420     kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7
421 #define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
422     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
423     kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \
424     name6, name7, name8
425 #define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
426     name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
427     name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \
428     name3, name4, name5, name6, name7, name8, name9
429
430 // Declares the types of value parameters.
431 #define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS()
432 #define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type
433 #define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \
434     typename p0##_type, typename p1##_type
435 #define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \
436     typename p0##_type, typename p1##_type, typename p2##_type
437 #define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
438     typename p0##_type, typename p1##_type, typename p2##_type, \
439     typename p3##_type
440 #define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
441     typename p0##_type, typename p1##_type, typename p2##_type, \
442     typename p3##_type, typename p4##_type
443 #define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
444     typename p0##_type, typename p1##_type, typename p2##_type, \
445     typename p3##_type, typename p4##_type, typename p5##_type
446 #define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
447     p6) , typename p0##_type, typename p1##_type, typename p2##_type, \
448     typename p3##_type, typename p4##_type, typename p5##_type, \
449     typename p6##_type
450 #define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
451     p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \
452     typename p3##_type, typename p4##_type, typename p5##_type, \
453     typename p6##_type, typename p7##_type
454 #define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
455     p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \
456     typename p3##_type, typename p4##_type, typename p5##_type, \
457     typename p6##_type, typename p7##_type, typename p8##_type
458 #define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
459     p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \
460     typename p2##_type, typename p3##_type, typename p4##_type, \
461     typename p5##_type, typename p6##_type, typename p7##_type, \
462     typename p8##_type, typename p9##_type
463
464 // Initializes the value parameters.
465 #define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\
466     ()
467 #define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\
468     (p0##_type gmock_p0) : p0(::std::move(gmock_p0))
469 #define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\
470     (p0##_type gmock_p0, p1##_type gmock_p1) : p0(::std::move(gmock_p0)), \
471         p1(::std::move(gmock_p1))
472 #define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\
473     (p0##_type gmock_p0, p1##_type gmock_p1, \
474         p2##_type gmock_p2) : p0(::std::move(gmock_p0)), \
475         p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2))
476 #define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\
477     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
478         p3##_type gmock_p3) : p0(::std::move(gmock_p0)), \
479         p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
480         p3(::std::move(gmock_p3))
481 #define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\
482     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
483         p3##_type gmock_p3, p4##_type gmock_p4) : p0(::std::move(gmock_p0)), \
484         p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
485         p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4))
486 #define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\
487     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
488         p3##_type gmock_p3, p4##_type gmock_p4, \
489         p5##_type gmock_p5) : p0(::std::move(gmock_p0)), \
490         p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
491         p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
492         p5(::std::move(gmock_p5))
493 #define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\
494     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
495         p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
496         p6##_type gmock_p6) : p0(::std::move(gmock_p0)), \
497         p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
498         p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
499         p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6))
500 #define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\
501     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
502         p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
503         p6##_type gmock_p6, p7##_type gmock_p7) : p0(::std::move(gmock_p0)), \
504         p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
505         p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
506         p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \
507         p7(::std::move(gmock_p7))
508 #define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
509     p7, p8)\
510     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
511         p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
512         p6##_type gmock_p6, p7##_type gmock_p7, \
513         p8##_type gmock_p8) : p0(::std::move(gmock_p0)), \
514         p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
515         p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
516         p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \
517         p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8))
518 #define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
519     p7, p8, p9)\
520     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
521         p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
522         p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
523         p9##_type gmock_p9) : p0(::std::move(gmock_p0)), \
524         p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
525         p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
526         p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \
527         p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8)), \
528         p9(::std::move(gmock_p9))
529
530 // Declares the fields for storing the value parameters.
531 #define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS()
532 #define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0;
533 #define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \
534     p1##_type p1;
535 #define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \
536     p1##_type p1; p2##_type p2;
537 #define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \
538     p1##_type p1; p2##_type p2; p3##_type p3;
539 #define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
540     p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4;
541 #define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
542     p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
543     p5##_type p5;
544 #define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
545     p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
546     p5##_type p5; p6##_type p6;
547 #define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
548     p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
549     p5##_type p5; p6##_type p6; p7##_type p7;
550 #define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
551     p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
552     p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8;
553 #define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
554     p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
555     p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \
556     p9##_type p9;
557
558 // Lists the value parameters.
559 #define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS()
560 #define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0
561 #define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1
562 #define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2
563 #define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3
564 #define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \
565     p2, p3, p4
566 #define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \
567     p1, p2, p3, p4, p5
568 #define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
569     p6) p0, p1, p2, p3, p4, p5, p6
570 #define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
571     p7) p0, p1, p2, p3, p4, p5, p6, p7
572 #define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
573     p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8
574 #define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
575     p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9
576
577 // Lists the value parameter types.
578 #define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS()
579 #define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type
580 #define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \
581     p1##_type
582 #define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \
583     p1##_type, p2##_type
584 #define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
585     p0##_type, p1##_type, p2##_type, p3##_type
586 #define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
587     p0##_type, p1##_type, p2##_type, p3##_type, p4##_type
588 #define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
589     p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type
590 #define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
591     p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \
592     p6##_type
593 #define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
594     p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
595     p5##_type, p6##_type, p7##_type
596 #define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
597     p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
598     p5##_type, p6##_type, p7##_type, p8##_type
599 #define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
600     p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
601     p5##_type, p6##_type, p7##_type, p8##_type, p9##_type
602
603 // Declares the value parameters.
604 #define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS()
605 #define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0
606 #define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \
607     p1##_type p1
608 #define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \
609     p1##_type p1, p2##_type p2
610 #define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \
611     p1##_type p1, p2##_type p2, p3##_type p3
612 #define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
613     p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4
614 #define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
615     p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
616     p5##_type p5
617 #define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
618     p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
619     p5##_type p5, p6##_type p6
620 #define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
621     p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
622     p5##_type p5, p6##_type p6, p7##_type p7
623 #define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
624     p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
625     p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8
626 #define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
627     p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
628     p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
629     p9##_type p9
630
631 // The suffix of the class template implementing the action template.
632 #define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS()
633 #define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P
634 #define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2
635 #define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3
636 #define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4
637 #define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5
638 #define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6
639 #define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7
640 #define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
641     p7) P8
642 #define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
643     p7, p8) P9
644 #define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
645     p7, p8, p9) P10
646
647 // The name of the class template implementing the action template.
648 #define GMOCK_ACTION_CLASS_(name, value_params)\
649     GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params)
650
651 #define ACTION_TEMPLATE(name, template_params, value_params)\
652   template <GMOCK_INTERNAL_DECL_##template_params\
653             GMOCK_INTERNAL_DECL_TYPE_##value_params>\
654   class GMOCK_ACTION_CLASS_(name, value_params) {\
655    public:\
656     explicit GMOCK_ACTION_CLASS_(name, value_params)\
657         GMOCK_INTERNAL_INIT_##value_params {}\
658     template <typename F>\
659     class gmock_Impl : public ::testing::ActionInterface<F> {\
660      public:\
661       typedef F function_type;\
662       typedef typename ::testing::internal::Function<F>::Result return_type;\
663       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
664           args_type;\
665       explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\
666       virtual return_type Perform(const args_type& args) {\
667         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
668             Perform(this, args);\
669       }\
670       template <typename arg0_type, typename arg1_type, typename arg2_type, \
671           typename arg3_type, typename arg4_type, typename arg5_type, \
672           typename arg6_type, typename arg7_type, typename arg8_type, \
673           typename arg9_type>\
674       return_type gmock_PerformImpl(const args_type& args, \
675           const arg0_type& arg0, const arg1_type& arg1, \
676           const arg2_type& arg2, const arg3_type& arg3, \
677           const arg4_type& arg4, const arg5_type& arg5, \
678           const arg6_type& arg6, const arg7_type& arg7, \
679           const arg8_type& arg8, const arg9_type& arg9) const;\
680       GMOCK_INTERNAL_DEFN_##value_params\
681      private:\
682       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
683     };\
684     template <typename F> operator ::testing::Action<F>() const {\
685       return ::testing::Action<F>(\
686           new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
687     }\
688     GMOCK_INTERNAL_DEFN_##value_params\
689    private:\
690     GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\
691   };\
692   template <GMOCK_INTERNAL_DECL_##template_params\
693             GMOCK_INTERNAL_DECL_TYPE_##value_params>\
694   inline GMOCK_ACTION_CLASS_(name, value_params)<\
695       GMOCK_INTERNAL_LIST_##template_params\
696       GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\
697           GMOCK_INTERNAL_DECL_##value_params) {\
698     return GMOCK_ACTION_CLASS_(name, value_params)<\
699         GMOCK_INTERNAL_LIST_##template_params\
700         GMOCK_INTERNAL_LIST_TYPE_##value_params>(\
701             GMOCK_INTERNAL_LIST_##value_params);\
702   }\
703   template <GMOCK_INTERNAL_DECL_##template_params\
704             GMOCK_INTERNAL_DECL_TYPE_##value_params>\
705   template <typename F>\
706   template <typename arg0_type, typename arg1_type, typename arg2_type, \
707       typename arg3_type, typename arg4_type, typename arg5_type, \
708       typename arg6_type, typename arg7_type, typename arg8_type, \
709       typename arg9_type>\
710   typename ::testing::internal::Function<F>::Result\
711       GMOCK_ACTION_CLASS_(name, value_params)<\
712           GMOCK_INTERNAL_LIST_##template_params\
713           GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
714               gmock_PerformImpl(\
715           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
716
717 #define ACTION(name)\
718   class name##Action {\
719    public:\
720     name##Action() {}\
721     template <typename F>\
722     class gmock_Impl : public ::testing::ActionInterface<F> {\
723      public:\
724       typedef F function_type;\
725       typedef typename ::testing::internal::Function<F>::Result return_type;\
726       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
727           args_type;\
728       gmock_Impl() {}\
729       virtual return_type Perform(const args_type& args) {\
730         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
731             Perform(this, args);\
732       }\
733       template <typename arg0_type, typename arg1_type, typename arg2_type, \
734           typename arg3_type, typename arg4_type, typename arg5_type, \
735           typename arg6_type, typename arg7_type, typename arg8_type, \
736           typename arg9_type>\
737       return_type gmock_PerformImpl(const args_type& args, \
738           const arg0_type& arg0, const arg1_type& arg1, \
739           const arg2_type& arg2, const arg3_type& arg3, \
740           const arg4_type& arg4, const arg5_type& arg5, \
741           const arg6_type& arg6, const arg7_type& arg7, \
742           const arg8_type& arg8, const arg9_type& arg9) const;\
743      private:\
744       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
745     };\
746     template <typename F> operator ::testing::Action<F>() const {\
747       return ::testing::Action<F>(new gmock_Impl<F>());\
748     }\
749    private:\
750     GTEST_DISALLOW_ASSIGN_(name##Action);\
751   };\
752   inline name##Action name() {\
753     return name##Action();\
754   }\
755   template <typename F>\
756   template <typename arg0_type, typename arg1_type, typename arg2_type, \
757       typename arg3_type, typename arg4_type, typename arg5_type, \
758       typename arg6_type, typename arg7_type, typename arg8_type, \
759       typename arg9_type>\
760   typename ::testing::internal::Function<F>::Result\
761       name##Action::gmock_Impl<F>::gmock_PerformImpl(\
762           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
763
764 #define ACTION_P(name, p0)\
765   template <typename p0##_type>\
766   class name##ActionP {\
767    public:\
768     explicit name##ActionP(p0##_type gmock_p0) : \
769         p0(::std::forward<p0##_type>(gmock_p0)) {}\
770     template <typename F>\
771     class gmock_Impl : public ::testing::ActionInterface<F> {\
772      public:\
773       typedef F function_type;\
774       typedef typename ::testing::internal::Function<F>::Result return_type;\
775       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
776           args_type;\
777       explicit gmock_Impl(p0##_type gmock_p0) : \
778           p0(::std::forward<p0##_type>(gmock_p0)) {}\
779       virtual return_type Perform(const args_type& args) {\
780         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
781             Perform(this, args);\
782       }\
783       template <typename arg0_type, typename arg1_type, typename arg2_type, \
784           typename arg3_type, typename arg4_type, typename arg5_type, \
785           typename arg6_type, typename arg7_type, typename arg8_type, \
786           typename arg9_type>\
787       return_type gmock_PerformImpl(const args_type& args, \
788           const arg0_type& arg0, const arg1_type& arg1, \
789           const arg2_type& arg2, const arg3_type& arg3, \
790           const arg4_type& arg4, const arg5_type& arg5, \
791           const arg6_type& arg6, const arg7_type& arg7, \
792           const arg8_type& arg8, const arg9_type& arg9) const;\
793       p0##_type p0;\
794      private:\
795       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
796     };\
797     template <typename F> operator ::testing::Action<F>() const {\
798       return ::testing::Action<F>(new gmock_Impl<F>(p0));\
799     }\
800     p0##_type p0;\
801    private:\
802     GTEST_DISALLOW_ASSIGN_(name##ActionP);\
803   };\
804   template <typename p0##_type>\
805   inline name##ActionP<p0##_type> name(p0##_type p0) {\
806     return name##ActionP<p0##_type>(p0);\
807   }\
808   template <typename p0##_type>\
809   template <typename F>\
810   template <typename arg0_type, typename arg1_type, typename arg2_type, \
811       typename arg3_type, typename arg4_type, typename arg5_type, \
812       typename arg6_type, typename arg7_type, typename arg8_type, \
813       typename arg9_type>\
814   typename ::testing::internal::Function<F>::Result\
815       name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\
816           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
817
818 #define ACTION_P2(name, p0, p1)\
819   template <typename p0##_type, typename p1##_type>\
820   class name##ActionP2 {\
821    public:\
822     name##ActionP2(p0##_type gmock_p0, \
823         p1##_type gmock_p1) : p0(::std::forward<p0##_type>(gmock_p0)), \
824         p1(::std::forward<p1##_type>(gmock_p1)) {}\
825     template <typename F>\
826     class gmock_Impl : public ::testing::ActionInterface<F> {\
827      public:\
828       typedef F function_type;\
829       typedef typename ::testing::internal::Function<F>::Result return_type;\
830       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
831           args_type;\
832       gmock_Impl(p0##_type gmock_p0, \
833           p1##_type gmock_p1) : p0(::std::forward<p0##_type>(gmock_p0)), \
834           p1(::std::forward<p1##_type>(gmock_p1)) {}\
835       virtual return_type Perform(const args_type& args) {\
836         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
837             Perform(this, args);\
838       }\
839       template <typename arg0_type, typename arg1_type, typename arg2_type, \
840           typename arg3_type, typename arg4_type, typename arg5_type, \
841           typename arg6_type, typename arg7_type, typename arg8_type, \
842           typename arg9_type>\
843       return_type gmock_PerformImpl(const args_type& args, \
844           const arg0_type& arg0, const arg1_type& arg1, \
845           const arg2_type& arg2, const arg3_type& arg3, \
846           const arg4_type& arg4, const arg5_type& arg5, \
847           const arg6_type& arg6, const arg7_type& arg7, \
848           const arg8_type& arg8, const arg9_type& arg9) const;\
849       p0##_type p0;\
850       p1##_type p1;\
851      private:\
852       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
853     };\
854     template <typename F> operator ::testing::Action<F>() const {\
855       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
856     }\
857     p0##_type p0;\
858     p1##_type p1;\
859    private:\
860     GTEST_DISALLOW_ASSIGN_(name##ActionP2);\
861   };\
862   template <typename p0##_type, typename p1##_type>\
863   inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
864       p1##_type p1) {\
865     return name##ActionP2<p0##_type, p1##_type>(p0, p1);\
866   }\
867   template <typename p0##_type, typename p1##_type>\
868   template <typename F>\
869   template <typename arg0_type, typename arg1_type, typename arg2_type, \
870       typename arg3_type, typename arg4_type, typename arg5_type, \
871       typename arg6_type, typename arg7_type, typename arg8_type, \
872       typename arg9_type>\
873   typename ::testing::internal::Function<F>::Result\
874       name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\
875           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
876
877 #define ACTION_P3(name, p0, p1, p2)\
878   template <typename p0##_type, typename p1##_type, typename p2##_type>\
879   class name##ActionP3 {\
880    public:\
881     name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \
882         p2##_type gmock_p2) : p0(::std::forward<p0##_type>(gmock_p0)), \
883         p1(::std::forward<p1##_type>(gmock_p1)), \
884         p2(::std::forward<p2##_type>(gmock_p2)) {}\
885     template <typename F>\
886     class gmock_Impl : public ::testing::ActionInterface<F> {\
887      public:\
888       typedef F function_type;\
889       typedef typename ::testing::internal::Function<F>::Result return_type;\
890       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
891           args_type;\
892       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \
893           p2##_type gmock_p2) : p0(::std::forward<p0##_type>(gmock_p0)), \
894           p1(::std::forward<p1##_type>(gmock_p1)), \
895           p2(::std::forward<p2##_type>(gmock_p2)) {}\
896       virtual return_type Perform(const args_type& args) {\
897         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
898             Perform(this, args);\
899       }\
900       template <typename arg0_type, typename arg1_type, typename arg2_type, \
901           typename arg3_type, typename arg4_type, typename arg5_type, \
902           typename arg6_type, typename arg7_type, typename arg8_type, \
903           typename arg9_type>\
904       return_type gmock_PerformImpl(const args_type& args, \
905           const arg0_type& arg0, const arg1_type& arg1, \
906           const arg2_type& arg2, const arg3_type& arg3, \
907           const arg4_type& arg4, const arg5_type& arg5, \
908           const arg6_type& arg6, const arg7_type& arg7, \
909           const arg8_type& arg8, const arg9_type& arg9) const;\
910       p0##_type p0;\
911       p1##_type p1;\
912       p2##_type p2;\
913      private:\
914       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
915     };\
916     template <typename F> operator ::testing::Action<F>() const {\
917       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
918     }\
919     p0##_type p0;\
920     p1##_type p1;\
921     p2##_type p2;\
922    private:\
923     GTEST_DISALLOW_ASSIGN_(name##ActionP3);\
924   };\
925   template <typename p0##_type, typename p1##_type, typename p2##_type>\
926   inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
927       p1##_type p1, p2##_type p2) {\
928     return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
929   }\
930   template <typename p0##_type, typename p1##_type, typename p2##_type>\
931   template <typename F>\
932   template <typename arg0_type, typename arg1_type, typename arg2_type, \
933       typename arg3_type, typename arg4_type, typename arg5_type, \
934       typename arg6_type, typename arg7_type, typename arg8_type, \
935       typename arg9_type>\
936   typename ::testing::internal::Function<F>::Result\
937       name##ActionP3<p0##_type, p1##_type, \
938           p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\
939           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
940
941 #define ACTION_P4(name, p0, p1, p2, p3)\
942   template <typename p0##_type, typename p1##_type, typename p2##_type, \
943       typename p3##_type>\
944   class name##ActionP4 {\
945    public:\
946     name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \
947         p2##_type gmock_p2, \
948         p3##_type gmock_p3) : p0(::std::forward<p0##_type>(gmock_p0)), \
949         p1(::std::forward<p1##_type>(gmock_p1)), \
950         p2(::std::forward<p2##_type>(gmock_p2)), \
951         p3(::std::forward<p3##_type>(gmock_p3)) {}\
952     template <typename F>\
953     class gmock_Impl : public ::testing::ActionInterface<F> {\
954      public:\
955       typedef F function_type;\
956       typedef typename ::testing::internal::Function<F>::Result return_type;\
957       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
958           args_type;\
959       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
960           p3##_type gmock_p3) : p0(::std::forward<p0##_type>(gmock_p0)), \
961           p1(::std::forward<p1##_type>(gmock_p1)), \
962           p2(::std::forward<p2##_type>(gmock_p2)), \
963           p3(::std::forward<p3##_type>(gmock_p3)) {}\
964       virtual return_type Perform(const args_type& args) {\
965         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
966             Perform(this, args);\
967       }\
968       template <typename arg0_type, typename arg1_type, typename arg2_type, \
969           typename arg3_type, typename arg4_type, typename arg5_type, \
970           typename arg6_type, typename arg7_type, typename arg8_type, \
971           typename arg9_type>\
972       return_type gmock_PerformImpl(const args_type& args, \
973           const arg0_type& arg0, const arg1_type& arg1, \
974           const arg2_type& arg2, const arg3_type& arg3, \
975           const arg4_type& arg4, const arg5_type& arg5, \
976           const arg6_type& arg6, const arg7_type& arg7, \
977           const arg8_type& arg8, const arg9_type& arg9) const;\
978       p0##_type p0;\
979       p1##_type p1;\
980       p2##_type p2;\
981       p3##_type p3;\
982      private:\
983       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
984     };\
985     template <typename F> operator ::testing::Action<F>() const {\
986       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
987     }\
988     p0##_type p0;\
989     p1##_type p1;\
990     p2##_type p2;\
991     p3##_type p3;\
992    private:\
993     GTEST_DISALLOW_ASSIGN_(name##ActionP4);\
994   };\
995   template <typename p0##_type, typename p1##_type, typename p2##_type, \
996       typename p3##_type>\
997   inline name##ActionP4<p0##_type, p1##_type, p2##_type, \
998       p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
999       p3##_type p3) {\
1000     return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \
1001         p2, p3);\
1002   }\
1003   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1004       typename p3##_type>\
1005   template <typename F>\
1006   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1007       typename arg3_type, typename arg4_type, typename arg5_type, \
1008       typename arg6_type, typename arg7_type, typename arg8_type, \
1009       typename arg9_type>\
1010   typename ::testing::internal::Function<F>::Result\
1011       name##ActionP4<p0##_type, p1##_type, p2##_type, \
1012           p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1013           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1014
1015 #define ACTION_P5(name, p0, p1, p2, p3, p4)\
1016   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1017       typename p3##_type, typename p4##_type>\
1018   class name##ActionP5 {\
1019    public:\
1020     name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \
1021         p2##_type gmock_p2, p3##_type gmock_p3, \
1022         p4##_type gmock_p4) : p0(::std::forward<p0##_type>(gmock_p0)), \
1023         p1(::std::forward<p1##_type>(gmock_p1)), \
1024         p2(::std::forward<p2##_type>(gmock_p2)), \
1025         p3(::std::forward<p3##_type>(gmock_p3)), \
1026         p4(::std::forward<p4##_type>(gmock_p4)) {}\
1027     template <typename F>\
1028     class gmock_Impl : public ::testing::ActionInterface<F> {\
1029      public:\
1030       typedef F function_type;\
1031       typedef typename ::testing::internal::Function<F>::Result return_type;\
1032       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1033           args_type;\
1034       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1035           p3##_type gmock_p3, \
1036           p4##_type gmock_p4) : p0(::std::forward<p0##_type>(gmock_p0)), \
1037           p1(::std::forward<p1##_type>(gmock_p1)), \
1038           p2(::std::forward<p2##_type>(gmock_p2)), \
1039           p3(::std::forward<p3##_type>(gmock_p3)), \
1040           p4(::std::forward<p4##_type>(gmock_p4)) {}\
1041       virtual return_type Perform(const args_type& args) {\
1042         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1043             Perform(this, args);\
1044       }\
1045       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1046           typename arg3_type, typename arg4_type, typename arg5_type, \
1047           typename arg6_type, typename arg7_type, typename arg8_type, \
1048           typename arg9_type>\
1049       return_type gmock_PerformImpl(const args_type& args, \
1050           const arg0_type& arg0, const arg1_type& arg1, \
1051           const arg2_type& arg2, const arg3_type& arg3, \
1052           const arg4_type& arg4, const arg5_type& arg5, \
1053           const arg6_type& arg6, const arg7_type& arg7, \
1054           const arg8_type& arg8, const arg9_type& arg9) const;\
1055       p0##_type p0;\
1056       p1##_type p1;\
1057       p2##_type p2;\
1058       p3##_type p3;\
1059       p4##_type p4;\
1060      private:\
1061       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1062     };\
1063     template <typename F> operator ::testing::Action<F>() const {\
1064       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\
1065     }\
1066     p0##_type p0;\
1067     p1##_type p1;\
1068     p2##_type p2;\
1069     p3##_type p3;\
1070     p4##_type p4;\
1071    private:\
1072     GTEST_DISALLOW_ASSIGN_(name##ActionP5);\
1073   };\
1074   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1075       typename p3##_type, typename p4##_type>\
1076   inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1077       p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1078       p4##_type p4) {\
1079     return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1080         p4##_type>(p0, p1, p2, p3, p4);\
1081   }\
1082   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1083       typename p3##_type, typename p4##_type>\
1084   template <typename F>\
1085   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1086       typename arg3_type, typename arg4_type, typename arg5_type, \
1087       typename arg6_type, typename arg7_type, typename arg8_type, \
1088       typename arg9_type>\
1089   typename ::testing::internal::Function<F>::Result\
1090       name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1091           p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1092           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1093
1094 #define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\
1095   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1096       typename p3##_type, typename p4##_type, typename p5##_type>\
1097   class name##ActionP6 {\
1098    public:\
1099     name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \
1100         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1101         p5##_type gmock_p5) : p0(::std::forward<p0##_type>(gmock_p0)), \
1102         p1(::std::forward<p1##_type>(gmock_p1)), \
1103         p2(::std::forward<p2##_type>(gmock_p2)), \
1104         p3(::std::forward<p3##_type>(gmock_p3)), \
1105         p4(::std::forward<p4##_type>(gmock_p4)), \
1106         p5(::std::forward<p5##_type>(gmock_p5)) {}\
1107     template <typename F>\
1108     class gmock_Impl : public ::testing::ActionInterface<F> {\
1109      public:\
1110       typedef F function_type;\
1111       typedef typename ::testing::internal::Function<F>::Result return_type;\
1112       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1113           args_type;\
1114       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1115           p3##_type gmock_p3, p4##_type gmock_p4, \
1116           p5##_type gmock_p5) : p0(::std::forward<p0##_type>(gmock_p0)), \
1117           p1(::std::forward<p1##_type>(gmock_p1)), \
1118           p2(::std::forward<p2##_type>(gmock_p2)), \
1119           p3(::std::forward<p3##_type>(gmock_p3)), \
1120           p4(::std::forward<p4##_type>(gmock_p4)), \
1121           p5(::std::forward<p5##_type>(gmock_p5)) {}\
1122       virtual return_type Perform(const args_type& args) {\
1123         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1124             Perform(this, args);\
1125       }\
1126       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1127           typename arg3_type, typename arg4_type, typename arg5_type, \
1128           typename arg6_type, typename arg7_type, typename arg8_type, \
1129           typename arg9_type>\
1130       return_type gmock_PerformImpl(const args_type& args, \
1131           const arg0_type& arg0, const arg1_type& arg1, \
1132           const arg2_type& arg2, const arg3_type& arg3, \
1133           const arg4_type& arg4, const arg5_type& arg5, \
1134           const arg6_type& arg6, const arg7_type& arg7, \
1135           const arg8_type& arg8, const arg9_type& arg9) const;\
1136       p0##_type p0;\
1137       p1##_type p1;\
1138       p2##_type p2;\
1139       p3##_type p3;\
1140       p4##_type p4;\
1141       p5##_type p5;\
1142      private:\
1143       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1144     };\
1145     template <typename F> operator ::testing::Action<F>() const {\
1146       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\
1147     }\
1148     p0##_type p0;\
1149     p1##_type p1;\
1150     p2##_type p2;\
1151     p3##_type p3;\
1152     p4##_type p4;\
1153     p5##_type p5;\
1154    private:\
1155     GTEST_DISALLOW_ASSIGN_(name##ActionP6);\
1156   };\
1157   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1158       typename p3##_type, typename p4##_type, typename p5##_type>\
1159   inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
1160       p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
1161       p3##_type p3, p4##_type p4, p5##_type p5) {\
1162     return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
1163         p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
1164   }\
1165   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1166       typename p3##_type, typename p4##_type, typename p5##_type>\
1167   template <typename F>\
1168   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1169       typename arg3_type, typename arg4_type, typename arg5_type, \
1170       typename arg6_type, typename arg7_type, typename arg8_type, \
1171       typename arg9_type>\
1172   typename ::testing::internal::Function<F>::Result\
1173       name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1174           p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1175           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1176
1177 #define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\
1178   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1179       typename p3##_type, typename p4##_type, typename p5##_type, \
1180       typename p6##_type>\
1181   class name##ActionP7 {\
1182    public:\
1183     name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \
1184         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1185         p5##_type gmock_p5, \
1186         p6##_type gmock_p6) : p0(::std::forward<p0##_type>(gmock_p0)), \
1187         p1(::std::forward<p1##_type>(gmock_p1)), \
1188         p2(::std::forward<p2##_type>(gmock_p2)), \
1189         p3(::std::forward<p3##_type>(gmock_p3)), \
1190         p4(::std::forward<p4##_type>(gmock_p4)), \
1191         p5(::std::forward<p5##_type>(gmock_p5)), \
1192         p6(::std::forward<p6##_type>(gmock_p6)) {}\
1193     template <typename F>\
1194     class gmock_Impl : public ::testing::ActionInterface<F> {\
1195      public:\
1196       typedef F function_type;\
1197       typedef typename ::testing::internal::Function<F>::Result return_type;\
1198       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1199           args_type;\
1200       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1201           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1202           p6##_type gmock_p6) : p0(::std::forward<p0##_type>(gmock_p0)), \
1203           p1(::std::forward<p1##_type>(gmock_p1)), \
1204           p2(::std::forward<p2##_type>(gmock_p2)), \
1205           p3(::std::forward<p3##_type>(gmock_p3)), \
1206           p4(::std::forward<p4##_type>(gmock_p4)), \
1207           p5(::std::forward<p5##_type>(gmock_p5)), \
1208           p6(::std::forward<p6##_type>(gmock_p6)) {}\
1209       virtual return_type Perform(const args_type& args) {\
1210         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1211             Perform(this, args);\
1212       }\
1213       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1214           typename arg3_type, typename arg4_type, typename arg5_type, \
1215           typename arg6_type, typename arg7_type, typename arg8_type, \
1216           typename arg9_type>\
1217       return_type gmock_PerformImpl(const args_type& args, \
1218           const arg0_type& arg0, const arg1_type& arg1, \
1219           const arg2_type& arg2, const arg3_type& arg3, \
1220           const arg4_type& arg4, const arg5_type& arg5, \
1221           const arg6_type& arg6, const arg7_type& arg7, \
1222           const arg8_type& arg8, const arg9_type& arg9) const;\
1223       p0##_type p0;\
1224       p1##_type p1;\
1225       p2##_type p2;\
1226       p3##_type p3;\
1227       p4##_type p4;\
1228       p5##_type p5;\
1229       p6##_type p6;\
1230      private:\
1231       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1232     };\
1233     template <typename F> operator ::testing::Action<F>() const {\
1234       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
1235           p6));\
1236     }\
1237     p0##_type p0;\
1238     p1##_type p1;\
1239     p2##_type p2;\
1240     p3##_type p3;\
1241     p4##_type p4;\
1242     p5##_type p5;\
1243     p6##_type p6;\
1244    private:\
1245     GTEST_DISALLOW_ASSIGN_(name##ActionP7);\
1246   };\
1247   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1248       typename p3##_type, typename p4##_type, typename p5##_type, \
1249       typename p6##_type>\
1250   inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
1251       p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
1252       p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
1253       p6##_type p6) {\
1254     return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
1255         p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
1256   }\
1257   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1258       typename p3##_type, typename p4##_type, typename p5##_type, \
1259       typename p6##_type>\
1260   template <typename F>\
1261   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1262       typename arg3_type, typename arg4_type, typename arg5_type, \
1263       typename arg6_type, typename arg7_type, typename arg8_type, \
1264       typename arg9_type>\
1265   typename ::testing::internal::Function<F>::Result\
1266       name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1267           p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1268           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1269
1270 #define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\
1271   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1272       typename p3##_type, typename p4##_type, typename p5##_type, \
1273       typename p6##_type, typename p7##_type>\
1274   class name##ActionP8 {\
1275    public:\
1276     name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \
1277         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1278         p5##_type gmock_p5, p6##_type gmock_p6, \
1279         p7##_type gmock_p7) : p0(::std::forward<p0##_type>(gmock_p0)), \
1280         p1(::std::forward<p1##_type>(gmock_p1)), \
1281         p2(::std::forward<p2##_type>(gmock_p2)), \
1282         p3(::std::forward<p3##_type>(gmock_p3)), \
1283         p4(::std::forward<p4##_type>(gmock_p4)), \
1284         p5(::std::forward<p5##_type>(gmock_p5)), \
1285         p6(::std::forward<p6##_type>(gmock_p6)), \
1286         p7(::std::forward<p7##_type>(gmock_p7)) {}\
1287     template <typename F>\
1288     class gmock_Impl : public ::testing::ActionInterface<F> {\
1289      public:\
1290       typedef F function_type;\
1291       typedef typename ::testing::internal::Function<F>::Result return_type;\
1292       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1293           args_type;\
1294       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1295           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1296           p6##_type gmock_p6, \
1297           p7##_type gmock_p7) : p0(::std::forward<p0##_type>(gmock_p0)), \
1298           p1(::std::forward<p1##_type>(gmock_p1)), \
1299           p2(::std::forward<p2##_type>(gmock_p2)), \
1300           p3(::std::forward<p3##_type>(gmock_p3)), \
1301           p4(::std::forward<p4##_type>(gmock_p4)), \
1302           p5(::std::forward<p5##_type>(gmock_p5)), \
1303           p6(::std::forward<p6##_type>(gmock_p6)), \
1304           p7(::std::forward<p7##_type>(gmock_p7)) {}\
1305       virtual return_type Perform(const args_type& args) {\
1306         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1307             Perform(this, args);\
1308       }\
1309       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1310           typename arg3_type, typename arg4_type, typename arg5_type, \
1311           typename arg6_type, typename arg7_type, typename arg8_type, \
1312           typename arg9_type>\
1313       return_type gmock_PerformImpl(const args_type& args, \
1314           const arg0_type& arg0, const arg1_type& arg1, \
1315           const arg2_type& arg2, const arg3_type& arg3, \
1316           const arg4_type& arg4, const arg5_type& arg5, \
1317           const arg6_type& arg6, const arg7_type& arg7, \
1318           const arg8_type& arg8, const arg9_type& arg9) const;\
1319       p0##_type p0;\
1320       p1##_type p1;\
1321       p2##_type p2;\
1322       p3##_type p3;\
1323       p4##_type p4;\
1324       p5##_type p5;\
1325       p6##_type p6;\
1326       p7##_type p7;\
1327      private:\
1328       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1329     };\
1330     template <typename F> operator ::testing::Action<F>() const {\
1331       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
1332           p6, p7));\
1333     }\
1334     p0##_type p0;\
1335     p1##_type p1;\
1336     p2##_type p2;\
1337     p3##_type p3;\
1338     p4##_type p4;\
1339     p5##_type p5;\
1340     p6##_type p6;\
1341     p7##_type p7;\
1342    private:\
1343     GTEST_DISALLOW_ASSIGN_(name##ActionP8);\
1344   };\
1345   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1346       typename p3##_type, typename p4##_type, typename p5##_type, \
1347       typename p6##_type, typename p7##_type>\
1348   inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
1349       p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
1350       p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
1351       p6##_type p6, p7##_type p7) {\
1352     return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
1353         p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
1354         p6, p7);\
1355   }\
1356   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1357       typename p3##_type, typename p4##_type, typename p5##_type, \
1358       typename p6##_type, typename p7##_type>\
1359   template <typename F>\
1360   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1361       typename arg3_type, typename arg4_type, typename arg5_type, \
1362       typename arg6_type, typename arg7_type, typename arg8_type, \
1363       typename arg9_type>\
1364   typename ::testing::internal::Function<F>::Result\
1365       name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1366           p5##_type, p6##_type, \
1367           p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1368           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1369
1370 #define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\
1371   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1372       typename p3##_type, typename p4##_type, typename p5##_type, \
1373       typename p6##_type, typename p7##_type, typename p8##_type>\
1374   class name##ActionP9 {\
1375    public:\
1376     name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \
1377         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1378         p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
1379         p8##_type gmock_p8) : p0(::std::forward<p0##_type>(gmock_p0)), \
1380         p1(::std::forward<p1##_type>(gmock_p1)), \
1381         p2(::std::forward<p2##_type>(gmock_p2)), \
1382         p3(::std::forward<p3##_type>(gmock_p3)), \
1383         p4(::std::forward<p4##_type>(gmock_p4)), \
1384         p5(::std::forward<p5##_type>(gmock_p5)), \
1385         p6(::std::forward<p6##_type>(gmock_p6)), \
1386         p7(::std::forward<p7##_type>(gmock_p7)), \
1387         p8(::std::forward<p8##_type>(gmock_p8)) {}\
1388     template <typename F>\
1389     class gmock_Impl : public ::testing::ActionInterface<F> {\
1390      public:\
1391       typedef F function_type;\
1392       typedef typename ::testing::internal::Function<F>::Result return_type;\
1393       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1394           args_type;\
1395       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1396           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1397           p6##_type gmock_p6, p7##_type gmock_p7, \
1398           p8##_type gmock_p8) : p0(::std::forward<p0##_type>(gmock_p0)), \
1399           p1(::std::forward<p1##_type>(gmock_p1)), \
1400           p2(::std::forward<p2##_type>(gmock_p2)), \
1401           p3(::std::forward<p3##_type>(gmock_p3)), \
1402           p4(::std::forward<p4##_type>(gmock_p4)), \
1403           p5(::std::forward<p5##_type>(gmock_p5)), \
1404           p6(::std::forward<p6##_type>(gmock_p6)), \
1405           p7(::std::forward<p7##_type>(gmock_p7)), \
1406           p8(::std::forward<p8##_type>(gmock_p8)) {}\
1407       virtual return_type Perform(const args_type& args) {\
1408         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1409             Perform(this, args);\
1410       }\
1411       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1412           typename arg3_type, typename arg4_type, typename arg5_type, \
1413           typename arg6_type, typename arg7_type, typename arg8_type, \
1414           typename arg9_type>\
1415       return_type gmock_PerformImpl(const args_type& args, \
1416           const arg0_type& arg0, const arg1_type& arg1, \
1417           const arg2_type& arg2, const arg3_type& arg3, \
1418           const arg4_type& arg4, const arg5_type& arg5, \
1419           const arg6_type& arg6, const arg7_type& arg7, \
1420           const arg8_type& arg8, const arg9_type& arg9) const;\
1421       p0##_type p0;\
1422       p1##_type p1;\
1423       p2##_type p2;\
1424       p3##_type p3;\
1425       p4##_type p4;\
1426       p5##_type p5;\
1427       p6##_type p6;\
1428       p7##_type p7;\
1429       p8##_type p8;\
1430      private:\
1431       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1432     };\
1433     template <typename F> operator ::testing::Action<F>() const {\
1434       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
1435           p6, p7, p8));\
1436     }\
1437     p0##_type p0;\
1438     p1##_type p1;\
1439     p2##_type p2;\
1440     p3##_type p3;\
1441     p4##_type p4;\
1442     p5##_type p5;\
1443     p6##_type p6;\
1444     p7##_type p7;\
1445     p8##_type p8;\
1446    private:\
1447     GTEST_DISALLOW_ASSIGN_(name##ActionP9);\
1448   };\
1449   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1450       typename p3##_type, typename p4##_type, typename p5##_type, \
1451       typename p6##_type, typename p7##_type, typename p8##_type>\
1452   inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
1453       p4##_type, p5##_type, p6##_type, p7##_type, \
1454       p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1455       p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
1456       p8##_type p8) {\
1457     return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
1458         p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
1459         p3, p4, p5, p6, p7, p8);\
1460   }\
1461   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1462       typename p3##_type, typename p4##_type, typename p5##_type, \
1463       typename p6##_type, typename p7##_type, typename p8##_type>\
1464   template <typename F>\
1465   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1466       typename arg3_type, typename arg4_type, typename arg5_type, \
1467       typename arg6_type, typename arg7_type, typename arg8_type, \
1468       typename arg9_type>\
1469   typename ::testing::internal::Function<F>::Result\
1470       name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1471           p5##_type, p6##_type, p7##_type, \
1472           p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1473           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1474
1475 #define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\
1476   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1477       typename p3##_type, typename p4##_type, typename p5##_type, \
1478       typename p6##_type, typename p7##_type, typename p8##_type, \
1479       typename p9##_type>\
1480   class name##ActionP10 {\
1481    public:\
1482     name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \
1483         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1484         p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
1485         p8##_type gmock_p8, \
1486         p9##_type gmock_p9) : p0(::std::forward<p0##_type>(gmock_p0)), \
1487         p1(::std::forward<p1##_type>(gmock_p1)), \
1488         p2(::std::forward<p2##_type>(gmock_p2)), \
1489         p3(::std::forward<p3##_type>(gmock_p3)), \
1490         p4(::std::forward<p4##_type>(gmock_p4)), \
1491         p5(::std::forward<p5##_type>(gmock_p5)), \
1492         p6(::std::forward<p6##_type>(gmock_p6)), \
1493         p7(::std::forward<p7##_type>(gmock_p7)), \
1494         p8(::std::forward<p8##_type>(gmock_p8)), \
1495         p9(::std::forward<p9##_type>(gmock_p9)) {}\
1496     template <typename F>\
1497     class gmock_Impl : public ::testing::ActionInterface<F> {\
1498      public:\
1499       typedef F function_type;\
1500       typedef typename ::testing::internal::Function<F>::Result return_type;\
1501       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1502           args_type;\
1503       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1504           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1505           p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
1506           p9##_type gmock_p9) : p0(::std::forward<p0##_type>(gmock_p0)), \
1507           p1(::std::forward<p1##_type>(gmock_p1)), \
1508           p2(::std::forward<p2##_type>(gmock_p2)), \
1509           p3(::std::forward<p3##_type>(gmock_p3)), \
1510           p4(::std::forward<p4##_type>(gmock_p4)), \
1511           p5(::std::forward<p5##_type>(gmock_p5)), \
1512           p6(::std::forward<p6##_type>(gmock_p6)), \
1513           p7(::std::forward<p7##_type>(gmock_p7)), \
1514           p8(::std::forward<p8##_type>(gmock_p8)), \
1515           p9(::std::forward<p9##_type>(gmock_p9)) {}\
1516       virtual return_type Perform(const args_type& args) {\
1517         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1518             Perform(this, args);\
1519       }\
1520       template <typename arg0_type, typename arg1_type, typename arg2_type, \
1521           typename arg3_type, typename arg4_type, typename arg5_type, \
1522           typename arg6_type, typename arg7_type, typename arg8_type, \
1523           typename arg9_type>\
1524       return_type gmock_PerformImpl(const args_type& args, \
1525           const arg0_type& arg0, const arg1_type& arg1, \
1526           const arg2_type& arg2, const arg3_type& arg3, \
1527           const arg4_type& arg4, const arg5_type& arg5, \
1528           const arg6_type& arg6, const arg7_type& arg7, \
1529           const arg8_type& arg8, const arg9_type& arg9) const;\
1530       p0##_type p0;\
1531       p1##_type p1;\
1532       p2##_type p2;\
1533       p3##_type p3;\
1534       p4##_type p4;\
1535       p5##_type p5;\
1536       p6##_type p6;\
1537       p7##_type p7;\
1538       p8##_type p8;\
1539       p9##_type p9;\
1540      private:\
1541       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1542     };\
1543     template <typename F> operator ::testing::Action<F>() const {\
1544       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
1545           p6, p7, p8, p9));\
1546     }\
1547     p0##_type p0;\
1548     p1##_type p1;\
1549     p2##_type p2;\
1550     p3##_type p3;\
1551     p4##_type p4;\
1552     p5##_type p5;\
1553     p6##_type p6;\
1554     p7##_type p7;\
1555     p8##_type p8;\
1556     p9##_type p9;\
1557    private:\
1558     GTEST_DISALLOW_ASSIGN_(name##ActionP10);\
1559   };\
1560   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1561       typename p3##_type, typename p4##_type, typename p5##_type, \
1562       typename p6##_type, typename p7##_type, typename p8##_type, \
1563       typename p9##_type>\
1564   inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
1565       p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
1566       p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1567       p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
1568       p9##_type p9) {\
1569     return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
1570         p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
1571         p1, p2, p3, p4, p5, p6, p7, p8, p9);\
1572   }\
1573   template <typename p0##_type, typename p1##_type, typename p2##_type, \
1574       typename p3##_type, typename p4##_type, typename p5##_type, \
1575       typename p6##_type, typename p7##_type, typename p8##_type, \
1576       typename p9##_type>\
1577   template <typename F>\
1578   template <typename arg0_type, typename arg1_type, typename arg2_type, \
1579       typename arg3_type, typename arg4_type, typename arg5_type, \
1580       typename arg6_type, typename arg7_type, typename arg8_type, \
1581       typename arg9_type>\
1582   typename ::testing::internal::Function<F>::Result\
1583       name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1584           p5##_type, p6##_type, p7##_type, p8##_type, \
1585           p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1586           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1587
1588 namespace testing {
1589
1590
1591 // The ACTION*() macros trigger warning C4100 (unreferenced formal
1592 // parameter) in MSVC with -W4.  Unfortunately they cannot be fixed in
1593 // the macro definition, as the warnings are generated when the macro
1594 // is expanded and macro expansion cannot contain #pragma.  Therefore
1595 // we suppress them here.
1596 #ifdef _MSC_VER
1597 # pragma warning(push)
1598 # pragma warning(disable:4100)
1599 #endif
1600
1601 // Various overloads for InvokeArgument<N>().
1602 //
1603 // The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
1604 // (0-based) argument, which must be a k-ary callable, of the mock
1605 // function, with arguments a1, a2, ..., a_k.
1606 //
1607 // Notes:
1608 //
1609 //   1. The arguments are passed by value by default.  If you need to
1610 //   pass an argument by reference, wrap it inside ByRef().  For
1611 //   example,
1612 //
1613 //     InvokeArgument<1>(5, string("Hello"), ByRef(foo))
1614 //
1615 //   passes 5 and string("Hello") by value, and passes foo by
1616 //   reference.
1617 //
1618 //   2. If the callable takes an argument by reference but ByRef() is
1619 //   not used, it will receive the reference to a copy of the value,
1620 //   instead of the original value.  For example, when the 0-th
1621 //   argument of the mock function takes a const string&, the action
1622 //
1623 //     InvokeArgument<0>(string("Hello"))
1624 //
1625 //   makes a copy of the temporary string("Hello") object and passes a
1626 //   reference of the copy, instead of the original temporary object,
1627 //   to the callable.  This makes it easy for a user to define an
1628 //   InvokeArgument action from temporary values and have it performed
1629 //   later.
1630
1631 namespace internal {
1632 namespace invoke_argument {
1633
1634 // Appears in InvokeArgumentAdl's argument list to help avoid
1635 // accidental calls to user functions of the same name.
1636 struct AdlTag {};
1637
1638 // InvokeArgumentAdl - a helper for InvokeArgument.
1639 // The basic overloads are provided here for generic functors.
1640 // Overloads for other custom-callables are provided in the
1641 // internal/custom/callback-actions.h header.
1642
1643 template <typename R, typename F>
1644 R InvokeArgumentAdl(AdlTag, F f) {
1645   return f();
1646 }
1647 template <typename R, typename F, typename A1>
1648 R InvokeArgumentAdl(AdlTag, F f, A1 a1) {
1649   return f(a1);
1650 }
1651 template <typename R, typename F, typename A1, typename A2>
1652 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2) {
1653   return f(a1, a2);
1654 }
1655 template <typename R, typename F, typename A1, typename A2, typename A3>
1656 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3) {
1657   return f(a1, a2, a3);
1658 }
1659 template <typename R, typename F, typename A1, typename A2, typename A3,
1660     typename A4>
1661 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4) {
1662   return f(a1, a2, a3, a4);
1663 }
1664 template <typename R, typename F, typename A1, typename A2, typename A3,
1665     typename A4, typename A5>
1666 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
1667   return f(a1, a2, a3, a4, a5);
1668 }
1669 template <typename R, typename F, typename A1, typename A2, typename A3,
1670     typename A4, typename A5, typename A6>
1671 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
1672   return f(a1, a2, a3, a4, a5, a6);
1673 }
1674 template <typename R, typename F, typename A1, typename A2, typename A3,
1675     typename A4, typename A5, typename A6, typename A7>
1676 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
1677     A7 a7) {
1678   return f(a1, a2, a3, a4, a5, a6, a7);
1679 }
1680 template <typename R, typename F, typename A1, typename A2, typename A3,
1681     typename A4, typename A5, typename A6, typename A7, typename A8>
1682 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
1683     A7 a7, A8 a8) {
1684   return f(a1, a2, a3, a4, a5, a6, a7, a8);
1685 }
1686 template <typename R, typename F, typename A1, typename A2, typename A3,
1687     typename A4, typename A5, typename A6, typename A7, typename A8,
1688     typename A9>
1689 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
1690     A7 a7, A8 a8, A9 a9) {
1691   return f(a1, a2, a3, a4, a5, a6, a7, a8, a9);
1692 }
1693 template <typename R, typename F, typename A1, typename A2, typename A3,
1694     typename A4, typename A5, typename A6, typename A7, typename A8,
1695     typename A9, typename A10>
1696 R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
1697     A7 a7, A8 a8, A9 a9, A10 a10) {
1698   return f(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
1699 }
1700 }  // namespace invoke_argument
1701 }  // namespace internal
1702
1703 ACTION_TEMPLATE(InvokeArgument,
1704                 HAS_1_TEMPLATE_PARAMS(int, k),
1705                 AND_0_VALUE_PARAMS()) {
1706   using internal::invoke_argument::InvokeArgumentAdl;
1707   return InvokeArgumentAdl<return_type>(
1708       internal::invoke_argument::AdlTag(),
1709       ::std::get<k>(args));
1710 }
1711
1712 ACTION_TEMPLATE(InvokeArgument,
1713                 HAS_1_TEMPLATE_PARAMS(int, k),
1714                 AND_1_VALUE_PARAMS(p0)) {
1715   using internal::invoke_argument::InvokeArgumentAdl;
1716   return InvokeArgumentAdl<return_type>(
1717       internal::invoke_argument::AdlTag(),
1718       ::std::get<k>(args), p0);
1719 }
1720
1721 ACTION_TEMPLATE(InvokeArgument,
1722                 HAS_1_TEMPLATE_PARAMS(int, k),
1723                 AND_2_VALUE_PARAMS(p0, p1)) {
1724   using internal::invoke_argument::InvokeArgumentAdl;
1725   return InvokeArgumentAdl<return_type>(
1726       internal::invoke_argument::AdlTag(),
1727       ::std::get<k>(args), p0, p1);
1728 }
1729
1730 ACTION_TEMPLATE(InvokeArgument,
1731                 HAS_1_TEMPLATE_PARAMS(int, k),
1732                 AND_3_VALUE_PARAMS(p0, p1, p2)) {
1733   using internal::invoke_argument::InvokeArgumentAdl;
1734   return InvokeArgumentAdl<return_type>(
1735       internal::invoke_argument::AdlTag(),
1736       ::std::get<k>(args), p0, p1, p2);
1737 }
1738
1739 ACTION_TEMPLATE(InvokeArgument,
1740                 HAS_1_TEMPLATE_PARAMS(int, k),
1741                 AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
1742   using internal::invoke_argument::InvokeArgumentAdl;
1743   return InvokeArgumentAdl<return_type>(
1744       internal::invoke_argument::AdlTag(),
1745       ::std::get<k>(args), p0, p1, p2, p3);
1746 }
1747
1748 ACTION_TEMPLATE(InvokeArgument,
1749                 HAS_1_TEMPLATE_PARAMS(int, k),
1750                 AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
1751   using internal::invoke_argument::InvokeArgumentAdl;
1752   return InvokeArgumentAdl<return_type>(
1753       internal::invoke_argument::AdlTag(),
1754       ::std::get<k>(args), p0, p1, p2, p3, p4);
1755 }
1756
1757 ACTION_TEMPLATE(InvokeArgument,
1758                 HAS_1_TEMPLATE_PARAMS(int, k),
1759                 AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
1760   using internal::invoke_argument::InvokeArgumentAdl;
1761   return InvokeArgumentAdl<return_type>(
1762       internal::invoke_argument::AdlTag(),
1763       ::std::get<k>(args), p0, p1, p2, p3, p4, p5);
1764 }
1765
1766 ACTION_TEMPLATE(InvokeArgument,
1767                 HAS_1_TEMPLATE_PARAMS(int, k),
1768                 AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
1769   using internal::invoke_argument::InvokeArgumentAdl;
1770   return InvokeArgumentAdl<return_type>(
1771       internal::invoke_argument::AdlTag(),
1772       ::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6);
1773 }
1774
1775 ACTION_TEMPLATE(InvokeArgument,
1776                 HAS_1_TEMPLATE_PARAMS(int, k),
1777                 AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
1778   using internal::invoke_argument::InvokeArgumentAdl;
1779   return InvokeArgumentAdl<return_type>(
1780       internal::invoke_argument::AdlTag(),
1781       ::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7);
1782 }
1783
1784 ACTION_TEMPLATE(InvokeArgument,
1785                 HAS_1_TEMPLATE_PARAMS(int, k),
1786                 AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
1787   using internal::invoke_argument::InvokeArgumentAdl;
1788   return InvokeArgumentAdl<return_type>(
1789       internal::invoke_argument::AdlTag(),
1790       ::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8);
1791 }
1792
1793 ACTION_TEMPLATE(InvokeArgument,
1794                 HAS_1_TEMPLATE_PARAMS(int, k),
1795                 AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
1796   using internal::invoke_argument::InvokeArgumentAdl;
1797   return InvokeArgumentAdl<return_type>(
1798       internal::invoke_argument::AdlTag(),
1799       ::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
1800 }
1801
1802 // Various overloads for ReturnNew<T>().
1803 //
1804 // The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new
1805 // instance of type T, constructed on the heap with constructor arguments
1806 // a1, a2, ..., and a_k. The caller assumes ownership of the returned value.
1807 ACTION_TEMPLATE(ReturnNew,
1808                 HAS_1_TEMPLATE_PARAMS(typename, T),
1809                 AND_0_VALUE_PARAMS()) {
1810   return new T();
1811 }
1812
1813 ACTION_TEMPLATE(ReturnNew,
1814                 HAS_1_TEMPLATE_PARAMS(typename, T),
1815                 AND_1_VALUE_PARAMS(p0)) {
1816   return new T(p0);
1817 }
1818
1819 ACTION_TEMPLATE(ReturnNew,
1820                 HAS_1_TEMPLATE_PARAMS(typename, T),
1821                 AND_2_VALUE_PARAMS(p0, p1)) {
1822   return new T(p0, p1);
1823 }
1824
1825 ACTION_TEMPLATE(ReturnNew,
1826                 HAS_1_TEMPLATE_PARAMS(typename, T),
1827                 AND_3_VALUE_PARAMS(p0, p1, p2)) {
1828   return new T(p0, p1, p2);
1829 }
1830
1831 ACTION_TEMPLATE(ReturnNew,
1832                 HAS_1_TEMPLATE_PARAMS(typename, T),
1833                 AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
1834   return new T(p0, p1, p2, p3);
1835 }
1836
1837 ACTION_TEMPLATE(ReturnNew,
1838                 HAS_1_TEMPLATE_PARAMS(typename, T),
1839                 AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
1840   return new T(p0, p1, p2, p3, p4);
1841 }
1842
1843 ACTION_TEMPLATE(ReturnNew,
1844                 HAS_1_TEMPLATE_PARAMS(typename, T),
1845                 AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
1846   return new T(p0, p1, p2, p3, p4, p5);
1847 }
1848
1849 ACTION_TEMPLATE(ReturnNew,
1850                 HAS_1_TEMPLATE_PARAMS(typename, T),
1851                 AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
1852   return new T(p0, p1, p2, p3, p4, p5, p6);
1853 }
1854
1855 ACTION_TEMPLATE(ReturnNew,
1856                 HAS_1_TEMPLATE_PARAMS(typename, T),
1857                 AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
1858   return new T(p0, p1, p2, p3, p4, p5, p6, p7);
1859 }
1860
1861 ACTION_TEMPLATE(ReturnNew,
1862                 HAS_1_TEMPLATE_PARAMS(typename, T),
1863                 AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
1864   return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8);
1865 }
1866
1867 ACTION_TEMPLATE(ReturnNew,
1868                 HAS_1_TEMPLATE_PARAMS(typename, T),
1869                 AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
1870   return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
1871 }
1872
1873 #ifdef _MSC_VER
1874 # pragma warning(pop)
1875 #endif
1876
1877 }  // namespace testing
1878
1879 // Include any custom callback actions added by the local installation.
1880 // We must include this header at the end to make sure it can use the
1881 // declarations from this file.
1882 #include "gmock/internal/custom/gmock-generated-actions.h"
1883
1884 #endif  // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_