1 // This file was GENERATED by a script. DO NOT EDIT BY HAND!!!
3 // Copyright 2007, Google Inc.
4 // All rights reserved.
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following disclaimer
14 // in the documentation and/or other materials provided with the
16 // * Neither the name of Google Inc. nor the names of its
17 // contributors may be used to endorse or promote products derived from
18 // this software without specific prior written permission.
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 // Author: wan@google.com (Zhanyong Wan)
34 // Google Mock - a framework for writing C++ mock classes.
36 // This file implements some commonly used variadic actions.
38 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
39 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
41 #include "gmock/gmock-actions.h"
42 #include "gmock/internal/gmock-port.h"
47 // InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
48 // function or method with the unpacked values, where F is a function
49 // type that takes N arguments.
50 template <typename Result, typename ArgumentTuple>
54 class InvokeHelper<R, ::std::tr1::tuple<> > {
56 template <typename Function>
57 static R Invoke(Function function, const ::std::tr1::tuple<>&) {
61 template <class Class, typename MethodPtr>
62 static R InvokeMethod(Class* obj_ptr,
64 const ::std::tr1::tuple<>&) {
65 return (obj_ptr->*method_ptr)();
69 template <typename R, typename A1>
70 class InvokeHelper<R, ::std::tr1::tuple<A1> > {
72 template <typename Function>
73 static R Invoke(Function function, const ::std::tr1::tuple<A1>& args) {
74 using ::std::tr1::get;
75 return function(get<0>(args));
78 template <class Class, typename MethodPtr>
79 static R InvokeMethod(Class* obj_ptr,
81 const ::std::tr1::tuple<A1>& args) {
82 using ::std::tr1::get;
83 return (obj_ptr->*method_ptr)(get<0>(args));
87 template <typename R, typename A1, typename A2>
88 class InvokeHelper<R, ::std::tr1::tuple<A1, A2> > {
90 template <typename Function>
91 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2>& args) {
92 using ::std::tr1::get;
93 return function(get<0>(args), get<1>(args));
96 template <class Class, typename MethodPtr>
97 static R InvokeMethod(Class* obj_ptr,
99 const ::std::tr1::tuple<A1, A2>& args) {
100 using ::std::tr1::get;
101 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
105 template <typename R, typename A1, typename A2, typename A3>
106 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3> > {
108 template <typename Function>
109 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2,
111 using ::std::tr1::get;
112 return function(get<0>(args), get<1>(args), get<2>(args));
115 template <class Class, typename MethodPtr>
116 static R InvokeMethod(Class* obj_ptr,
117 MethodPtr method_ptr,
118 const ::std::tr1::tuple<A1, A2, A3>& args) {
119 using ::std::tr1::get;
120 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args));
124 template <typename R, typename A1, typename A2, typename A3, typename A4>
125 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4> > {
127 template <typename Function>
128 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3,
130 using ::std::tr1::get;
131 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args));
134 template <class Class, typename MethodPtr>
135 static R InvokeMethod(Class* obj_ptr,
136 MethodPtr method_ptr,
137 const ::std::tr1::tuple<A1, A2, A3, A4>& args) {
138 using ::std::tr1::get;
139 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
144 template <typename R, typename A1, typename A2, typename A3, typename A4,
146 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5> > {
148 template <typename Function>
149 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
151 using ::std::tr1::get;
152 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
156 template <class Class, typename MethodPtr>
157 static R InvokeMethod(Class* obj_ptr,
158 MethodPtr method_ptr,
159 const ::std::tr1::tuple<A1, A2, A3, A4, A5>& args) {
160 using ::std::tr1::get;
161 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
162 get<3>(args), get<4>(args));
166 template <typename R, typename A1, typename A2, typename A3, typename A4,
167 typename A5, typename A6>
168 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6> > {
170 template <typename Function>
171 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
173 using ::std::tr1::get;
174 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
175 get<4>(args), get<5>(args));
178 template <class Class, typename MethodPtr>
179 static R InvokeMethod(Class* obj_ptr,
180 MethodPtr method_ptr,
181 const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6>& args) {
182 using ::std::tr1::get;
183 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
184 get<3>(args), get<4>(args), get<5>(args));
188 template <typename R, typename A1, typename A2, typename A3, typename A4,
189 typename A5, typename A6, typename A7>
190 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7> > {
192 template <typename Function>
193 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
195 using ::std::tr1::get;
196 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
197 get<4>(args), get<5>(args), get<6>(args));
200 template <class Class, typename MethodPtr>
201 static R InvokeMethod(Class* obj_ptr,
202 MethodPtr method_ptr,
203 const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6,
205 using ::std::tr1::get;
206 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
207 get<3>(args), get<4>(args), get<5>(args), get<6>(args));
211 template <typename R, typename A1, typename A2, typename A3, typename A4,
212 typename A5, typename A6, typename A7, typename A8>
213 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
215 template <typename Function>
216 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
217 A5, A6, A7, A8>& args) {
218 using ::std::tr1::get;
219 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
220 get<4>(args), get<5>(args), get<6>(args), get<7>(args));
223 template <class Class, typename MethodPtr>
224 static R InvokeMethod(Class* obj_ptr,
225 MethodPtr method_ptr,
226 const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7,
228 using ::std::tr1::get;
229 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
230 get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args));
234 template <typename R, typename A1, typename A2, typename A3, typename A4,
235 typename A5, typename A6, typename A7, typename A8, typename A9>
236 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
238 template <typename Function>
239 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
240 A5, A6, A7, A8, A9>& args) {
241 using ::std::tr1::get;
242 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
243 get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args));
246 template <class Class, typename MethodPtr>
247 static R InvokeMethod(Class* obj_ptr,
248 MethodPtr method_ptr,
249 const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
251 using ::std::tr1::get;
252 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
253 get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args),
258 template <typename R, typename A1, typename A2, typename A3, typename A4,
259 typename A5, typename A6, typename A7, typename A8, typename A9,
261 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
264 template <typename Function>
265 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
266 A5, A6, A7, A8, A9, A10>& args) {
267 using ::std::tr1::get;
268 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
269 get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
273 template <class Class, typename MethodPtr>
274 static R InvokeMethod(Class* obj_ptr,
275 MethodPtr method_ptr,
276 const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
278 using ::std::tr1::get;
279 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
280 get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args),
281 get<8>(args), get<9>(args));
285 // CallableHelper has static methods for invoking "callables",
286 // i.e. function pointers and functors. It uses overloading to
287 // provide a uniform interface for invoking different kinds of
288 // callables. In particular, you can use:
290 // CallableHelper<R>::Call(callable, a1, a2, ..., an)
292 // to invoke an n-ary callable, where R is its return type. If an
293 // argument, say a2, needs to be passed by reference, you should write
294 // ByRef(a2) instead of a2 in the above expression.
295 template <typename R>
296 class CallableHelper {
298 // Calls a nullary callable.
299 template <typename Function>
300 static R Call(Function function) { return function(); }
302 // Calls a unary callable.
304 // We deliberately pass a1 by value instead of const reference here
305 // in case it is a C-string literal. If we had declared the
306 // parameter as 'const A1& a1' and write Call(function, "Hi"), the
307 // compiler would've thought A1 is 'char[3]', which causes trouble
308 // when you need to copy a value of type A1. By declaring the
309 // parameter as 'A1 a1', the compiler will correctly infer that A1
310 // is 'const char*' when it sees Call(function, "Hi").
312 // Since this function is defined inline, the compiler can get rid
313 // of the copying of the arguments. Therefore the performance won't
315 template <typename Function, typename A1>
316 static R Call(Function function, A1 a1) { return function(a1); }
318 // Calls a binary callable.
319 template <typename Function, typename A1, typename A2>
320 static R Call(Function function, A1 a1, A2 a2) {
321 return function(a1, a2);
324 // Calls a ternary callable.
325 template <typename Function, typename A1, typename A2, typename A3>
326 static R Call(Function function, A1 a1, A2 a2, A3 a3) {
327 return function(a1, a2, a3);
330 // Calls a 4-ary callable.
331 template <typename Function, typename A1, typename A2, typename A3,
333 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4) {
334 return function(a1, a2, a3, a4);
337 // Calls a 5-ary callable.
338 template <typename Function, typename A1, typename A2, typename A3,
339 typename A4, typename A5>
340 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
341 return function(a1, a2, a3, a4, a5);
344 // Calls a 6-ary callable.
345 template <typename Function, typename A1, typename A2, typename A3,
346 typename A4, typename A5, typename A6>
347 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
348 return function(a1, a2, a3, a4, a5, a6);
351 // Calls a 7-ary callable.
352 template <typename Function, typename A1, typename A2, typename A3,
353 typename A4, typename A5, typename A6, typename A7>
354 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
356 return function(a1, a2, a3, a4, a5, a6, a7);
359 // Calls a 8-ary callable.
360 template <typename Function, typename A1, typename A2, typename A3,
361 typename A4, typename A5, typename A6, typename A7, typename A8>
362 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
364 return function(a1, a2, a3, a4, a5, a6, a7, a8);
367 // Calls a 9-ary callable.
368 template <typename Function, typename A1, typename A2, typename A3,
369 typename A4, typename A5, typename A6, typename A7, typename A8,
371 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
372 A7 a7, A8 a8, A9 a9) {
373 return function(a1, a2, a3, a4, a5, a6, a7, a8, a9);
376 // Calls a 10-ary callable.
377 template <typename Function, typename A1, typename A2, typename A3,
378 typename A4, typename A5, typename A6, typename A7, typename A8,
379 typename A9, typename A10>
380 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
381 A7 a7, A8 a8, A9 a9, A10 a10) {
382 return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
385 }; // class CallableHelper
387 // An INTERNAL macro for extracting the type of a tuple field. It's
388 // subject to change without notice - DO NOT USE IN USER CODE!
389 #define GMOCK_FIELD_(Tuple, N) \
390 typename ::std::tr1::tuple_element<N, Tuple>::type
392 // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
393 // type of an n-ary function whose i-th (1-based) argument type is the
394 // k{i}-th (0-based) field of ArgumentTuple, which must be a tuple
395 // type, and whose return type is Result. For example,
396 // SelectArgs<int, ::std::tr1::tuple<bool, char, double, long>, 0, 3>::type
397 // is int(bool, long).
399 // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
400 // returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
402 // SelectArgs<int, ::std::tr1::tuple<bool, char, double>, 2, 0>::Select(
403 // ::std::tr1::make_tuple(true, 'a', 2.5))
404 // returns ::std::tr1::tuple (2.5, true).
406 // The numbers in list k1, k2, ..., k_n must be >= 0, where n can be
407 // in the range [0, 10]. Duplicates are allowed and they don't have
408 // to be in an ascending or descending order.
410 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
411 int k4, int k5, int k6, int k7, int k8, int k9, int k10>
414 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
415 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
416 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
417 GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
418 GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9),
419 GMOCK_FIELD_(ArgumentTuple, k10));
420 typedef typename Function<type>::ArgumentTuple SelectedArgs;
421 static SelectedArgs Select(const ArgumentTuple& args) {
422 using ::std::tr1::get;
423 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
424 get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
425 get<k8>(args), get<k9>(args), get<k10>(args));
429 template <typename Result, typename ArgumentTuple>
430 class SelectArgs<Result, ArgumentTuple,
431 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
433 typedef Result type();
434 typedef typename Function<type>::ArgumentTuple SelectedArgs;
435 static SelectedArgs Select(const ArgumentTuple& /* args */) {
436 using ::std::tr1::get;
437 return SelectedArgs();
441 template <typename Result, typename ArgumentTuple, int k1>
442 class SelectArgs<Result, ArgumentTuple,
443 k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
445 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1));
446 typedef typename Function<type>::ArgumentTuple SelectedArgs;
447 static SelectedArgs Select(const ArgumentTuple& args) {
448 using ::std::tr1::get;
449 return SelectedArgs(get<k1>(args));
453 template <typename Result, typename ArgumentTuple, int k1, int k2>
454 class SelectArgs<Result, ArgumentTuple,
455 k1, k2, -1, -1, -1, -1, -1, -1, -1, -1> {
457 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
458 GMOCK_FIELD_(ArgumentTuple, k2));
459 typedef typename Function<type>::ArgumentTuple SelectedArgs;
460 static SelectedArgs Select(const ArgumentTuple& args) {
461 using ::std::tr1::get;
462 return SelectedArgs(get<k1>(args), get<k2>(args));
466 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3>
467 class SelectArgs<Result, ArgumentTuple,
468 k1, k2, k3, -1, -1, -1, -1, -1, -1, -1> {
470 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
471 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3));
472 typedef typename Function<type>::ArgumentTuple SelectedArgs;
473 static SelectedArgs Select(const ArgumentTuple& args) {
474 using ::std::tr1::get;
475 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args));
479 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
481 class SelectArgs<Result, ArgumentTuple,
482 k1, k2, k3, k4, -1, -1, -1, -1, -1, -1> {
484 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
485 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
486 GMOCK_FIELD_(ArgumentTuple, k4));
487 typedef typename Function<type>::ArgumentTuple SelectedArgs;
488 static SelectedArgs Select(const ArgumentTuple& args) {
489 using ::std::tr1::get;
490 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
495 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
497 class SelectArgs<Result, ArgumentTuple,
498 k1, k2, k3, k4, k5, -1, -1, -1, -1, -1> {
500 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
501 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
502 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5));
503 typedef typename Function<type>::ArgumentTuple SelectedArgs;
504 static SelectedArgs Select(const ArgumentTuple& args) {
505 using ::std::tr1::get;
506 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
507 get<k4>(args), get<k5>(args));
511 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
512 int k4, int k5, int k6>
513 class SelectArgs<Result, ArgumentTuple,
514 k1, k2, k3, k4, k5, k6, -1, -1, -1, -1> {
516 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
517 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
518 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
519 GMOCK_FIELD_(ArgumentTuple, k6));
520 typedef typename Function<type>::ArgumentTuple SelectedArgs;
521 static SelectedArgs Select(const ArgumentTuple& args) {
522 using ::std::tr1::get;
523 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
524 get<k4>(args), get<k5>(args), get<k6>(args));
528 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
529 int k4, int k5, int k6, int k7>
530 class SelectArgs<Result, ArgumentTuple,
531 k1, k2, k3, k4, k5, k6, k7, -1, -1, -1> {
533 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
534 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
535 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
536 GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7));
537 typedef typename Function<type>::ArgumentTuple SelectedArgs;
538 static SelectedArgs Select(const ArgumentTuple& args) {
539 using ::std::tr1::get;
540 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
541 get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args));
545 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
546 int k4, int k5, int k6, int k7, int k8>
547 class SelectArgs<Result, ArgumentTuple,
548 k1, k2, k3, k4, k5, k6, k7, k8, -1, -1> {
550 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
551 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
552 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
553 GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
554 GMOCK_FIELD_(ArgumentTuple, k8));
555 typedef typename Function<type>::ArgumentTuple SelectedArgs;
556 static SelectedArgs Select(const ArgumentTuple& args) {
557 using ::std::tr1::get;
558 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
559 get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
564 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
565 int k4, int k5, int k6, int k7, int k8, int k9>
566 class SelectArgs<Result, ArgumentTuple,
567 k1, k2, k3, k4, k5, k6, k7, k8, k9, -1> {
569 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
570 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
571 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
572 GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
573 GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9));
574 typedef typename Function<type>::ArgumentTuple SelectedArgs;
575 static SelectedArgs Select(const ArgumentTuple& args) {
576 using ::std::tr1::get;
577 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
578 get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
579 get<k8>(args), get<k9>(args));
585 // Implements the WithArgs action.
586 template <typename InnerAction, int k1 = -1, int k2 = -1, int k3 = -1,
587 int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
588 int k9 = -1, int k10 = -1>
589 class WithArgsAction {
591 explicit WithArgsAction(const InnerAction& action) : action_(action) {}
593 template <typename F>
594 operator Action<F>() const { return MakeAction(new Impl<F>(action_)); }
597 template <typename F>
598 class Impl : public ActionInterface<F> {
600 typedef typename Function<F>::Result Result;
601 typedef typename Function<F>::ArgumentTuple ArgumentTuple;
603 explicit Impl(const InnerAction& action) : action_(action) {}
605 virtual Result Perform(const ArgumentTuple& args) {
606 return action_.Perform(SelectArgs<Result, ArgumentTuple, k1, k2, k3, k4,
607 k5, k6, k7, k8, k9, k10>::Select(args));
611 typedef typename SelectArgs<Result, ArgumentTuple,
612 k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType;
614 Action<InnerFunctionType> action_;
617 const InnerAction action_;
619 GTEST_DISALLOW_ASSIGN_(WithArgsAction);
622 // A macro from the ACTION* family (defined later in this file)
623 // defines an action that can be used in a mock function. Typically,
624 // these actions only care about a subset of the arguments of the mock
625 // function. For example, if such an action only uses the second
626 // argument, it can be used in any mock function that takes >= 2
627 // arguments where the type of the second argument is compatible.
629 // Therefore, the action implementation must be prepared to take more
630 // arguments than it needs. The ExcessiveArg type is used to
631 // represent those excessive arguments. In order to keep the compiler
632 // error messages tractable, we define it in the testing namespace
633 // instead of testing::internal. However, this is an INTERNAL TYPE
634 // and subject to change without notice, so a user MUST NOT USE THIS
636 struct ExcessiveArg {};
638 // A helper class needed for implementing the ACTION* macros.
639 template <typename Result, class Impl>
642 static Result Perform(Impl* impl, const ::std::tr1::tuple<>& args) {
643 using ::std::tr1::get;
644 return impl->template gmock_PerformImpl<>(args, ExcessiveArg(),
645 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
646 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
650 template <typename A0>
651 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0>& args) {
652 using ::std::tr1::get;
653 return impl->template gmock_PerformImpl<A0>(args, get<0>(args),
654 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
655 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
659 template <typename A0, typename A1>
660 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1>& args) {
661 using ::std::tr1::get;
662 return impl->template gmock_PerformImpl<A0, A1>(args, get<0>(args),
663 get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
664 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
668 template <typename A0, typename A1, typename A2>
669 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2>& args) {
670 using ::std::tr1::get;
671 return impl->template gmock_PerformImpl<A0, A1, A2>(args, get<0>(args),
672 get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(),
673 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
677 template <typename A0, typename A1, typename A2, typename A3>
678 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2,
680 using ::std::tr1::get;
681 return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, get<0>(args),
682 get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(),
683 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
687 template <typename A0, typename A1, typename A2, typename A3, typename A4>
688 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3,
690 using ::std::tr1::get;
691 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args,
692 get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
693 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
697 template <typename A0, typename A1, typename A2, typename A3, typename A4,
699 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
701 using ::std::tr1::get;
702 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args,
703 get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
704 get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
708 template <typename A0, typename A1, typename A2, typename A3, typename A4,
709 typename A5, typename A6>
710 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
712 using ::std::tr1::get;
713 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args,
714 get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
715 get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(),
719 template <typename A0, typename A1, typename A2, typename A3, typename A4,
720 typename A5, typename A6, typename A7>
721 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
723 using ::std::tr1::get;
724 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6,
725 A7>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
726 get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(),
730 template <typename A0, typename A1, typename A2, typename A3, typename A4,
731 typename A5, typename A6, typename A7, typename A8>
732 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
733 A5, A6, A7, A8>& args) {
734 using ::std::tr1::get;
735 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7,
736 A8>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
737 get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
741 template <typename A0, typename A1, typename A2, typename A3, typename A4,
742 typename A5, typename A6, typename A7, typename A8, typename A9>
743 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
744 A5, A6, A7, A8, A9>& args) {
745 using ::std::tr1::get;
746 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8,
747 A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
748 get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
753 } // namespace internal
755 // Various overloads for Invoke().
757 // WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes
758 // the selected arguments of the mock function to an_action and
759 // performs it. It serves as an adaptor between actions with
760 // different argument lists. C++ doesn't support default arguments for
761 // function templates, so we have to overload it.
762 template <int k1, typename InnerAction>
763 inline internal::WithArgsAction<InnerAction, k1>
764 WithArgs(const InnerAction& action) {
765 return internal::WithArgsAction<InnerAction, k1>(action);
768 template <int k1, int k2, typename InnerAction>
769 inline internal::WithArgsAction<InnerAction, k1, k2>
770 WithArgs(const InnerAction& action) {
771 return internal::WithArgsAction<InnerAction, k1, k2>(action);
774 template <int k1, int k2, int k3, typename InnerAction>
775 inline internal::WithArgsAction<InnerAction, k1, k2, k3>
776 WithArgs(const InnerAction& action) {
777 return internal::WithArgsAction<InnerAction, k1, k2, k3>(action);
780 template <int k1, int k2, int k3, int k4, typename InnerAction>
781 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4>
782 WithArgs(const InnerAction& action) {
783 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4>(action);
786 template <int k1, int k2, int k3, int k4, int k5, typename InnerAction>
787 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>
788 WithArgs(const InnerAction& action) {
789 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>(action);
792 template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerAction>
793 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>
794 WithArgs(const InnerAction& action) {
795 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>(action);
798 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
799 typename InnerAction>
800 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7>
801 WithArgs(const InnerAction& action) {
802 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6,
806 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
807 typename InnerAction>
808 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8>
809 WithArgs(const InnerAction& action) {
810 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7,
814 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
815 int k9, typename InnerAction>
816 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, k9>
817 WithArgs(const InnerAction& action) {
818 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
822 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
823 int k9, int k10, typename InnerAction>
824 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
826 WithArgs(const InnerAction& action) {
827 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
831 // Creates an action that does actions a1, a2, ..., sequentially in
833 template <typename Action1, typename Action2>
834 inline internal::DoBothAction<Action1, Action2>
835 DoAll(Action1 a1, Action2 a2) {
836 return internal::DoBothAction<Action1, Action2>(a1, a2);
839 template <typename Action1, typename Action2, typename Action3>
840 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
842 DoAll(Action1 a1, Action2 a2, Action3 a3) {
843 return DoAll(a1, DoAll(a2, a3));
846 template <typename Action1, typename Action2, typename Action3,
848 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
849 internal::DoBothAction<Action3, Action4> > >
850 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) {
851 return DoAll(a1, DoAll(a2, a3, a4));
854 template <typename Action1, typename Action2, typename Action3,
855 typename Action4, typename Action5>
856 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
857 internal::DoBothAction<Action3, internal::DoBothAction<Action4,
859 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) {
860 return DoAll(a1, DoAll(a2, a3, a4, a5));
863 template <typename Action1, typename Action2, typename Action3,
864 typename Action4, typename Action5, typename Action6>
865 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
866 internal::DoBothAction<Action3, internal::DoBothAction<Action4,
867 internal::DoBothAction<Action5, Action6> > > > >
868 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) {
869 return DoAll(a1, DoAll(a2, a3, a4, a5, a6));
872 template <typename Action1, typename Action2, typename Action3,
873 typename Action4, typename Action5, typename Action6, typename Action7>
874 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
875 internal::DoBothAction<Action3, internal::DoBothAction<Action4,
876 internal::DoBothAction<Action5, internal::DoBothAction<Action6,
878 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
880 return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7));
883 template <typename Action1, typename Action2, typename Action3,
884 typename Action4, typename Action5, typename Action6, typename Action7,
886 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
887 internal::DoBothAction<Action3, internal::DoBothAction<Action4,
888 internal::DoBothAction<Action5, internal::DoBothAction<Action6,
889 internal::DoBothAction<Action7, Action8> > > > > > >
890 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
891 Action7 a7, Action8 a8) {
892 return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8));
895 template <typename Action1, typename Action2, typename Action3,
896 typename Action4, typename Action5, typename Action6, typename Action7,
897 typename Action8, typename Action9>
898 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
899 internal::DoBothAction<Action3, internal::DoBothAction<Action4,
900 internal::DoBothAction<Action5, internal::DoBothAction<Action6,
901 internal::DoBothAction<Action7, internal::DoBothAction<Action8,
902 Action9> > > > > > > >
903 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
904 Action7 a7, Action8 a8, Action9 a9) {
905 return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9));
908 template <typename Action1, typename Action2, typename Action3,
909 typename Action4, typename Action5, typename Action6, typename Action7,
910 typename Action8, typename Action9, typename Action10>
911 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
912 internal::DoBothAction<Action3, internal::DoBothAction<Action4,
913 internal::DoBothAction<Action5, internal::DoBothAction<Action6,
914 internal::DoBothAction<Action7, internal::DoBothAction<Action8,
915 internal::DoBothAction<Action9, Action10> > > > > > > > >
916 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
917 Action7 a7, Action8 a8, Action9 a9, Action10 a10) {
918 return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10));
921 } // namespace testing
923 // The ACTION* family of macros can be used in a namespace scope to
924 // define custom actions easily. The syntax:
926 // ACTION(name) { statements; }
928 // will define an action with the given name that executes the
929 // statements. The value returned by the statements will be used as
930 // the return value of the action. Inside the statements, you can
931 // refer to the K-th (0-based) argument of the mock function by
932 // 'argK', and refer to its type by 'argK_type'. For example:
934 // ACTION(IncrementArg1) {
935 // arg1_type temp = arg1;
939 // allows you to write
941 // ...WillOnce(IncrementArg1());
943 // You can also refer to the entire argument tuple and its type by
944 // 'args' and 'args_type', and refer to the mock function type and its
945 // return type by 'function_type' and 'return_type'.
947 // Note that you don't need to specify the types of the mock function
948 // arguments. However rest assured that your code is still type-safe:
949 // you'll get a compiler error if *arg1 doesn't support the ++
950 // operator, or if the type of ++(*arg1) isn't compatible with the
951 // mock function's return type, for example.
953 // Sometimes you'll want to parameterize the action. For that you can use
956 // ACTION_P(name, param_name) { statements; }
960 // ACTION_P(Add, n) { return arg0 + n; }
962 // will allow you to write:
964 // ...WillOnce(Add(5));
966 // Note that you don't need to provide the type of the parameter
967 // either. If you need to reference the type of a parameter named
968 // 'foo', you can write 'foo_type'. For example, in the body of
969 // ACTION_P(Add, n) above, you can write 'n_type' to refer to the type
972 // We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support
973 // multi-parameter actions.
975 // For the purpose of typing, you can view
977 // ACTION_Pk(Foo, p1, ..., pk) { ... }
981 // template <typename p1_type, ..., typename pk_type>
982 // FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
984 // In particular, you can provide the template type arguments
985 // explicitly when invoking Foo(), as in Foo<long, bool>(5, false);
986 // although usually you can rely on the compiler to infer the types
987 // for you automatically. You can assign the result of expression
988 // Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ...,
989 // pk_type>. This can be useful when composing actions.
991 // You can also overload actions with different numbers of parameters:
993 // ACTION_P(Plus, a) { ... }
994 // ACTION_P2(Plus, a, b) { ... }
996 // While it's tempting to always use the ACTION* macros when defining
997 // a new action, you should also consider implementing ActionInterface
998 // or using MakePolymorphicAction() instead, especially if you need to
999 // use the action a lot. While these approaches require more work,
1000 // they give you more control on the types of the mock function
1001 // arguments and the action parameters, which in general leads to
1002 // better compiler error messages that pay off in the long run. They
1003 // also allow overloading actions based on parameter types (as opposed
1004 // to just based on the number of parameters).
1008 // ACTION*() can only be used in a namespace scope. The reason is
1009 // that C++ doesn't yet allow function-local types to be used to
1010 // instantiate templates. The up-coming C++0x standard will fix this.
1011 // Once that's done, we'll consider supporting using ACTION*() inside
1014 // MORE INFORMATION:
1016 // To learn more about using these macros, please search for 'ACTION'
1017 // on http://code.google.com/p/googlemock/wiki/CookBook.
1019 // An internal macro needed for implementing ACTION*().
1020 #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\
1021 const args_type& args GTEST_ATTRIBUTE_UNUSED_,\
1022 arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_,\
1023 arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_,\
1024 arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_,\
1025 arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_,\
1026 arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_,\
1027 arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_,\
1028 arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_,\
1029 arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_,\
1030 arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_,\
1031 arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_
1033 // Sometimes you want to give an action explicit template parameters
1034 // that cannot be inferred from its value parameters. ACTION() and
1035 // ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that
1036 // and can be viewed as an extension to ACTION() and ACTION_P*().
1040 // ACTION_TEMPLATE(ActionName,
1041 // HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m),
1042 // AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; }
1044 // defines an action template that takes m explicit template
1045 // parameters and n value parameters. name_i is the name of the i-th
1046 // template parameter, and kind_i specifies whether it's a typename,
1047 // an integral constant, or a template. p_i is the name of the i-th
1052 // // DuplicateArg<k, T>(output) converts the k-th argument of the mock
1053 // // function to type T and copies it to *output.
1054 // ACTION_TEMPLATE(DuplicateArg,
1055 // HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
1056 // AND_1_VALUE_PARAMS(output)) {
1057 // *output = T(std::tr1::get<k>(args));
1061 // EXPECT_CALL(mock, Foo(_, _))
1062 // .WillOnce(DuplicateArg<1, unsigned char>(&n));
1064 // To create an instance of an action template, write:
1066 // ActionName<t1, ..., t_m>(v1, ..., v_n)
1068 // where the ts are the template arguments and the vs are the value
1069 // arguments. The value argument types are inferred by the compiler.
1070 // If you want to explicitly specify the value argument types, you can
1071 // provide additional template arguments:
1073 // ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n)
1075 // where u_i is the desired type of v_i.
1077 // ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the
1078 // number of value parameters, but not on the number of template
1079 // parameters. Without the restriction, the meaning of the following
1082 // OverloadedAction<int, bool>(x);
1084 // Are we using a single-template-parameter action where 'bool' refers
1085 // to the type of x, or are we using a two-template-parameter action
1086 // where the compiler is asked to infer the type of x?
1088 // Implementation notes:
1090 // GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and
1091 // GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for
1092 // implementing ACTION_TEMPLATE. The main trick we use is to create
1093 // new macro invocations when expanding a macro. For example, we have
1095 // #define ACTION_TEMPLATE(name, template_params, value_params)
1096 // ... GMOCK_INTERNAL_DECL_##template_params ...
1098 // which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...)
1101 // ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ...
1103 // Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the
1104 // preprocessor will continue to expand it to
1106 // ... typename T ...
1108 // This technique conforms to the C++ standard and is portable. It
1109 // allows us to implement action templates using O(N) code, where N is
1110 // the maximum number of template/value parameters supported. Without
1111 // using it, we'd have to devote O(N^2) amount of code to implement all
1112 // combinations of m and n.
1114 // Declares the template parameters.
1115 #define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0
1116 #define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
1117 name1) kind0 name0, kind1 name1
1118 #define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1119 kind2, name2) kind0 name0, kind1 name1, kind2 name2
1120 #define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1121 kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \
1123 #define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1124 kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \
1125 kind2 name2, kind3 name3, kind4 name4
1126 #define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1127 kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \
1128 kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5
1129 #define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1130 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
1131 name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \
1132 kind5 name5, kind6 name6
1133 #define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1134 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
1135 kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \
1136 kind4 name4, kind5 name5, kind6 name6, kind7 name7
1137 #define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1138 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
1139 kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \
1140 kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \
1142 #define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
1143 name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
1144 name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \
1145 kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \
1146 kind6 name6, kind7 name7, kind8 name8, kind9 name9
1148 // Lists the template parameters.
1149 #define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0
1150 #define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
1152 #define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1153 kind2, name2) name0, name1, name2
1154 #define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1155 kind2, name2, kind3, name3) name0, name1, name2, name3
1156 #define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1157 kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \
1159 #define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1160 kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \
1161 name2, name3, name4, name5
1162 #define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1163 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
1164 name6) name0, name1, name2, name3, name4, name5, name6
1165 #define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1166 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
1167 kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7
1168 #define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1169 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
1170 kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \
1172 #define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
1173 name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
1174 name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \
1175 name3, name4, name5, name6, name7, name8, name9
1177 // Declares the types of value parameters.
1178 #define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS()
1179 #define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type
1180 #define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \
1181 typename p0##_type, typename p1##_type
1182 #define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \
1183 typename p0##_type, typename p1##_type, typename p2##_type
1184 #define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
1185 typename p0##_type, typename p1##_type, typename p2##_type, \
1187 #define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
1188 typename p0##_type, typename p1##_type, typename p2##_type, \
1189 typename p3##_type, typename p4##_type
1190 #define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
1191 typename p0##_type, typename p1##_type, typename p2##_type, \
1192 typename p3##_type, typename p4##_type, typename p5##_type
1193 #define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1194 p6) , typename p0##_type, typename p1##_type, typename p2##_type, \
1195 typename p3##_type, typename p4##_type, typename p5##_type, \
1197 #define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1198 p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \
1199 typename p3##_type, typename p4##_type, typename p5##_type, \
1200 typename p6##_type, typename p7##_type
1201 #define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1202 p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \
1203 typename p3##_type, typename p4##_type, typename p5##_type, \
1204 typename p6##_type, typename p7##_type, typename p8##_type
1205 #define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1206 p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \
1207 typename p2##_type, typename p3##_type, typename p4##_type, \
1208 typename p5##_type, typename p6##_type, typename p7##_type, \
1209 typename p8##_type, typename p9##_type
1211 // Initializes the value parameters.
1212 #define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\
1214 #define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\
1215 (p0##_type gmock_p0) : p0(gmock_p0)
1216 #define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\
1217 (p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1)
1218 #define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\
1219 (p0##_type gmock_p0, p1##_type gmock_p1, \
1220 p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2)
1221 #define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\
1222 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1223 p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1225 #define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\
1226 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1227 p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), \
1228 p2(gmock_p2), p3(gmock_p3), p4(gmock_p4)
1229 #define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\
1230 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1231 p3##_type gmock_p3, p4##_type gmock_p4, \
1232 p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1233 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5)
1234 #define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\
1235 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1236 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1237 p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1238 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6)
1239 #define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\
1240 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1241 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1242 p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \
1243 p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
1245 #define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1247 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1248 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1249 p6##_type gmock_p6, p7##_type gmock_p7, \
1250 p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1251 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
1253 #define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1255 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1256 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1257 p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
1258 p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1259 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
1260 p8(gmock_p8), p9(gmock_p9)
1262 // Declares the fields for storing the value parameters.
1263 #define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS()
1264 #define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0;
1265 #define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \
1267 #define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \
1268 p1##_type p1; p2##_type p2;
1269 #define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \
1270 p1##_type p1; p2##_type p2; p3##_type p3;
1271 #define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
1272 p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4;
1273 #define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
1274 p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
1276 #define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1277 p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
1278 p5##_type p5; p6##_type p6;
1279 #define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1280 p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
1281 p5##_type p5; p6##_type p6; p7##_type p7;
1282 #define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1283 p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
1284 p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8;
1285 #define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1286 p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
1287 p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \
1290 // Lists the value parameters.
1291 #define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS()
1292 #define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0
1293 #define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1
1294 #define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2
1295 #define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3
1296 #define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \
1298 #define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \
1300 #define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1301 p6) p0, p1, p2, p3, p4, p5, p6
1302 #define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1303 p7) p0, p1, p2, p3, p4, p5, p6, p7
1304 #define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1305 p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8
1306 #define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1307 p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9
1309 // Lists the value parameter types.
1310 #define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS()
1311 #define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type
1312 #define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \
1314 #define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \
1315 p1##_type, p2##_type
1316 #define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
1317 p0##_type, p1##_type, p2##_type, p3##_type
1318 #define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
1319 p0##_type, p1##_type, p2##_type, p3##_type, p4##_type
1320 #define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
1321 p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type
1322 #define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1323 p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \
1325 #define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1326 p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1327 p5##_type, p6##_type, p7##_type
1328 #define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1329 p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1330 p5##_type, p6##_type, p7##_type, p8##_type
1331 #define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1332 p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1333 p5##_type, p6##_type, p7##_type, p8##_type, p9##_type
1335 // Declares the value parameters.
1336 #define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS()
1337 #define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0
1338 #define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \
1340 #define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \
1341 p1##_type p1, p2##_type p2
1342 #define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \
1343 p1##_type p1, p2##_type p2, p3##_type p3
1344 #define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
1345 p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4
1346 #define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
1347 p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
1349 #define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1350 p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
1351 p5##_type p5, p6##_type p6
1352 #define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1353 p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
1354 p5##_type p5, p6##_type p6, p7##_type p7
1355 #define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1356 p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1357 p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8
1358 #define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1359 p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1360 p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
1363 // The suffix of the class template implementing the action template.
1364 #define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS()
1365 #define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P
1366 #define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2
1367 #define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3
1368 #define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4
1369 #define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5
1370 #define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6
1371 #define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7
1372 #define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1374 #define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1376 #define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1379 // The name of the class template implementing the action template.
1380 #define GMOCK_ACTION_CLASS_(name, value_params)\
1381 GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params)
1383 #define ACTION_TEMPLATE(name, template_params, value_params)\
1384 template <GMOCK_INTERNAL_DECL_##template_params\
1385 GMOCK_INTERNAL_DECL_TYPE_##value_params>\
1386 class GMOCK_ACTION_CLASS_(name, value_params) {\
1388 GMOCK_ACTION_CLASS_(name, value_params)\
1389 GMOCK_INTERNAL_INIT_##value_params {}\
1390 template <typename F>\
1391 class gmock_Impl : public ::testing::ActionInterface<F> {\
1393 typedef F function_type;\
1394 typedef typename ::testing::internal::Function<F>::Result return_type;\
1395 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1397 explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\
1398 virtual return_type Perform(const args_type& args) {\
1399 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1400 Perform(this, args);\
1402 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1403 typename arg3_type, typename arg4_type, typename arg5_type, \
1404 typename arg6_type, typename arg7_type, typename arg8_type, \
1405 typename arg9_type>\
1406 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1407 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1408 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1409 arg9_type arg9) const;\
1410 GMOCK_INTERNAL_DEFN_##value_params\
1412 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1414 template <typename F> operator ::testing::Action<F>() const {\
1415 return ::testing::Action<F>(\
1416 new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
1418 GMOCK_INTERNAL_DEFN_##value_params\
1420 GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\
1422 template <GMOCK_INTERNAL_DECL_##template_params\
1423 GMOCK_INTERNAL_DECL_TYPE_##value_params>\
1424 inline GMOCK_ACTION_CLASS_(name, value_params)<\
1425 GMOCK_INTERNAL_LIST_##template_params\
1426 GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\
1427 GMOCK_INTERNAL_DECL_##value_params) {\
1428 return GMOCK_ACTION_CLASS_(name, value_params)<\
1429 GMOCK_INTERNAL_LIST_##template_params\
1430 GMOCK_INTERNAL_LIST_TYPE_##value_params>(\
1431 GMOCK_INTERNAL_LIST_##value_params);\
1433 template <GMOCK_INTERNAL_DECL_##template_params\
1434 GMOCK_INTERNAL_DECL_TYPE_##value_params>\
1435 template <typename F>\
1436 template <typename arg0_type, typename arg1_type, typename arg2_type,\
1437 typename arg3_type, typename arg4_type, typename arg5_type,\
1438 typename arg6_type, typename arg7_type, typename arg8_type,\
1439 typename arg9_type>\
1440 typename ::testing::internal::Function<F>::Result\
1441 GMOCK_ACTION_CLASS_(name, value_params)<\
1442 GMOCK_INTERNAL_LIST_##template_params\
1443 GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
1445 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1447 #define ACTION(name)\
1448 class name##Action {\
1451 template <typename F>\
1452 class gmock_Impl : public ::testing::ActionInterface<F> {\
1454 typedef F function_type;\
1455 typedef typename ::testing::internal::Function<F>::Result return_type;\
1456 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1459 virtual return_type Perform(const args_type& args) {\
1460 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1461 Perform(this, args);\
1463 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1464 typename arg3_type, typename arg4_type, typename arg5_type, \
1465 typename arg6_type, typename arg7_type, typename arg8_type, \
1466 typename arg9_type>\
1467 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1468 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1469 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1470 arg9_type arg9) const;\
1472 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1474 template <typename F> operator ::testing::Action<F>() const {\
1475 return ::testing::Action<F>(new gmock_Impl<F>());\
1478 GTEST_DISALLOW_ASSIGN_(name##Action);\
1480 inline name##Action name() {\
1481 return name##Action();\
1483 template <typename F>\
1484 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1485 typename arg3_type, typename arg4_type, typename arg5_type, \
1486 typename arg6_type, typename arg7_type, typename arg8_type, \
1487 typename arg9_type>\
1488 typename ::testing::internal::Function<F>::Result\
1489 name##Action::gmock_Impl<F>::gmock_PerformImpl(\
1490 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1492 #define ACTION_P(name, p0)\
1493 template <typename p0##_type>\
1494 class name##ActionP {\
1496 name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\
1497 template <typename F>\
1498 class gmock_Impl : public ::testing::ActionInterface<F> {\
1500 typedef F function_type;\
1501 typedef typename ::testing::internal::Function<F>::Result return_type;\
1502 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1504 explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\
1505 virtual return_type Perform(const args_type& args) {\
1506 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1507 Perform(this, args);\
1509 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1510 typename arg3_type, typename arg4_type, typename arg5_type, \
1511 typename arg6_type, typename arg7_type, typename arg8_type, \
1512 typename arg9_type>\
1513 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1514 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1515 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1516 arg9_type arg9) const;\
1519 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1521 template <typename F> operator ::testing::Action<F>() const {\
1522 return ::testing::Action<F>(new gmock_Impl<F>(p0));\
1526 GTEST_DISALLOW_ASSIGN_(name##ActionP);\
1528 template <typename p0##_type>\
1529 inline name##ActionP<p0##_type> name(p0##_type p0) {\
1530 return name##ActionP<p0##_type>(p0);\
1532 template <typename p0##_type>\
1533 template <typename F>\
1534 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1535 typename arg3_type, typename arg4_type, typename arg5_type, \
1536 typename arg6_type, typename arg7_type, typename arg8_type, \
1537 typename arg9_type>\
1538 typename ::testing::internal::Function<F>::Result\
1539 name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1540 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1542 #define ACTION_P2(name, p0, p1)\
1543 template <typename p0##_type, typename p1##_type>\
1544 class name##ActionP2 {\
1546 name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
1548 template <typename F>\
1549 class gmock_Impl : public ::testing::ActionInterface<F> {\
1551 typedef F function_type;\
1552 typedef typename ::testing::internal::Function<F>::Result return_type;\
1553 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1555 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
1557 virtual return_type Perform(const args_type& args) {\
1558 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1559 Perform(this, args);\
1561 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1562 typename arg3_type, typename arg4_type, typename arg5_type, \
1563 typename arg6_type, typename arg7_type, typename arg8_type, \
1564 typename arg9_type>\
1565 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1566 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1567 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1568 arg9_type arg9) const;\
1572 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1574 template <typename F> operator ::testing::Action<F>() const {\
1575 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
1580 GTEST_DISALLOW_ASSIGN_(name##ActionP2);\
1582 template <typename p0##_type, typename p1##_type>\
1583 inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
1585 return name##ActionP2<p0##_type, p1##_type>(p0, p1);\
1587 template <typename p0##_type, typename p1##_type>\
1588 template <typename F>\
1589 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1590 typename arg3_type, typename arg4_type, typename arg5_type, \
1591 typename arg6_type, typename arg7_type, typename arg8_type, \
1592 typename arg9_type>\
1593 typename ::testing::internal::Function<F>::Result\
1594 name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1595 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1597 #define ACTION_P3(name, p0, p1, p2)\
1598 template <typename p0##_type, typename p1##_type, typename p2##_type>\
1599 class name##ActionP3 {\
1601 name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \
1602 p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
1603 template <typename F>\
1604 class gmock_Impl : public ::testing::ActionInterface<F> {\
1606 typedef F function_type;\
1607 typedef typename ::testing::internal::Function<F>::Result return_type;\
1608 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1610 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \
1611 p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
1612 virtual return_type Perform(const args_type& args) {\
1613 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1614 Perform(this, args);\
1616 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1617 typename arg3_type, typename arg4_type, typename arg5_type, \
1618 typename arg6_type, typename arg7_type, typename arg8_type, \
1619 typename arg9_type>\
1620 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1621 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1622 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1623 arg9_type arg9) const;\
1628 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1630 template <typename F> operator ::testing::Action<F>() const {\
1631 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
1637 GTEST_DISALLOW_ASSIGN_(name##ActionP3);\
1639 template <typename p0##_type, typename p1##_type, typename p2##_type>\
1640 inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
1641 p1##_type p1, p2##_type p2) {\
1642 return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
1644 template <typename p0##_type, typename p1##_type, typename p2##_type>\
1645 template <typename F>\
1646 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1647 typename arg3_type, typename arg4_type, typename arg5_type, \
1648 typename arg6_type, typename arg7_type, typename arg8_type, \
1649 typename arg9_type>\
1650 typename ::testing::internal::Function<F>::Result\
1651 name##ActionP3<p0##_type, p1##_type, \
1652 p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1653 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1655 #define ACTION_P4(name, p0, p1, p2, p3)\
1656 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1657 typename p3##_type>\
1658 class name##ActionP4 {\
1660 name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \
1661 p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \
1662 p2(gmock_p2), p3(gmock_p3) {}\
1663 template <typename F>\
1664 class gmock_Impl : public ::testing::ActionInterface<F> {\
1666 typedef F function_type;\
1667 typedef typename ::testing::internal::Function<F>::Result return_type;\
1668 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1670 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1671 p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1673 virtual return_type Perform(const args_type& args) {\
1674 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1675 Perform(this, args);\
1677 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1678 typename arg3_type, typename arg4_type, typename arg5_type, \
1679 typename arg6_type, typename arg7_type, typename arg8_type, \
1680 typename arg9_type>\
1681 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1682 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1683 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1684 arg9_type arg9) const;\
1690 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1692 template <typename F> operator ::testing::Action<F>() const {\
1693 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
1700 GTEST_DISALLOW_ASSIGN_(name##ActionP4);\
1702 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1703 typename p3##_type>\
1704 inline name##ActionP4<p0##_type, p1##_type, p2##_type, \
1705 p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
1707 return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \
1710 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1711 typename p3##_type>\
1712 template <typename F>\
1713 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1714 typename arg3_type, typename arg4_type, typename arg5_type, \
1715 typename arg6_type, typename arg7_type, typename arg8_type, \
1716 typename arg9_type>\
1717 typename ::testing::internal::Function<F>::Result\
1718 name##ActionP4<p0##_type, p1##_type, p2##_type, \
1719 p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1720 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1722 #define ACTION_P5(name, p0, p1, p2, p3, p4)\
1723 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1724 typename p3##_type, typename p4##_type>\
1725 class name##ActionP5 {\
1727 name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \
1728 p2##_type gmock_p2, p3##_type gmock_p3, \
1729 p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1730 p3(gmock_p3), p4(gmock_p4) {}\
1731 template <typename F>\
1732 class gmock_Impl : public ::testing::ActionInterface<F> {\
1734 typedef F function_type;\
1735 typedef typename ::testing::internal::Function<F>::Result return_type;\
1736 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1738 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1739 p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \
1740 p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\
1741 virtual return_type Perform(const args_type& args) {\
1742 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1743 Perform(this, args);\
1745 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1746 typename arg3_type, typename arg4_type, typename arg5_type, \
1747 typename arg6_type, typename arg7_type, typename arg8_type, \
1748 typename arg9_type>\
1749 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1750 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1751 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1752 arg9_type arg9) const;\
1759 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1761 template <typename F> operator ::testing::Action<F>() const {\
1762 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\
1770 GTEST_DISALLOW_ASSIGN_(name##ActionP5);\
1772 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1773 typename p3##_type, typename p4##_type>\
1774 inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1775 p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1777 return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1778 p4##_type>(p0, p1, p2, p3, p4);\
1780 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1781 typename p3##_type, typename p4##_type>\
1782 template <typename F>\
1783 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1784 typename arg3_type, typename arg4_type, typename arg5_type, \
1785 typename arg6_type, typename arg7_type, typename arg8_type, \
1786 typename arg9_type>\
1787 typename ::testing::internal::Function<F>::Result\
1788 name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1789 p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1790 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1792 #define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\
1793 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1794 typename p3##_type, typename p4##_type, typename p5##_type>\
1795 class name##ActionP6 {\
1797 name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \
1798 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1799 p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1800 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\
1801 template <typename F>\
1802 class gmock_Impl : public ::testing::ActionInterface<F> {\
1804 typedef F function_type;\
1805 typedef typename ::testing::internal::Function<F>::Result return_type;\
1806 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1808 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1809 p3##_type gmock_p3, p4##_type gmock_p4, \
1810 p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1811 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\
1812 virtual return_type Perform(const args_type& args) {\
1813 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1814 Perform(this, args);\
1816 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1817 typename arg3_type, typename arg4_type, typename arg5_type, \
1818 typename arg6_type, typename arg7_type, typename arg8_type, \
1819 typename arg9_type>\
1820 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1821 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1822 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1823 arg9_type arg9) const;\
1831 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1833 template <typename F> operator ::testing::Action<F>() const {\
1834 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\
1843 GTEST_DISALLOW_ASSIGN_(name##ActionP6);\
1845 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1846 typename p3##_type, typename p4##_type, typename p5##_type>\
1847 inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
1848 p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
1849 p3##_type p3, p4##_type p4, p5##_type p5) {\
1850 return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
1851 p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
1853 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1854 typename p3##_type, typename p4##_type, typename p5##_type>\
1855 template <typename F>\
1856 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1857 typename arg3_type, typename arg4_type, typename arg5_type, \
1858 typename arg6_type, typename arg7_type, typename arg8_type, \
1859 typename arg9_type>\
1860 typename ::testing::internal::Function<F>::Result\
1861 name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1862 p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1863 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1865 #define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\
1866 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1867 typename p3##_type, typename p4##_type, typename p5##_type, \
1868 typename p6##_type>\
1869 class name##ActionP7 {\
1871 name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \
1872 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1873 p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \
1874 p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \
1876 template <typename F>\
1877 class gmock_Impl : public ::testing::ActionInterface<F> {\
1879 typedef F function_type;\
1880 typedef typename ::testing::internal::Function<F>::Result return_type;\
1881 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1883 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1884 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1885 p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1886 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\
1887 virtual return_type Perform(const args_type& args) {\
1888 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1889 Perform(this, args);\
1891 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1892 typename arg3_type, typename arg4_type, typename arg5_type, \
1893 typename arg6_type, typename arg7_type, typename arg8_type, \
1894 typename arg9_type>\
1895 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1896 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1897 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1898 arg9_type arg9) const;\
1907 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1909 template <typename F> operator ::testing::Action<F>() const {\
1910 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
1921 GTEST_DISALLOW_ASSIGN_(name##ActionP7);\
1923 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1924 typename p3##_type, typename p4##_type, typename p5##_type, \
1925 typename p6##_type>\
1926 inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
1927 p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
1928 p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
1930 return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
1931 p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
1933 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1934 typename p3##_type, typename p4##_type, typename p5##_type, \
1935 typename p6##_type>\
1936 template <typename F>\
1937 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1938 typename arg3_type, typename arg4_type, typename arg5_type, \
1939 typename arg6_type, typename arg7_type, typename arg8_type, \
1940 typename arg9_type>\
1941 typename ::testing::internal::Function<F>::Result\
1942 name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1943 p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1944 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1946 #define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\
1947 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1948 typename p3##_type, typename p4##_type, typename p5##_type, \
1949 typename p6##_type, typename p7##_type>\
1950 class name##ActionP8 {\
1952 name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \
1953 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1954 p5##_type gmock_p5, p6##_type gmock_p6, \
1955 p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
1956 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
1958 template <typename F>\
1959 class gmock_Impl : public ::testing::ActionInterface<F> {\
1961 typedef F function_type;\
1962 typedef typename ::testing::internal::Function<F>::Result return_type;\
1963 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1965 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1966 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1967 p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \
1968 p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \
1969 p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\
1970 virtual return_type Perform(const args_type& args) {\
1971 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1972 Perform(this, args);\
1974 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1975 typename arg3_type, typename arg4_type, typename arg5_type, \
1976 typename arg6_type, typename arg7_type, typename arg8_type, \
1977 typename arg9_type>\
1978 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1979 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1980 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1981 arg9_type arg9) const;\
1991 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
1993 template <typename F> operator ::testing::Action<F>() const {\
1994 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
2006 GTEST_DISALLOW_ASSIGN_(name##ActionP8);\
2008 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2009 typename p3##_type, typename p4##_type, typename p5##_type, \
2010 typename p6##_type, typename p7##_type>\
2011 inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
2012 p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
2013 p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
2014 p6##_type p6, p7##_type p7) {\
2015 return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
2016 p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
2019 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2020 typename p3##_type, typename p4##_type, typename p5##_type, \
2021 typename p6##_type, typename p7##_type>\
2022 template <typename F>\
2023 template <typename arg0_type, typename arg1_type, typename arg2_type, \
2024 typename arg3_type, typename arg4_type, typename arg5_type, \
2025 typename arg6_type, typename arg7_type, typename arg8_type, \
2026 typename arg9_type>\
2027 typename ::testing::internal::Function<F>::Result\
2028 name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
2029 p5##_type, p6##_type, \
2030 p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\
2031 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
2033 #define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\
2034 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2035 typename p3##_type, typename p4##_type, typename p5##_type, \
2036 typename p6##_type, typename p7##_type, typename p8##_type>\
2037 class name##ActionP9 {\
2039 name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \
2040 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
2041 p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
2042 p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
2043 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
2045 template <typename F>\
2046 class gmock_Impl : public ::testing::ActionInterface<F> {\
2048 typedef F function_type;\
2049 typedef typename ::testing::internal::Function<F>::Result return_type;\
2050 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
2052 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
2053 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
2054 p6##_type gmock_p6, p7##_type gmock_p7, \
2055 p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
2056 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
2057 p7(gmock_p7), p8(gmock_p8) {}\
2058 virtual return_type Perform(const args_type& args) {\
2059 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
2060 Perform(this, args);\
2062 template <typename arg0_type, typename arg1_type, typename arg2_type, \
2063 typename arg3_type, typename arg4_type, typename arg5_type, \
2064 typename arg6_type, typename arg7_type, typename arg8_type, \
2065 typename arg9_type>\
2066 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
2067 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
2068 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
2069 arg9_type arg9) const;\
2080 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
2082 template <typename F> operator ::testing::Action<F>() const {\
2083 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
2096 GTEST_DISALLOW_ASSIGN_(name##ActionP9);\
2098 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2099 typename p3##_type, typename p4##_type, typename p5##_type, \
2100 typename p6##_type, typename p7##_type, typename p8##_type>\
2101 inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
2102 p4##_type, p5##_type, p6##_type, p7##_type, \
2103 p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
2104 p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
2106 return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
2107 p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
2108 p3, p4, p5, p6, p7, p8);\
2110 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2111 typename p3##_type, typename p4##_type, typename p5##_type, \
2112 typename p6##_type, typename p7##_type, typename p8##_type>\
2113 template <typename F>\
2114 template <typename arg0_type, typename arg1_type, typename arg2_type, \
2115 typename arg3_type, typename arg4_type, typename arg5_type, \
2116 typename arg6_type, typename arg7_type, typename arg8_type, \
2117 typename arg9_type>\
2118 typename ::testing::internal::Function<F>::Result\
2119 name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
2120 p5##_type, p6##_type, p7##_type, \
2121 p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\
2122 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
2124 #define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\
2125 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2126 typename p3##_type, typename p4##_type, typename p5##_type, \
2127 typename p6##_type, typename p7##_type, typename p8##_type, \
2128 typename p9##_type>\
2129 class name##ActionP10 {\
2131 name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \
2132 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
2133 p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
2134 p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \
2135 p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
2136 p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\
2137 template <typename F>\
2138 class gmock_Impl : public ::testing::ActionInterface<F> {\
2140 typedef F function_type;\
2141 typedef typename ::testing::internal::Function<F>::Result return_type;\
2142 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
2144 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
2145 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
2146 p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
2147 p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
2148 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
2149 p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\
2150 virtual return_type Perform(const args_type& args) {\
2151 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
2152 Perform(this, args);\
2154 template <typename arg0_type, typename arg1_type, typename arg2_type, \
2155 typename arg3_type, typename arg4_type, typename arg5_type, \
2156 typename arg6_type, typename arg7_type, typename arg8_type, \
2157 typename arg9_type>\
2158 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
2159 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
2160 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
2161 arg9_type arg9) const;\
2173 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
2175 template <typename F> operator ::testing::Action<F>() const {\
2176 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
2190 GTEST_DISALLOW_ASSIGN_(name##ActionP10);\
2192 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2193 typename p3##_type, typename p4##_type, typename p5##_type, \
2194 typename p6##_type, typename p7##_type, typename p8##_type, \
2195 typename p9##_type>\
2196 inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
2197 p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
2198 p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
2199 p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
2201 return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
2202 p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
2203 p1, p2, p3, p4, p5, p6, p7, p8, p9);\
2205 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2206 typename p3##_type, typename p4##_type, typename p5##_type, \
2207 typename p6##_type, typename p7##_type, typename p8##_type, \
2208 typename p9##_type>\
2209 template <typename F>\
2210 template <typename arg0_type, typename arg1_type, typename arg2_type, \
2211 typename arg3_type, typename arg4_type, typename arg5_type, \
2212 typename arg6_type, typename arg7_type, typename arg8_type, \
2213 typename arg9_type>\
2214 typename ::testing::internal::Function<F>::Result\
2215 name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
2216 p5##_type, p6##_type, p7##_type, p8##_type, \
2217 p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\
2218 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
2220 // TODO(wan@google.com): move the following to a different .h file
2221 // such that we don't have to run 'pump' every time the code is
2225 // The ACTION*() macros trigger warning C4100 (unreferenced formal
2226 // parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
2227 // the macro definition, as the warnings are generated when the macro
2228 // is expanded and macro expansion cannot contain #pragma. Therefore
2229 // we suppress them here.
2231 # pragma warning(push)
2232 # pragma warning(disable:4100)
2235 // Various overloads for InvokeArgument<N>().
2237 // The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
2238 // (0-based) argument, which must be a k-ary callable, of the mock
2239 // function, with arguments a1, a2, ..., a_k.
2243 // 1. The arguments are passed by value by default. If you need to
2244 // pass an argument by reference, wrap it inside ByRef(). For
2247 // InvokeArgument<1>(5, string("Hello"), ByRef(foo))
2249 // passes 5 and string("Hello") by value, and passes foo by
2252 // 2. If the callable takes an argument by reference but ByRef() is
2253 // not used, it will receive the reference to a copy of the value,
2254 // instead of the original value. For example, when the 0-th
2255 // argument of the mock function takes a const string&, the action
2257 // InvokeArgument<0>(string("Hello"))
2259 // makes a copy of the temporary string("Hello") object and passes a
2260 // reference of the copy, instead of the original temporary object,
2261 // to the callable. This makes it easy for a user to define an
2262 // InvokeArgument action from temporary values and have it performed
2265 ACTION_TEMPLATE(InvokeArgument,
2266 HAS_1_TEMPLATE_PARAMS(int, k),
2267 AND_0_VALUE_PARAMS()) {
2268 return internal::CallableHelper<return_type>::Call(
2269 ::std::tr1::get<k>(args));
2272 ACTION_TEMPLATE(InvokeArgument,
2273 HAS_1_TEMPLATE_PARAMS(int, k),
2274 AND_1_VALUE_PARAMS(p0)) {
2275 return internal::CallableHelper<return_type>::Call(
2276 ::std::tr1::get<k>(args), p0);
2279 ACTION_TEMPLATE(InvokeArgument,
2280 HAS_1_TEMPLATE_PARAMS(int, k),
2281 AND_2_VALUE_PARAMS(p0, p1)) {
2282 return internal::CallableHelper<return_type>::Call(
2283 ::std::tr1::get<k>(args), p0, p1);
2286 ACTION_TEMPLATE(InvokeArgument,
2287 HAS_1_TEMPLATE_PARAMS(int, k),
2288 AND_3_VALUE_PARAMS(p0, p1, p2)) {
2289 return internal::CallableHelper<return_type>::Call(
2290 ::std::tr1::get<k>(args), p0, p1, p2);
2293 ACTION_TEMPLATE(InvokeArgument,
2294 HAS_1_TEMPLATE_PARAMS(int, k),
2295 AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
2296 return internal::CallableHelper<return_type>::Call(
2297 ::std::tr1::get<k>(args), p0, p1, p2, p3);
2300 ACTION_TEMPLATE(InvokeArgument,
2301 HAS_1_TEMPLATE_PARAMS(int, k),
2302 AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
2303 return internal::CallableHelper<return_type>::Call(
2304 ::std::tr1::get<k>(args), p0, p1, p2, p3, p4);
2307 ACTION_TEMPLATE(InvokeArgument,
2308 HAS_1_TEMPLATE_PARAMS(int, k),
2309 AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
2310 return internal::CallableHelper<return_type>::Call(
2311 ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5);
2314 ACTION_TEMPLATE(InvokeArgument,
2315 HAS_1_TEMPLATE_PARAMS(int, k),
2316 AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
2317 return internal::CallableHelper<return_type>::Call(
2318 ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6);
2321 ACTION_TEMPLATE(InvokeArgument,
2322 HAS_1_TEMPLATE_PARAMS(int, k),
2323 AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
2324 return internal::CallableHelper<return_type>::Call(
2325 ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7);
2328 ACTION_TEMPLATE(InvokeArgument,
2329 HAS_1_TEMPLATE_PARAMS(int, k),
2330 AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
2331 return internal::CallableHelper<return_type>::Call(
2332 ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8);
2335 ACTION_TEMPLATE(InvokeArgument,
2336 HAS_1_TEMPLATE_PARAMS(int, k),
2337 AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
2338 return internal::CallableHelper<return_type>::Call(
2339 ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
2342 // Various overloads for ReturnNew<T>().
2344 // The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new
2345 // instance of type T, constructed on the heap with constructor arguments
2346 // a1, a2, ..., and a_k. The caller assumes ownership of the returned value.
2347 ACTION_TEMPLATE(ReturnNew,
2348 HAS_1_TEMPLATE_PARAMS(typename, T),
2349 AND_0_VALUE_PARAMS()) {
2353 ACTION_TEMPLATE(ReturnNew,
2354 HAS_1_TEMPLATE_PARAMS(typename, T),
2355 AND_1_VALUE_PARAMS(p0)) {
2359 ACTION_TEMPLATE(ReturnNew,
2360 HAS_1_TEMPLATE_PARAMS(typename, T),
2361 AND_2_VALUE_PARAMS(p0, p1)) {
2362 return new T(p0, p1);
2365 ACTION_TEMPLATE(ReturnNew,
2366 HAS_1_TEMPLATE_PARAMS(typename, T),
2367 AND_3_VALUE_PARAMS(p0, p1, p2)) {
2368 return new T(p0, p1, p2);
2371 ACTION_TEMPLATE(ReturnNew,
2372 HAS_1_TEMPLATE_PARAMS(typename, T),
2373 AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
2374 return new T(p0, p1, p2, p3);
2377 ACTION_TEMPLATE(ReturnNew,
2378 HAS_1_TEMPLATE_PARAMS(typename, T),
2379 AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
2380 return new T(p0, p1, p2, p3, p4);
2383 ACTION_TEMPLATE(ReturnNew,
2384 HAS_1_TEMPLATE_PARAMS(typename, T),
2385 AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
2386 return new T(p0, p1, p2, p3, p4, p5);
2389 ACTION_TEMPLATE(ReturnNew,
2390 HAS_1_TEMPLATE_PARAMS(typename, T),
2391 AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
2392 return new T(p0, p1, p2, p3, p4, p5, p6);
2395 ACTION_TEMPLATE(ReturnNew,
2396 HAS_1_TEMPLATE_PARAMS(typename, T),
2397 AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
2398 return new T(p0, p1, p2, p3, p4, p5, p6, p7);
2401 ACTION_TEMPLATE(ReturnNew,
2402 HAS_1_TEMPLATE_PARAMS(typename, T),
2403 AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
2404 return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8);
2407 ACTION_TEMPLATE(ReturnNew,
2408 HAS_1_TEMPLATE_PARAMS(typename, T),
2409 AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
2410 return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
2414 # pragma warning(pop)
2417 } // namespace testing
2419 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_