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