blob: 4ce7d35090b598085a4a2702bd2b6d62a2a56495 [file] [log] [blame]
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001// This file was GENERATED by command:
2// pump.py gmock-generated-actions.h.pump
3// DO NOT EDIT BY HAND!!!
shiqiane35fdd92008-12-10 05:08:54 +00004
5// Copyright 2007, Google Inc.
6// All rights reserved.
7//
8// Redistribution and use in source and binary forms, with or without
9// modification, are permitted provided that the following conditions are
10// met:
11//
12// * Redistributions of source code must retain the above copyright
13// notice, this list of conditions and the following disclaimer.
14// * Redistributions in binary form must reproduce the above
15// copyright notice, this list of conditions and the following disclaimer
16// in the documentation and/or other materials provided with the
17// distribution.
18// * Neither the name of Google Inc. nor the names of its
19// contributors may be used to endorse or promote products derived from
20// this software without specific prior written permission.
21//
22// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33//
34// Author: wan@google.com (Zhanyong Wan)
35
36// Google Mock - a framework for writing C++ mock classes.
37//
38// This file implements some commonly used variadic actions.
39
Gennadiy Civil984cba32018-07-27 11:15:08 -040040// GOOGLETEST_CM0002 DO NOT DELETE
41
shiqiane35fdd92008-12-10 05:08:54 +000042#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
43#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
44
zhanyong.wan53e08c42010-09-14 05:38:21 +000045#include "gmock/gmock-actions.h"
46#include "gmock/internal/gmock-port.h"
shiqiane35fdd92008-12-10 05:08:54 +000047
48namespace testing {
49namespace internal {
50
51// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
Gennadiy Civile1071eb2018-04-10 15:57:16 -040052// function, method, or callback with the unpacked values, where F is
53// a function type that takes N arguments.
shiqiane35fdd92008-12-10 05:08:54 +000054template <typename Result, typename ArgumentTuple>
55class InvokeHelper;
56
57template <typename R>
kosakbd018832014-04-02 20:30:00 +000058class InvokeHelper<R, ::testing::tuple<> > {
shiqiane35fdd92008-12-10 05:08:54 +000059 public:
60 template <typename Function>
kosakbd018832014-04-02 20:30:00 +000061 static R Invoke(Function function, const ::testing::tuple<>&) {
62 return function();
shiqiane35fdd92008-12-10 05:08:54 +000063 }
64
65 template <class Class, typename MethodPtr>
66 static R InvokeMethod(Class* obj_ptr,
67 MethodPtr method_ptr,
kosakbd018832014-04-02 20:30:00 +000068 const ::testing::tuple<>&) {
69 return (obj_ptr->*method_ptr)();
shiqiane35fdd92008-12-10 05:08:54 +000070 }
Gennadiy Civile1071eb2018-04-10 15:57:16 -040071
72 template <typename CallbackType>
73 static R InvokeCallback(CallbackType* callback,
74 const ::testing::tuple<>&) {
75 return callback->Run();
76 }
shiqiane35fdd92008-12-10 05:08:54 +000077};
78
79template <typename R, typename A1>
kosakbd018832014-04-02 20:30:00 +000080class InvokeHelper<R, ::testing::tuple<A1> > {
shiqiane35fdd92008-12-10 05:08:54 +000081 public:
82 template <typename Function>
kosakbd018832014-04-02 20:30:00 +000083 static R Invoke(Function function, const ::testing::tuple<A1>& args) {
84 return function(get<0>(args));
shiqiane35fdd92008-12-10 05:08:54 +000085 }
86
87 template <class Class, typename MethodPtr>
88 static R InvokeMethod(Class* obj_ptr,
89 MethodPtr method_ptr,
kosakbd018832014-04-02 20:30:00 +000090 const ::testing::tuple<A1>& args) {
91 return (obj_ptr->*method_ptr)(get<0>(args));
shiqiane35fdd92008-12-10 05:08:54 +000092 }
Gennadiy Civile1071eb2018-04-10 15:57:16 -040093
94 template <typename CallbackType>
95 static R InvokeCallback(CallbackType* callback,
96 const ::testing::tuple<A1>& args) {
97 return callback->Run(get<0>(args));
98 }
shiqiane35fdd92008-12-10 05:08:54 +000099};
100
101template <typename R, typename A1, typename A2>
kosakbd018832014-04-02 20:30:00 +0000102class InvokeHelper<R, ::testing::tuple<A1, A2> > {
shiqiane35fdd92008-12-10 05:08:54 +0000103 public:
104 template <typename Function>
kosakbd018832014-04-02 20:30:00 +0000105 static R Invoke(Function function, const ::testing::tuple<A1, A2>& args) {
106 return function(get<0>(args), get<1>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000107 }
108
109 template <class Class, typename MethodPtr>
110 static R InvokeMethod(Class* obj_ptr,
111 MethodPtr method_ptr,
kosakbd018832014-04-02 20:30:00 +0000112 const ::testing::tuple<A1, A2>& args) {
113 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000114 }
Gennadiy Civile1071eb2018-04-10 15:57:16 -0400115
116 template <typename CallbackType>
117 static R InvokeCallback(CallbackType* callback,
118 const ::testing::tuple<A1, A2>& args) {
119 return callback->Run(get<0>(args), get<1>(args));
120 }
shiqiane35fdd92008-12-10 05:08:54 +0000121};
122
123template <typename R, typename A1, typename A2, typename A3>
kosakbd018832014-04-02 20:30:00 +0000124class InvokeHelper<R, ::testing::tuple<A1, A2, A3> > {
shiqiane35fdd92008-12-10 05:08:54 +0000125 public:
126 template <typename Function>
kosakbd018832014-04-02 20:30:00 +0000127 static R Invoke(Function function, const ::testing::tuple<A1, A2, A3>& args) {
128 return function(get<0>(args), get<1>(args), get<2>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000129 }
130
131 template <class Class, typename MethodPtr>
132 static R InvokeMethod(Class* obj_ptr,
133 MethodPtr method_ptr,
kosakbd018832014-04-02 20:30:00 +0000134 const ::testing::tuple<A1, A2, A3>& args) {
135 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
136 get<2>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000137 }
Gennadiy Civile1071eb2018-04-10 15:57:16 -0400138
139 template <typename CallbackType>
140 static R InvokeCallback(CallbackType* callback,
141 const ::testing::tuple<A1, A2, A3>& args) {
142 return callback->Run(get<0>(args), get<1>(args), get<2>(args));
143 }
shiqiane35fdd92008-12-10 05:08:54 +0000144};
145
146template <typename R, typename A1, typename A2, typename A3, typename A4>
kosakbd018832014-04-02 20:30:00 +0000147class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4> > {
shiqiane35fdd92008-12-10 05:08:54 +0000148 public:
149 template <typename Function>
kosakbd018832014-04-02 20:30:00 +0000150 static R Invoke(Function function, const ::testing::tuple<A1, A2, A3,
shiqiane35fdd92008-12-10 05:08:54 +0000151 A4>& args) {
kosakbd018832014-04-02 20:30:00 +0000152 return function(get<0>(args), get<1>(args), get<2>(args),
153 get<3>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000154 }
155
156 template <class Class, typename MethodPtr>
157 static R InvokeMethod(Class* obj_ptr,
158 MethodPtr method_ptr,
kosakbd018832014-04-02 20:30:00 +0000159 const ::testing::tuple<A1, A2, A3, A4>& args) {
160 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
161 get<2>(args), get<3>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000162 }
Gennadiy Civile1071eb2018-04-10 15:57:16 -0400163
164 template <typename CallbackType>
165 static R InvokeCallback(CallbackType* callback,
166 const ::testing::tuple<A1, A2, A3, A4>& args) {
167 return callback->Run(get<0>(args), get<1>(args), get<2>(args),
168 get<3>(args));
169 }
shiqiane35fdd92008-12-10 05:08:54 +0000170};
171
172template <typename R, typename A1, typename A2, typename A3, typename A4,
173 typename A5>
kosakbd018832014-04-02 20:30:00 +0000174class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5> > {
shiqiane35fdd92008-12-10 05:08:54 +0000175 public:
176 template <typename Function>
kosakbd018832014-04-02 20:30:00 +0000177 static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4,
shiqiane35fdd92008-12-10 05:08:54 +0000178 A5>& args) {
kosakbd018832014-04-02 20:30:00 +0000179 return function(get<0>(args), get<1>(args), get<2>(args),
180 get<3>(args), get<4>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000181 }
182
183 template <class Class, typename MethodPtr>
184 static R InvokeMethod(Class* obj_ptr,
185 MethodPtr method_ptr,
kosakbd018832014-04-02 20:30:00 +0000186 const ::testing::tuple<A1, A2, A3, A4, A5>& args) {
187 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
188 get<2>(args), get<3>(args), get<4>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000189 }
Gennadiy Civile1071eb2018-04-10 15:57:16 -0400190
191 template <typename CallbackType>
192 static R InvokeCallback(CallbackType* callback,
193 const ::testing::tuple<A1, A2, A3, A4, A5>& args) {
194 return callback->Run(get<0>(args), get<1>(args), get<2>(args),
195 get<3>(args), get<4>(args));
196 }
shiqiane35fdd92008-12-10 05:08:54 +0000197};
198
199template <typename R, typename A1, typename A2, typename A3, typename A4,
200 typename A5, typename A6>
kosakbd018832014-04-02 20:30:00 +0000201class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
shiqiane35fdd92008-12-10 05:08:54 +0000202 public:
203 template <typename Function>
kosakbd018832014-04-02 20:30:00 +0000204 static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
205 A6>& args) {
206 return function(get<0>(args), get<1>(args), get<2>(args),
207 get<3>(args), get<4>(args), get<5>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000208 }
209
210 template <class Class, typename MethodPtr>
211 static R InvokeMethod(Class* obj_ptr,
212 MethodPtr method_ptr,
kosakbd018832014-04-02 20:30:00 +0000213 const ::testing::tuple<A1, A2, A3, A4, A5, A6>& args) {
214 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
215 get<2>(args), get<3>(args), get<4>(args), get<5>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000216 }
Gennadiy Civile1071eb2018-04-10 15:57:16 -0400217
218 // There is no InvokeCallback() for 6-tuples, as google3 callbacks
219 // support 5 arguments at most.
shiqiane35fdd92008-12-10 05:08:54 +0000220};
221
222template <typename R, typename A1, typename A2, typename A3, typename A4,
223 typename A5, typename A6, typename A7>
kosakbd018832014-04-02 20:30:00 +0000224class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
shiqiane35fdd92008-12-10 05:08:54 +0000225 public:
226 template <typename Function>
kosakbd018832014-04-02 20:30:00 +0000227 static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
228 A6, A7>& args) {
229 return function(get<0>(args), get<1>(args), get<2>(args),
230 get<3>(args), get<4>(args), get<5>(args), get<6>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000231 }
232
233 template <class Class, typename MethodPtr>
234 static R InvokeMethod(Class* obj_ptr,
235 MethodPtr method_ptr,
kosakbd018832014-04-02 20:30:00 +0000236 const ::testing::tuple<A1, A2, A3, A4, A5, A6,
shiqiane35fdd92008-12-10 05:08:54 +0000237 A7>& args) {
kosakbd018832014-04-02 20:30:00 +0000238 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
239 get<2>(args), get<3>(args), get<4>(args), get<5>(args),
240 get<6>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000241 }
Gennadiy Civile1071eb2018-04-10 15:57:16 -0400242
243 // There is no InvokeCallback() for 7-tuples, as google3 callbacks
244 // support 5 arguments at most.
shiqiane35fdd92008-12-10 05:08:54 +0000245};
246
247template <typename R, typename A1, typename A2, typename A3, typename A4,
248 typename A5, typename A6, typename A7, typename A8>
kosakbd018832014-04-02 20:30:00 +0000249class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
shiqiane35fdd92008-12-10 05:08:54 +0000250 public:
251 template <typename Function>
kosakbd018832014-04-02 20:30:00 +0000252 static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
253 A6, A7, A8>& args) {
254 return function(get<0>(args), get<1>(args), get<2>(args),
255 get<3>(args), get<4>(args), get<5>(args), get<6>(args),
256 get<7>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000257 }
258
259 template <class Class, typename MethodPtr>
260 static R InvokeMethod(Class* obj_ptr,
261 MethodPtr method_ptr,
kosakbd018832014-04-02 20:30:00 +0000262 const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7,
shiqiane35fdd92008-12-10 05:08:54 +0000263 A8>& args) {
kosakbd018832014-04-02 20:30:00 +0000264 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
265 get<2>(args), get<3>(args), get<4>(args), get<5>(args),
266 get<6>(args), get<7>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000267 }
Gennadiy Civile1071eb2018-04-10 15:57:16 -0400268
269 // There is no InvokeCallback() for 8-tuples, as google3 callbacks
270 // support 5 arguments at most.
shiqiane35fdd92008-12-10 05:08:54 +0000271};
272
273template <typename R, typename A1, typename A2, typename A3, typename A4,
274 typename A5, typename A6, typename A7, typename A8, typename A9>
kosakbd018832014-04-02 20:30:00 +0000275class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
shiqiane35fdd92008-12-10 05:08:54 +0000276 public:
277 template <typename Function>
kosakbd018832014-04-02 20:30:00 +0000278 static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
279 A6, A7, A8, A9>& args) {
280 return function(get<0>(args), get<1>(args), get<2>(args),
281 get<3>(args), get<4>(args), get<5>(args), get<6>(args),
282 get<7>(args), get<8>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000283 }
284
285 template <class Class, typename MethodPtr>
286 static R InvokeMethod(Class* obj_ptr,
287 MethodPtr method_ptr,
kosakbd018832014-04-02 20:30:00 +0000288 const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
shiqiane35fdd92008-12-10 05:08:54 +0000289 A9>& args) {
kosakbd018832014-04-02 20:30:00 +0000290 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
291 get<2>(args), get<3>(args), get<4>(args), get<5>(args),
292 get<6>(args), get<7>(args), get<8>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000293 }
Gennadiy Civile1071eb2018-04-10 15:57:16 -0400294
295 // There is no InvokeCallback() for 9-tuples, as google3 callbacks
296 // support 5 arguments at most.
shiqiane35fdd92008-12-10 05:08:54 +0000297};
298
299template <typename R, typename A1, typename A2, typename A3, typename A4,
300 typename A5, typename A6, typename A7, typename A8, typename A9,
301 typename A10>
kosakbd018832014-04-02 20:30:00 +0000302class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
shiqiane35fdd92008-12-10 05:08:54 +0000303 A10> > {
304 public:
305 template <typename Function>
kosakbd018832014-04-02 20:30:00 +0000306 static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
307 A6, A7, A8, A9, A10>& args) {
308 return function(get<0>(args), get<1>(args), get<2>(args),
309 get<3>(args), get<4>(args), get<5>(args), get<6>(args),
310 get<7>(args), get<8>(args), get<9>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000311 }
312
313 template <class Class, typename MethodPtr>
314 static R InvokeMethod(Class* obj_ptr,
315 MethodPtr method_ptr,
kosakbd018832014-04-02 20:30:00 +0000316 const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
shiqiane35fdd92008-12-10 05:08:54 +0000317 A9, A10>& args) {
kosakbd018832014-04-02 20:30:00 +0000318 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
319 get<2>(args), get<3>(args), get<4>(args), get<5>(args),
320 get<6>(args), get<7>(args), get<8>(args), get<9>(args));
shiqiane35fdd92008-12-10 05:08:54 +0000321 }
Gennadiy Civile1071eb2018-04-10 15:57:16 -0400322
323 // There is no InvokeCallback() for 10-tuples, as google3 callbacks
324 // support 5 arguments at most.
325};
326
327// Implements the Invoke(callback) action.
328template <typename CallbackType>
329class InvokeCallbackAction {
330 public:
331 // The c'tor takes ownership of the callback.
332 explicit InvokeCallbackAction(CallbackType* callback)
333 : callback_(callback) {
334 callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
335 }
336
337 // This type conversion operator template allows Invoke(callback) to
338 // be used wherever the callback's type is compatible with that of
339 // the mock function, i.e. if the mock function's arguments can be
340 // implicitly converted to the callback's arguments and the
341 // callback's result can be implicitly converted to the mock
342 // function's result.
343 template <typename Result, typename ArgumentTuple>
344 Result Perform(const ArgumentTuple& args) const {
345 return InvokeHelper<Result, ArgumentTuple>::InvokeCallback(
346 callback_.get(), args);
347 }
348 private:
349 const linked_ptr<CallbackType> callback_;
shiqiane35fdd92008-12-10 05:08:54 +0000350};
351
shiqiane35fdd92008-12-10 05:08:54 +0000352// An INTERNAL macro for extracting the type of a tuple field. It's
353// subject to change without notice - DO NOT USE IN USER CODE!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000354#define GMOCK_FIELD_(Tuple, N) \
kosakbd018832014-04-02 20:30:00 +0000355 typename ::testing::tuple_element<N, Tuple>::type
shiqiane35fdd92008-12-10 05:08:54 +0000356
357// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
358// type of an n-ary function whose i-th (1-based) argument type is the
359// k{i}-th (0-based) field of ArgumentTuple, which must be a tuple
360// type, and whose return type is Result. For example,
kosakbd018832014-04-02 20:30:00 +0000361// SelectArgs<int, ::testing::tuple<bool, char, double, long>, 0, 3>::type
shiqiane35fdd92008-12-10 05:08:54 +0000362// is int(bool, long).
363//
364// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
365// returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
366// For example,
kosakbd018832014-04-02 20:30:00 +0000367// SelectArgs<int, tuple<bool, char, double>, 2, 0>::Select(
368// ::testing::make_tuple(true, 'a', 2.5))
369// returns tuple (2.5, true).
shiqiane35fdd92008-12-10 05:08:54 +0000370//
371// The numbers in list k1, k2, ..., k_n must be >= 0, where n can be
372// in the range [0, 10]. Duplicates are allowed and they don't have
373// to be in an ascending or descending order.
374
375template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
376 int k4, int k5, int k6, int k7, int k8, int k9, int k10>
377class SelectArgs {
378 public:
zhanyong.wane0d051e2009-02-19 00:33:37 +0000379 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
380 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
381 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
382 GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
383 GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9),
384 GMOCK_FIELD_(ArgumentTuple, k10));
shiqiane35fdd92008-12-10 05:08:54 +0000385 typedef typename Function<type>::ArgumentTuple SelectedArgs;
386 static SelectedArgs Select(const ArgumentTuple& args) {
shiqiane35fdd92008-12-10 05:08:54 +0000387 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
388 get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
389 get<k8>(args), get<k9>(args), get<k10>(args));
390 }
391};
392
393template <typename Result, typename ArgumentTuple>
394class SelectArgs<Result, ArgumentTuple,
395 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
396 public:
397 typedef Result type();
398 typedef typename Function<type>::ArgumentTuple SelectedArgs;
zhanyong.wan3fbd2dd2009-03-26 19:06:45 +0000399 static SelectedArgs Select(const ArgumentTuple& /* args */) {
shiqiane35fdd92008-12-10 05:08:54 +0000400 return SelectedArgs();
401 }
402};
403
404template <typename Result, typename ArgumentTuple, int k1>
405class SelectArgs<Result, ArgumentTuple,
406 k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
407 public:
zhanyong.wane0d051e2009-02-19 00:33:37 +0000408 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1));
shiqiane35fdd92008-12-10 05:08:54 +0000409 typedef typename Function<type>::ArgumentTuple SelectedArgs;
410 static SelectedArgs Select(const ArgumentTuple& args) {
shiqiane35fdd92008-12-10 05:08:54 +0000411 return SelectedArgs(get<k1>(args));
412 }
413};
414
415template <typename Result, typename ArgumentTuple, int k1, int k2>
416class SelectArgs<Result, ArgumentTuple,
417 k1, k2, -1, -1, -1, -1, -1, -1, -1, -1> {
418 public:
zhanyong.wane0d051e2009-02-19 00:33:37 +0000419 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
420 GMOCK_FIELD_(ArgumentTuple, k2));
shiqiane35fdd92008-12-10 05:08:54 +0000421 typedef typename Function<type>::ArgumentTuple SelectedArgs;
422 static SelectedArgs Select(const ArgumentTuple& args) {
shiqiane35fdd92008-12-10 05:08:54 +0000423 return SelectedArgs(get<k1>(args), get<k2>(args));
424 }
425};
426
427template <typename Result, typename ArgumentTuple, int k1, int k2, int k3>
428class SelectArgs<Result, ArgumentTuple,
429 k1, k2, k3, -1, -1, -1, -1, -1, -1, -1> {
430 public:
zhanyong.wane0d051e2009-02-19 00:33:37 +0000431 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
432 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3));
shiqiane35fdd92008-12-10 05:08:54 +0000433 typedef typename Function<type>::ArgumentTuple SelectedArgs;
434 static SelectedArgs Select(const ArgumentTuple& args) {
shiqiane35fdd92008-12-10 05:08:54 +0000435 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args));
436 }
437};
438
439template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
440 int k4>
441class SelectArgs<Result, ArgumentTuple,
442 k1, k2, k3, k4, -1, -1, -1, -1, -1, -1> {
443 public:
zhanyong.wane0d051e2009-02-19 00:33:37 +0000444 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
445 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
446 GMOCK_FIELD_(ArgumentTuple, k4));
shiqiane35fdd92008-12-10 05:08:54 +0000447 typedef typename Function<type>::ArgumentTuple SelectedArgs;
448 static SelectedArgs Select(const ArgumentTuple& args) {
shiqiane35fdd92008-12-10 05:08:54 +0000449 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
450 get<k4>(args));
451 }
452};
453
454template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
455 int k4, int k5>
456class SelectArgs<Result, ArgumentTuple,
457 k1, k2, k3, k4, k5, -1, -1, -1, -1, -1> {
458 public:
zhanyong.wane0d051e2009-02-19 00:33:37 +0000459 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
460 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
461 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5));
shiqiane35fdd92008-12-10 05:08:54 +0000462 typedef typename Function<type>::ArgumentTuple SelectedArgs;
463 static SelectedArgs Select(const ArgumentTuple& args) {
shiqiane35fdd92008-12-10 05:08:54 +0000464 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
465 get<k4>(args), get<k5>(args));
466 }
467};
468
469template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
470 int k4, int k5, int k6>
471class SelectArgs<Result, ArgumentTuple,
472 k1, k2, k3, k4, k5, k6, -1, -1, -1, -1> {
473 public:
zhanyong.wane0d051e2009-02-19 00:33:37 +0000474 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
475 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
476 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
477 GMOCK_FIELD_(ArgumentTuple, k6));
shiqiane35fdd92008-12-10 05:08:54 +0000478 typedef typename Function<type>::ArgumentTuple SelectedArgs;
479 static SelectedArgs Select(const ArgumentTuple& args) {
shiqiane35fdd92008-12-10 05:08:54 +0000480 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
481 get<k4>(args), get<k5>(args), get<k6>(args));
482 }
483};
484
485template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
486 int k4, int k5, int k6, int k7>
487class SelectArgs<Result, ArgumentTuple,
488 k1, k2, k3, k4, k5, k6, k7, -1, -1, -1> {
489 public:
zhanyong.wane0d051e2009-02-19 00:33:37 +0000490 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
491 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
492 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
493 GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7));
shiqiane35fdd92008-12-10 05:08:54 +0000494 typedef typename Function<type>::ArgumentTuple SelectedArgs;
495 static SelectedArgs Select(const ArgumentTuple& args) {
shiqiane35fdd92008-12-10 05:08:54 +0000496 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
497 get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args));
498 }
499};
500
501template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
502 int k4, int k5, int k6, int k7, int k8>
503class SelectArgs<Result, ArgumentTuple,
504 k1, k2, k3, k4, k5, k6, k7, k8, -1, -1> {
505 public:
zhanyong.wane0d051e2009-02-19 00:33:37 +0000506 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
507 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
508 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
509 GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
510 GMOCK_FIELD_(ArgumentTuple, k8));
shiqiane35fdd92008-12-10 05:08:54 +0000511 typedef typename Function<type>::ArgumentTuple SelectedArgs;
512 static SelectedArgs Select(const ArgumentTuple& args) {
shiqiane35fdd92008-12-10 05:08:54 +0000513 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
514 get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
515 get<k8>(args));
516 }
517};
518
519template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
520 int k4, int k5, int k6, int k7, int k8, int k9>
521class SelectArgs<Result, ArgumentTuple,
522 k1, k2, k3, k4, k5, k6, k7, k8, k9, -1> {
523 public:
zhanyong.wane0d051e2009-02-19 00:33:37 +0000524 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
525 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
526 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
527 GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
528 GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9));
shiqiane35fdd92008-12-10 05:08:54 +0000529 typedef typename Function<type>::ArgumentTuple SelectedArgs;
530 static SelectedArgs Select(const ArgumentTuple& args) {
shiqiane35fdd92008-12-10 05:08:54 +0000531 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
532 get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
533 get<k8>(args), get<k9>(args));
534 }
535};
536
zhanyong.wane0d051e2009-02-19 00:33:37 +0000537#undef GMOCK_FIELD_
shiqiane35fdd92008-12-10 05:08:54 +0000538
539// Implements the WithArgs action.
540template <typename InnerAction, int k1 = -1, int k2 = -1, int k3 = -1,
541 int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
542 int k9 = -1, int k10 = -1>
543class WithArgsAction {
544 public:
545 explicit WithArgsAction(const InnerAction& action) : action_(action) {}
546
547 template <typename F>
zhanyong.wan38ca64d2009-02-19 22:30:22 +0000548 operator Action<F>() const { return MakeAction(new Impl<F>(action_)); }
549
550 private:
551 template <typename F>
552 class Impl : public ActionInterface<F> {
553 public:
shiqiane35fdd92008-12-10 05:08:54 +0000554 typedef typename Function<F>::Result Result;
555 typedef typename Function<F>::ArgumentTuple ArgumentTuple;
zhanyong.wan38ca64d2009-02-19 22:30:22 +0000556
557 explicit Impl(const InnerAction& action) : action_(action) {}
558
559 virtual Result Perform(const ArgumentTuple& args) {
560 return action_.Perform(SelectArgs<Result, ArgumentTuple, k1, k2, k3, k4,
561 k5, k6, k7, k8, k9, k10>::Select(args));
562 }
563
564 private:
shiqiane35fdd92008-12-10 05:08:54 +0000565 typedef typename SelectArgs<Result, ArgumentTuple,
zhanyong.wan38ca64d2009-02-19 22:30:22 +0000566 k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType;
shiqiane35fdd92008-12-10 05:08:54 +0000567
zhanyong.wan38ca64d2009-02-19 22:30:22 +0000568 Action<InnerFunctionType> action_;
569 };
shiqiane35fdd92008-12-10 05:08:54 +0000570
shiqiane35fdd92008-12-10 05:08:54 +0000571 const InnerAction action_;
zhanyong.wan32de5f52009-12-23 00:13:23 +0000572
573 GTEST_DISALLOW_ASSIGN_(WithArgsAction);
shiqiane35fdd92008-12-10 05:08:54 +0000574};
575
shiqian326aa562009-01-09 21:43:57 +0000576// A macro from the ACTION* family (defined later in this file)
577// defines an action that can be used in a mock function. Typically,
578// these actions only care about a subset of the arguments of the mock
579// function. For example, if such an action only uses the second
580// argument, it can be used in any mock function that takes >= 2
581// arguments where the type of the second argument is compatible.
582//
583// Therefore, the action implementation must be prepared to take more
584// arguments than it needs. The ExcessiveArg type is used to
585// represent those excessive arguments. In order to keep the compiler
586// error messages tractable, we define it in the testing namespace
587// instead of testing::internal. However, this is an INTERNAL TYPE
588// and subject to change without notice, so a user MUST NOT USE THIS
589// TYPE DIRECTLY.
590struct ExcessiveArg {};
591
592// A helper class needed for implementing the ACTION* macros.
593template <typename Result, class Impl>
594class ActionHelper {
595 public:
kosakbd018832014-04-02 20:30:00 +0000596 static Result Perform(Impl* impl, const ::testing::tuple<>& args) {
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000597 return impl->template gmock_PerformImpl<>(args, ExcessiveArg(),
shiqian326aa562009-01-09 21:43:57 +0000598 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000599 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
600 ExcessiveArg());
shiqian326aa562009-01-09 21:43:57 +0000601 }
602
603 template <typename A0>
kosakbd018832014-04-02 20:30:00 +0000604 static Result Perform(Impl* impl, const ::testing::tuple<A0>& args) {
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000605 return impl->template gmock_PerformImpl<A0>(args, get<0>(args),
shiqian326aa562009-01-09 21:43:57 +0000606 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000607 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
608 ExcessiveArg());
shiqian326aa562009-01-09 21:43:57 +0000609 }
610
611 template <typename A0, typename A1>
kosakbd018832014-04-02 20:30:00 +0000612 static Result Perform(Impl* impl, const ::testing::tuple<A0, A1>& args) {
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000613 return impl->template gmock_PerformImpl<A0, A1>(args, get<0>(args),
614 get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
shiqian326aa562009-01-09 21:43:57 +0000615 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000616 ExcessiveArg());
shiqian326aa562009-01-09 21:43:57 +0000617 }
618
619 template <typename A0, typename A1, typename A2>
kosakbd018832014-04-02 20:30:00 +0000620 static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2>& args) {
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000621 return impl->template gmock_PerformImpl<A0, A1, A2>(args, get<0>(args),
622 get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(),
623 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
624 ExcessiveArg());
shiqian326aa562009-01-09 21:43:57 +0000625 }
626
627 template <typename A0, typename A1, typename A2, typename A3>
kosakbd018832014-04-02 20:30:00 +0000628 static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2,
shiqian326aa562009-01-09 21:43:57 +0000629 A3>& args) {
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000630 return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, get<0>(args),
631 get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(),
632 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
633 ExcessiveArg());
shiqian326aa562009-01-09 21:43:57 +0000634 }
635
636 template <typename A0, typename A1, typename A2, typename A3, typename A4>
kosakbd018832014-04-02 20:30:00 +0000637 static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3,
shiqian326aa562009-01-09 21:43:57 +0000638 A4>& args) {
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000639 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args,
640 get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
641 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
642 ExcessiveArg());
shiqian326aa562009-01-09 21:43:57 +0000643 }
644
645 template <typename A0, typename A1, typename A2, typename A3, typename A4,
646 typename A5>
kosakbd018832014-04-02 20:30:00 +0000647 static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
shiqian326aa562009-01-09 21:43:57 +0000648 A5>& args) {
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000649 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args,
650 get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
651 get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
652 ExcessiveArg());
shiqian326aa562009-01-09 21:43:57 +0000653 }
654
655 template <typename A0, typename A1, typename A2, typename A3, typename A4,
656 typename A5, typename A6>
kosakbd018832014-04-02 20:30:00 +0000657 static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
shiqian326aa562009-01-09 21:43:57 +0000658 A5, A6>& args) {
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000659 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args,
660 get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
661 get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(),
662 ExcessiveArg());
shiqian326aa562009-01-09 21:43:57 +0000663 }
664
665 template <typename A0, typename A1, typename A2, typename A3, typename A4,
666 typename A5, typename A6, typename A7>
kosakbd018832014-04-02 20:30:00 +0000667 static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
shiqian326aa562009-01-09 21:43:57 +0000668 A5, A6, A7>& args) {
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000669 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6,
670 A7>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
671 get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(),
672 ExcessiveArg());
shiqian326aa562009-01-09 21:43:57 +0000673 }
674
675 template <typename A0, typename A1, typename A2, typename A3, typename A4,
676 typename A5, typename A6, typename A7, typename A8>
kosakbd018832014-04-02 20:30:00 +0000677 static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
shiqian326aa562009-01-09 21:43:57 +0000678 A5, A6, A7, A8>& args) {
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000679 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7,
680 A8>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
681 get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
682 ExcessiveArg());
shiqian326aa562009-01-09 21:43:57 +0000683 }
684
685 template <typename A0, typename A1, typename A2, typename A3, typename A4,
686 typename A5, typename A6, typename A7, typename A8, typename A9>
kosakbd018832014-04-02 20:30:00 +0000687 static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
shiqian326aa562009-01-09 21:43:57 +0000688 A5, A6, A7, A8, A9>& args) {
zhanyong.wan7f4c2c02009-02-19 22:38:27 +0000689 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8,
690 A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
691 get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
692 get<9>(args));
shiqian326aa562009-01-09 21:43:57 +0000693 }
694};
695
shiqiane35fdd92008-12-10 05:08:54 +0000696} // namespace internal
697
698// Various overloads for Invoke().
699
shiqiane35fdd92008-12-10 05:08:54 +0000700// WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes
701// the selected arguments of the mock function to an_action and
702// performs it. It serves as an adaptor between actions with
703// different argument lists. C++ doesn't support default arguments for
704// function templates, so we have to overload it.
705template <int k1, typename InnerAction>
706inline internal::WithArgsAction<InnerAction, k1>
707WithArgs(const InnerAction& action) {
708 return internal::WithArgsAction<InnerAction, k1>(action);
709}
710
711template <int k1, int k2, typename InnerAction>
712inline internal::WithArgsAction<InnerAction, k1, k2>
713WithArgs(const InnerAction& action) {
714 return internal::WithArgsAction<InnerAction, k1, k2>(action);
715}
716
717template <int k1, int k2, int k3, typename InnerAction>
718inline internal::WithArgsAction<InnerAction, k1, k2, k3>
719WithArgs(const InnerAction& action) {
720 return internal::WithArgsAction<InnerAction, k1, k2, k3>(action);
721}
722
723template <int k1, int k2, int k3, int k4, typename InnerAction>
724inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4>
725WithArgs(const InnerAction& action) {
726 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4>(action);
727}
728
729template <int k1, int k2, int k3, int k4, int k5, typename InnerAction>
730inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>
731WithArgs(const InnerAction& action) {
732 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>(action);
733}
734
735template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerAction>
736inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>
737WithArgs(const InnerAction& action) {
738 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>(action);
739}
740
741template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
742 typename InnerAction>
743inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7>
744WithArgs(const InnerAction& action) {
745 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6,
746 k7>(action);
747}
748
749template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
750 typename InnerAction>
751inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8>
752WithArgs(const InnerAction& action) {
753 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7,
754 k8>(action);
755}
756
757template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
758 int k9, typename InnerAction>
759inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, k9>
760WithArgs(const InnerAction& action) {
761 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
762 k9>(action);
763}
764
765template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
766 int k9, int k10, typename InnerAction>
767inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
768 k9, k10>
769WithArgs(const InnerAction& action) {
770 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
771 k9, k10>(action);
772}
773
774// Creates an action that does actions a1, a2, ..., sequentially in
775// each invocation.
776template <typename Action1, typename Action2>
777inline internal::DoBothAction<Action1, Action2>
778DoAll(Action1 a1, Action2 a2) {
779 return internal::DoBothAction<Action1, Action2>(a1, a2);
780}
781
782template <typename Action1, typename Action2, typename Action3>
783inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
784 Action3> >
785DoAll(Action1 a1, Action2 a2, Action3 a3) {
786 return DoAll(a1, DoAll(a2, a3));
787}
788
789template <typename Action1, typename Action2, typename Action3,
790 typename Action4>
791inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
792 internal::DoBothAction<Action3, Action4> > >
793DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) {
794 return DoAll(a1, DoAll(a2, a3, a4));
795}
796
797template <typename Action1, typename Action2, typename Action3,
798 typename Action4, typename Action5>
799inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
800 internal::DoBothAction<Action3, internal::DoBothAction<Action4,
801 Action5> > > >
802DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) {
803 return DoAll(a1, DoAll(a2, a3, a4, a5));
804}
805
806template <typename Action1, typename Action2, typename Action3,
807 typename Action4, typename Action5, typename Action6>
808inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
809 internal::DoBothAction<Action3, internal::DoBothAction<Action4,
810 internal::DoBothAction<Action5, Action6> > > > >
811DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) {
812 return DoAll(a1, DoAll(a2, a3, a4, a5, a6));
813}
814
815template <typename Action1, typename Action2, typename Action3,
816 typename Action4, typename Action5, typename Action6, typename Action7>
817inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
818 internal::DoBothAction<Action3, internal::DoBothAction<Action4,
819 internal::DoBothAction<Action5, internal::DoBothAction<Action6,
820 Action7> > > > > >
821DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
822 Action7 a7) {
823 return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7));
824}
825
826template <typename Action1, typename Action2, typename Action3,
827 typename Action4, typename Action5, typename Action6, typename Action7,
828 typename Action8>
829inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
830 internal::DoBothAction<Action3, internal::DoBothAction<Action4,
831 internal::DoBothAction<Action5, internal::DoBothAction<Action6,
832 internal::DoBothAction<Action7, Action8> > > > > > >
833DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
834 Action7 a7, Action8 a8) {
835 return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8));
836}
837
838template <typename Action1, typename Action2, typename Action3,
839 typename Action4, typename Action5, typename Action6, typename Action7,
840 typename Action8, typename Action9>
841inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
842 internal::DoBothAction<Action3, internal::DoBothAction<Action4,
843 internal::DoBothAction<Action5, internal::DoBothAction<Action6,
844 internal::DoBothAction<Action7, internal::DoBothAction<Action8,
845 Action9> > > > > > > >
846DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
847 Action7 a7, Action8 a8, Action9 a9) {
848 return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9));
849}
850
851template <typename Action1, typename Action2, typename Action3,
852 typename Action4, typename Action5, typename Action6, typename Action7,
853 typename Action8, typename Action9, typename Action10>
854inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
855 internal::DoBothAction<Action3, internal::DoBothAction<Action4,
856 internal::DoBothAction<Action5, internal::DoBothAction<Action6,
857 internal::DoBothAction<Action7, internal::DoBothAction<Action8,
858 internal::DoBothAction<Action9, Action10> > > > > > > > >
859DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
860 Action7 a7, Action8 a8, Action9 a9, Action10 a10) {
861 return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10));
862}
863
864} // namespace testing
865
shiqian326aa562009-01-09 21:43:57 +0000866// The ACTION* family of macros can be used in a namespace scope to
867// define custom actions easily. The syntax:
868//
869// ACTION(name) { statements; }
870//
871// will define an action with the given name that executes the
872// statements. The value returned by the statements will be used as
873// the return value of the action. Inside the statements, you can
874// refer to the K-th (0-based) argument of the mock function by
875// 'argK', and refer to its type by 'argK_type'. For example:
876//
877// ACTION(IncrementArg1) {
878// arg1_type temp = arg1;
879// return ++(*temp);
880// }
881//
882// allows you to write
883//
884// ...WillOnce(IncrementArg1());
885//
886// You can also refer to the entire argument tuple and its type by
887// 'args' and 'args_type', and refer to the mock function type and its
888// return type by 'function_type' and 'return_type'.
889//
890// Note that you don't need to specify the types of the mock function
891// arguments. However rest assured that your code is still type-safe:
892// you'll get a compiler error if *arg1 doesn't support the ++
893// operator, or if the type of ++(*arg1) isn't compatible with the
894// mock function's return type, for example.
895//
896// Sometimes you'll want to parameterize the action. For that you can use
897// another macro:
898//
899// ACTION_P(name, param_name) { statements; }
900//
901// For example:
902//
903// ACTION_P(Add, n) { return arg0 + n; }
904//
905// will allow you to write:
906//
907// ...WillOnce(Add(5));
908//
909// Note that you don't need to provide the type of the parameter
910// either. If you need to reference the type of a parameter named
911// 'foo', you can write 'foo_type'. For example, in the body of
912// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type
913// of 'n'.
914//
915// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support
916// multi-parameter actions.
917//
918// For the purpose of typing, you can view
919//
920// ACTION_Pk(Foo, p1, ..., pk) { ... }
921//
922// as shorthand for
923//
924// template <typename p1_type, ..., typename pk_type>
925// FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
926//
927// In particular, you can provide the template type arguments
928// explicitly when invoking Foo(), as in Foo<long, bool>(5, false);
929// although usually you can rely on the compiler to infer the types
930// for you automatically. You can assign the result of expression
931// Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ...,
932// pk_type>. This can be useful when composing actions.
933//
934// You can also overload actions with different numbers of parameters:
935//
936// ACTION_P(Plus, a) { ... }
937// ACTION_P2(Plus, a, b) { ... }
938//
939// While it's tempting to always use the ACTION* macros when defining
940// a new action, you should also consider implementing ActionInterface
941// or using MakePolymorphicAction() instead, especially if you need to
942// use the action a lot. While these approaches require more work,
943// they give you more control on the types of the mock function
944// arguments and the action parameters, which in general leads to
945// better compiler error messages that pay off in the long run. They
946// also allow overloading actions based on parameter types (as opposed
947// to just based on the number of parameters).
948//
949// CAVEAT:
950//
951// ACTION*() can only be used in a namespace scope. The reason is
952// that C++ doesn't yet allow function-local types to be used to
953// instantiate templates. The up-coming C++0x standard will fix this.
954// Once that's done, we'll consider supporting using ACTION*() inside
955// a function.
956//
957// MORE INFORMATION:
958//
959// To learn more about using these macros, please search for 'ACTION'
Herbert Thielene033d8c2017-08-31 18:12:17 +0200960// on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
shiqian326aa562009-01-09 21:43:57 +0000961
zhanyong.wan33c0af02009-04-03 00:10:12 +0000962// An internal macro needed for implementing ACTION*().
963#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\
jgm79a367e2012-04-10 16:02:11 +0000964 const args_type& args GTEST_ATTRIBUTE_UNUSED_, \
965 arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_, \
966 arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_, \
967 arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_, \
968 arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_, \
969 arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_, \
970 arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_, \
971 arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_, \
972 arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_, \
973 arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_, \
zhanyong.wan33c0af02009-04-03 00:10:12 +0000974 arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_
975
zhanyong.wan18490652009-05-11 18:54:08 +0000976// Sometimes you want to give an action explicit template parameters
977// that cannot be inferred from its value parameters. ACTION() and
978// ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that
979// and can be viewed as an extension to ACTION() and ACTION_P*().
980//
981// The syntax:
982//
983// ACTION_TEMPLATE(ActionName,
984// HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m),
985// AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; }
986//
987// defines an action template that takes m explicit template
988// parameters and n value parameters. name_i is the name of the i-th
989// template parameter, and kind_i specifies whether it's a typename,
990// an integral constant, or a template. p_i is the name of the i-th
991// value parameter.
992//
993// Example:
994//
995// // DuplicateArg<k, T>(output) converts the k-th argument of the mock
996// // function to type T and copies it to *output.
997// ACTION_TEMPLATE(DuplicateArg,
998// HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
999// AND_1_VALUE_PARAMS(output)) {
kosakbd018832014-04-02 20:30:00 +00001000// *output = T(::testing::get<k>(args));
zhanyong.wan18490652009-05-11 18:54:08 +00001001// }
1002// ...
1003// int n;
1004// EXPECT_CALL(mock, Foo(_, _))
1005// .WillOnce(DuplicateArg<1, unsigned char>(&n));
1006//
1007// To create an instance of an action template, write:
1008//
1009// ActionName<t1, ..., t_m>(v1, ..., v_n)
1010//
1011// where the ts are the template arguments and the vs are the value
1012// arguments. The value argument types are inferred by the compiler.
1013// If you want to explicitly specify the value argument types, you can
1014// provide additional template arguments:
1015//
1016// ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n)
1017//
1018// where u_i is the desired type of v_i.
1019//
1020// ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the
1021// number of value parameters, but not on the number of template
1022// parameters. Without the restriction, the meaning of the following
1023// is unclear:
1024//
1025// OverloadedAction<int, bool>(x);
1026//
1027// Are we using a single-template-parameter action where 'bool' refers
1028// to the type of x, or are we using a two-template-parameter action
1029// where the compiler is asked to infer the type of x?
1030//
1031// Implementation notes:
1032//
1033// GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and
1034// GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for
1035// implementing ACTION_TEMPLATE. The main trick we use is to create
1036// new macro invocations when expanding a macro. For example, we have
1037//
1038// #define ACTION_TEMPLATE(name, template_params, value_params)
1039// ... GMOCK_INTERNAL_DECL_##template_params ...
1040//
1041// which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...)
1042// to expand to
1043//
1044// ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ...
1045//
1046// Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the
1047// preprocessor will continue to expand it to
1048//
1049// ... typename T ...
1050//
1051// This technique conforms to the C++ standard and is portable. It
1052// allows us to implement action templates using O(N) code, where N is
1053// the maximum number of template/value parameters supported. Without
1054// using it, we'd have to devote O(N^2) amount of code to implement all
1055// combinations of m and n.
1056
1057// Declares the template parameters.
1058#define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0
1059#define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
1060 name1) kind0 name0, kind1 name1
1061#define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1062 kind2, name2) kind0 name0, kind1 name1, kind2 name2
1063#define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1064 kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \
1065 kind3 name3
1066#define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1067 kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \
1068 kind2 name2, kind3 name3, kind4 name4
1069#define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1070 kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \
1071 kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5
1072#define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1073 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
1074 name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \
1075 kind5 name5, kind6 name6
1076#define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1077 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
1078 kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \
1079 kind4 name4, kind5 name5, kind6 name6, kind7 name7
1080#define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1081 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
1082 kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \
1083 kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \
1084 kind8 name8
1085#define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
1086 name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
1087 name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \
1088 kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \
1089 kind6 name6, kind7 name7, kind8 name8, kind9 name9
1090
1091// Lists the template parameters.
1092#define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0
1093#define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
1094 name1) name0, name1
1095#define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1096 kind2, name2) name0, name1, name2
1097#define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1098 kind2, name2, kind3, name3) name0, name1, name2, name3
1099#define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1100 kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \
1101 name4
1102#define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1103 kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \
1104 name2, name3, name4, name5
1105#define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1106 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
1107 name6) name0, name1, name2, name3, name4, name5, name6
1108#define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1109 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
1110 kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7
1111#define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
1112 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
1113 kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \
1114 name6, name7, name8
1115#define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
1116 name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
1117 name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \
1118 name3, name4, name5, name6, name7, name8, name9
1119
1120// Declares the types of value parameters.
1121#define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS()
1122#define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type
1123#define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \
1124 typename p0##_type, typename p1##_type
1125#define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \
1126 typename p0##_type, typename p1##_type, typename p2##_type
1127#define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
1128 typename p0##_type, typename p1##_type, typename p2##_type, \
1129 typename p3##_type
1130#define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
1131 typename p0##_type, typename p1##_type, typename p2##_type, \
1132 typename p3##_type, typename p4##_type
1133#define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
1134 typename p0##_type, typename p1##_type, typename p2##_type, \
1135 typename p3##_type, typename p4##_type, typename p5##_type
1136#define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1137 p6) , typename p0##_type, typename p1##_type, typename p2##_type, \
1138 typename p3##_type, typename p4##_type, typename p5##_type, \
1139 typename p6##_type
1140#define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1141 p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \
1142 typename p3##_type, typename p4##_type, typename p5##_type, \
1143 typename p6##_type, typename p7##_type
1144#define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1145 p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \
1146 typename p3##_type, typename p4##_type, typename p5##_type, \
1147 typename p6##_type, typename p7##_type, typename p8##_type
1148#define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1149 p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \
1150 typename p2##_type, typename p3##_type, typename p4##_type, \
1151 typename p5##_type, typename p6##_type, typename p7##_type, \
1152 typename p8##_type, typename p9##_type
1153
1154// Initializes the value parameters.
1155#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\
1156 ()
1157#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001158 (p0##_type gmock_p0) : p0(::testing::internal::move(gmock_p0))
zhanyong.wan18490652009-05-11 18:54:08 +00001159#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001160 (p0##_type gmock_p0, \
1161 p1##_type gmock_p1) : p0(::testing::internal::move(gmock_p0)), \
1162 p1(::testing::internal::move(gmock_p1))
zhanyong.wan18490652009-05-11 18:54:08 +00001163#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\
1164 (p0##_type gmock_p0, p1##_type gmock_p1, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001165 p2##_type gmock_p2) : p0(::testing::internal::move(gmock_p0)), \
1166 p1(::testing::internal::move(gmock_p1)), \
1167 p2(::testing::internal::move(gmock_p2))
zhanyong.wan18490652009-05-11 18:54:08 +00001168#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\
1169 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001170 p3##_type gmock_p3) : p0(::testing::internal::move(gmock_p0)), \
1171 p1(::testing::internal::move(gmock_p1)), \
1172 p2(::testing::internal::move(gmock_p2)), \
1173 p3(::testing::internal::move(gmock_p3))
zhanyong.wan18490652009-05-11 18:54:08 +00001174#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\
1175 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001176 p3##_type gmock_p3, \
1177 p4##_type gmock_p4) : p0(::testing::internal::move(gmock_p0)), \
1178 p1(::testing::internal::move(gmock_p1)), \
1179 p2(::testing::internal::move(gmock_p2)), \
1180 p3(::testing::internal::move(gmock_p3)), \
1181 p4(::testing::internal::move(gmock_p4))
zhanyong.wan18490652009-05-11 18:54:08 +00001182#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\
1183 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1184 p3##_type gmock_p3, p4##_type gmock_p4, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001185 p5##_type gmock_p5) : p0(::testing::internal::move(gmock_p0)), \
1186 p1(::testing::internal::move(gmock_p1)), \
1187 p2(::testing::internal::move(gmock_p2)), \
1188 p3(::testing::internal::move(gmock_p3)), \
1189 p4(::testing::internal::move(gmock_p4)), \
1190 p5(::testing::internal::move(gmock_p5))
zhanyong.wan18490652009-05-11 18:54:08 +00001191#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\
1192 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1193 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001194 p6##_type gmock_p6) : p0(::testing::internal::move(gmock_p0)), \
1195 p1(::testing::internal::move(gmock_p1)), \
1196 p2(::testing::internal::move(gmock_p2)), \
1197 p3(::testing::internal::move(gmock_p3)), \
1198 p4(::testing::internal::move(gmock_p4)), \
1199 p5(::testing::internal::move(gmock_p5)), \
1200 p6(::testing::internal::move(gmock_p6))
zhanyong.wan18490652009-05-11 18:54:08 +00001201#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\
1202 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1203 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001204 p6##_type gmock_p6, \
1205 p7##_type gmock_p7) : p0(::testing::internal::move(gmock_p0)), \
1206 p1(::testing::internal::move(gmock_p1)), \
1207 p2(::testing::internal::move(gmock_p2)), \
1208 p3(::testing::internal::move(gmock_p3)), \
1209 p4(::testing::internal::move(gmock_p4)), \
1210 p5(::testing::internal::move(gmock_p5)), \
1211 p6(::testing::internal::move(gmock_p6)), \
1212 p7(::testing::internal::move(gmock_p7))
zhanyong.wan18490652009-05-11 18:54:08 +00001213#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1214 p7, p8)\
1215 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1216 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1217 p6##_type gmock_p6, p7##_type gmock_p7, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001218 p8##_type gmock_p8) : p0(::testing::internal::move(gmock_p0)), \
1219 p1(::testing::internal::move(gmock_p1)), \
1220 p2(::testing::internal::move(gmock_p2)), \
1221 p3(::testing::internal::move(gmock_p3)), \
1222 p4(::testing::internal::move(gmock_p4)), \
1223 p5(::testing::internal::move(gmock_p5)), \
1224 p6(::testing::internal::move(gmock_p6)), \
1225 p7(::testing::internal::move(gmock_p7)), \
1226 p8(::testing::internal::move(gmock_p8))
zhanyong.wan18490652009-05-11 18:54:08 +00001227#define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1228 p7, p8, p9)\
1229 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1230 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
1231 p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001232 p9##_type gmock_p9) : p0(::testing::internal::move(gmock_p0)), \
1233 p1(::testing::internal::move(gmock_p1)), \
1234 p2(::testing::internal::move(gmock_p2)), \
1235 p3(::testing::internal::move(gmock_p3)), \
1236 p4(::testing::internal::move(gmock_p4)), \
1237 p5(::testing::internal::move(gmock_p5)), \
1238 p6(::testing::internal::move(gmock_p6)), \
1239 p7(::testing::internal::move(gmock_p7)), \
1240 p8(::testing::internal::move(gmock_p8)), \
1241 p9(::testing::internal::move(gmock_p9))
zhanyong.wan18490652009-05-11 18:54:08 +00001242
1243// Declares the fields for storing the value parameters.
1244#define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS()
1245#define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0;
1246#define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \
1247 p1##_type p1;
1248#define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \
1249 p1##_type p1; p2##_type p2;
1250#define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \
1251 p1##_type p1; p2##_type p2; p3##_type p3;
1252#define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
1253 p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4;
1254#define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
1255 p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
1256 p5##_type p5;
1257#define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1258 p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
1259 p5##_type p5; p6##_type p6;
1260#define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1261 p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
1262 p5##_type p5; p6##_type p6; p7##_type p7;
1263#define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1264 p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
1265 p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8;
1266#define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1267 p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
1268 p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \
1269 p9##_type p9;
1270
1271// Lists the value parameters.
1272#define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS()
1273#define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0
1274#define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1
1275#define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2
1276#define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3
1277#define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \
1278 p2, p3, p4
1279#define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \
1280 p1, p2, p3, p4, p5
1281#define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1282 p6) p0, p1, p2, p3, p4, p5, p6
1283#define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1284 p7) p0, p1, p2, p3, p4, p5, p6, p7
1285#define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1286 p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8
1287#define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1288 p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9
1289
1290// Lists the value parameter types.
1291#define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS()
1292#define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type
1293#define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \
1294 p1##_type
1295#define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \
1296 p1##_type, p2##_type
1297#define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
1298 p0##_type, p1##_type, p2##_type, p3##_type
1299#define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
1300 p0##_type, p1##_type, p2##_type, p3##_type, p4##_type
1301#define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
1302 p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type
1303#define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1304 p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \
1305 p6##_type
1306#define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1307 p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1308 p5##_type, p6##_type, p7##_type
1309#define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1310 p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1311 p5##_type, p6##_type, p7##_type, p8##_type
1312#define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1313 p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
1314 p5##_type, p6##_type, p7##_type, p8##_type, p9##_type
1315
1316// Declares the value parameters.
1317#define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS()
1318#define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0
1319#define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \
1320 p1##_type p1
1321#define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \
1322 p1##_type p1, p2##_type p2
1323#define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \
1324 p1##_type p1, p2##_type p2, p3##_type p3
1325#define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
1326 p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4
1327#define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
1328 p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
1329 p5##_type p5
1330#define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
1331 p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
1332 p5##_type p5, p6##_type p6
1333#define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1334 p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
1335 p5##_type p5, p6##_type p6, p7##_type p7
1336#define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1337 p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1338 p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8
1339#define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1340 p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1341 p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
1342 p9##_type p9
1343
1344// The suffix of the class template implementing the action template.
1345#define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS()
1346#define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P
1347#define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2
1348#define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3
1349#define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4
1350#define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5
1351#define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6
1352#define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7
1353#define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1354 p7) P8
1355#define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1356 p7, p8) P9
1357#define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
1358 p7, p8, p9) P10
1359
1360// The name of the class template implementing the action template.
1361#define GMOCK_ACTION_CLASS_(name, value_params)\
zhanyong.wanccedc1c2010-08-09 22:46:12 +00001362 GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params)
zhanyong.wan18490652009-05-11 18:54:08 +00001363
1364#define ACTION_TEMPLATE(name, template_params, value_params)\
1365 template <GMOCK_INTERNAL_DECL_##template_params\
1366 GMOCK_INTERNAL_DECL_TYPE_##value_params>\
1367 class GMOCK_ACTION_CLASS_(name, value_params) {\
1368 public:\
billydonahue1f5fdea2014-05-19 17:54:51 +00001369 explicit GMOCK_ACTION_CLASS_(name, value_params)\
zhanyong.wan18490652009-05-11 18:54:08 +00001370 GMOCK_INTERNAL_INIT_##value_params {}\
1371 template <typename F>\
1372 class gmock_Impl : public ::testing::ActionInterface<F> {\
1373 public:\
1374 typedef F function_type;\
1375 typedef typename ::testing::internal::Function<F>::Result return_type;\
1376 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1377 args_type;\
1378 explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\
1379 virtual return_type Perform(const args_type& args) {\
1380 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1381 Perform(this, args);\
1382 }\
1383 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1384 typename arg3_type, typename arg4_type, typename arg5_type, \
1385 typename arg6_type, typename arg7_type, typename arg8_type, \
1386 typename arg9_type>\
1387 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1388 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1389 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1390 arg9_type arg9) const;\
1391 GMOCK_INTERNAL_DEFN_##value_params\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001392 private:\
1393 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
zhanyong.wan18490652009-05-11 18:54:08 +00001394 };\
1395 template <typename F> operator ::testing::Action<F>() const {\
1396 return ::testing::Action<F>(\
1397 new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
1398 }\
1399 GMOCK_INTERNAL_DEFN_##value_params\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001400 private:\
1401 GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\
zhanyong.wan18490652009-05-11 18:54:08 +00001402 };\
1403 template <GMOCK_INTERNAL_DECL_##template_params\
1404 GMOCK_INTERNAL_DECL_TYPE_##value_params>\
1405 inline GMOCK_ACTION_CLASS_(name, value_params)<\
1406 GMOCK_INTERNAL_LIST_##template_params\
1407 GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\
1408 GMOCK_INTERNAL_DECL_##value_params) {\
1409 return GMOCK_ACTION_CLASS_(name, value_params)<\
1410 GMOCK_INTERNAL_LIST_##template_params\
1411 GMOCK_INTERNAL_LIST_TYPE_##value_params>(\
1412 GMOCK_INTERNAL_LIST_##value_params);\
1413 }\
1414 template <GMOCK_INTERNAL_DECL_##template_params\
1415 GMOCK_INTERNAL_DECL_TYPE_##value_params>\
1416 template <typename F>\
jgm79a367e2012-04-10 16:02:11 +00001417 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1418 typename arg3_type, typename arg4_type, typename arg5_type, \
1419 typename arg6_type, typename arg7_type, typename arg8_type, \
zhanyong.wan18490652009-05-11 18:54:08 +00001420 typename arg9_type>\
1421 typename ::testing::internal::Function<F>::Result\
1422 GMOCK_ACTION_CLASS_(name, value_params)<\
1423 GMOCK_INTERNAL_LIST_##template_params\
1424 GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
1425 gmock_PerformImpl(\
1426 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
1427
shiqian326aa562009-01-09 21:43:57 +00001428#define ACTION(name)\
1429 class name##Action {\
1430 public:\
1431 name##Action() {}\
1432 template <typename F>\
1433 class gmock_Impl : public ::testing::ActionInterface<F> {\
1434 public:\
1435 typedef F function_type;\
1436 typedef typename ::testing::internal::Function<F>::Result return_type;\
1437 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1438 args_type;\
1439 gmock_Impl() {}\
1440 virtual return_type Perform(const args_type& args) {\
1441 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1442 Perform(this, args);\
1443 }\
1444 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1445 typename arg3_type, typename arg4_type, typename arg5_type, \
1446 typename arg6_type, typename arg7_type, typename arg8_type, \
1447 typename arg9_type>\
1448 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1449 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1450 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1451 arg9_type arg9) const;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001452 private:\
1453 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
shiqian326aa562009-01-09 21:43:57 +00001454 };\
1455 template <typename F> operator ::testing::Action<F>() const {\
1456 return ::testing::Action<F>(new gmock_Impl<F>());\
1457 }\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001458 private:\
1459 GTEST_DISALLOW_ASSIGN_(name##Action);\
shiqian326aa562009-01-09 21:43:57 +00001460 };\
1461 inline name##Action name() {\
1462 return name##Action();\
1463 }\
1464 template <typename F>\
1465 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1466 typename arg3_type, typename arg4_type, typename arg5_type, \
1467 typename arg6_type, typename arg7_type, typename arg8_type, \
1468 typename arg9_type>\
1469 typename ::testing::internal::Function<F>::Result\
zhanyong.wan33c0af02009-04-03 00:10:12 +00001470 name##Action::gmock_Impl<F>::gmock_PerformImpl(\
1471 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
shiqian326aa562009-01-09 21:43:57 +00001472
1473#define ACTION_P(name, p0)\
1474 template <typename p0##_type>\
1475 class name##ActionP {\
1476 public:\
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001477 explicit name##ActionP(p0##_type gmock_p0) : \
1478 p0(::testing::internal::forward<p0##_type>(gmock_p0)) {}\
shiqian326aa562009-01-09 21:43:57 +00001479 template <typename F>\
1480 class gmock_Impl : public ::testing::ActionInterface<F> {\
1481 public:\
1482 typedef F function_type;\
1483 typedef typename ::testing::internal::Function<F>::Result return_type;\
1484 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1485 args_type;\
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001486 explicit gmock_Impl(p0##_type gmock_p0) : \
1487 p0(::testing::internal::forward<p0##_type>(gmock_p0)) {}\
shiqian326aa562009-01-09 21:43:57 +00001488 virtual return_type Perform(const args_type& args) {\
1489 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1490 Perform(this, args);\
1491 }\
1492 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1493 typename arg3_type, typename arg4_type, typename arg5_type, \
1494 typename arg6_type, typename arg7_type, typename arg8_type, \
1495 typename arg9_type>\
1496 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1497 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1498 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1499 arg9_type arg9) const;\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001500 p0##_type p0;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001501 private:\
1502 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
shiqian326aa562009-01-09 21:43:57 +00001503 };\
1504 template <typename F> operator ::testing::Action<F>() const {\
1505 return ::testing::Action<F>(new gmock_Impl<F>(p0));\
1506 }\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001507 p0##_type p0;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001508 private:\
1509 GTEST_DISALLOW_ASSIGN_(name##ActionP);\
shiqian326aa562009-01-09 21:43:57 +00001510 };\
1511 template <typename p0##_type>\
1512 inline name##ActionP<p0##_type> name(p0##_type p0) {\
1513 return name##ActionP<p0##_type>(p0);\
1514 }\
1515 template <typename p0##_type>\
1516 template <typename F>\
1517 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1518 typename arg3_type, typename arg4_type, typename arg5_type, \
1519 typename arg6_type, typename arg7_type, typename arg8_type, \
1520 typename arg9_type>\
1521 typename ::testing::internal::Function<F>::Result\
zhanyong.wan33c0af02009-04-03 00:10:12 +00001522 name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1523 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
shiqian326aa562009-01-09 21:43:57 +00001524
1525#define ACTION_P2(name, p0, p1)\
1526 template <typename p0##_type, typename p1##_type>\
1527 class name##ActionP2 {\
1528 public:\
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001529 name##ActionP2(p0##_type gmock_p0, \
1530 p1##_type gmock_p1) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1531 p1(::testing::internal::forward<p1##_type>(gmock_p1)) {}\
shiqian326aa562009-01-09 21:43:57 +00001532 template <typename F>\
1533 class gmock_Impl : public ::testing::ActionInterface<F> {\
1534 public:\
1535 typedef F function_type;\
1536 typedef typename ::testing::internal::Function<F>::Result return_type;\
1537 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1538 args_type;\
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001539 gmock_Impl(p0##_type gmock_p0, \
1540 p1##_type gmock_p1) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1541 p1(::testing::internal::forward<p1##_type>(gmock_p1)) {}\
shiqian326aa562009-01-09 21:43:57 +00001542 virtual return_type Perform(const args_type& args) {\
1543 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1544 Perform(this, args);\
1545 }\
1546 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1547 typename arg3_type, typename arg4_type, typename arg5_type, \
1548 typename arg6_type, typename arg7_type, typename arg8_type, \
1549 typename arg9_type>\
1550 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1551 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1552 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1553 arg9_type arg9) const;\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001554 p0##_type p0;\
1555 p1##_type p1;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001556 private:\
1557 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
shiqian326aa562009-01-09 21:43:57 +00001558 };\
1559 template <typename F> operator ::testing::Action<F>() const {\
1560 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
1561 }\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001562 p0##_type p0;\
1563 p1##_type p1;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001564 private:\
1565 GTEST_DISALLOW_ASSIGN_(name##ActionP2);\
shiqian326aa562009-01-09 21:43:57 +00001566 };\
1567 template <typename p0##_type, typename p1##_type>\
1568 inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
1569 p1##_type p1) {\
1570 return name##ActionP2<p0##_type, p1##_type>(p0, p1);\
1571 }\
1572 template <typename p0##_type, typename p1##_type>\
1573 template <typename F>\
1574 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1575 typename arg3_type, typename arg4_type, typename arg5_type, \
1576 typename arg6_type, typename arg7_type, typename arg8_type, \
1577 typename arg9_type>\
1578 typename ::testing::internal::Function<F>::Result\
zhanyong.wan33c0af02009-04-03 00:10:12 +00001579 name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1580 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
shiqian326aa562009-01-09 21:43:57 +00001581
1582#define ACTION_P3(name, p0, p1, p2)\
1583 template <typename p0##_type, typename p1##_type, typename p2##_type>\
1584 class name##ActionP3 {\
1585 public:\
1586 name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001587 p2##_type gmock_p2) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1588 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
1589 p2(::testing::internal::forward<p2##_type>(gmock_p2)) {}\
shiqian326aa562009-01-09 21:43:57 +00001590 template <typename F>\
1591 class gmock_Impl : public ::testing::ActionInterface<F> {\
1592 public:\
1593 typedef F function_type;\
1594 typedef typename ::testing::internal::Function<F>::Result return_type;\
1595 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1596 args_type;\
1597 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001598 p2##_type gmock_p2) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1599 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
1600 p2(::testing::internal::forward<p2##_type>(gmock_p2)) {}\
shiqian326aa562009-01-09 21:43:57 +00001601 virtual return_type Perform(const args_type& args) {\
1602 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1603 Perform(this, args);\
1604 }\
1605 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1606 typename arg3_type, typename arg4_type, typename arg5_type, \
1607 typename arg6_type, typename arg7_type, typename arg8_type, \
1608 typename arg9_type>\
1609 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1610 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1611 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1612 arg9_type arg9) const;\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001613 p0##_type p0;\
1614 p1##_type p1;\
1615 p2##_type p2;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001616 private:\
1617 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
shiqian326aa562009-01-09 21:43:57 +00001618 };\
1619 template <typename F> operator ::testing::Action<F>() const {\
1620 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
1621 }\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001622 p0##_type p0;\
1623 p1##_type p1;\
1624 p2##_type p2;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001625 private:\
1626 GTEST_DISALLOW_ASSIGN_(name##ActionP3);\
shiqian326aa562009-01-09 21:43:57 +00001627 };\
1628 template <typename p0##_type, typename p1##_type, typename p2##_type>\
1629 inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
1630 p1##_type p1, p2##_type p2) {\
1631 return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
1632 }\
1633 template <typename p0##_type, typename p1##_type, typename p2##_type>\
1634 template <typename F>\
1635 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1636 typename arg3_type, typename arg4_type, typename arg5_type, \
1637 typename arg6_type, typename arg7_type, typename arg8_type, \
1638 typename arg9_type>\
1639 typename ::testing::internal::Function<F>::Result\
zhanyong.wan33c0af02009-04-03 00:10:12 +00001640 name##ActionP3<p0##_type, p1##_type, \
1641 p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1642 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
shiqian326aa562009-01-09 21:43:57 +00001643
1644#define ACTION_P4(name, p0, p1, p2, p3)\
1645 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1646 typename p3##_type>\
1647 class name##ActionP4 {\
1648 public:\
1649 name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001650 p2##_type gmock_p2, \
1651 p3##_type gmock_p3) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1652 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
1653 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
1654 p3(::testing::internal::forward<p3##_type>(gmock_p3)) {}\
shiqian326aa562009-01-09 21:43:57 +00001655 template <typename F>\
1656 class gmock_Impl : public ::testing::ActionInterface<F> {\
1657 public:\
1658 typedef F function_type;\
1659 typedef typename ::testing::internal::Function<F>::Result return_type;\
1660 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1661 args_type;\
1662 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001663 p3##_type gmock_p3) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1664 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
1665 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
1666 p3(::testing::internal::forward<p3##_type>(gmock_p3)) {}\
shiqian326aa562009-01-09 21:43:57 +00001667 virtual return_type Perform(const args_type& args) {\
1668 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1669 Perform(this, args);\
1670 }\
1671 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1672 typename arg3_type, typename arg4_type, typename arg5_type, \
1673 typename arg6_type, typename arg7_type, typename arg8_type, \
1674 typename arg9_type>\
1675 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1676 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1677 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1678 arg9_type arg9) const;\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001679 p0##_type p0;\
1680 p1##_type p1;\
1681 p2##_type p2;\
1682 p3##_type p3;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001683 private:\
1684 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
shiqian326aa562009-01-09 21:43:57 +00001685 };\
1686 template <typename F> operator ::testing::Action<F>() const {\
1687 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
1688 }\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001689 p0##_type p0;\
1690 p1##_type p1;\
1691 p2##_type p2;\
1692 p3##_type p3;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001693 private:\
1694 GTEST_DISALLOW_ASSIGN_(name##ActionP4);\
shiqian326aa562009-01-09 21:43:57 +00001695 };\
1696 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1697 typename p3##_type>\
1698 inline name##ActionP4<p0##_type, p1##_type, p2##_type, \
1699 p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
1700 p3##_type p3) {\
1701 return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \
1702 p2, p3);\
1703 }\
1704 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1705 typename p3##_type>\
1706 template <typename F>\
1707 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1708 typename arg3_type, typename arg4_type, typename arg5_type, \
1709 typename arg6_type, typename arg7_type, typename arg8_type, \
1710 typename arg9_type>\
1711 typename ::testing::internal::Function<F>::Result\
zhanyong.wan33c0af02009-04-03 00:10:12 +00001712 name##ActionP4<p0##_type, p1##_type, p2##_type, \
1713 p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1714 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
shiqian326aa562009-01-09 21:43:57 +00001715
1716#define ACTION_P5(name, p0, p1, p2, p3, p4)\
1717 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1718 typename p3##_type, typename p4##_type>\
1719 class name##ActionP5 {\
1720 public:\
1721 name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \
1722 p2##_type gmock_p2, p3##_type gmock_p3, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001723 p4##_type gmock_p4) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1724 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
1725 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
1726 p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
1727 p4(::testing::internal::forward<p4##_type>(gmock_p4)) {}\
shiqian326aa562009-01-09 21:43:57 +00001728 template <typename F>\
1729 class gmock_Impl : public ::testing::ActionInterface<F> {\
1730 public:\
1731 typedef F function_type;\
1732 typedef typename ::testing::internal::Function<F>::Result return_type;\
1733 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1734 args_type;\
1735 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001736 p3##_type gmock_p3, \
1737 p4##_type gmock_p4) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1738 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
1739 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
1740 p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
1741 p4(::testing::internal::forward<p4##_type>(gmock_p4)) {}\
shiqian326aa562009-01-09 21:43:57 +00001742 virtual return_type Perform(const args_type& args) {\
1743 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1744 Perform(this, args);\
1745 }\
1746 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1747 typename arg3_type, typename arg4_type, typename arg5_type, \
1748 typename arg6_type, typename arg7_type, typename arg8_type, \
1749 typename arg9_type>\
1750 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1751 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1752 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1753 arg9_type arg9) const;\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001754 p0##_type p0;\
1755 p1##_type p1;\
1756 p2##_type p2;\
1757 p3##_type p3;\
1758 p4##_type p4;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001759 private:\
1760 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
shiqian326aa562009-01-09 21:43:57 +00001761 };\
1762 template <typename F> operator ::testing::Action<F>() const {\
1763 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\
1764 }\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001765 p0##_type p0;\
1766 p1##_type p1;\
1767 p2##_type p2;\
1768 p3##_type p3;\
1769 p4##_type p4;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001770 private:\
1771 GTEST_DISALLOW_ASSIGN_(name##ActionP5);\
shiqian326aa562009-01-09 21:43:57 +00001772 };\
1773 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1774 typename p3##_type, typename p4##_type>\
1775 inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1776 p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
1777 p4##_type p4) {\
1778 return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1779 p4##_type>(p0, p1, p2, p3, p4);\
1780 }\
1781 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1782 typename p3##_type, typename p4##_type>\
1783 template <typename F>\
1784 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1785 typename arg3_type, typename arg4_type, typename arg5_type, \
1786 typename arg6_type, typename arg7_type, typename arg8_type, \
1787 typename arg9_type>\
1788 typename ::testing::internal::Function<F>::Result\
zhanyong.wan33c0af02009-04-03 00:10:12 +00001789 name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
1790 p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1791 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
shiqian326aa562009-01-09 21:43:57 +00001792
1793#define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\
1794 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1795 typename p3##_type, typename p4##_type, typename p5##_type>\
1796 class name##ActionP6 {\
1797 public:\
1798 name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \
1799 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001800 p5##_type gmock_p5) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1801 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
1802 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
1803 p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
1804 p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
1805 p5(::testing::internal::forward<p5##_type>(gmock_p5)) {}\
shiqian326aa562009-01-09 21:43:57 +00001806 template <typename F>\
1807 class gmock_Impl : public ::testing::ActionInterface<F> {\
1808 public:\
1809 typedef F function_type;\
1810 typedef typename ::testing::internal::Function<F>::Result return_type;\
1811 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1812 args_type;\
1813 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1814 p3##_type gmock_p3, p4##_type gmock_p4, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001815 p5##_type gmock_p5) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1816 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
1817 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
1818 p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
1819 p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
1820 p5(::testing::internal::forward<p5##_type>(gmock_p5)) {}\
shiqian326aa562009-01-09 21:43:57 +00001821 virtual return_type Perform(const args_type& args) {\
1822 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1823 Perform(this, args);\
1824 }\
1825 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1826 typename arg3_type, typename arg4_type, typename arg5_type, \
1827 typename arg6_type, typename arg7_type, typename arg8_type, \
1828 typename arg9_type>\
1829 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1830 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1831 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1832 arg9_type arg9) const;\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001833 p0##_type p0;\
1834 p1##_type p1;\
1835 p2##_type p2;\
1836 p3##_type p3;\
1837 p4##_type p4;\
1838 p5##_type p5;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001839 private:\
1840 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
shiqian326aa562009-01-09 21:43:57 +00001841 };\
1842 template <typename F> operator ::testing::Action<F>() const {\
1843 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\
1844 }\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001845 p0##_type p0;\
1846 p1##_type p1;\
1847 p2##_type p2;\
1848 p3##_type p3;\
1849 p4##_type p4;\
1850 p5##_type p5;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001851 private:\
1852 GTEST_DISALLOW_ASSIGN_(name##ActionP6);\
shiqian326aa562009-01-09 21:43:57 +00001853 };\
1854 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1855 typename p3##_type, typename p4##_type, typename p5##_type>\
1856 inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
1857 p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
1858 p3##_type p3, p4##_type p4, p5##_type p5) {\
1859 return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
1860 p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
1861 }\
1862 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1863 typename p3##_type, typename p4##_type, typename p5##_type>\
1864 template <typename F>\
1865 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1866 typename arg3_type, typename arg4_type, typename arg5_type, \
1867 typename arg6_type, typename arg7_type, typename arg8_type, \
1868 typename arg9_type>\
1869 typename ::testing::internal::Function<F>::Result\
1870 name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
zhanyong.wan33c0af02009-04-03 00:10:12 +00001871 p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1872 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
shiqian326aa562009-01-09 21:43:57 +00001873
1874#define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\
1875 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1876 typename p3##_type, typename p4##_type, typename p5##_type, \
1877 typename p6##_type>\
1878 class name##ActionP7 {\
1879 public:\
1880 name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \
1881 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001882 p5##_type gmock_p5, \
1883 p6##_type gmock_p6) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1884 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
1885 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
1886 p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
1887 p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
1888 p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
1889 p6(::testing::internal::forward<p6##_type>(gmock_p6)) {}\
shiqian326aa562009-01-09 21:43:57 +00001890 template <typename F>\
1891 class gmock_Impl : public ::testing::ActionInterface<F> {\
1892 public:\
1893 typedef F function_type;\
1894 typedef typename ::testing::internal::Function<F>::Result return_type;\
1895 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1896 args_type;\
1897 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1898 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001899 p6##_type gmock_p6) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1900 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
1901 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
1902 p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
1903 p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
1904 p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
1905 p6(::testing::internal::forward<p6##_type>(gmock_p6)) {}\
shiqian326aa562009-01-09 21:43:57 +00001906 virtual return_type Perform(const args_type& args) {\
1907 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
1908 Perform(this, args);\
1909 }\
1910 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1911 typename arg3_type, typename arg4_type, typename arg5_type, \
1912 typename arg6_type, typename arg7_type, typename arg8_type, \
1913 typename arg9_type>\
1914 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
1915 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
1916 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
1917 arg9_type arg9) const;\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001918 p0##_type p0;\
1919 p1##_type p1;\
1920 p2##_type p2;\
1921 p3##_type p3;\
1922 p4##_type p4;\
1923 p5##_type p5;\
1924 p6##_type p6;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001925 private:\
1926 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
shiqian326aa562009-01-09 21:43:57 +00001927 };\
1928 template <typename F> operator ::testing::Action<F>() const {\
1929 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
1930 p6));\
1931 }\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00001932 p0##_type p0;\
1933 p1##_type p1;\
1934 p2##_type p2;\
1935 p3##_type p3;\
1936 p4##_type p4;\
1937 p5##_type p5;\
1938 p6##_type p6;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00001939 private:\
1940 GTEST_DISALLOW_ASSIGN_(name##ActionP7);\
shiqian326aa562009-01-09 21:43:57 +00001941 };\
1942 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1943 typename p3##_type, typename p4##_type, typename p5##_type, \
1944 typename p6##_type>\
1945 inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
1946 p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
1947 p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
1948 p6##_type p6) {\
1949 return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
1950 p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
1951 }\
1952 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1953 typename p3##_type, typename p4##_type, typename p5##_type, \
1954 typename p6##_type>\
1955 template <typename F>\
1956 template <typename arg0_type, typename arg1_type, typename arg2_type, \
1957 typename arg3_type, typename arg4_type, typename arg5_type, \
1958 typename arg6_type, typename arg7_type, typename arg8_type, \
1959 typename arg9_type>\
1960 typename ::testing::internal::Function<F>::Result\
1961 name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
zhanyong.wan33c0af02009-04-03 00:10:12 +00001962 p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\
1963 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
shiqian326aa562009-01-09 21:43:57 +00001964
1965#define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\
1966 template <typename p0##_type, typename p1##_type, typename p2##_type, \
1967 typename p3##_type, typename p4##_type, typename p5##_type, \
1968 typename p6##_type, typename p7##_type>\
1969 class name##ActionP8 {\
1970 public:\
1971 name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \
1972 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
1973 p5##_type gmock_p5, p6##_type gmock_p6, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001974 p7##_type gmock_p7) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1975 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
1976 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
1977 p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
1978 p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
1979 p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
1980 p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
1981 p7(::testing::internal::forward<p7##_type>(gmock_p7)) {}\
shiqian326aa562009-01-09 21:43:57 +00001982 template <typename F>\
1983 class gmock_Impl : public ::testing::ActionInterface<F> {\
1984 public:\
1985 typedef F function_type;\
1986 typedef typename ::testing::internal::Function<F>::Result return_type;\
1987 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
1988 args_type;\
1989 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
1990 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04001991 p6##_type gmock_p6, \
1992 p7##_type gmock_p7) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
1993 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
1994 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
1995 p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
1996 p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
1997 p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
1998 p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
1999 p7(::testing::internal::forward<p7##_type>(gmock_p7)) {}\
shiqian326aa562009-01-09 21:43:57 +00002000 virtual return_type Perform(const args_type& args) {\
2001 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
2002 Perform(this, args);\
2003 }\
2004 template <typename arg0_type, typename arg1_type, typename arg2_type, \
2005 typename arg3_type, typename arg4_type, typename arg5_type, \
2006 typename arg6_type, typename arg7_type, typename arg8_type, \
2007 typename arg9_type>\
2008 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
2009 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
2010 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
2011 arg9_type arg9) const;\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00002012 p0##_type p0;\
2013 p1##_type p1;\
2014 p2##_type p2;\
2015 p3##_type p3;\
2016 p4##_type p4;\
2017 p5##_type p5;\
2018 p6##_type p6;\
2019 p7##_type p7;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00002020 private:\
2021 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
shiqian326aa562009-01-09 21:43:57 +00002022 };\
2023 template <typename F> operator ::testing::Action<F>() const {\
2024 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
2025 p6, p7));\
2026 }\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00002027 p0##_type p0;\
2028 p1##_type p1;\
2029 p2##_type p2;\
2030 p3##_type p3;\
2031 p4##_type p4;\
2032 p5##_type p5;\
2033 p6##_type p6;\
2034 p7##_type p7;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00002035 private:\
2036 GTEST_DISALLOW_ASSIGN_(name##ActionP8);\
shiqian326aa562009-01-09 21:43:57 +00002037 };\
2038 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2039 typename p3##_type, typename p4##_type, typename p5##_type, \
2040 typename p6##_type, typename p7##_type>\
2041 inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
2042 p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
2043 p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
2044 p6##_type p6, p7##_type p7) {\
2045 return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
2046 p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
2047 p6, p7);\
2048 }\
2049 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2050 typename p3##_type, typename p4##_type, typename p5##_type, \
2051 typename p6##_type, typename p7##_type>\
2052 template <typename F>\
2053 template <typename arg0_type, typename arg1_type, typename arg2_type, \
2054 typename arg3_type, typename arg4_type, typename arg5_type, \
2055 typename arg6_type, typename arg7_type, typename arg8_type, \
2056 typename arg9_type>\
2057 typename ::testing::internal::Function<F>::Result\
2058 name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
zhanyong.wan33c0af02009-04-03 00:10:12 +00002059 p5##_type, p6##_type, \
2060 p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\
2061 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
shiqian326aa562009-01-09 21:43:57 +00002062
2063#define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\
2064 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2065 typename p3##_type, typename p4##_type, typename p5##_type, \
2066 typename p6##_type, typename p7##_type, typename p8##_type>\
2067 class name##ActionP9 {\
2068 public:\
2069 name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \
2070 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
2071 p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04002072 p8##_type gmock_p8) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
2073 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
2074 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
2075 p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
2076 p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
2077 p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
2078 p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
2079 p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
2080 p8(::testing::internal::forward<p8##_type>(gmock_p8)) {}\
shiqian326aa562009-01-09 21:43:57 +00002081 template <typename F>\
2082 class gmock_Impl : public ::testing::ActionInterface<F> {\
2083 public:\
2084 typedef F function_type;\
2085 typedef typename ::testing::internal::Function<F>::Result return_type;\
2086 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
2087 args_type;\
2088 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
2089 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
2090 p6##_type gmock_p6, p7##_type gmock_p7, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04002091 p8##_type gmock_p8) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
2092 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
2093 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
2094 p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
2095 p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
2096 p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
2097 p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
2098 p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
2099 p8(::testing::internal::forward<p8##_type>(gmock_p8)) {}\
shiqian326aa562009-01-09 21:43:57 +00002100 virtual return_type Perform(const args_type& args) {\
2101 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
2102 Perform(this, args);\
2103 }\
2104 template <typename arg0_type, typename arg1_type, typename arg2_type, \
2105 typename arg3_type, typename arg4_type, typename arg5_type, \
2106 typename arg6_type, typename arg7_type, typename arg8_type, \
2107 typename arg9_type>\
2108 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
2109 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
2110 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
2111 arg9_type arg9) const;\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00002112 p0##_type p0;\
2113 p1##_type p1;\
2114 p2##_type p2;\
2115 p3##_type p3;\
2116 p4##_type p4;\
2117 p5##_type p5;\
2118 p6##_type p6;\
2119 p7##_type p7;\
2120 p8##_type p8;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00002121 private:\
2122 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
shiqian326aa562009-01-09 21:43:57 +00002123 };\
2124 template <typename F> operator ::testing::Action<F>() const {\
2125 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
2126 p6, p7, p8));\
2127 }\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00002128 p0##_type p0;\
2129 p1##_type p1;\
2130 p2##_type p2;\
2131 p3##_type p3;\
2132 p4##_type p4;\
2133 p5##_type p5;\
2134 p6##_type p6;\
2135 p7##_type p7;\
2136 p8##_type p8;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00002137 private:\
2138 GTEST_DISALLOW_ASSIGN_(name##ActionP9);\
shiqian326aa562009-01-09 21:43:57 +00002139 };\
2140 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2141 typename p3##_type, typename p4##_type, typename p5##_type, \
2142 typename p6##_type, typename p7##_type, typename p8##_type>\
2143 inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
2144 p4##_type, p5##_type, p6##_type, p7##_type, \
2145 p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
2146 p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
2147 p8##_type p8) {\
2148 return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
2149 p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
2150 p3, p4, p5, p6, p7, p8);\
2151 }\
2152 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2153 typename p3##_type, typename p4##_type, typename p5##_type, \
2154 typename p6##_type, typename p7##_type, typename p8##_type>\
2155 template <typename F>\
2156 template <typename arg0_type, typename arg1_type, typename arg2_type, \
2157 typename arg3_type, typename arg4_type, typename arg5_type, \
2158 typename arg6_type, typename arg7_type, typename arg8_type, \
2159 typename arg9_type>\
2160 typename ::testing::internal::Function<F>::Result\
2161 name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
zhanyong.wan33c0af02009-04-03 00:10:12 +00002162 p5##_type, p6##_type, p7##_type, \
2163 p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\
2164 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
shiqian326aa562009-01-09 21:43:57 +00002165
2166#define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\
2167 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2168 typename p3##_type, typename p4##_type, typename p5##_type, \
2169 typename p6##_type, typename p7##_type, typename p8##_type, \
2170 typename p9##_type>\
2171 class name##ActionP10 {\
2172 public:\
2173 name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \
2174 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
2175 p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04002176 p8##_type gmock_p8, \
2177 p9##_type gmock_p9) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
2178 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
2179 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
2180 p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
2181 p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
2182 p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
2183 p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
2184 p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
2185 p8(::testing::internal::forward<p8##_type>(gmock_p8)), \
2186 p9(::testing::internal::forward<p9##_type>(gmock_p9)) {}\
shiqian326aa562009-01-09 21:43:57 +00002187 template <typename F>\
2188 class gmock_Impl : public ::testing::ActionInterface<F> {\
2189 public:\
2190 typedef F function_type;\
2191 typedef typename ::testing::internal::Function<F>::Result return_type;\
2192 typedef typename ::testing::internal::Function<F>::ArgumentTuple\
2193 args_type;\
2194 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
2195 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
2196 p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
Gennadiy Civile1071eb2018-04-10 15:57:16 -04002197 p9##_type gmock_p9) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
2198 p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
2199 p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
2200 p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
2201 p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
2202 p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
2203 p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
2204 p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
2205 p8(::testing::internal::forward<p8##_type>(gmock_p8)), \
2206 p9(::testing::internal::forward<p9##_type>(gmock_p9)) {}\
shiqian326aa562009-01-09 21:43:57 +00002207 virtual return_type Perform(const args_type& args) {\
2208 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
2209 Perform(this, args);\
2210 }\
2211 template <typename arg0_type, typename arg1_type, typename arg2_type, \
2212 typename arg3_type, typename arg4_type, typename arg5_type, \
2213 typename arg6_type, typename arg7_type, typename arg8_type, \
2214 typename arg9_type>\
2215 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
2216 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
2217 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
2218 arg9_type arg9) const;\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00002219 p0##_type p0;\
2220 p1##_type p1;\
2221 p2##_type p2;\
2222 p3##_type p3;\
2223 p4##_type p4;\
2224 p5##_type p5;\
2225 p6##_type p6;\
2226 p7##_type p7;\
2227 p8##_type p8;\
2228 p9##_type p9;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00002229 private:\
2230 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
shiqian326aa562009-01-09 21:43:57 +00002231 };\
2232 template <typename F> operator ::testing::Action<F>() const {\
2233 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
2234 p6, p7, p8, p9));\
2235 }\
zhanyong.wanc069d7f2009-02-02 20:51:53 +00002236 p0##_type p0;\
2237 p1##_type p1;\
2238 p2##_type p2;\
2239 p3##_type p3;\
2240 p4##_type p4;\
2241 p5##_type p5;\
2242 p6##_type p6;\
2243 p7##_type p7;\
2244 p8##_type p8;\
2245 p9##_type p9;\
zhanyong.wan32de5f52009-12-23 00:13:23 +00002246 private:\
2247 GTEST_DISALLOW_ASSIGN_(name##ActionP10);\
shiqian326aa562009-01-09 21:43:57 +00002248 };\
2249 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2250 typename p3##_type, typename p4##_type, typename p5##_type, \
2251 typename p6##_type, typename p7##_type, typename p8##_type, \
2252 typename p9##_type>\
2253 inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
2254 p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
2255 p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
2256 p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
2257 p9##_type p9) {\
2258 return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
2259 p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
2260 p1, p2, p3, p4, p5, p6, p7, p8, p9);\
2261 }\
2262 template <typename p0##_type, typename p1##_type, typename p2##_type, \
2263 typename p3##_type, typename p4##_type, typename p5##_type, \
2264 typename p6##_type, typename p7##_type, typename p8##_type, \
2265 typename p9##_type>\
2266 template <typename F>\
2267 template <typename arg0_type, typename arg1_type, typename arg2_type, \
2268 typename arg3_type, typename arg4_type, typename arg5_type, \
2269 typename arg6_type, typename arg7_type, typename arg8_type, \
2270 typename arg9_type>\
2271 typename ::testing::internal::Function<F>::Result\
2272 name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
zhanyong.wan33c0af02009-04-03 00:10:12 +00002273 p5##_type, p6##_type, p7##_type, p8##_type, \
2274 p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\
2275 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
shiqian326aa562009-01-09 21:43:57 +00002276
zhanyong.wane1cdce52009-02-06 01:09:43 +00002277namespace testing {
2278
kosak67c377d2015-07-19 20:39:47 +00002279
zhanyong.wan32de5f52009-12-23 00:13:23 +00002280// The ACTION*() macros trigger warning C4100 (unreferenced formal
2281// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
2282// the macro definition, as the warnings are generated when the macro
2283// is expanded and macro expansion cannot contain #pragma. Therefore
2284// we suppress them here.
2285#ifdef _MSC_VER
zhanyong.wan658ac0b2011-02-24 07:29:13 +00002286# pragma warning(push)
2287# pragma warning(disable:4100)
zhanyong.wan32de5f52009-12-23 00:13:23 +00002288#endif
2289
zhanyong.wan16cf4732009-05-14 20:55:30 +00002290// Various overloads for InvokeArgument<N>().
2291//
2292// The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
2293// (0-based) argument, which must be a k-ary callable, of the mock
2294// function, with arguments a1, a2, ..., a_k.
2295//
2296// Notes:
2297//
2298// 1. The arguments are passed by value by default. If you need to
2299// pass an argument by reference, wrap it inside ByRef(). For
2300// example,
2301//
2302// InvokeArgument<1>(5, string("Hello"), ByRef(foo))
2303//
2304// passes 5 and string("Hello") by value, and passes foo by
2305// reference.
2306//
2307// 2. If the callable takes an argument by reference but ByRef() is
2308// not used, it will receive the reference to a copy of the value,
2309// instead of the original value. For example, when the 0-th
2310// argument of the mock function takes a const string&, the action
2311//
2312// InvokeArgument<0>(string("Hello"))
2313//
2314// makes a copy of the temporary string("Hello") object and passes a
2315// reference of the copy, instead of the original temporary object,
2316// to the callable. This makes it easy for a user to define an
2317// InvokeArgument action from temporary values and have it performed
2318// later.
zhanyong.wan7f4c2c02009-02-19 22:38:27 +00002319
kosak67c377d2015-07-19 20:39:47 +00002320namespace internal {
2321namespace invoke_argument {
2322
2323// Appears in InvokeArgumentAdl's argument list to help avoid
2324// accidental calls to user functions of the same name.
2325struct AdlTag {};
2326
2327// InvokeArgumentAdl - a helper for InvokeArgument.
2328// The basic overloads are provided here for generic functors.
2329// Overloads for other custom-callables are provided in the
2330// internal/custom/callback-actions.h header.
2331
2332template <typename R, typename F>
2333R InvokeArgumentAdl(AdlTag, F f) {
2334 return f();
2335}
2336template <typename R, typename F, typename A1>
2337R InvokeArgumentAdl(AdlTag, F f, A1 a1) {
2338 return f(a1);
2339}
2340template <typename R, typename F, typename A1, typename A2>
2341R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2) {
2342 return f(a1, a2);
2343}
2344template <typename R, typename F, typename A1, typename A2, typename A3>
2345R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3) {
2346 return f(a1, a2, a3);
2347}
2348template <typename R, typename F, typename A1, typename A2, typename A3,
2349 typename A4>
2350R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4) {
2351 return f(a1, a2, a3, a4);
2352}
2353template <typename R, typename F, typename A1, typename A2, typename A3,
2354 typename A4, typename A5>
2355R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
2356 return f(a1, a2, a3, a4, a5);
2357}
2358template <typename R, typename F, typename A1, typename A2, typename A3,
2359 typename A4, typename A5, typename A6>
2360R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
2361 return f(a1, a2, a3, a4, a5, a6);
2362}
2363template <typename R, typename F, typename A1, typename A2, typename A3,
2364 typename A4, typename A5, typename A6, typename A7>
2365R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
2366 A7 a7) {
2367 return f(a1, a2, a3, a4, a5, a6, a7);
2368}
2369template <typename R, typename F, typename A1, typename A2, typename A3,
2370 typename A4, typename A5, typename A6, typename A7, typename A8>
2371R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
2372 A7 a7, A8 a8) {
2373 return f(a1, a2, a3, a4, a5, a6, a7, a8);
2374}
2375template <typename R, typename F, typename A1, typename A2, typename A3,
2376 typename A4, typename A5, typename A6, typename A7, typename A8,
2377 typename A9>
2378R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
2379 A7 a7, A8 a8, A9 a9) {
2380 return f(a1, a2, a3, a4, a5, a6, a7, a8, a9);
2381}
2382template <typename R, typename F, typename A1, typename A2, typename A3,
2383 typename A4, typename A5, typename A6, typename A7, typename A8,
2384 typename A9, typename A10>
2385R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
2386 A7 a7, A8 a8, A9 a9, A10 a10) {
2387 return f(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
2388}
2389} // namespace invoke_argument
2390} // namespace internal
2391
zhanyong.wan16cf4732009-05-14 20:55:30 +00002392ACTION_TEMPLATE(InvokeArgument,
2393 HAS_1_TEMPLATE_PARAMS(int, k),
2394 AND_0_VALUE_PARAMS()) {
kosak67c377d2015-07-19 20:39:47 +00002395 using internal::invoke_argument::InvokeArgumentAdl;
2396 return InvokeArgumentAdl<return_type>(
2397 internal::invoke_argument::AdlTag(),
kosakbd018832014-04-02 20:30:00 +00002398 ::testing::get<k>(args));
zhanyong.wan7f4c2c02009-02-19 22:38:27 +00002399}
2400
zhanyong.wan16cf4732009-05-14 20:55:30 +00002401ACTION_TEMPLATE(InvokeArgument,
2402 HAS_1_TEMPLATE_PARAMS(int, k),
2403 AND_1_VALUE_PARAMS(p0)) {
kosak67c377d2015-07-19 20:39:47 +00002404 using internal::invoke_argument::InvokeArgumentAdl;
2405 return InvokeArgumentAdl<return_type>(
2406 internal::invoke_argument::AdlTag(),
kosakbd018832014-04-02 20:30:00 +00002407 ::testing::get<k>(args), p0);
zhanyong.wan16cf4732009-05-14 20:55:30 +00002408}
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002409
zhanyong.wan16cf4732009-05-14 20:55:30 +00002410ACTION_TEMPLATE(InvokeArgument,
2411 HAS_1_TEMPLATE_PARAMS(int, k),
2412 AND_2_VALUE_PARAMS(p0, p1)) {
kosak67c377d2015-07-19 20:39:47 +00002413 using internal::invoke_argument::InvokeArgumentAdl;
2414 return InvokeArgumentAdl<return_type>(
2415 internal::invoke_argument::AdlTag(),
kosakbd018832014-04-02 20:30:00 +00002416 ::testing::get<k>(args), p0, p1);
zhanyong.wan16cf4732009-05-14 20:55:30 +00002417}
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002418
zhanyong.wan16cf4732009-05-14 20:55:30 +00002419ACTION_TEMPLATE(InvokeArgument,
2420 HAS_1_TEMPLATE_PARAMS(int, k),
2421 AND_3_VALUE_PARAMS(p0, p1, p2)) {
kosak67c377d2015-07-19 20:39:47 +00002422 using internal::invoke_argument::InvokeArgumentAdl;
2423 return InvokeArgumentAdl<return_type>(
2424 internal::invoke_argument::AdlTag(),
kosakbd018832014-04-02 20:30:00 +00002425 ::testing::get<k>(args), p0, p1, p2);
zhanyong.wan16cf4732009-05-14 20:55:30 +00002426}
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002427
zhanyong.wan16cf4732009-05-14 20:55:30 +00002428ACTION_TEMPLATE(InvokeArgument,
2429 HAS_1_TEMPLATE_PARAMS(int, k),
2430 AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
kosak67c377d2015-07-19 20:39:47 +00002431 using internal::invoke_argument::InvokeArgumentAdl;
2432 return InvokeArgumentAdl<return_type>(
2433 internal::invoke_argument::AdlTag(),
kosakbd018832014-04-02 20:30:00 +00002434 ::testing::get<k>(args), p0, p1, p2, p3);
zhanyong.wan16cf4732009-05-14 20:55:30 +00002435}
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002436
zhanyong.wan16cf4732009-05-14 20:55:30 +00002437ACTION_TEMPLATE(InvokeArgument,
2438 HAS_1_TEMPLATE_PARAMS(int, k),
2439 AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
kosak67c377d2015-07-19 20:39:47 +00002440 using internal::invoke_argument::InvokeArgumentAdl;
2441 return InvokeArgumentAdl<return_type>(
2442 internal::invoke_argument::AdlTag(),
kosakbd018832014-04-02 20:30:00 +00002443 ::testing::get<k>(args), p0, p1, p2, p3, p4);
zhanyong.wan16cf4732009-05-14 20:55:30 +00002444}
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002445
zhanyong.wan16cf4732009-05-14 20:55:30 +00002446ACTION_TEMPLATE(InvokeArgument,
2447 HAS_1_TEMPLATE_PARAMS(int, k),
2448 AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
kosak67c377d2015-07-19 20:39:47 +00002449 using internal::invoke_argument::InvokeArgumentAdl;
2450 return InvokeArgumentAdl<return_type>(
2451 internal::invoke_argument::AdlTag(),
kosakbd018832014-04-02 20:30:00 +00002452 ::testing::get<k>(args), p0, p1, p2, p3, p4, p5);
zhanyong.wan16cf4732009-05-14 20:55:30 +00002453}
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002454
zhanyong.wan16cf4732009-05-14 20:55:30 +00002455ACTION_TEMPLATE(InvokeArgument,
2456 HAS_1_TEMPLATE_PARAMS(int, k),
2457 AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
kosak67c377d2015-07-19 20:39:47 +00002458 using internal::invoke_argument::InvokeArgumentAdl;
2459 return InvokeArgumentAdl<return_type>(
2460 internal::invoke_argument::AdlTag(),
kosakbd018832014-04-02 20:30:00 +00002461 ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6);
zhanyong.wan16cf4732009-05-14 20:55:30 +00002462}
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002463
zhanyong.wan16cf4732009-05-14 20:55:30 +00002464ACTION_TEMPLATE(InvokeArgument,
2465 HAS_1_TEMPLATE_PARAMS(int, k),
2466 AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
kosak67c377d2015-07-19 20:39:47 +00002467 using internal::invoke_argument::InvokeArgumentAdl;
2468 return InvokeArgumentAdl<return_type>(
2469 internal::invoke_argument::AdlTag(),
kosakbd018832014-04-02 20:30:00 +00002470 ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7);
zhanyong.wan16cf4732009-05-14 20:55:30 +00002471}
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002472
zhanyong.wan16cf4732009-05-14 20:55:30 +00002473ACTION_TEMPLATE(InvokeArgument,
2474 HAS_1_TEMPLATE_PARAMS(int, k),
2475 AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
kosak67c377d2015-07-19 20:39:47 +00002476 using internal::invoke_argument::InvokeArgumentAdl;
2477 return InvokeArgumentAdl<return_type>(
2478 internal::invoke_argument::AdlTag(),
kosakbd018832014-04-02 20:30:00 +00002479 ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8);
zhanyong.wan16cf4732009-05-14 20:55:30 +00002480}
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002481
zhanyong.wan16cf4732009-05-14 20:55:30 +00002482ACTION_TEMPLATE(InvokeArgument,
2483 HAS_1_TEMPLATE_PARAMS(int, k),
2484 AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
kosak67c377d2015-07-19 20:39:47 +00002485 using internal::invoke_argument::InvokeArgumentAdl;
2486 return InvokeArgumentAdl<return_type>(
2487 internal::invoke_argument::AdlTag(),
kosakbd018832014-04-02 20:30:00 +00002488 ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
zhanyong.wan16cf4732009-05-14 20:55:30 +00002489}
zhanyong.wan7f4c2c02009-02-19 22:38:27 +00002490
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002491// Various overloads for ReturnNew<T>().
2492//
2493// The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new
2494// instance of type T, constructed on the heap with constructor arguments
2495// a1, a2, ..., and a_k. The caller assumes ownership of the returned value.
zhanyong.wan16cf4732009-05-14 20:55:30 +00002496ACTION_TEMPLATE(ReturnNew,
2497 HAS_1_TEMPLATE_PARAMS(typename, T),
2498 AND_0_VALUE_PARAMS()) {
2499 return new T();
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002500}
2501
zhanyong.wan16cf4732009-05-14 20:55:30 +00002502ACTION_TEMPLATE(ReturnNew,
2503 HAS_1_TEMPLATE_PARAMS(typename, T),
2504 AND_1_VALUE_PARAMS(p0)) {
2505 return new T(p0);
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002506}
2507
zhanyong.wan16cf4732009-05-14 20:55:30 +00002508ACTION_TEMPLATE(ReturnNew,
2509 HAS_1_TEMPLATE_PARAMS(typename, T),
2510 AND_2_VALUE_PARAMS(p0, p1)) {
2511 return new T(p0, p1);
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002512}
2513
zhanyong.wan16cf4732009-05-14 20:55:30 +00002514ACTION_TEMPLATE(ReturnNew,
2515 HAS_1_TEMPLATE_PARAMS(typename, T),
2516 AND_3_VALUE_PARAMS(p0, p1, p2)) {
2517 return new T(p0, p1, p2);
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002518}
2519
zhanyong.wan16cf4732009-05-14 20:55:30 +00002520ACTION_TEMPLATE(ReturnNew,
2521 HAS_1_TEMPLATE_PARAMS(typename, T),
2522 AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
2523 return new T(p0, p1, p2, p3);
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002524}
2525
zhanyong.wan16cf4732009-05-14 20:55:30 +00002526ACTION_TEMPLATE(ReturnNew,
2527 HAS_1_TEMPLATE_PARAMS(typename, T),
2528 AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
2529 return new T(p0, p1, p2, p3, p4);
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002530}
2531
zhanyong.wan16cf4732009-05-14 20:55:30 +00002532ACTION_TEMPLATE(ReturnNew,
2533 HAS_1_TEMPLATE_PARAMS(typename, T),
2534 AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
2535 return new T(p0, p1, p2, p3, p4, p5);
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002536}
2537
zhanyong.wan16cf4732009-05-14 20:55:30 +00002538ACTION_TEMPLATE(ReturnNew,
2539 HAS_1_TEMPLATE_PARAMS(typename, T),
2540 AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
2541 return new T(p0, p1, p2, p3, p4, p5, p6);
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002542}
2543
zhanyong.wan16cf4732009-05-14 20:55:30 +00002544ACTION_TEMPLATE(ReturnNew,
2545 HAS_1_TEMPLATE_PARAMS(typename, T),
2546 AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
2547 return new T(p0, p1, p2, p3, p4, p5, p6, p7);
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002548}
2549
zhanyong.wan16cf4732009-05-14 20:55:30 +00002550ACTION_TEMPLATE(ReturnNew,
2551 HAS_1_TEMPLATE_PARAMS(typename, T),
2552 AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
2553 return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8);
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002554}
2555
zhanyong.wan16cf4732009-05-14 20:55:30 +00002556ACTION_TEMPLATE(ReturnNew,
2557 HAS_1_TEMPLATE_PARAMS(typename, T),
2558 AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
2559 return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
zhanyong.wan1c8eb1c2009-04-09 07:29:58 +00002560}
2561
zhanyong.wan32de5f52009-12-23 00:13:23 +00002562#ifdef _MSC_VER
zhanyong.wan658ac0b2011-02-24 07:29:13 +00002563# pragma warning(pop)
zhanyong.wan32de5f52009-12-23 00:13:23 +00002564#endif
2565
zhanyong.wane1cdce52009-02-06 01:09:43 +00002566} // namespace testing
2567
Gennadiy Civile1071eb2018-04-10 15:57:16 -04002568// Include any custom callback actions added by the local installation.
kosak67c377d2015-07-19 20:39:47 +00002569// We must include this header at the end to make sure it can use the
2570// declarations from this file.
kosak6e108722015-07-28 00:53:13 +00002571#include "gmock/internal/custom/gmock-generated-actions.h"
kosak67c377d2015-07-19 20:39:47 +00002572
shiqiane35fdd92008-12-10 05:08:54 +00002573#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_