blob: dd7435e26f5eb9c588ea840293c3b4e6e6c69d33 [file] [log] [blame]
stoyan@google.comce161d82009-10-27 09:05:00 +09001// Copyright (c) 2009 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09005// This file automatically generated by testing/generate_gmock_mutant.py.
6// DO NOT EDIT.
7
stoyan@google.comce161d82009-10-27 09:05:00 +09008#ifndef TESTING_GMOCK_MUTANT_H_
9#define TESTING_GMOCK_MUTANT_H_
10
11// The intention of this file is to make possible using GMock actions in
12// all of its syntactic beauty. Classes and helper functions can be used as
13// more generic variants of Task and Callback classes (see base/task.h)
14// Mutant supports both pre-bound arguments (like Task) and call-time
15// arguments (like Callback) - hence the name. :-)
16//
stoyan@chromium.org81758fe2009-11-13 08:10:11 +090017// DispatchToMethod/Function supports two sets of arguments: pre-bound (P) and
stoyan@google.comce161d82009-10-27 09:05:00 +090018// call-time (C). The arguments as well as the return type are templatized.
stoyan@chromium.org81758fe2009-11-13 08:10:11 +090019// DispatchToMethod/Function will also try to call the selected method or
20// function even if provided pre-bound arguments does not match exactly with
21// the function signature hence the X1, X2 ... XN parameters in CreateFunctor.
22// DispatchToMethod will try to invoke method that may not belong to the
23// object's class itself but to the object's class base class.
stoyan@google.comce161d82009-10-27 09:05:00 +090024//
25// Additionally you can bind the object at calltime by binding a pointer to
26// pointer to the object at creation time - before including this file you
27// have to #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING.
28//
29// TODO(stoyan): It's yet not clear to me should we use T& and T&* instead
30// of T* and T** when we invoke CreateFunctor to match the EXPECT_CALL style.
31//
32//
33// Sample usage with gMock:
34//
35// struct Mock : public ObjectDelegate {
36// MOCK_METHOD2(string, OnRequest(int n, const string& request));
37// MOCK_METHOD1(void, OnQuit(int exit_code));
38// MOCK_METHOD2(void, LogMessage(int level, const string& message));
39//
40// string HandleFlowers(const string& reply, int n, const string& request) {
41// string result = SStringPrintf("In request of %d %s ", n, request);
42// for (int i = 0; i < n; ++i) result.append(reply)
43// return result;
44// }
45//
46// void DoLogMessage(int level, const string& message) {
47// }
48//
49// void QuitMessageLoop(int seconds) {
50// MessageLoop* loop = MessageLoop::current();
51// loop->PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask,
52// 1000 * seconds);
53// }
54// };
55//
56// Mock mock;
57// // Will invoke mock.HandleFlowers("orchids", n, request)
58// // "orchids" is a pre-bound argument, and <n> and <request> are call-time
59// // arguments - they are not known until the OnRequest mock is invoked.
60// EXPECT_CALL(mock, OnRequest(Ge(5), StartsWith("flower"))
61// .Times(1)
62// .WillOnce(Invoke(CreateFunctor(&mock, &Mock::HandleFlowers,
63// string("orchids"))));
64//
65//
66// // No pre-bound arguments, two call-time arguments passed
67// // directly to DoLogMessage
68// EXPECT_CALL(mock, OnLogMessage(_, _))
69// .Times(AnyNumber())
70// .WillAlways(Invoke(CreateFunctor, &mock, &Mock::DoLogMessage));
71//
72//
73// // In this case we have a single pre-bound argument - 3. We ignore
74// // all of the arguments of OnQuit.
75// EXCEPT_CALL(mock, OnQuit(_))
76// .Times(1)
77// .WillOnce(InvokeWithoutArgs(CreateFunctor(
78// &mock, &Mock::QuitMessageLoop, 3)));
79//
80// MessageLoop loop;
81// loop.Run();
82//
83//
84// // Here is another example of how we can set an action that invokes
85// // method of an object that is not yet created.
86// struct Mock : public ObjectDelegate {
87// MOCK_METHOD1(void, DemiurgeCreated(Demiurge*));
88// MOCK_METHOD2(void, OnRequest(int count, const string&));
89//
90// void StoreDemiurge(Demiurge* w) {
91// demiurge_ = w;
92// }
93//
94// Demiurge* demiurge;
95// }
96//
97// EXPECT_CALL(mock, DemiurgeCreated(_)).Times(1)
98// .WillOnce(Invoke(CreateFunctor(&mock, &Mock::StoreDemiurge)));
99//
100// EXPECT_CALL(mock, OnRequest(_, StrEq("Moby Dick")))
101// .Times(AnyNumber())
102// .WillAlways(WithArgs<0>(Invoke(
103// CreateFunctor(&mock->demiurge_, &Demiurge::DecreaseMonsters))));
104//
105
106#include "base/linked_ptr.h"
107#include "base/tuple.h" // for Tuple
108
109namespace testing {
110
111// 0 - 0
112template <typename R, typename T, typename Method>
113inline R DispatchToMethod(T* obj, Method method,
114 const Tuple0& p,
115 const Tuple0& c) {
116 return (obj->*method)();
117}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900118template <typename R, typename Function>
119inline R DispatchToFunction(Function function,
120 const Tuple0& p,
121 const Tuple0& c) {
122 return (*function)();
123}
stoyan@google.comce161d82009-10-27 09:05:00 +0900124
125// 0 - 1
126template <typename R, typename T, typename Method, typename C1>
127inline R DispatchToMethod(T* obj, Method method,
128 const Tuple0& p,
129 const Tuple1<C1>& c) {
130 return (obj->*method)(c.a);
131}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900132template <typename R, typename Function, typename C1>
133inline R DispatchToFunction(Function function,
134 const Tuple0& p,
135 const Tuple1<C1>& c) {
136 return (*function)(c.a);
137}
stoyan@google.comce161d82009-10-27 09:05:00 +0900138
139// 0 - 2
140template <typename R, typename T, typename Method, typename C1, typename C2>
141inline R DispatchToMethod(T* obj, Method method,
142 const Tuple0& p,
143 const Tuple2<C1, C2>& c) {
144 return (obj->*method)(c.a, c.b);
145}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900146template <typename R, typename Function, typename C1, typename C2>
147inline R DispatchToFunction(Function function,
148 const Tuple0& p,
149 const Tuple2<C1, C2>& c) {
150 return (*function)(c.a, c.b);
151}
stoyan@google.comce161d82009-10-27 09:05:00 +0900152
153// 0 - 3
154template <typename R, typename T, typename Method, typename C1, typename C2,
155 typename C3>
156inline R DispatchToMethod(T* obj, Method method,
157 const Tuple0& p,
158 const Tuple3<C1, C2, C3>& c) {
159 return (obj->*method)(c.a, c.b, c.c);
160}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900161template <typename R, typename Function, typename C1, typename C2, typename C3>
162inline R DispatchToFunction(Function function,
163 const Tuple0& p,
164 const Tuple3<C1, C2, C3>& c) {
165 return (*function)(c.a, c.b, c.c);
166}
stoyan@google.comce161d82009-10-27 09:05:00 +0900167
168// 0 - 4
169template <typename R, typename T, typename Method, typename C1, typename C2,
170 typename C3, typename C4>
171inline R DispatchToMethod(T* obj, Method method,
172 const Tuple0& p,
173 const Tuple4<C1, C2, C3, C4>& c) {
174 return (obj->*method)(c.a, c.b, c.c, c.d);
175}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900176template <typename R, typename Function, typename C1, typename C2, typename C3,
177 typename C4>
178inline R DispatchToFunction(Function function,
179 const Tuple0& p,
180 const Tuple4<C1, C2, C3, C4>& c) {
181 return (*function)(c.a, c.b, c.c, c.d);
182}
stoyan@google.comce161d82009-10-27 09:05:00 +0900183
184// 1 - 0
185template <typename R, typename T, typename Method, typename P1>
186inline R DispatchToMethod(T* obj, Method method,
187 const Tuple1<P1>& p,
188 const Tuple0& c) {
189 return (obj->*method)(p.a);
190}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900191template <typename R, typename Function, typename P1>
192inline R DispatchToFunction(Function function,
193 const Tuple1<P1>& p,
194 const Tuple0& c) {
195 return (*function)(p.a);
196}
stoyan@google.comce161d82009-10-27 09:05:00 +0900197
198// 1 - 1
199template <typename R, typename T, typename Method, typename P1, typename C1>
200inline R DispatchToMethod(T* obj, Method method,
201 const Tuple1<P1>& p,
202 const Tuple1<C1>& c) {
203 return (obj->*method)(p.a, c.a);
204}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900205template <typename R, typename Function, typename P1, typename C1>
206inline R DispatchToFunction(Function function,
207 const Tuple1<P1>& p,
208 const Tuple1<C1>& c) {
209 return (*function)(p.a, c.a);
210}
stoyan@google.comce161d82009-10-27 09:05:00 +0900211
212// 1 - 2
213template <typename R, typename T, typename Method, typename P1, typename C1,
214 typename C2>
215inline R DispatchToMethod(T* obj, Method method,
216 const Tuple1<P1>& p,
217 const Tuple2<C1, C2>& c) {
218 return (obj->*method)(p.a, c.a, c.b);
219}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900220template <typename R, typename Function, typename P1, typename C1, typename C2>
221inline R DispatchToFunction(Function function,
222 const Tuple1<P1>& p,
223 const Tuple2<C1, C2>& c) {
224 return (*function)(p.a, c.a, c.b);
225}
stoyan@google.comce161d82009-10-27 09:05:00 +0900226
227// 1 - 3
228template <typename R, typename T, typename Method, typename P1, typename C1,
229 typename C2, typename C3>
230inline R DispatchToMethod(T* obj, Method method,
231 const Tuple1<P1>& p,
232 const Tuple3<C1, C2, C3>& c) {
233 return (obj->*method)(p.a, c.a, c.b, c.c);
234}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900235template <typename R, typename Function, typename P1, typename C1, typename C2,
236 typename C3>
237inline R DispatchToFunction(Function function,
238 const Tuple1<P1>& p,
239 const Tuple3<C1, C2, C3>& c) {
240 return (*function)(p.a, c.a, c.b, c.c);
241}
stoyan@google.comce161d82009-10-27 09:05:00 +0900242
243// 1 - 4
244template <typename R, typename T, typename Method, typename P1, typename C1,
245 typename C2, typename C3, typename C4>
246inline R DispatchToMethod(T* obj, Method method,
247 const Tuple1<P1>& p,
248 const Tuple4<C1, C2, C3, C4>& c) {
249 return (obj->*method)(p.a, c.a, c.b, c.c, c.d);
250}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900251template <typename R, typename Function, typename P1, typename C1, typename C2,
252 typename C3, typename C4>
253inline R DispatchToFunction(Function function,
254 const Tuple1<P1>& p,
255 const Tuple4<C1, C2, C3, C4>& c) {
256 return (*function)(p.a, c.a, c.b, c.c, c.d);
257}
stoyan@google.comce161d82009-10-27 09:05:00 +0900258
259// 2 - 0
260template <typename R, typename T, typename Method, typename P1, typename P2>
261inline R DispatchToMethod(T* obj, Method method,
262 const Tuple2<P1, P2>& p,
263 const Tuple0& c) {
264 return (obj->*method)(p.a, p.b);
265}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900266template <typename R, typename Function, typename P1, typename P2>
267inline R DispatchToFunction(Function function,
268 const Tuple2<P1, P2>& p,
269 const Tuple0& c) {
270 return (*function)(p.a, p.b);
271}
stoyan@google.comce161d82009-10-27 09:05:00 +0900272
273// 2 - 1
274template <typename R, typename T, typename Method, typename P1, typename P2,
275 typename C1>
276inline R DispatchToMethod(T* obj, Method method,
277 const Tuple2<P1, P2>& p,
278 const Tuple1<C1>& c) {
279 return (obj->*method)(p.a, p.b, c.a);
280}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900281template <typename R, typename Function, typename P1, typename P2, typename C1>
282inline R DispatchToFunction(Function function,
283 const Tuple2<P1, P2>& p,
284 const Tuple1<C1>& c) {
285 return (*function)(p.a, p.b, c.a);
286}
stoyan@google.comce161d82009-10-27 09:05:00 +0900287
288// 2 - 2
289template <typename R, typename T, typename Method, typename P1, typename P2,
290 typename C1, typename C2>
291inline R DispatchToMethod(T* obj, Method method,
292 const Tuple2<P1, P2>& p,
293 const Tuple2<C1, C2>& c) {
294 return (obj->*method)(p.a, p.b, c.a, c.b);
295}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900296template <typename R, typename Function, typename P1, typename P2, typename C1,
297 typename C2>
298inline R DispatchToFunction(Function function,
299 const Tuple2<P1, P2>& p,
300 const Tuple2<C1, C2>& c) {
301 return (*function)(p.a, p.b, c.a, c.b);
302}
stoyan@google.comce161d82009-10-27 09:05:00 +0900303
304// 2 - 3
305template <typename R, typename T, typename Method, typename P1, typename P2,
306 typename C1, typename C2, typename C3>
307inline R DispatchToMethod(T* obj, Method method,
308 const Tuple2<P1, P2>& p,
309 const Tuple3<C1, C2, C3>& c) {
310 return (obj->*method)(p.a, p.b, c.a, c.b, c.c);
311}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900312template <typename R, typename Function, typename P1, typename P2, typename C1,
313 typename C2, typename C3>
314inline R DispatchToFunction(Function function,
315 const Tuple2<P1, P2>& p,
316 const Tuple3<C1, C2, C3>& c) {
317 return (*function)(p.a, p.b, c.a, c.b, c.c);
318}
stoyan@google.comce161d82009-10-27 09:05:00 +0900319
320// 2 - 4
321template <typename R, typename T, typename Method, typename P1, typename P2,
322 typename C1, typename C2, typename C3, typename C4>
323inline R DispatchToMethod(T* obj, Method method,
324 const Tuple2<P1, P2>& p,
325 const Tuple4<C1, C2, C3, C4>& c) {
326 return (obj->*method)(p.a, p.b, c.a, c.b, c.c, c.d);
327}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900328template <typename R, typename Function, typename P1, typename P2, typename C1,
329 typename C2, typename C3, typename C4>
330inline R DispatchToFunction(Function function,
331 const Tuple2<P1, P2>& p,
332 const Tuple4<C1, C2, C3, C4>& c) {
333 return (*function)(p.a, p.b, c.a, c.b, c.c, c.d);
334}
stoyan@google.comce161d82009-10-27 09:05:00 +0900335
336// 3 - 0
337template <typename R, typename T, typename Method, typename P1, typename P2,
338 typename P3>
339inline R DispatchToMethod(T* obj, Method method,
340 const Tuple3<P1, P2, P3>& p,
341 const Tuple0& c) {
342 return (obj->*method)(p.a, p.b, p.c);
343}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900344template <typename R, typename Function, typename P1, typename P2, typename P3>
345inline R DispatchToFunction(Function function,
346 const Tuple3<P1, P2, P3>& p,
347 const Tuple0& c) {
348 return (*function)(p.a, p.b, p.c);
349}
stoyan@google.comce161d82009-10-27 09:05:00 +0900350
351// 3 - 1
352template <typename R, typename T, typename Method, typename P1, typename P2,
353 typename P3, typename C1>
354inline R DispatchToMethod(T* obj, Method method,
355 const Tuple3<P1, P2, P3>& p,
356 const Tuple1<C1>& c) {
357 return (obj->*method)(p.a, p.b, p.c, c.a);
358}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900359template <typename R, typename Function, typename P1, typename P2, typename P3,
360 typename C1>
361inline R DispatchToFunction(Function function,
362 const Tuple3<P1, P2, P3>& p,
363 const Tuple1<C1>& c) {
364 return (*function)(p.a, p.b, p.c, c.a);
365}
stoyan@google.comce161d82009-10-27 09:05:00 +0900366
367// 3 - 2
368template <typename R, typename T, typename Method, typename P1, typename P2,
369 typename P3, typename C1, typename C2>
370inline R DispatchToMethod(T* obj, Method method,
371 const Tuple3<P1, P2, P3>& p,
372 const Tuple2<C1, C2>& c) {
373 return (obj->*method)(p.a, p.b, p.c, c.a, c.b);
374}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900375template <typename R, typename Function, typename P1, typename P2, typename P3,
376 typename C1, typename C2>
377inline R DispatchToFunction(Function function,
378 const Tuple3<P1, P2, P3>& p,
379 const Tuple2<C1, C2>& c) {
380 return (*function)(p.a, p.b, p.c, c.a, c.b);
381}
stoyan@google.comce161d82009-10-27 09:05:00 +0900382
383// 3 - 3
384template <typename R, typename T, typename Method, typename P1, typename P2,
385 typename P3, typename C1, typename C2, typename C3>
386inline R DispatchToMethod(T* obj, Method method,
387 const Tuple3<P1, P2, P3>& p,
388 const Tuple3<C1, C2, C3>& c) {
389 return (obj->*method)(p.a, p.b, p.c, c.a, c.b, c.c);
390}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900391template <typename R, typename Function, typename P1, typename P2, typename P3,
392 typename C1, typename C2, typename C3>
393inline R DispatchToFunction(Function function,
394 const Tuple3<P1, P2, P3>& p,
395 const Tuple3<C1, C2, C3>& c) {
396 return (*function)(p.a, p.b, p.c, c.a, c.b, c.c);
397}
stoyan@google.comce161d82009-10-27 09:05:00 +0900398
399// 3 - 4
400template <typename R, typename T, typename Method, typename P1, typename P2,
401 typename P3, typename C1, typename C2, typename C3, typename C4>
402inline R DispatchToMethod(T* obj, Method method,
403 const Tuple3<P1, P2, P3>& p,
404 const Tuple4<C1, C2, C3, C4>& c) {
405 return (obj->*method)(p.a, p.b, p.c, c.a, c.b, c.c, c.d);
406}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900407template <typename R, typename Function, typename P1, typename P2, typename P3,
408 typename C1, typename C2, typename C3, typename C4>
409inline R DispatchToFunction(Function function,
410 const Tuple3<P1, P2, P3>& p,
411 const Tuple4<C1, C2, C3, C4>& c) {
412 return (*function)(p.a, p.b, p.c, c.a, c.b, c.c, c.d);
413}
stoyan@google.comce161d82009-10-27 09:05:00 +0900414
415// 4 - 0
416template <typename R, typename T, typename Method, typename P1, typename P2,
417 typename P3, typename P4>
418inline R DispatchToMethod(T* obj, Method method,
419 const Tuple4<P1, P2, P3, P4>& p,
420 const Tuple0& c) {
421 return (obj->*method)(p.a, p.b, p.c, p.d);
422}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900423template <typename R, typename Function, typename P1, typename P2, typename P3,
424 typename P4>
425inline R DispatchToFunction(Function function,
426 const Tuple4<P1, P2, P3, P4>& p,
427 const Tuple0& c) {
428 return (*function)(p.a, p.b, p.c, p.d);
429}
stoyan@google.comce161d82009-10-27 09:05:00 +0900430
431// 4 - 1
432template <typename R, typename T, typename Method, typename P1, typename P2,
433 typename P3, typename P4, typename C1>
434inline R DispatchToMethod(T* obj, Method method,
435 const Tuple4<P1, P2, P3, P4>& p,
436 const Tuple1<C1>& c) {
437 return (obj->*method)(p.a, p.b, p.c, p.d, c.a);
438}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900439template <typename R, typename Function, typename P1, typename P2, typename P3,
440 typename P4, typename C1>
441inline R DispatchToFunction(Function function,
442 const Tuple4<P1, P2, P3, P4>& p,
443 const Tuple1<C1>& c) {
444 return (*function)(p.a, p.b, p.c, p.d, c.a);
445}
stoyan@google.comce161d82009-10-27 09:05:00 +0900446
447// 4 - 2
448template <typename R, typename T, typename Method, typename P1, typename P2,
449 typename P3, typename P4, typename C1, typename C2>
450inline R DispatchToMethod(T* obj, Method method,
451 const Tuple4<P1, P2, P3, P4>& p,
452 const Tuple2<C1, C2>& c) {
453 return (obj->*method)(p.a, p.b, p.c, p.d, c.a, c.b);
454}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900455template <typename R, typename Function, typename P1, typename P2, typename P3,
456 typename P4, typename C1, typename C2>
457inline R DispatchToFunction(Function function,
458 const Tuple4<P1, P2, P3, P4>& p,
459 const Tuple2<C1, C2>& c) {
460 return (*function)(p.a, p.b, p.c, p.d, c.a, c.b);
461}
stoyan@google.comce161d82009-10-27 09:05:00 +0900462
463// 4 - 3
464template <typename R, typename T, typename Method, typename P1, typename P2,
465 typename P3, typename P4, typename C1, typename C2, typename C3>
466inline R DispatchToMethod(T* obj, Method method,
467 const Tuple4<P1, P2, P3, P4>& p,
468 const Tuple3<C1, C2, C3>& c) {
469 return (obj->*method)(p.a, p.b, p.c, p.d, c.a, c.b, c.c);
470}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900471template <typename R, typename Function, typename P1, typename P2, typename P3,
472 typename P4, typename C1, typename C2, typename C3>
473inline R DispatchToFunction(Function function,
474 const Tuple4<P1, P2, P3, P4>& p,
475 const Tuple3<C1, C2, C3>& c) {
476 return (*function)(p.a, p.b, p.c, p.d, c.a, c.b, c.c);
477}
stoyan@google.comce161d82009-10-27 09:05:00 +0900478
479// 4 - 4
480template <typename R, typename T, typename Method, typename P1, typename P2,
481 typename P3, typename P4, typename C1, typename C2, typename C3,
482 typename C4>
483inline R DispatchToMethod(T* obj, Method method,
484 const Tuple4<P1, P2, P3, P4>& p,
485 const Tuple4<C1, C2, C3, C4>& c) {
486 return (obj->*method)(p.a, p.b, p.c, p.d, c.a, c.b, c.c, c.d);
487}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900488template <typename R, typename Function, typename P1, typename P2, typename P3,
489 typename P4, typename C1, typename C2, typename C3, typename C4>
490inline R DispatchToFunction(Function function,
491 const Tuple4<P1, P2, P3, P4>& p,
492 const Tuple4<C1, C2, C3, C4>& c) {
493 return (*function)(p.a, p.b, p.c, p.d, c.a, c.b, c.c, c.d);
494}
stoyan@google.comce161d82009-10-27 09:05:00 +0900495
496// Interface that is exposed to the consumer, that does the actual calling
497// of the method.
498template <typename R, typename Params>
499class MutantRunner {
500 public:
501 virtual R RunWithParams(const Params& params) = 0;
502 virtual ~MutantRunner() {}
503};
504
505// Mutant holds pre-bound arguments (like Task). Like Callback
506// allows call-time arguments. You bind a pointer to the object
507// at creation time.
508template <typename R, typename T, typename Method,
509 typename PreBound, typename Params>
510class Mutant : public MutantRunner<R, Params> {
511 public:
512 Mutant(T* obj, Method method, const PreBound& pb)
513 : obj_(obj), method_(method), pb_(pb) {
514 }
515
516 // MutantRunner implementation
517 virtual R RunWithParams(const Params& params) {
518 return DispatchToMethod<R>(this->obj_, this->method_, pb_, params);
519 }
520
521 T* obj_;
522 Method method_;
523 PreBound pb_;
524};
525
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900526template <typename R, typename Function, typename PreBound, typename Params>
527class MutantFunction : public MutantRunner<R, Params> {
528 public:
529 MutantFunction(Function function, const PreBound& pb)
530 : function_(function), pb_(pb) {
531 }
532
533 // MutantRunner implementation
534 virtual R RunWithParams(const Params& params) {
535 return DispatchToFunction<R>(function_, pb_, params);
536 }
537
538 Function function_;
539 PreBound pb_;
540};
541
stoyan@google.comce161d82009-10-27 09:05:00 +0900542#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
543// MutantLateBind is like Mutant, but you bind a pointer to a pointer
544// to the object. This way you can create actions for an object
545// that is not yet created (has only storage for a pointer to it).
546template <typename R, typename T, typename Method,
547 typename PreBound, typename Params>
548class MutantLateObjectBind : public MutantRunner<R, Params> {
549 public:
550 MutantLateObjectBind(T** obj, Method method, const PreBound& pb)
551 : obj_(obj), method_(method), pb_(pb) {
552 }
553
554 // MutantRunner implementation.
555 virtual R RunWithParams(const Params& params) {
556 EXPECT_THAT(*this->obj_, testing::NotNull());
557 if (NULL == *this->obj_)
558 return R();
559 return DispatchToMethod<R>( *this->obj_, this->method_, pb_, params);
560 }
561
562 T** obj_;
563 Method method_;
564 PreBound pb_;
565};
566#endif
567
568// Simple MutantRunner<> wrapper acting as a functor.
569// Redirects operator() to MutantRunner<Params>::Run()
570template <typename R, typename Params>
571struct MutantFunctor {
572 explicit MutantFunctor(MutantRunner<R, Params>* cb) : impl_(cb) {
573 }
574
575 ~MutantFunctor() {
576 }
577
578 inline R operator()() {
579 return impl_->RunWithParams(Tuple0());
580 }
581
582 template <typename Arg1>
583 inline R operator()(const Arg1& a) {
584 return impl_->RunWithParams(Params(a));
585 }
586
587 template <typename Arg1, typename Arg2>
588 inline R operator()(const Arg1& a, const Arg2& b) {
589 return impl_->RunWithParams(Params(a, b));
590 }
591
592 template <typename Arg1, typename Arg2, typename Arg3>
593 inline R operator()(const Arg1& a, const Arg2& b, const Arg3& c) {
594 return impl_->RunWithParams(Params(a, b, c));
595 }
596
597 template <typename Arg1, typename Arg2, typename Arg3, typename Arg4>
598 inline R operator()(const Arg1& a, const Arg2& b, const Arg3& c,
599 const Arg4& d) {
600 return impl_->RunWithParams(Params(a, b, c, d));
601 }
602
603 private:
604 // We need copy constructor since MutantFunctor is copied few times
605 // inside GMock machinery, hence no DISALLOW_EVIL_CONTRUCTORS
606 MutantFunctor();
607 linked_ptr<MutantRunner<R, Params> > impl_;
608};
609
stoyan@google.comce161d82009-10-27 09:05:00 +0900610// 0 - 0
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900611template <typename R, typename T, typename U>
stoyan@google.comce161d82009-10-27 09:05:00 +0900612inline MutantFunctor<R, Tuple0>
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900613CreateFunctor(T* obj, R (U::*method)()) {
614 MutantRunner<R, Tuple0>* t =
615 new Mutant<R, T, R (U::*)(),
stoyan@google.comce161d82009-10-27 09:05:00 +0900616 Tuple0, Tuple0>
617 (obj, method, MakeTuple());
618 return MutantFunctor<R, Tuple0>(t);
619}
620
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900621template <typename R>
stoyan@google.comce161d82009-10-27 09:05:00 +0900622inline MutantFunctor<R, Tuple0>
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900623CreateFunctor(R (*function)()) {
624 MutantRunner<R, Tuple0>* t =
625 new MutantFunction<R, R (*)(),
626 Tuple0, Tuple0>
627 (function, MakeTuple());
628 return MutantFunctor<R, Tuple0>(t);
629}
630
631#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
632template <typename R, typename T, typename U>
633inline MutantFunctor<R, Tuple0>
634CreateFunctor(T** obj, R (U::*method)()) {
635 MutantRunner<R, Tuple0>* t =
636 new MutantLateObjectBind<R, T, R (U::*)(),
stoyan@google.comce161d82009-10-27 09:05:00 +0900637 Tuple0, Tuple0>
638 (obj, method, MakeTuple());
639 return MutantFunctor<R, Tuple0>(t);
640}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900641#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
642
643#if defined (OS_WIN)
644template <typename R, typename T, typename U>
645inline MutantFunctor<R, Tuple0>
646CreateFunctor(T* obj, R (__stdcall U::*method)()) {
647 MutantRunner<R, Tuple0>* t =
648 new Mutant<R, T, R (__stdcall U::*)(),
649 Tuple0, Tuple0>
650 (obj, method, MakeTuple());
651 return MutantFunctor<R, Tuple0>(t);
652}
653#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +0900654
655// 0 - 1
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900656template <typename R, typename T, typename U, typename A1>
stoyan@google.comce161d82009-10-27 09:05:00 +0900657inline MutantFunctor<R, Tuple1<A1> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900658CreateFunctor(T* obj, R (U::*method)(A1)) {
659 MutantRunner<R, Tuple1<A1> >* t =
660 new Mutant<R, T, R (U::*)(A1),
stoyan@google.comce161d82009-10-27 09:05:00 +0900661 Tuple0, Tuple1<A1> >
662 (obj, method, MakeTuple());
663 return MutantFunctor<R, Tuple1<A1> >(t);
664}
665
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900666template <typename R, typename A1>
stoyan@google.comce161d82009-10-27 09:05:00 +0900667inline MutantFunctor<R, Tuple1<A1> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900668CreateFunctor(R (*function)(A1)) {
669 MutantRunner<R, Tuple1<A1> >* t =
670 new MutantFunction<R, R (*)(A1),
671 Tuple0, Tuple1<A1> >
672 (function, MakeTuple());
673 return MutantFunctor<R, Tuple1<A1> >(t);
674}
675
676#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
677template <typename R, typename T, typename U, typename A1>
678inline MutantFunctor<R, Tuple1<A1> >
679CreateFunctor(T** obj, R (U::*method)(A1)) {
680 MutantRunner<R, Tuple1<A1> >* t =
681 new MutantLateObjectBind<R, T, R (U::*)(A1),
stoyan@google.comce161d82009-10-27 09:05:00 +0900682 Tuple0, Tuple1<A1> >
683 (obj, method, MakeTuple());
684 return MutantFunctor<R, Tuple1<A1> >(t);
685}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900686#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
687
688#if defined (OS_WIN)
689template <typename R, typename T, typename U, typename A1>
690inline MutantFunctor<R, Tuple1<A1> >
691CreateFunctor(T* obj, R (__stdcall U::*method)(A1)) {
692 MutantRunner<R, Tuple1<A1> >* t =
693 new Mutant<R, T, R (__stdcall U::*)(A1),
694 Tuple0, Tuple1<A1> >
695 (obj, method, MakeTuple());
696 return MutantFunctor<R, Tuple1<A1> >(t);
697}
698#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +0900699
700// 0 - 2
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900701template <typename R, typename T, typename U, typename A1, typename A2>
stoyan@google.comce161d82009-10-27 09:05:00 +0900702inline MutantFunctor<R, Tuple2<A1, A2> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900703CreateFunctor(T* obj, R (U::*method)(A1, A2)) {
704 MutantRunner<R, Tuple2<A1, A2> >* t =
705 new Mutant<R, T, R (U::*)(A1, A2),
stoyan@google.comce161d82009-10-27 09:05:00 +0900706 Tuple0, Tuple2<A1, A2> >
707 (obj, method, MakeTuple());
708 return MutantFunctor<R, Tuple2<A1, A2> >(t);
709}
710
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900711template <typename R, typename A1, typename A2>
stoyan@google.comce161d82009-10-27 09:05:00 +0900712inline MutantFunctor<R, Tuple2<A1, A2> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900713CreateFunctor(R (*function)(A1, A2)) {
714 MutantRunner<R, Tuple2<A1, A2> >* t =
715 new MutantFunction<R, R (*)(A1, A2),
716 Tuple0, Tuple2<A1, A2> >
717 (function, MakeTuple());
718 return MutantFunctor<R, Tuple2<A1, A2> >(t);
719}
720
721#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
722template <typename R, typename T, typename U, typename A1, typename A2>
723inline MutantFunctor<R, Tuple2<A1, A2> >
724CreateFunctor(T** obj, R (U::*method)(A1, A2)) {
725 MutantRunner<R, Tuple2<A1, A2> >* t =
726 new MutantLateObjectBind<R, T, R (U::*)(A1, A2),
stoyan@google.comce161d82009-10-27 09:05:00 +0900727 Tuple0, Tuple2<A1, A2> >
728 (obj, method, MakeTuple());
729 return MutantFunctor<R, Tuple2<A1, A2> >(t);
730}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900731#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
732
733#if defined (OS_WIN)
734template <typename R, typename T, typename U, typename A1, typename A2>
735inline MutantFunctor<R, Tuple2<A1, A2> >
736CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2)) {
737 MutantRunner<R, Tuple2<A1, A2> >* t =
738 new Mutant<R, T, R (__stdcall U::*)(A1, A2),
739 Tuple0, Tuple2<A1, A2> >
740 (obj, method, MakeTuple());
741 return MutantFunctor<R, Tuple2<A1, A2> >(t);
742}
743#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +0900744
745// 0 - 3
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900746template <typename R, typename T, typename U, typename A1, typename A2,
747 typename A3>
stoyan@google.comce161d82009-10-27 09:05:00 +0900748inline MutantFunctor<R, Tuple3<A1, A2, A3> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900749CreateFunctor(T* obj, R (U::*method)(A1, A2, A3)) {
750 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
751 new Mutant<R, T, R (U::*)(A1, A2, A3),
stoyan@google.comce161d82009-10-27 09:05:00 +0900752 Tuple0, Tuple3<A1, A2, A3> >
753 (obj, method, MakeTuple());
754 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
755}
756
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900757template <typename R, typename A1, typename A2, typename A3>
stoyan@google.comce161d82009-10-27 09:05:00 +0900758inline MutantFunctor<R, Tuple3<A1, A2, A3> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900759CreateFunctor(R (*function)(A1, A2, A3)) {
760 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
761 new MutantFunction<R, R (*)(A1, A2, A3),
762 Tuple0, Tuple3<A1, A2, A3> >
763 (function, MakeTuple());
764 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
765}
766
767#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
768template <typename R, typename T, typename U, typename A1, typename A2,
769 typename A3>
770inline MutantFunctor<R, Tuple3<A1, A2, A3> >
771CreateFunctor(T** obj, R (U::*method)(A1, A2, A3)) {
772 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
773 new MutantLateObjectBind<R, T, R (U::*)(A1, A2, A3),
stoyan@google.comce161d82009-10-27 09:05:00 +0900774 Tuple0, Tuple3<A1, A2, A3> >
775 (obj, method, MakeTuple());
776 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
777}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900778#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
779
780#if defined (OS_WIN)
781template <typename R, typename T, typename U, typename A1, typename A2,
782 typename A3>
783inline MutantFunctor<R, Tuple3<A1, A2, A3> >
784CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2, A3)) {
785 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
786 new Mutant<R, T, R (__stdcall U::*)(A1, A2, A3),
787 Tuple0, Tuple3<A1, A2, A3> >
788 (obj, method, MakeTuple());
789 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
790}
791#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +0900792
793// 0 - 4
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900794template <typename R, typename T, typename U, typename A1, typename A2,
795 typename A3, typename A4>
stoyan@google.comce161d82009-10-27 09:05:00 +0900796inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900797CreateFunctor(T* obj, R (U::*method)(A1, A2, A3, A4)) {
798 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
799 new Mutant<R, T, R (U::*)(A1, A2, A3, A4),
stoyan@google.comce161d82009-10-27 09:05:00 +0900800 Tuple0, Tuple4<A1, A2, A3, A4> >
801 (obj, method, MakeTuple());
802 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
803}
804
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900805template <typename R, typename A1, typename A2, typename A3, typename A4>
stoyan@google.comce161d82009-10-27 09:05:00 +0900806inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900807CreateFunctor(R (*function)(A1, A2, A3, A4)) {
808 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
809 new MutantFunction<R, R (*)(A1, A2, A3, A4),
810 Tuple0, Tuple4<A1, A2, A3, A4> >
811 (function, MakeTuple());
812 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
813}
814
815#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
816template <typename R, typename T, typename U, typename A1, typename A2,
817 typename A3, typename A4>
818inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
819CreateFunctor(T** obj, R (U::*method)(A1, A2, A3, A4)) {
820 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
821 new MutantLateObjectBind<R, T, R (U::*)(A1, A2, A3, A4),
stoyan@google.comce161d82009-10-27 09:05:00 +0900822 Tuple0, Tuple4<A1, A2, A3, A4> >
823 (obj, method, MakeTuple());
824 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
825}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900826#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
827
828#if defined (OS_WIN)
829template <typename R, typename T, typename U, typename A1, typename A2,
830 typename A3, typename A4>
831inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
832CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2, A3, A4)) {
833 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
834 new Mutant<R, T, R (__stdcall U::*)(A1, A2, A3, A4),
835 Tuple0, Tuple4<A1, A2, A3, A4> >
836 (obj, method, MakeTuple());
837 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
838}
839#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +0900840
841// 1 - 0
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900842template <typename R, typename T, typename U, typename P1, typename X1>
stoyan@google.comce161d82009-10-27 09:05:00 +0900843inline MutantFunctor<R, Tuple0>
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900844CreateFunctor(T* obj, R (U::*method)(X1), const P1& p1) {
845 MutantRunner<R, Tuple0>* t =
846 new Mutant<R, T, R (U::*)(X1),
stoyan@google.comce161d82009-10-27 09:05:00 +0900847 Tuple1<P1>, Tuple0>
848 (obj, method, MakeTuple(p1));
849 return MutantFunctor<R, Tuple0>(t);
850}
851
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900852template <typename R, typename P1, typename X1>
stoyan@google.comce161d82009-10-27 09:05:00 +0900853inline MutantFunctor<R, Tuple0>
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900854CreateFunctor(R (*function)(X1), const P1& p1) {
855 MutantRunner<R, Tuple0>* t =
856 new MutantFunction<R, R (*)(X1),
857 Tuple1<P1>, Tuple0>
858 (function, MakeTuple(p1));
859 return MutantFunctor<R, Tuple0>(t);
860}
861
862#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
863template <typename R, typename T, typename U, typename P1, typename X1>
864inline MutantFunctor<R, Tuple0>
865CreateFunctor(T** obj, R (U::*method)(X1), const P1& p1) {
866 MutantRunner<R, Tuple0>* t =
867 new MutantLateObjectBind<R, T, R (U::*)(X1),
stoyan@google.comce161d82009-10-27 09:05:00 +0900868 Tuple1<P1>, Tuple0>
869 (obj, method, MakeTuple(p1));
870 return MutantFunctor<R, Tuple0>(t);
871}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900872#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
873
874#if defined (OS_WIN)
875template <typename R, typename T, typename U, typename P1, typename X1>
876inline MutantFunctor<R, Tuple0>
877CreateFunctor(T* obj, R (__stdcall U::*method)(X1), const P1& p1) {
878 MutantRunner<R, Tuple0>* t =
879 new Mutant<R, T, R (__stdcall U::*)(X1),
880 Tuple1<P1>, Tuple0>
881 (obj, method, MakeTuple(p1));
882 return MutantFunctor<R, Tuple0>(t);
883}
884#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +0900885
886// 1 - 1
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900887template <typename R, typename T, typename U, typename P1, typename A1,
888 typename X1>
stoyan@google.comce161d82009-10-27 09:05:00 +0900889inline MutantFunctor<R, Tuple1<A1> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900890CreateFunctor(T* obj, R (U::*method)(X1, A1), const P1& p1) {
891 MutantRunner<R, Tuple1<A1> >* t =
892 new Mutant<R, T, R (U::*)(X1, A1),
stoyan@google.comce161d82009-10-27 09:05:00 +0900893 Tuple1<P1>, Tuple1<A1> >
894 (obj, method, MakeTuple(p1));
895 return MutantFunctor<R, Tuple1<A1> >(t);
896}
897
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900898template <typename R, typename P1, typename A1, typename X1>
stoyan@google.comce161d82009-10-27 09:05:00 +0900899inline MutantFunctor<R, Tuple1<A1> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900900CreateFunctor(R (*function)(X1, A1), const P1& p1) {
901 MutantRunner<R, Tuple1<A1> >* t =
902 new MutantFunction<R, R (*)(X1, A1),
903 Tuple1<P1>, Tuple1<A1> >
904 (function, MakeTuple(p1));
905 return MutantFunctor<R, Tuple1<A1> >(t);
906}
907
908#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
909template <typename R, typename T, typename U, typename P1, typename A1,
910 typename X1>
911inline MutantFunctor<R, Tuple1<A1> >
912CreateFunctor(T** obj, R (U::*method)(X1, A1), const P1& p1) {
913 MutantRunner<R, Tuple1<A1> >* t =
914 new MutantLateObjectBind<R, T, R (U::*)(X1, A1),
stoyan@google.comce161d82009-10-27 09:05:00 +0900915 Tuple1<P1>, Tuple1<A1> >
916 (obj, method, MakeTuple(p1));
917 return MutantFunctor<R, Tuple1<A1> >(t);
918}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900919#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
920
921#if defined (OS_WIN)
922template <typename R, typename T, typename U, typename P1, typename A1,
923 typename X1>
924inline MutantFunctor<R, Tuple1<A1> >
925CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1), const P1& p1) {
926 MutantRunner<R, Tuple1<A1> >* t =
927 new Mutant<R, T, R (__stdcall U::*)(X1, A1),
928 Tuple1<P1>, Tuple1<A1> >
929 (obj, method, MakeTuple(p1));
930 return MutantFunctor<R, Tuple1<A1> >(t);
931}
932#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +0900933
934// 1 - 2
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900935template <typename R, typename T, typename U, typename P1, typename A1,
936 typename A2, typename X1>
stoyan@google.comce161d82009-10-27 09:05:00 +0900937inline MutantFunctor<R, Tuple2<A1, A2> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900938CreateFunctor(T* obj, R (U::*method)(X1, A1, A2), const P1& p1) {
939 MutantRunner<R, Tuple2<A1, A2> >* t =
940 new Mutant<R, T, R (U::*)(X1, A1, A2),
stoyan@google.comce161d82009-10-27 09:05:00 +0900941 Tuple1<P1>, Tuple2<A1, A2> >
942 (obj, method, MakeTuple(p1));
943 return MutantFunctor<R, Tuple2<A1, A2> >(t);
944}
945
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900946template <typename R, typename P1, typename A1, typename A2, typename X1>
stoyan@google.comce161d82009-10-27 09:05:00 +0900947inline MutantFunctor<R, Tuple2<A1, A2> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900948CreateFunctor(R (*function)(X1, A1, A2), const P1& p1) {
949 MutantRunner<R, Tuple2<A1, A2> >* t =
950 new MutantFunction<R, R (*)(X1, A1, A2),
951 Tuple1<P1>, Tuple2<A1, A2> >
952 (function, MakeTuple(p1));
953 return MutantFunctor<R, Tuple2<A1, A2> >(t);
954}
955
956#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
957template <typename R, typename T, typename U, typename P1, typename A1,
958 typename A2, typename X1>
959inline MutantFunctor<R, Tuple2<A1, A2> >
960CreateFunctor(T** obj, R (U::*method)(X1, A1, A2), const P1& p1) {
961 MutantRunner<R, Tuple2<A1, A2> >* t =
962 new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2),
stoyan@google.comce161d82009-10-27 09:05:00 +0900963 Tuple1<P1>, Tuple2<A1, A2> >
964 (obj, method, MakeTuple(p1));
965 return MutantFunctor<R, Tuple2<A1, A2> >(t);
966}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900967#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
968
969#if defined (OS_WIN)
970template <typename R, typename T, typename U, typename P1, typename A1,
971 typename A2, typename X1>
972inline MutantFunctor<R, Tuple2<A1, A2> >
973CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2), const P1& p1) {
974 MutantRunner<R, Tuple2<A1, A2> >* t =
975 new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2),
976 Tuple1<P1>, Tuple2<A1, A2> >
977 (obj, method, MakeTuple(p1));
978 return MutantFunctor<R, Tuple2<A1, A2> >(t);
979}
980#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +0900981
982// 1 - 3
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900983template <typename R, typename T, typename U, typename P1, typename A1,
984 typename A2, typename A3, typename X1>
stoyan@google.comce161d82009-10-27 09:05:00 +0900985inline MutantFunctor<R, Tuple3<A1, A2, A3> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900986CreateFunctor(T* obj, R (U::*method)(X1, A1, A2, A3), const P1& p1) {
987 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
988 new Mutant<R, T, R (U::*)(X1, A1, A2, A3),
stoyan@google.comce161d82009-10-27 09:05:00 +0900989 Tuple1<P1>, Tuple3<A1, A2, A3> >
990 (obj, method, MakeTuple(p1));
991 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
992}
993
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900994template <typename R, typename P1, typename A1, typename A2, typename A3,
995 typename X1>
stoyan@google.comce161d82009-10-27 09:05:00 +0900996inline MutantFunctor<R, Tuple3<A1, A2, A3> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +0900997CreateFunctor(R (*function)(X1, A1, A2, A3), const P1& p1) {
998 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
999 new MutantFunction<R, R (*)(X1, A1, A2, A3),
1000 Tuple1<P1>, Tuple3<A1, A2, A3> >
1001 (function, MakeTuple(p1));
1002 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1003}
1004
1005#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1006template <typename R, typename T, typename U, typename P1, typename A1,
1007 typename A2, typename A3, typename X1>
1008inline MutantFunctor<R, Tuple3<A1, A2, A3> >
1009CreateFunctor(T** obj, R (U::*method)(X1, A1, A2, A3), const P1& p1) {
1010 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1011 new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2, A3),
stoyan@google.comce161d82009-10-27 09:05:00 +09001012 Tuple1<P1>, Tuple3<A1, A2, A3> >
1013 (obj, method, MakeTuple(p1));
1014 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1015}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001016#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1017
1018#if defined (OS_WIN)
1019template <typename R, typename T, typename U, typename P1, typename A1,
1020 typename A2, typename A3, typename X1>
1021inline MutantFunctor<R, Tuple3<A1, A2, A3> >
1022CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2, A3), const P1& p1) {
1023 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1024 new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2, A3),
1025 Tuple1<P1>, Tuple3<A1, A2, A3> >
1026 (obj, method, MakeTuple(p1));
1027 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1028}
1029#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001030
1031// 1 - 4
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001032template <typename R, typename T, typename U, typename P1, typename A1,
1033 typename A2, typename A3, typename A4, typename X1>
stoyan@google.comce161d82009-10-27 09:05:00 +09001034inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001035CreateFunctor(T* obj, R (U::*method)(X1, A1, A2, A3, A4), const P1& p1) {
1036 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1037 new Mutant<R, T, R (U::*)(X1, A1, A2, A3, A4),
stoyan@google.comce161d82009-10-27 09:05:00 +09001038 Tuple1<P1>, Tuple4<A1, A2, A3, A4> >
1039 (obj, method, MakeTuple(p1));
1040 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1041}
1042
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001043template <typename R, typename P1, typename A1, typename A2, typename A3,
1044 typename A4, typename X1>
stoyan@google.comce161d82009-10-27 09:05:00 +09001045inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001046CreateFunctor(R (*function)(X1, A1, A2, A3, A4), const P1& p1) {
1047 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1048 new MutantFunction<R, R (*)(X1, A1, A2, A3, A4),
1049 Tuple1<P1>, Tuple4<A1, A2, A3, A4> >
1050 (function, MakeTuple(p1));
1051 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1052}
1053
1054#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1055template <typename R, typename T, typename U, typename P1, typename A1,
1056 typename A2, typename A3, typename A4, typename X1>
1057inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
1058CreateFunctor(T** obj, R (U::*method)(X1, A1, A2, A3, A4), const P1& p1) {
1059 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1060 new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2, A3, A4),
stoyan@google.comce161d82009-10-27 09:05:00 +09001061 Tuple1<P1>, Tuple4<A1, A2, A3, A4> >
1062 (obj, method, MakeTuple(p1));
1063 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1064}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001065#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1066
1067#if defined (OS_WIN)
1068template <typename R, typename T, typename U, typename P1, typename A1,
1069 typename A2, typename A3, typename A4, typename X1>
1070inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
1071CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4),
1072 const P1& p1) {
1073 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1074 new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4),
1075 Tuple1<P1>, Tuple4<A1, A2, A3, A4> >
1076 (obj, method, MakeTuple(p1));
1077 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1078}
1079#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001080
1081// 2 - 0
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001082template <typename R, typename T, typename U, typename P1, typename P2,
1083 typename X1, typename X2>
stoyan@google.comce161d82009-10-27 09:05:00 +09001084inline MutantFunctor<R, Tuple0>
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001085CreateFunctor(T* obj, R (U::*method)(X1, X2), const P1& p1, const P2& p2) {
1086 MutantRunner<R, Tuple0>* t =
1087 new Mutant<R, T, R (U::*)(X1, X2),
stoyan@google.comce161d82009-10-27 09:05:00 +09001088 Tuple2<P1, P2>, Tuple0>
1089 (obj, method, MakeTuple(p1, p2));
1090 return MutantFunctor<R, Tuple0>(t);
1091}
1092
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001093template <typename R, typename P1, typename P2, typename X1, typename X2>
stoyan@google.comce161d82009-10-27 09:05:00 +09001094inline MutantFunctor<R, Tuple0>
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001095CreateFunctor(R (*function)(X1, X2), const P1& p1, const P2& p2) {
1096 MutantRunner<R, Tuple0>* t =
1097 new MutantFunction<R, R (*)(X1, X2),
1098 Tuple2<P1, P2>, Tuple0>
1099 (function, MakeTuple(p1, p2));
1100 return MutantFunctor<R, Tuple0>(t);
1101}
1102
1103#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1104template <typename R, typename T, typename U, typename P1, typename P2,
1105 typename X1, typename X2>
1106inline MutantFunctor<R, Tuple0>
1107CreateFunctor(T** obj, R (U::*method)(X1, X2), const P1& p1, const P2& p2) {
1108 MutantRunner<R, Tuple0>* t =
1109 new MutantLateObjectBind<R, T, R (U::*)(X1, X2),
stoyan@google.comce161d82009-10-27 09:05:00 +09001110 Tuple2<P1, P2>, Tuple0>
1111 (obj, method, MakeTuple(p1, p2));
1112 return MutantFunctor<R, Tuple0>(t);
1113}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001114#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1115
1116#if defined (OS_WIN)
1117template <typename R, typename T, typename U, typename P1, typename P2,
1118 typename X1, typename X2>
1119inline MutantFunctor<R, Tuple0>
1120CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2), const P1& p1,
1121 const P2& p2) {
1122 MutantRunner<R, Tuple0>* t =
1123 new Mutant<R, T, R (__stdcall U::*)(X1, X2),
1124 Tuple2<P1, P2>, Tuple0>
1125 (obj, method, MakeTuple(p1, p2));
1126 return MutantFunctor<R, Tuple0>(t);
1127}
1128#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001129
1130// 2 - 1
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001131template <typename R, typename T, typename U, typename P1, typename P2,
1132 typename A1, typename X1, typename X2>
stoyan@google.comce161d82009-10-27 09:05:00 +09001133inline MutantFunctor<R, Tuple1<A1> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001134CreateFunctor(T* obj, R (U::*method)(X1, X2, A1), const P1& p1, const P2& p2) {
1135 MutantRunner<R, Tuple1<A1> >* t =
1136 new Mutant<R, T, R (U::*)(X1, X2, A1),
stoyan@google.comce161d82009-10-27 09:05:00 +09001137 Tuple2<P1, P2>, Tuple1<A1> >
1138 (obj, method, MakeTuple(p1, p2));
1139 return MutantFunctor<R, Tuple1<A1> >(t);
1140}
1141
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001142template <typename R, typename P1, typename P2, typename A1, typename X1,
1143 typename X2>
stoyan@google.comce161d82009-10-27 09:05:00 +09001144inline MutantFunctor<R, Tuple1<A1> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001145CreateFunctor(R (*function)(X1, X2, A1), const P1& p1, const P2& p2) {
1146 MutantRunner<R, Tuple1<A1> >* t =
1147 new MutantFunction<R, R (*)(X1, X2, A1),
1148 Tuple2<P1, P2>, Tuple1<A1> >
1149 (function, MakeTuple(p1, p2));
1150 return MutantFunctor<R, Tuple1<A1> >(t);
1151}
1152
1153#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1154template <typename R, typename T, typename U, typename P1, typename P2,
1155 typename A1, typename X1, typename X2>
1156inline MutantFunctor<R, Tuple1<A1> >
1157CreateFunctor(T** obj, R (U::*method)(X1, X2, A1), const P1& p1, const P2& p2) {
1158 MutantRunner<R, Tuple1<A1> >* t =
1159 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1),
stoyan@google.comce161d82009-10-27 09:05:00 +09001160 Tuple2<P1, P2>, Tuple1<A1> >
1161 (obj, method, MakeTuple(p1, p2));
1162 return MutantFunctor<R, Tuple1<A1> >(t);
1163}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001164#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1165
1166#if defined (OS_WIN)
1167template <typename R, typename T, typename U, typename P1, typename P2,
1168 typename A1, typename X1, typename X2>
1169inline MutantFunctor<R, Tuple1<A1> >
1170CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1), const P1& p1,
1171 const P2& p2) {
1172 MutantRunner<R, Tuple1<A1> >* t =
1173 new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1),
1174 Tuple2<P1, P2>, Tuple1<A1> >
1175 (obj, method, MakeTuple(p1, p2));
1176 return MutantFunctor<R, Tuple1<A1> >(t);
1177}
1178#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001179
1180// 2 - 2
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001181template <typename R, typename T, typename U, typename P1, typename P2,
1182 typename A1, typename A2, typename X1, typename X2>
stoyan@google.comce161d82009-10-27 09:05:00 +09001183inline MutantFunctor<R, Tuple2<A1, A2> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001184CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001185 const P2& p2) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001186 MutantRunner<R, Tuple2<A1, A2> >* t =
1187 new Mutant<R, T, R (U::*)(X1, X2, A1, A2),
stoyan@google.comce161d82009-10-27 09:05:00 +09001188 Tuple2<P1, P2>, Tuple2<A1, A2> >
1189 (obj, method, MakeTuple(p1, p2));
1190 return MutantFunctor<R, Tuple2<A1, A2> >(t);
1191}
1192
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001193template <typename R, typename P1, typename P2, typename A1, typename A2,
1194 typename X1, typename X2>
stoyan@google.comce161d82009-10-27 09:05:00 +09001195inline MutantFunctor<R, Tuple2<A1, A2> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001196CreateFunctor(R (*function)(X1, X2, A1, A2), const P1& p1, const P2& p2) {
1197 MutantRunner<R, Tuple2<A1, A2> >* t =
1198 new MutantFunction<R, R (*)(X1, X2, A1, A2),
1199 Tuple2<P1, P2>, Tuple2<A1, A2> >
1200 (function, MakeTuple(p1, p2));
1201 return MutantFunctor<R, Tuple2<A1, A2> >(t);
1202}
1203
1204#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1205template <typename R, typename T, typename U, typename P1, typename P2,
1206 typename A1, typename A2, typename X1, typename X2>
1207inline MutantFunctor<R, Tuple2<A1, A2> >
1208CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001209 const P2& p2) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001210 MutantRunner<R, Tuple2<A1, A2> >* t =
1211 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2),
stoyan@google.comce161d82009-10-27 09:05:00 +09001212 Tuple2<P1, P2>, Tuple2<A1, A2> >
1213 (obj, method, MakeTuple(p1, p2));
1214 return MutantFunctor<R, Tuple2<A1, A2> >(t);
1215}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001216#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1217
1218#if defined (OS_WIN)
1219template <typename R, typename T, typename U, typename P1, typename P2,
1220 typename A1, typename A2, typename X1, typename X2>
1221inline MutantFunctor<R, Tuple2<A1, A2> >
1222CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2), const P1& p1,
1223 const P2& p2) {
1224 MutantRunner<R, Tuple2<A1, A2> >* t =
1225 new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2),
1226 Tuple2<P1, P2>, Tuple2<A1, A2> >
1227 (obj, method, MakeTuple(p1, p2));
1228 return MutantFunctor<R, Tuple2<A1, A2> >(t);
1229}
1230#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001231
1232// 2 - 3
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001233template <typename R, typename T, typename U, typename P1, typename P2,
1234 typename A1, typename A2, typename A3, typename X1, typename X2>
stoyan@google.comce161d82009-10-27 09:05:00 +09001235inline MutantFunctor<R, Tuple3<A1, A2, A3> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001236CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2, A3), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001237 const P2& p2) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001238 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1239 new Mutant<R, T, R (U::*)(X1, X2, A1, A2, A3),
stoyan@google.comce161d82009-10-27 09:05:00 +09001240 Tuple2<P1, P2>, Tuple3<A1, A2, A3> >
1241 (obj, method, MakeTuple(p1, p2));
1242 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1243}
1244
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001245template <typename R, typename P1, typename P2, typename A1, typename A2,
1246 typename A3, typename X1, typename X2>
stoyan@google.comce161d82009-10-27 09:05:00 +09001247inline MutantFunctor<R, Tuple3<A1, A2, A3> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001248CreateFunctor(R (*function)(X1, X2, A1, A2, A3), const P1& p1, const P2& p2) {
1249 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1250 new MutantFunction<R, R (*)(X1, X2, A1, A2, A3),
1251 Tuple2<P1, P2>, Tuple3<A1, A2, A3> >
1252 (function, MakeTuple(p1, p2));
1253 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1254}
1255
1256#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1257template <typename R, typename T, typename U, typename P1, typename P2,
1258 typename A1, typename A2, typename A3, typename X1, typename X2>
1259inline MutantFunctor<R, Tuple3<A1, A2, A3> >
1260CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2, A3), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001261 const P2& p2) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001262 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1263 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2, A3),
stoyan@google.comce161d82009-10-27 09:05:00 +09001264 Tuple2<P1, P2>, Tuple3<A1, A2, A3> >
1265 (obj, method, MakeTuple(p1, p2));
1266 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1267}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001268#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1269
1270#if defined (OS_WIN)
1271template <typename R, typename T, typename U, typename P1, typename P2,
1272 typename A1, typename A2, typename A3, typename X1, typename X2>
1273inline MutantFunctor<R, Tuple3<A1, A2, A3> >
1274CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3),
1275 const P1& p1, const P2& p2) {
1276 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1277 new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3),
1278 Tuple2<P1, P2>, Tuple3<A1, A2, A3> >
1279 (obj, method, MakeTuple(p1, p2));
1280 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1281}
1282#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001283
1284// 2 - 4
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001285template <typename R, typename T, typename U, typename P1, typename P2,
1286 typename A1, typename A2, typename A3, typename A4, typename X1,
1287 typename X2>
stoyan@google.comce161d82009-10-27 09:05:00 +09001288inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001289CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2, A3, A4), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001290 const P2& p2) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001291 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1292 new Mutant<R, T, R (U::*)(X1, X2, A1, A2, A3, A4),
stoyan@google.comce161d82009-10-27 09:05:00 +09001293 Tuple2<P1, P2>, Tuple4<A1, A2, A3, A4> >
1294 (obj, method, MakeTuple(p1, p2));
1295 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1296}
1297
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001298template <typename R, typename P1, typename P2, typename A1, typename A2,
1299 typename A3, typename A4, typename X1, typename X2>
stoyan@google.comce161d82009-10-27 09:05:00 +09001300inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001301CreateFunctor(R (*function)(X1, X2, A1, A2, A3, A4), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001302 const P2& p2) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001303 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1304 new MutantFunction<R, R (*)(X1, X2, A1, A2, A3, A4),
1305 Tuple2<P1, P2>, Tuple4<A1, A2, A3, A4> >
1306 (function, MakeTuple(p1, p2));
1307 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1308}
1309
1310#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1311template <typename R, typename T, typename U, typename P1, typename P2,
1312 typename A1, typename A2, typename A3, typename A4, typename X1,
1313 typename X2>
1314inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
1315CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2, A3, A4), const P1& p1,
1316 const P2& p2) {
1317 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1318 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2, A3, A4),
stoyan@google.comce161d82009-10-27 09:05:00 +09001319 Tuple2<P1, P2>, Tuple4<A1, A2, A3, A4> >
1320 (obj, method, MakeTuple(p1, p2));
1321 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1322}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001323#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1324
1325#if defined (OS_WIN)
1326template <typename R, typename T, typename U, typename P1, typename P2,
1327 typename A1, typename A2, typename A3, typename A4, typename X1,
1328 typename X2>
1329inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
1330CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4),
1331 const P1& p1, const P2& p2) {
1332 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1333 new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4),
1334 Tuple2<P1, P2>, Tuple4<A1, A2, A3, A4> >
1335 (obj, method, MakeTuple(p1, p2));
1336 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1337}
1338#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001339
1340// 3 - 0
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001341template <typename R, typename T, typename U, typename P1, typename P2,
1342 typename P3, typename X1, typename X2, typename X3>
stoyan@google.comce161d82009-10-27 09:05:00 +09001343inline MutantFunctor<R, Tuple0>
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001344CreateFunctor(T* obj, R (U::*method)(X1, X2, X3), const P1& p1, const P2& p2,
stoyan@google.comce161d82009-10-27 09:05:00 +09001345 const P3& p3) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001346 MutantRunner<R, Tuple0>* t =
1347 new Mutant<R, T, R (U::*)(X1, X2, X3),
stoyan@google.comce161d82009-10-27 09:05:00 +09001348 Tuple3<P1, P2, P3>, Tuple0>
1349 (obj, method, MakeTuple(p1, p2, p3));
1350 return MutantFunctor<R, Tuple0>(t);
1351}
1352
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001353template <typename R, typename P1, typename P2, typename P3, typename X1,
1354 typename X2, typename X3>
stoyan@google.comce161d82009-10-27 09:05:00 +09001355inline MutantFunctor<R, Tuple0>
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001356CreateFunctor(R (*function)(X1, X2, X3), const P1& p1, const P2& p2,
stoyan@google.comce161d82009-10-27 09:05:00 +09001357 const P3& p3) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001358 MutantRunner<R, Tuple0>* t =
1359 new MutantFunction<R, R (*)(X1, X2, X3),
1360 Tuple3<P1, P2, P3>, Tuple0>
1361 (function, MakeTuple(p1, p2, p3));
1362 return MutantFunctor<R, Tuple0>(t);
1363}
1364
1365#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1366template <typename R, typename T, typename U, typename P1, typename P2,
1367 typename P3, typename X1, typename X2, typename X3>
1368inline MutantFunctor<R, Tuple0>
1369CreateFunctor(T** obj, R (U::*method)(X1, X2, X3), const P1& p1, const P2& p2,
1370 const P3& p3) {
1371 MutantRunner<R, Tuple0>* t =
1372 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3),
stoyan@google.comce161d82009-10-27 09:05:00 +09001373 Tuple3<P1, P2, P3>, Tuple0>
1374 (obj, method, MakeTuple(p1, p2, p3));
1375 return MutantFunctor<R, Tuple0>(t);
1376}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001377#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1378
1379#if defined (OS_WIN)
1380template <typename R, typename T, typename U, typename P1, typename P2,
1381 typename P3, typename X1, typename X2, typename X3>
1382inline MutantFunctor<R, Tuple0>
1383CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3), const P1& p1,
1384 const P2& p2, const P3& p3) {
1385 MutantRunner<R, Tuple0>* t =
1386 new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3),
1387 Tuple3<P1, P2, P3>, Tuple0>
1388 (obj, method, MakeTuple(p1, p2, p3));
1389 return MutantFunctor<R, Tuple0>(t);
1390}
1391#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001392
1393// 3 - 1
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001394template <typename R, typename T, typename U, typename P1, typename P2,
1395 typename P3, typename A1, typename X1, typename X2, typename X3>
stoyan@google.comce161d82009-10-27 09:05:00 +09001396inline MutantFunctor<R, Tuple1<A1> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001397CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001398 const P2& p2, const P3& p3) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001399 MutantRunner<R, Tuple1<A1> >* t =
1400 new Mutant<R, T, R (U::*)(X1, X2, X3, A1),
stoyan@google.comce161d82009-10-27 09:05:00 +09001401 Tuple3<P1, P2, P3>, Tuple1<A1> >
1402 (obj, method, MakeTuple(p1, p2, p3));
1403 return MutantFunctor<R, Tuple1<A1> >(t);
1404}
1405
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001406template <typename R, typename P1, typename P2, typename P3, typename A1,
1407 typename X1, typename X2, typename X3>
stoyan@google.comce161d82009-10-27 09:05:00 +09001408inline MutantFunctor<R, Tuple1<A1> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001409CreateFunctor(R (*function)(X1, X2, X3, A1), const P1& p1, const P2& p2,
1410 const P3& p3) {
1411 MutantRunner<R, Tuple1<A1> >* t =
1412 new MutantFunction<R, R (*)(X1, X2, X3, A1),
1413 Tuple3<P1, P2, P3>, Tuple1<A1> >
1414 (function, MakeTuple(p1, p2, p3));
1415 return MutantFunctor<R, Tuple1<A1> >(t);
1416}
1417
1418#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1419template <typename R, typename T, typename U, typename P1, typename P2,
1420 typename P3, typename A1, typename X1, typename X2, typename X3>
1421inline MutantFunctor<R, Tuple1<A1> >
1422CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001423 const P2& p2, const P3& p3) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001424 MutantRunner<R, Tuple1<A1> >* t =
1425 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1),
stoyan@google.comce161d82009-10-27 09:05:00 +09001426 Tuple3<P1, P2, P3>, Tuple1<A1> >
1427 (obj, method, MakeTuple(p1, p2, p3));
1428 return MutantFunctor<R, Tuple1<A1> >(t);
1429}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001430#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1431
1432#if defined (OS_WIN)
1433template <typename R, typename T, typename U, typename P1, typename P2,
1434 typename P3, typename A1, typename X1, typename X2, typename X3>
1435inline MutantFunctor<R, Tuple1<A1> >
1436CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1), const P1& p1,
1437 const P2& p2, const P3& p3) {
1438 MutantRunner<R, Tuple1<A1> >* t =
1439 new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1),
1440 Tuple3<P1, P2, P3>, Tuple1<A1> >
1441 (obj, method, MakeTuple(p1, p2, p3));
1442 return MutantFunctor<R, Tuple1<A1> >(t);
1443}
1444#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001445
1446// 3 - 2
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001447template <typename R, typename T, typename U, typename P1, typename P2,
1448 typename P3, typename A1, typename A2, typename X1, typename X2,
1449 typename X3>
stoyan@google.comce161d82009-10-27 09:05:00 +09001450inline MutantFunctor<R, Tuple2<A1, A2> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001451CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001452 const P2& p2, const P3& p3) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001453 MutantRunner<R, Tuple2<A1, A2> >* t =
1454 new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2),
stoyan@google.comce161d82009-10-27 09:05:00 +09001455 Tuple3<P1, P2, P3>, Tuple2<A1, A2> >
1456 (obj, method, MakeTuple(p1, p2, p3));
1457 return MutantFunctor<R, Tuple2<A1, A2> >(t);
1458}
1459
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001460template <typename R, typename P1, typename P2, typename P3, typename A1,
1461 typename A2, typename X1, typename X2, typename X3>
stoyan@google.comce161d82009-10-27 09:05:00 +09001462inline MutantFunctor<R, Tuple2<A1, A2> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001463CreateFunctor(R (*function)(X1, X2, X3, A1, A2), const P1& p1, const P2& p2,
1464 const P3& p3) {
1465 MutantRunner<R, Tuple2<A1, A2> >* t =
1466 new MutantFunction<R, R (*)(X1, X2, X3, A1, A2),
1467 Tuple3<P1, P2, P3>, Tuple2<A1, A2> >
1468 (function, MakeTuple(p1, p2, p3));
1469 return MutantFunctor<R, Tuple2<A1, A2> >(t);
1470}
1471
1472#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1473template <typename R, typename T, typename U, typename P1, typename P2,
1474 typename P3, typename A1, typename A2, typename X1, typename X2,
1475 typename X3>
1476inline MutantFunctor<R, Tuple2<A1, A2> >
1477CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001478 const P2& p2, const P3& p3) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001479 MutantRunner<R, Tuple2<A1, A2> >* t =
1480 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2),
stoyan@google.comce161d82009-10-27 09:05:00 +09001481 Tuple3<P1, P2, P3>, Tuple2<A1, A2> >
1482 (obj, method, MakeTuple(p1, p2, p3));
1483 return MutantFunctor<R, Tuple2<A1, A2> >(t);
1484}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001485#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1486
1487#if defined (OS_WIN)
1488template <typename R, typename T, typename U, typename P1, typename P2,
1489 typename P3, typename A1, typename A2, typename X1, typename X2,
1490 typename X3>
1491inline MutantFunctor<R, Tuple2<A1, A2> >
1492CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2),
1493 const P1& p1, const P2& p2, const P3& p3) {
1494 MutantRunner<R, Tuple2<A1, A2> >* t =
1495 new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2),
1496 Tuple3<P1, P2, P3>, Tuple2<A1, A2> >
1497 (obj, method, MakeTuple(p1, p2, p3));
1498 return MutantFunctor<R, Tuple2<A1, A2> >(t);
1499}
1500#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001501
1502// 3 - 3
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001503template <typename R, typename T, typename U, typename P1, typename P2,
1504 typename P3, typename A1, typename A2, typename A3, typename X1,
1505 typename X2, typename X3>
stoyan@google.comce161d82009-10-27 09:05:00 +09001506inline MutantFunctor<R, Tuple3<A1, A2, A3> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001507CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2, A3), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001508 const P2& p2, const P3& p3) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001509 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1510 new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2, A3),
stoyan@google.comce161d82009-10-27 09:05:00 +09001511 Tuple3<P1, P2, P3>, Tuple3<A1, A2, A3> >
1512 (obj, method, MakeTuple(p1, p2, p3));
1513 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1514}
1515
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001516template <typename R, typename P1, typename P2, typename P3, typename A1,
1517 typename A2, typename A3, typename X1, typename X2, typename X3>
stoyan@google.comce161d82009-10-27 09:05:00 +09001518inline MutantFunctor<R, Tuple3<A1, A2, A3> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001519CreateFunctor(R (*function)(X1, X2, X3, A1, A2, A3), const P1& p1, const P2& p2,
1520 const P3& p3) {
1521 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1522 new MutantFunction<R, R (*)(X1, X2, X3, A1, A2, A3),
1523 Tuple3<P1, P2, P3>, Tuple3<A1, A2, A3> >
1524 (function, MakeTuple(p1, p2, p3));
1525 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1526}
1527
1528#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1529template <typename R, typename T, typename U, typename P1, typename P2,
1530 typename P3, typename A1, typename A2, typename A3, typename X1,
1531 typename X2, typename X3>
1532inline MutantFunctor<R, Tuple3<A1, A2, A3> >
1533CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2, A3), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001534 const P2& p2, const P3& p3) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001535 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1536 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2, A3),
stoyan@google.comce161d82009-10-27 09:05:00 +09001537 Tuple3<P1, P2, P3>, Tuple3<A1, A2, A3> >
1538 (obj, method, MakeTuple(p1, p2, p3));
1539 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1540}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001541#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1542
1543#if defined (OS_WIN)
1544template <typename R, typename T, typename U, typename P1, typename P2,
1545 typename P3, typename A1, typename A2, typename A3, typename X1,
1546 typename X2, typename X3>
1547inline MutantFunctor<R, Tuple3<A1, A2, A3> >
1548CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3),
1549 const P1& p1, const P2& p2, const P3& p3) {
1550 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1551 new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3),
1552 Tuple3<P1, P2, P3>, Tuple3<A1, A2, A3> >
1553 (obj, method, MakeTuple(p1, p2, p3));
1554 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1555}
1556#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001557
1558// 3 - 4
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001559template <typename R, typename T, typename U, typename P1, typename P2,
1560 typename P3, typename A1, typename A2, typename A3, typename A4,
1561 typename X1, typename X2, typename X3>
stoyan@google.comce161d82009-10-27 09:05:00 +09001562inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001563CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001564 const P2& p2, const P3& p3) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001565 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1566 new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4),
stoyan@google.comce161d82009-10-27 09:05:00 +09001567 Tuple3<P1, P2, P3>, Tuple4<A1, A2, A3, A4> >
1568 (obj, method, MakeTuple(p1, p2, p3));
1569 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1570}
1571
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001572template <typename R, typename P1, typename P2, typename P3, typename A1,
1573 typename A2, typename A3, typename A4, typename X1, typename X2,
1574 typename X3>
stoyan@google.comce161d82009-10-27 09:05:00 +09001575inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001576CreateFunctor(R (*function)(X1, X2, X3, A1, A2, A3, A4), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001577 const P2& p2, const P3& p3) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001578 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1579 new MutantFunction<R, R (*)(X1, X2, X3, A1, A2, A3, A4),
1580 Tuple3<P1, P2, P3>, Tuple4<A1, A2, A3, A4> >
1581 (function, MakeTuple(p1, p2, p3));
1582 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1583}
1584
1585#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1586template <typename R, typename T, typename U, typename P1, typename P2,
1587 typename P3, typename A1, typename A2, typename A3, typename A4,
1588 typename X1, typename X2, typename X3>
1589inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
1590CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4), const P1& p1,
1591 const P2& p2, const P3& p3) {
1592 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1593 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4),
stoyan@google.comce161d82009-10-27 09:05:00 +09001594 Tuple3<P1, P2, P3>, Tuple4<A1, A2, A3, A4> >
1595 (obj, method, MakeTuple(p1, p2, p3));
1596 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1597}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001598#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1599
1600#if defined (OS_WIN)
1601template <typename R, typename T, typename U, typename P1, typename P2,
1602 typename P3, typename A1, typename A2, typename A3, typename A4,
1603 typename X1, typename X2, typename X3>
1604inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
1605CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4),
1606 const P1& p1, const P2& p2, const P3& p3) {
1607 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1608 new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4),
1609 Tuple3<P1, P2, P3>, Tuple4<A1, A2, A3, A4> >
1610 (obj, method, MakeTuple(p1, p2, p3));
1611 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1612}
1613#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001614
1615// 4 - 0
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001616template <typename R, typename T, typename U, typename P1, typename P2,
1617 typename P3, typename P4, typename X1, typename X2, typename X3,
1618 typename X4>
stoyan@google.comce161d82009-10-27 09:05:00 +09001619inline MutantFunctor<R, Tuple0>
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001620CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001621 const P2& p2, const P3& p3, const P4& p4) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001622 MutantRunner<R, Tuple0>* t =
1623 new Mutant<R, T, R (U::*)(X1, X2, X3, X4),
stoyan@google.comce161d82009-10-27 09:05:00 +09001624 Tuple4<P1, P2, P3, P4>, Tuple0>
1625 (obj, method, MakeTuple(p1, p2, p3, p4));
1626 return MutantFunctor<R, Tuple0>(t);
1627}
1628
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001629template <typename R, typename P1, typename P2, typename P3, typename P4,
1630 typename X1, typename X2, typename X3, typename X4>
stoyan@google.comce161d82009-10-27 09:05:00 +09001631inline MutantFunctor<R, Tuple0>
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001632CreateFunctor(R (*function)(X1, X2, X3, X4), const P1& p1, const P2& p2,
1633 const P3& p3, const P4& p4) {
1634 MutantRunner<R, Tuple0>* t =
1635 new MutantFunction<R, R (*)(X1, X2, X3, X4),
1636 Tuple4<P1, P2, P3, P4>, Tuple0>
1637 (function, MakeTuple(p1, p2, p3, p4));
1638 return MutantFunctor<R, Tuple0>(t);
1639}
1640
1641#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1642template <typename R, typename T, typename U, typename P1, typename P2,
1643 typename P3, typename P4, typename X1, typename X2, typename X3,
1644 typename X4>
1645inline MutantFunctor<R, Tuple0>
1646CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001647 const P2& p2, const P3& p3, const P4& p4) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001648 MutantRunner<R, Tuple0>* t =
1649 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4),
stoyan@google.comce161d82009-10-27 09:05:00 +09001650 Tuple4<P1, P2, P3, P4>, Tuple0>
1651 (obj, method, MakeTuple(p1, p2, p3, p4));
1652 return MutantFunctor<R, Tuple0>(t);
1653}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001654#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1655
1656#if defined (OS_WIN)
1657template <typename R, typename T, typename U, typename P1, typename P2,
1658 typename P3, typename P4, typename X1, typename X2, typename X3,
1659 typename X4>
1660inline MutantFunctor<R, Tuple0>
1661CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4), const P1& p1,
1662 const P2& p2, const P3& p3, const P4& p4) {
1663 MutantRunner<R, Tuple0>* t =
1664 new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4),
1665 Tuple4<P1, P2, P3, P4>, Tuple0>
1666 (obj, method, MakeTuple(p1, p2, p3, p4));
1667 return MutantFunctor<R, Tuple0>(t);
1668}
1669#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001670
1671// 4 - 1
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001672template <typename R, typename T, typename U, typename P1, typename P2,
1673 typename P3, typename P4, typename A1, typename X1, typename X2,
1674 typename X3, typename X4>
stoyan@google.comce161d82009-10-27 09:05:00 +09001675inline MutantFunctor<R, Tuple1<A1> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001676CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001677 const P2& p2, const P3& p3, const P4& p4) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001678 MutantRunner<R, Tuple1<A1> >* t =
1679 new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1),
stoyan@google.comce161d82009-10-27 09:05:00 +09001680 Tuple4<P1, P2, P3, P4>, Tuple1<A1> >
1681 (obj, method, MakeTuple(p1, p2, p3, p4));
1682 return MutantFunctor<R, Tuple1<A1> >(t);
1683}
1684
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001685template <typename R, typename P1, typename P2, typename P3, typename P4,
1686 typename A1, typename X1, typename X2, typename X3, typename X4>
stoyan@google.comce161d82009-10-27 09:05:00 +09001687inline MutantFunctor<R, Tuple1<A1> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001688CreateFunctor(R (*function)(X1, X2, X3, X4, A1), const P1& p1, const P2& p2,
1689 const P3& p3, const P4& p4) {
1690 MutantRunner<R, Tuple1<A1> >* t =
1691 new MutantFunction<R, R (*)(X1, X2, X3, X4, A1),
1692 Tuple4<P1, P2, P3, P4>, Tuple1<A1> >
1693 (function, MakeTuple(p1, p2, p3, p4));
1694 return MutantFunctor<R, Tuple1<A1> >(t);
1695}
1696
1697#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1698template <typename R, typename T, typename U, typename P1, typename P2,
1699 typename P3, typename P4, typename A1, typename X1, typename X2,
1700 typename X3, typename X4>
1701inline MutantFunctor<R, Tuple1<A1> >
1702CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001703 const P2& p2, const P3& p3, const P4& p4) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001704 MutantRunner<R, Tuple1<A1> >* t =
1705 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1),
stoyan@google.comce161d82009-10-27 09:05:00 +09001706 Tuple4<P1, P2, P3, P4>, Tuple1<A1> >
1707 (obj, method, MakeTuple(p1, p2, p3, p4));
1708 return MutantFunctor<R, Tuple1<A1> >(t);
1709}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001710#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1711
1712#if defined (OS_WIN)
1713template <typename R, typename T, typename U, typename P1, typename P2,
1714 typename P3, typename P4, typename A1, typename X1, typename X2,
1715 typename X3, typename X4>
1716inline MutantFunctor<R, Tuple1<A1> >
1717CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1),
1718 const P1& p1, const P2& p2, const P3& p3, const P4& p4) {
1719 MutantRunner<R, Tuple1<A1> >* t =
1720 new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1),
1721 Tuple4<P1, P2, P3, P4>, Tuple1<A1> >
1722 (obj, method, MakeTuple(p1, p2, p3, p4));
1723 return MutantFunctor<R, Tuple1<A1> >(t);
1724}
1725#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001726
1727// 4 - 2
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001728template <typename R, typename T, typename U, typename P1, typename P2,
1729 typename P3, typename P4, typename A1, typename A2, typename X1,
1730 typename X2, typename X3, typename X4>
stoyan@google.comce161d82009-10-27 09:05:00 +09001731inline MutantFunctor<R, Tuple2<A1, A2> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001732CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001733 const P2& p2, const P3& p3, const P4& p4) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001734 MutantRunner<R, Tuple2<A1, A2> >* t =
1735 new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2),
stoyan@google.comce161d82009-10-27 09:05:00 +09001736 Tuple4<P1, P2, P3, P4>, Tuple2<A1, A2> >
1737 (obj, method, MakeTuple(p1, p2, p3, p4));
1738 return MutantFunctor<R, Tuple2<A1, A2> >(t);
1739}
1740
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001741template <typename R, typename P1, typename P2, typename P3, typename P4,
1742 typename A1, typename A2, typename X1, typename X2, typename X3,
1743 typename X4>
stoyan@google.comce161d82009-10-27 09:05:00 +09001744inline MutantFunctor<R, Tuple2<A1, A2> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001745CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2), const P1& p1, const P2& p2,
1746 const P3& p3, const P4& p4) {
1747 MutantRunner<R, Tuple2<A1, A2> >* t =
1748 new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2),
1749 Tuple4<P1, P2, P3, P4>, Tuple2<A1, A2> >
1750 (function, MakeTuple(p1, p2, p3, p4));
1751 return MutantFunctor<R, Tuple2<A1, A2> >(t);
1752}
1753
1754#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1755template <typename R, typename T, typename U, typename P1, typename P2,
1756 typename P3, typename P4, typename A1, typename A2, typename X1,
1757 typename X2, typename X3, typename X4>
1758inline MutantFunctor<R, Tuple2<A1, A2> >
1759CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001760 const P2& p2, const P3& p3, const P4& p4) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001761 MutantRunner<R, Tuple2<A1, A2> >* t =
1762 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2),
stoyan@google.comce161d82009-10-27 09:05:00 +09001763 Tuple4<P1, P2, P3, P4>, Tuple2<A1, A2> >
1764 (obj, method, MakeTuple(p1, p2, p3, p4));
1765 return MutantFunctor<R, Tuple2<A1, A2> >(t);
1766}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001767#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1768
1769#if defined (OS_WIN)
1770template <typename R, typename T, typename U, typename P1, typename P2,
1771 typename P3, typename P4, typename A1, typename A2, typename X1,
1772 typename X2, typename X3, typename X4>
1773inline MutantFunctor<R, Tuple2<A1, A2> >
1774CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2),
1775 const P1& p1, const P2& p2, const P3& p3, const P4& p4) {
1776 MutantRunner<R, Tuple2<A1, A2> >* t =
1777 new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2),
1778 Tuple4<P1, P2, P3, P4>, Tuple2<A1, A2> >
1779 (obj, method, MakeTuple(p1, p2, p3, p4));
1780 return MutantFunctor<R, Tuple2<A1, A2> >(t);
1781}
1782#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001783
1784// 4 - 3
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001785template <typename R, typename T, typename U, typename P1, typename P2,
1786 typename P3, typename P4, typename A1, typename A2, typename A3,
1787 typename X1, typename X2, typename X3, typename X4>
stoyan@google.comce161d82009-10-27 09:05:00 +09001788inline MutantFunctor<R, Tuple3<A1, A2, A3> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001789CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001790 const P2& p2, const P3& p3, const P4& p4) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001791 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1792 new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3),
stoyan@google.comce161d82009-10-27 09:05:00 +09001793 Tuple4<P1, P2, P3, P4>, Tuple3<A1, A2, A3> >
1794 (obj, method, MakeTuple(p1, p2, p3, p4));
1795 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1796}
1797
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001798template <typename R, typename P1, typename P2, typename P3, typename P4,
1799 typename A1, typename A2, typename A3, typename X1, typename X2,
1800 typename X3, typename X4>
stoyan@google.comce161d82009-10-27 09:05:00 +09001801inline MutantFunctor<R, Tuple3<A1, A2, A3> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001802CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2, A3), const P1& p1,
stoyan@google.comce161d82009-10-27 09:05:00 +09001803 const P2& p2, const P3& p3, const P4& p4) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001804 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1805 new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2, A3),
1806 Tuple4<P1, P2, P3, P4>, Tuple3<A1, A2, A3> >
1807 (function, MakeTuple(p1, p2, p3, p4));
1808 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1809}
1810
1811#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1812template <typename R, typename T, typename U, typename P1, typename P2,
1813 typename P3, typename P4, typename A1, typename A2, typename A3,
1814 typename X1, typename X2, typename X3, typename X4>
1815inline MutantFunctor<R, Tuple3<A1, A2, A3> >
1816CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3), const P1& p1,
1817 const P2& p2, const P3& p3, const P4& p4) {
1818 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1819 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3),
stoyan@google.comce161d82009-10-27 09:05:00 +09001820 Tuple4<P1, P2, P3, P4>, Tuple3<A1, A2, A3> >
1821 (obj, method, MakeTuple(p1, p2, p3, p4));
1822 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1823}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001824#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1825
1826#if defined (OS_WIN)
1827template <typename R, typename T, typename U, typename P1, typename P2,
1828 typename P3, typename P4, typename A1, typename A2, typename A3,
1829 typename X1, typename X2, typename X3, typename X4>
1830inline MutantFunctor<R, Tuple3<A1, A2, A3> >
1831CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3),
1832 const P1& p1, const P2& p2, const P3& p3, const P4& p4) {
1833 MutantRunner<R, Tuple3<A1, A2, A3> >* t =
1834 new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3),
1835 Tuple4<P1, P2, P3, P4>, Tuple3<A1, A2, A3> >
1836 (obj, method, MakeTuple(p1, p2, p3, p4));
1837 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t);
1838}
1839#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001840
1841// 4 - 4
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001842template <typename R, typename T, typename U, typename P1, typename P2,
1843 typename P3, typename P4, typename A1, typename A2, typename A3,
1844 typename A4, typename X1, typename X2, typename X3, typename X4>
stoyan@google.comce161d82009-10-27 09:05:00 +09001845inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001846CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4),
stoyan@google.comce161d82009-10-27 09:05:00 +09001847 const P1& p1, const P2& p2, const P3& p3, const P4& p4) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001848 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1849 new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4),
stoyan@google.comce161d82009-10-27 09:05:00 +09001850 Tuple4<P1, P2, P3, P4>, Tuple4<A1, A2, A3, A4> >
1851 (obj, method, MakeTuple(p1, p2, p3, p4));
1852 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1853}
1854
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001855template <typename R, typename P1, typename P2, typename P3, typename P4,
1856 typename A1, typename A2, typename A3, typename A4, typename X1,
1857 typename X2, typename X3, typename X4>
stoyan@google.comce161d82009-10-27 09:05:00 +09001858inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001859CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2, A3, A4), const P1& p1,
1860 const P2& p2, const P3& p3, const P4& p4) {
1861 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1862 new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2, A3, A4),
1863 Tuple4<P1, P2, P3, P4>, Tuple4<A1, A2, A3, A4> >
1864 (function, MakeTuple(p1, p2, p3, p4));
1865 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1866}
1867
1868#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1869template <typename R, typename T, typename U, typename P1, typename P2,
1870 typename P3, typename P4, typename A1, typename A2, typename A3,
1871 typename A4, typename X1, typename X2, typename X3, typename X4>
1872inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
1873CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4),
stoyan@google.comce161d82009-10-27 09:05:00 +09001874 const P1& p1, const P2& p2, const P3& p3, const P4& p4) {
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001875 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1876 new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4),
stoyan@google.comce161d82009-10-27 09:05:00 +09001877 Tuple4<P1, P2, P3, P4>, Tuple4<A1, A2, A3, A4> >
1878 (obj, method, MakeTuple(p1, p2, p3, p4));
1879 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1880}
stoyan@chromium.org81758fe2009-11-13 08:10:11 +09001881#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
1882
1883#if defined (OS_WIN)
1884template <typename R, typename T, typename U, typename P1, typename P2,
1885 typename P3, typename P4, typename A1, typename A2, typename A3,
1886 typename A4, typename X1, typename X2, typename X3, typename X4>
1887inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> >
1888CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4),
1889 const P1& p1, const P2& p2, const P3& p3, const P4& p4) {
1890 MutantRunner<R, Tuple4<A1, A2, A3, A4> >* t =
1891 new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4),
1892 Tuple4<P1, P2, P3, P4>, Tuple4<A1, A2, A3, A4> >
1893 (obj, method, MakeTuple(p1, p2, p3, p4));
1894 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t);
1895}
1896#endif // OS_WIN
stoyan@google.comce161d82009-10-27 09:05:00 +09001897
1898} // namespace testing
1899
1900#endif // TESTING_GMOCK_MUTANT_H_