| OLD | NEW |
| (Empty) |
| 1 // This file was GENERATED by a script. DO NOT EDIT BY HAND!!! | |
| 2 | |
| 3 // Copyright 2007, Google Inc. | |
| 4 // All rights reserved. | |
| 5 // | |
| 6 // Redistribution and use in source and binary forms, with or without | |
| 7 // modification, are permitted provided that the following conditions are | |
| 8 // met: | |
| 9 // | |
| 10 // * Redistributions of source code must retain the above copyright | |
| 11 // notice, this list of conditions and the following disclaimer. | |
| 12 // * Redistributions in binary form must reproduce the above | |
| 13 // copyright notice, this list of conditions and the following disclaimer | |
| 14 // in the documentation and/or other materials provided with the | |
| 15 // distribution. | |
| 16 // * Neither the name of Google Inc. nor the names of its | |
| 17 // contributors may be used to endorse or promote products derived from | |
| 18 // this software without specific prior written permission. | |
| 19 // | |
| 20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 31 // | |
| 32 // Author: wan@google.com (Zhanyong Wan) | |
| 33 | |
| 34 // Google Mock - a framework for writing C++ mock classes. | |
| 35 // | |
| 36 // This file implements some commonly used variadic actions. | |
| 37 | |
| 38 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ | |
| 39 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ | |
| 40 | |
| 41 #include <gmock/gmock-actions.h> | |
| 42 #include <gmock/internal/gmock-port.h> | |
| 43 | |
| 44 namespace testing { | |
| 45 namespace internal { | |
| 46 | |
| 47 // InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary | |
| 48 // function or method with the unpacked values, where F is a function | |
| 49 // type that takes N arguments. | |
| 50 template <typename Result, typename ArgumentTuple> | |
| 51 class InvokeHelper; | |
| 52 | |
| 53 template <typename R> | |
| 54 class InvokeHelper<R, ::std::tr1::tuple<> > { | |
| 55 public: | |
| 56 template <typename Function> | |
| 57 static R Invoke(Function function, const ::std::tr1::tuple<>&) { | |
| 58 return function(); | |
| 59 } | |
| 60 | |
| 61 template <class Class, typename MethodPtr> | |
| 62 static R InvokeMethod(Class* obj_ptr, | |
| 63 MethodPtr method_ptr, | |
| 64 const ::std::tr1::tuple<>&) { | |
| 65 return (obj_ptr->*method_ptr)(); | |
| 66 } | |
| 67 }; | |
| 68 | |
| 69 template <typename R, typename A1> | |
| 70 class InvokeHelper<R, ::std::tr1::tuple<A1> > { | |
| 71 public: | |
| 72 template <typename Function> | |
| 73 static R Invoke(Function function, const ::std::tr1::tuple<A1>& args) { | |
| 74 using ::std::tr1::get; | |
| 75 return function(get<0>(args)); | |
| 76 } | |
| 77 | |
| 78 template <class Class, typename MethodPtr> | |
| 79 static R InvokeMethod(Class* obj_ptr, | |
| 80 MethodPtr method_ptr, | |
| 81 const ::std::tr1::tuple<A1>& args) { | |
| 82 using ::std::tr1::get; | |
| 83 return (obj_ptr->*method_ptr)(get<0>(args)); | |
| 84 } | |
| 85 }; | |
| 86 | |
| 87 template <typename R, typename A1, typename A2> | |
| 88 class InvokeHelper<R, ::std::tr1::tuple<A1, A2> > { | |
| 89 public: | |
| 90 template <typename Function> | |
| 91 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2>& args) { | |
| 92 using ::std::tr1::get; | |
| 93 return function(get<0>(args), get<1>(args)); | |
| 94 } | |
| 95 | |
| 96 template <class Class, typename MethodPtr> | |
| 97 static R InvokeMethod(Class* obj_ptr, | |
| 98 MethodPtr method_ptr, | |
| 99 const ::std::tr1::tuple<A1, A2>& args) { | |
| 100 using ::std::tr1::get; | |
| 101 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args)); | |
| 102 } | |
| 103 }; | |
| 104 | |
| 105 template <typename R, typename A1, typename A2, typename A3> | |
| 106 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3> > { | |
| 107 public: | |
| 108 template <typename Function> | |
| 109 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, | |
| 110 A3>& args) { | |
| 111 using ::std::tr1::get; | |
| 112 return function(get<0>(args), get<1>(args), get<2>(args)); | |
| 113 } | |
| 114 | |
| 115 template <class Class, typename MethodPtr> | |
| 116 static R InvokeMethod(Class* obj_ptr, | |
| 117 MethodPtr method_ptr, | |
| 118 const ::std::tr1::tuple<A1, A2, A3>& args) { | |
| 119 using ::std::tr1::get; | |
| 120 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args)); | |
| 121 } | |
| 122 }; | |
| 123 | |
| 124 template <typename R, typename A1, typename A2, typename A3, typename A4> | |
| 125 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4> > { | |
| 126 public: | |
| 127 template <typename Function> | |
| 128 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, | |
| 129 A4>& args) { | |
| 130 using ::std::tr1::get; | |
| 131 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args)); | |
| 132 } | |
| 133 | |
| 134 template <class Class, typename MethodPtr> | |
| 135 static R InvokeMethod(Class* obj_ptr, | |
| 136 MethodPtr method_ptr, | |
| 137 const ::std::tr1::tuple<A1, A2, A3, A4>& args) { | |
| 138 using ::std::tr1::get; | |
| 139 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), | |
| 140 get<3>(args)); | |
| 141 } | |
| 142 }; | |
| 143 | |
| 144 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
| 145 typename A5> | |
| 146 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5> > { | |
| 147 public: | |
| 148 template <typename Function> | |
| 149 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4, | |
| 150 A5>& args) { | |
| 151 using ::std::tr1::get; | |
| 152 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args), | |
| 153 get<4>(args)); | |
| 154 } | |
| 155 | |
| 156 template <class Class, typename MethodPtr> | |
| 157 static R InvokeMethod(Class* obj_ptr, | |
| 158 MethodPtr method_ptr, | |
| 159 const ::std::tr1::tuple<A1, A2, A3, A4, A5>& args) { | |
| 160 using ::std::tr1::get; | |
| 161 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), | |
| 162 get<3>(args), get<4>(args)); | |
| 163 } | |
| 164 }; | |
| 165 | |
| 166 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
| 167 typename A5, typename A6> | |
| 168 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6> > { | |
| 169 public: | |
| 170 template <typename Function> | |
| 171 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4, | |
| 172 A5, A6>& args) { | |
| 173 using ::std::tr1::get; | |
| 174 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args), | |
| 175 get<4>(args), get<5>(args)); | |
| 176 } | |
| 177 | |
| 178 template <class Class, typename MethodPtr> | |
| 179 static R InvokeMethod(Class* obj_ptr, | |
| 180 MethodPtr method_ptr, | |
| 181 const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6>& args) { | |
| 182 using ::std::tr1::get; | |
| 183 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), | |
| 184 get<3>(args), get<4>(args), get<5>(args)); | |
| 185 } | |
| 186 }; | |
| 187 | |
| 188 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
| 189 typename A5, typename A6, typename A7> | |
| 190 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7> > { | |
| 191 public: | |
| 192 template <typename Function> | |
| 193 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4, | |
| 194 A5, A6, A7>& args) { | |
| 195 using ::std::tr1::get; | |
| 196 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args), | |
| 197 get<4>(args), get<5>(args), get<6>(args)); | |
| 198 } | |
| 199 | |
| 200 template <class Class, typename MethodPtr> | |
| 201 static R InvokeMethod(Class* obj_ptr, | |
| 202 MethodPtr method_ptr, | |
| 203 const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, | |
| 204 A7>& args) { | |
| 205 using ::std::tr1::get; | |
| 206 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), | |
| 207 get<3>(args), get<4>(args), get<5>(args), get<6>(args)); | |
| 208 } | |
| 209 }; | |
| 210 | |
| 211 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
| 212 typename A5, typename A6, typename A7, typename A8> | |
| 213 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > { | |
| 214 public: | |
| 215 template <typename Function> | |
| 216 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4, | |
| 217 A5, A6, A7, A8>& args) { | |
| 218 using ::std::tr1::get; | |
| 219 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args), | |
| 220 get<4>(args), get<5>(args), get<6>(args), get<7>(args)); | |
| 221 } | |
| 222 | |
| 223 template <class Class, typename MethodPtr> | |
| 224 static R InvokeMethod(Class* obj_ptr, | |
| 225 MethodPtr method_ptr, | |
| 226 const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, | |
| 227 A8>& args) { | |
| 228 using ::std::tr1::get; | |
| 229 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), | |
| 230 get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args)); | |
| 231 } | |
| 232 }; | |
| 233 | |
| 234 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
| 235 typename A5, typename A6, typename A7, typename A8, typename A9> | |
| 236 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > { | |
| 237 public: | |
| 238 template <typename Function> | |
| 239 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4, | |
| 240 A5, A6, A7, A8, A9>& args) { | |
| 241 using ::std::tr1::get; | |
| 242 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args), | |
| 243 get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args)); | |
| 244 } | |
| 245 | |
| 246 template <class Class, typename MethodPtr> | |
| 247 static R InvokeMethod(Class* obj_ptr, | |
| 248 MethodPtr method_ptr, | |
| 249 const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, | |
| 250 A9>& args) { | |
| 251 using ::std::tr1::get; | |
| 252 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), | |
| 253 get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args), | |
| 254 get<8>(args)); | |
| 255 } | |
| 256 }; | |
| 257 | |
| 258 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
| 259 typename A5, typename A6, typename A7, typename A8, typename A9, | |
| 260 typename A10> | |
| 261 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9, | |
| 262 A10> > { | |
| 263 public: | |
| 264 template <typename Function> | |
| 265 static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4, | |
| 266 A5, A6, A7, A8, A9, A10>& args) { | |
| 267 using ::std::tr1::get; | |
| 268 return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args), | |
| 269 get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), | |
| 270 get<9>(args)); | |
| 271 } | |
| 272 | |
| 273 template <class Class, typename MethodPtr> | |
| 274 static R InvokeMethod(Class* obj_ptr, | |
| 275 MethodPtr method_ptr, | |
| 276 const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, | |
| 277 A9, A10>& args) { | |
| 278 using ::std::tr1::get; | |
| 279 return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), | |
| 280 get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args), | |
| 281 get<8>(args), get<9>(args)); | |
| 282 } | |
| 283 }; | |
| 284 | |
| 285 // CallableHelper has static methods for invoking "callables", | |
| 286 // i.e. function pointers and functors. It uses overloading to | |
| 287 // provide a uniform interface for invoking different kinds of | |
| 288 // callables. In particular, you can use: | |
| 289 // | |
| 290 // CallableHelper<R>::Call(callable, a1, a2, ..., an) | |
| 291 // | |
| 292 // to invoke an n-ary callable, where R is its return type. If an | |
| 293 // argument, say a2, needs to be passed by reference, you should write | |
| 294 // ByRef(a2) instead of a2 in the above expression. | |
| 295 template <typename R> | |
| 296 class CallableHelper { | |
| 297 public: | |
| 298 // Calls a nullary callable. | |
| 299 template <typename Function> | |
| 300 static R Call(Function function) { return function(); } | |
| 301 | |
| 302 // Calls a unary callable. | |
| 303 | |
| 304 // We deliberately pass a1 by value instead of const reference here | |
| 305 // in case it is a C-string literal. If we had declared the | |
| 306 // parameter as 'const A1& a1' and write Call(function, "Hi"), the | |
| 307 // compiler would've thought A1 is 'char[3]', which causes trouble | |
| 308 // when you need to copy a value of type A1. By declaring the | |
| 309 // parameter as 'A1 a1', the compiler will correctly infer that A1 | |
| 310 // is 'const char*' when it sees Call(function, "Hi"). | |
| 311 // | |
| 312 // Since this function is defined inline, the compiler can get rid | |
| 313 // of the copying of the arguments. Therefore the performance won't | |
| 314 // be hurt. | |
| 315 template <typename Function, typename A1> | |
| 316 static R Call(Function function, A1 a1) { return function(a1); } | |
| 317 | |
| 318 // Calls a binary callable. | |
| 319 template <typename Function, typename A1, typename A2> | |
| 320 static R Call(Function function, A1 a1, A2 a2) { | |
| 321 return function(a1, a2); | |
| 322 } | |
| 323 | |
| 324 // Calls a ternary callable. | |
| 325 template <typename Function, typename A1, typename A2, typename A3> | |
| 326 static R Call(Function function, A1 a1, A2 a2, A3 a3) { | |
| 327 return function(a1, a2, a3); | |
| 328 } | |
| 329 | |
| 330 // Calls a 4-ary callable. | |
| 331 template <typename Function, typename A1, typename A2, typename A3, | |
| 332 typename A4> | |
| 333 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4) { | |
| 334 return function(a1, a2, a3, a4); | |
| 335 } | |
| 336 | |
| 337 // Calls a 5-ary callable. | |
| 338 template <typename Function, typename A1, typename A2, typename A3, | |
| 339 typename A4, typename A5> | |
| 340 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { | |
| 341 return function(a1, a2, a3, a4, a5); | |
| 342 } | |
| 343 | |
| 344 // Calls a 6-ary callable. | |
| 345 template <typename Function, typename A1, typename A2, typename A3, | |
| 346 typename A4, typename A5, typename A6> | |
| 347 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { | |
| 348 return function(a1, a2, a3, a4, a5, a6); | |
| 349 } | |
| 350 | |
| 351 // Calls a 7-ary callable. | |
| 352 template <typename Function, typename A1, typename A2, typename A3, | |
| 353 typename A4, typename A5, typename A6, typename A7> | |
| 354 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, | |
| 355 A7 a7) { | |
| 356 return function(a1, a2, a3, a4, a5, a6, a7); | |
| 357 } | |
| 358 | |
| 359 // Calls a 8-ary callable. | |
| 360 template <typename Function, typename A1, typename A2, typename A3, | |
| 361 typename A4, typename A5, typename A6, typename A7, typename A8> | |
| 362 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, | |
| 363 A7 a7, A8 a8) { | |
| 364 return function(a1, a2, a3, a4, a5, a6, a7, a8); | |
| 365 } | |
| 366 | |
| 367 // Calls a 9-ary callable. | |
| 368 template <typename Function, typename A1, typename A2, typename A3, | |
| 369 typename A4, typename A5, typename A6, typename A7, typename A8, | |
| 370 typename A9> | |
| 371 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, | |
| 372 A7 a7, A8 a8, A9 a9) { | |
| 373 return function(a1, a2, a3, a4, a5, a6, a7, a8, a9); | |
| 374 } | |
| 375 | |
| 376 // Calls a 10-ary callable. | |
| 377 template <typename Function, typename A1, typename A2, typename A3, | |
| 378 typename A4, typename A5, typename A6, typename A7, typename A8, | |
| 379 typename A9, typename A10> | |
| 380 static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, | |
| 381 A7 a7, A8 a8, A9 a9, A10 a10) { | |
| 382 return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); | |
| 383 } | |
| 384 | |
| 385 }; // class CallableHelper | |
| 386 | |
| 387 // An INTERNAL macro for extracting the type of a tuple field. It's | |
| 388 // subject to change without notice - DO NOT USE IN USER CODE! | |
| 389 #define GMOCK_FIELD_(Tuple, N) \ | |
| 390 typename ::std::tr1::tuple_element<N, Tuple>::type | |
| 391 | |
| 392 // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the | |
| 393 // type of an n-ary function whose i-th (1-based) argument type is the | |
| 394 // k{i}-th (0-based) field of ArgumentTuple, which must be a tuple | |
| 395 // type, and whose return type is Result. For example, | |
| 396 // SelectArgs<int, ::std::tr1::tuple<bool, char, double, long>, 0, 3>::type | |
| 397 // is int(bool, long). | |
| 398 // | |
| 399 // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args) | |
| 400 // returns the selected fields (k1, k2, ..., k_n) of args as a tuple. | |
| 401 // For example, | |
| 402 // SelectArgs<int, ::std::tr1::tuple<bool, char, double>, 2, 0>::Select( | |
| 403 // ::std::tr1::make_tuple(true, 'a', 2.5)) | |
| 404 // returns ::std::tr1::tuple (2.5, true). | |
| 405 // | |
| 406 // The numbers in list k1, k2, ..., k_n must be >= 0, where n can be | |
| 407 // in the range [0, 10]. Duplicates are allowed and they don't have | |
| 408 // to be in an ascending or descending order. | |
| 409 | |
| 410 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, | |
| 411 int k4, int k5, int k6, int k7, int k8, int k9, int k10> | |
| 412 class SelectArgs { | |
| 413 public: | |
| 414 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), | |
| 415 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), | |
| 416 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), | |
| 417 GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7), | |
| 418 GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9), | |
| 419 GMOCK_FIELD_(ArgumentTuple, k10)); | |
| 420 typedef typename Function<type>::ArgumentTuple SelectedArgs; | |
| 421 static SelectedArgs Select(const ArgumentTuple& args) { | |
| 422 using ::std::tr1::get; | |
| 423 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), | |
| 424 get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args), | |
| 425 get<k8>(args), get<k9>(args), get<k10>(args)); | |
| 426 } | |
| 427 }; | |
| 428 | |
| 429 template <typename Result, typename ArgumentTuple> | |
| 430 class SelectArgs<Result, ArgumentTuple, | |
| 431 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { | |
| 432 public: | |
| 433 typedef Result type(); | |
| 434 typedef typename Function<type>::ArgumentTuple SelectedArgs; | |
| 435 static SelectedArgs Select(const ArgumentTuple& /* args */) { | |
| 436 using ::std::tr1::get; | |
| 437 return SelectedArgs(); | |
| 438 } | |
| 439 }; | |
| 440 | |
| 441 template <typename Result, typename ArgumentTuple, int k1> | |
| 442 class SelectArgs<Result, ArgumentTuple, | |
| 443 k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { | |
| 444 public: | |
| 445 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1)); | |
| 446 typedef typename Function<type>::ArgumentTuple SelectedArgs; | |
| 447 static SelectedArgs Select(const ArgumentTuple& args) { | |
| 448 using ::std::tr1::get; | |
| 449 return SelectedArgs(get<k1>(args)); | |
| 450 } | |
| 451 }; | |
| 452 | |
| 453 template <typename Result, typename ArgumentTuple, int k1, int k2> | |
| 454 class SelectArgs<Result, ArgumentTuple, | |
| 455 k1, k2, -1, -1, -1, -1, -1, -1, -1, -1> { | |
| 456 public: | |
| 457 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), | |
| 458 GMOCK_FIELD_(ArgumentTuple, k2)); | |
| 459 typedef typename Function<type>::ArgumentTuple SelectedArgs; | |
| 460 static SelectedArgs Select(const ArgumentTuple& args) { | |
| 461 using ::std::tr1::get; | |
| 462 return SelectedArgs(get<k1>(args), get<k2>(args)); | |
| 463 } | |
| 464 }; | |
| 465 | |
| 466 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3> | |
| 467 class SelectArgs<Result, ArgumentTuple, | |
| 468 k1, k2, k3, -1, -1, -1, -1, -1, -1, -1> { | |
| 469 public: | |
| 470 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), | |
| 471 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3)); | |
| 472 typedef typename Function<type>::ArgumentTuple SelectedArgs; | |
| 473 static SelectedArgs Select(const ArgumentTuple& args) { | |
| 474 using ::std::tr1::get; | |
| 475 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args)); | |
| 476 } | |
| 477 }; | |
| 478 | |
| 479 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, | |
| 480 int k4> | |
| 481 class SelectArgs<Result, ArgumentTuple, | |
| 482 k1, k2, k3, k4, -1, -1, -1, -1, -1, -1> { | |
| 483 public: | |
| 484 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), | |
| 485 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), | |
| 486 GMOCK_FIELD_(ArgumentTuple, k4)); | |
| 487 typedef typename Function<type>::ArgumentTuple SelectedArgs; | |
| 488 static SelectedArgs Select(const ArgumentTuple& args) { | |
| 489 using ::std::tr1::get; | |
| 490 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), | |
| 491 get<k4>(args)); | |
| 492 } | |
| 493 }; | |
| 494 | |
| 495 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, | |
| 496 int k4, int k5> | |
| 497 class SelectArgs<Result, ArgumentTuple, | |
| 498 k1, k2, k3, k4, k5, -1, -1, -1, -1, -1> { | |
| 499 public: | |
| 500 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), | |
| 501 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), | |
| 502 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5)); | |
| 503 typedef typename Function<type>::ArgumentTuple SelectedArgs; | |
| 504 static SelectedArgs Select(const ArgumentTuple& args) { | |
| 505 using ::std::tr1::get; | |
| 506 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), | |
| 507 get<k4>(args), get<k5>(args)); | |
| 508 } | |
| 509 }; | |
| 510 | |
| 511 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, | |
| 512 int k4, int k5, int k6> | |
| 513 class SelectArgs<Result, ArgumentTuple, | |
| 514 k1, k2, k3, k4, k5, k6, -1, -1, -1, -1> { | |
| 515 public: | |
| 516 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), | |
| 517 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), | |
| 518 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), | |
| 519 GMOCK_FIELD_(ArgumentTuple, k6)); | |
| 520 typedef typename Function<type>::ArgumentTuple SelectedArgs; | |
| 521 static SelectedArgs Select(const ArgumentTuple& args) { | |
| 522 using ::std::tr1::get; | |
| 523 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), | |
| 524 get<k4>(args), get<k5>(args), get<k6>(args)); | |
| 525 } | |
| 526 }; | |
| 527 | |
| 528 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, | |
| 529 int k4, int k5, int k6, int k7> | |
| 530 class SelectArgs<Result, ArgumentTuple, | |
| 531 k1, k2, k3, k4, k5, k6, k7, -1, -1, -1> { | |
| 532 public: | |
| 533 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), | |
| 534 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), | |
| 535 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), | |
| 536 GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7)); | |
| 537 typedef typename Function<type>::ArgumentTuple SelectedArgs; | |
| 538 static SelectedArgs Select(const ArgumentTuple& args) { | |
| 539 using ::std::tr1::get; | |
| 540 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), | |
| 541 get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args)); | |
| 542 } | |
| 543 }; | |
| 544 | |
| 545 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, | |
| 546 int k4, int k5, int k6, int k7, int k8> | |
| 547 class SelectArgs<Result, ArgumentTuple, | |
| 548 k1, k2, k3, k4, k5, k6, k7, k8, -1, -1> { | |
| 549 public: | |
| 550 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), | |
| 551 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), | |
| 552 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), | |
| 553 GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7), | |
| 554 GMOCK_FIELD_(ArgumentTuple, k8)); | |
| 555 typedef typename Function<type>::ArgumentTuple SelectedArgs; | |
| 556 static SelectedArgs Select(const ArgumentTuple& args) { | |
| 557 using ::std::tr1::get; | |
| 558 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), | |
| 559 get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args), | |
| 560 get<k8>(args)); | |
| 561 } | |
| 562 }; | |
| 563 | |
| 564 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, | |
| 565 int k4, int k5, int k6, int k7, int k8, int k9> | |
| 566 class SelectArgs<Result, ArgumentTuple, | |
| 567 k1, k2, k3, k4, k5, k6, k7, k8, k9, -1> { | |
| 568 public: | |
| 569 typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), | |
| 570 GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), | |
| 571 GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), | |
| 572 GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7), | |
| 573 GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9)); | |
| 574 typedef typename Function<type>::ArgumentTuple SelectedArgs; | |
| 575 static SelectedArgs Select(const ArgumentTuple& args) { | |
| 576 using ::std::tr1::get; | |
| 577 return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), | |
| 578 get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args), | |
| 579 get<k8>(args), get<k9>(args)); | |
| 580 } | |
| 581 }; | |
| 582 | |
| 583 #undef GMOCK_FIELD_ | |
| 584 | |
| 585 // Implements the WithArgs action. | |
| 586 template <typename InnerAction, int k1 = -1, int k2 = -1, int k3 = -1, | |
| 587 int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1, | |
| 588 int k9 = -1, int k10 = -1> | |
| 589 class WithArgsAction { | |
| 590 public: | |
| 591 explicit WithArgsAction(const InnerAction& action) : action_(action) {} | |
| 592 | |
| 593 template <typename F> | |
| 594 operator Action<F>() const { return MakeAction(new Impl<F>(action_)); } | |
| 595 | |
| 596 private: | |
| 597 template <typename F> | |
| 598 class Impl : public ActionInterface<F> { | |
| 599 public: | |
| 600 typedef typename Function<F>::Result Result; | |
| 601 typedef typename Function<F>::ArgumentTuple ArgumentTuple; | |
| 602 | |
| 603 explicit Impl(const InnerAction& action) : action_(action) {} | |
| 604 | |
| 605 virtual Result Perform(const ArgumentTuple& args) { | |
| 606 return action_.Perform(SelectArgs<Result, ArgumentTuple, k1, k2, k3, k4, | |
| 607 k5, k6, k7, k8, k9, k10>::Select(args)); | |
| 608 } | |
| 609 | |
| 610 private: | |
| 611 typedef typename SelectArgs<Result, ArgumentTuple, | |
| 612 k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType; | |
| 613 | |
| 614 Action<InnerFunctionType> action_; | |
| 615 }; | |
| 616 | |
| 617 const InnerAction action_; | |
| 618 }; | |
| 619 | |
| 620 // A macro from the ACTION* family (defined later in this file) | |
| 621 // defines an action that can be used in a mock function. Typically, | |
| 622 // these actions only care about a subset of the arguments of the mock | |
| 623 // function. For example, if such an action only uses the second | |
| 624 // argument, it can be used in any mock function that takes >= 2 | |
| 625 // arguments where the type of the second argument is compatible. | |
| 626 // | |
| 627 // Therefore, the action implementation must be prepared to take more | |
| 628 // arguments than it needs. The ExcessiveArg type is used to | |
| 629 // represent those excessive arguments. In order to keep the compiler | |
| 630 // error messages tractable, we define it in the testing namespace | |
| 631 // instead of testing::internal. However, this is an INTERNAL TYPE | |
| 632 // and subject to change without notice, so a user MUST NOT USE THIS | |
| 633 // TYPE DIRECTLY. | |
| 634 struct ExcessiveArg {}; | |
| 635 | |
| 636 // A helper class needed for implementing the ACTION* macros. | |
| 637 template <typename Result, class Impl> | |
| 638 class ActionHelper { | |
| 639 public: | |
| 640 static Result Perform(Impl* impl, const ::std::tr1::tuple<>& args) { | |
| 641 using ::std::tr1::get; | |
| 642 return impl->template gmock_PerformImpl<>(args, ExcessiveArg(), | |
| 643 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), | |
| 644 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), | |
| 645 ExcessiveArg()); | |
| 646 } | |
| 647 | |
| 648 template <typename A0> | |
| 649 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0>& args) { | |
| 650 using ::std::tr1::get; | |
| 651 return impl->template gmock_PerformImpl<A0>(args, get<0>(args), | |
| 652 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), | |
| 653 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), | |
| 654 ExcessiveArg()); | |
| 655 } | |
| 656 | |
| 657 template <typename A0, typename A1> | |
| 658 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1>& args) { | |
| 659 using ::std::tr1::get; | |
| 660 return impl->template gmock_PerformImpl<A0, A1>(args, get<0>(args), | |
| 661 get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), | |
| 662 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), | |
| 663 ExcessiveArg()); | |
| 664 } | |
| 665 | |
| 666 template <typename A0, typename A1, typename A2> | |
| 667 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2>& args) { | |
| 668 using ::std::tr1::get; | |
| 669 return impl->template gmock_PerformImpl<A0, A1, A2>(args, get<0>(args), | |
| 670 get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(), | |
| 671 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), | |
| 672 ExcessiveArg()); | |
| 673 } | |
| 674 | |
| 675 template <typename A0, typename A1, typename A2, typename A3> | |
| 676 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, | |
| 677 A3>& args) { | |
| 678 using ::std::tr1::get; | |
| 679 return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, get<0>(args), | |
| 680 get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(), | |
| 681 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), | |
| 682 ExcessiveArg()); | |
| 683 } | |
| 684 | |
| 685 template <typename A0, typename A1, typename A2, typename A3, typename A4> | |
| 686 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, | |
| 687 A4>& args) { | |
| 688 using ::std::tr1::get; | |
| 689 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args, | |
| 690 get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), | |
| 691 ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), | |
| 692 ExcessiveArg()); | |
| 693 } | |
| 694 | |
| 695 template <typename A0, typename A1, typename A2, typename A3, typename A4, | |
| 696 typename A5> | |
| 697 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, | |
| 698 A5>& args) { | |
| 699 using ::std::tr1::get; | |
| 700 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args, | |
| 701 get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), | |
| 702 get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), | |
| 703 ExcessiveArg()); | |
| 704 } | |
| 705 | |
| 706 template <typename A0, typename A1, typename A2, typename A3, typename A4, | |
| 707 typename A5, typename A6> | |
| 708 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, | |
| 709 A5, A6>& args) { | |
| 710 using ::std::tr1::get; | |
| 711 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args, | |
| 712 get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), | |
| 713 get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(), | |
| 714 ExcessiveArg()); | |
| 715 } | |
| 716 | |
| 717 template <typename A0, typename A1, typename A2, typename A3, typename A4, | |
| 718 typename A5, typename A6, typename A7> | |
| 719 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, | |
| 720 A5, A6, A7>& args) { | |
| 721 using ::std::tr1::get; | |
| 722 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, | |
| 723 A7>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), | |
| 724 get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(), | |
| 725 ExcessiveArg()); | |
| 726 } | |
| 727 | |
| 728 template <typename A0, typename A1, typename A2, typename A3, typename A4, | |
| 729 typename A5, typename A6, typename A7, typename A8> | |
| 730 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, | |
| 731 A5, A6, A7, A8>& args) { | |
| 732 using ::std::tr1::get; | |
| 733 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, | |
| 734 A8>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), | |
| 735 get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), | |
| 736 ExcessiveArg()); | |
| 737 } | |
| 738 | |
| 739 template <typename A0, typename A1, typename A2, typename A3, typename A4, | |
| 740 typename A5, typename A6, typename A7, typename A8, typename A9> | |
| 741 static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, | |
| 742 A5, A6, A7, A8, A9>& args) { | |
| 743 using ::std::tr1::get; | |
| 744 return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8, | |
| 745 A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), | |
| 746 get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), | |
| 747 get<9>(args)); | |
| 748 } | |
| 749 }; | |
| 750 | |
| 751 } // namespace internal | |
| 752 | |
| 753 // Various overloads for Invoke(). | |
| 754 | |
| 755 // WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes | |
| 756 // the selected arguments of the mock function to an_action and | |
| 757 // performs it. It serves as an adaptor between actions with | |
| 758 // different argument lists. C++ doesn't support default arguments for | |
| 759 // function templates, so we have to overload it. | |
| 760 template <int k1, typename InnerAction> | |
| 761 inline internal::WithArgsAction<InnerAction, k1> | |
| 762 WithArgs(const InnerAction& action) { | |
| 763 return internal::WithArgsAction<InnerAction, k1>(action); | |
| 764 } | |
| 765 | |
| 766 template <int k1, int k2, typename InnerAction> | |
| 767 inline internal::WithArgsAction<InnerAction, k1, k2> | |
| 768 WithArgs(const InnerAction& action) { | |
| 769 return internal::WithArgsAction<InnerAction, k1, k2>(action); | |
| 770 } | |
| 771 | |
| 772 template <int k1, int k2, int k3, typename InnerAction> | |
| 773 inline internal::WithArgsAction<InnerAction, k1, k2, k3> | |
| 774 WithArgs(const InnerAction& action) { | |
| 775 return internal::WithArgsAction<InnerAction, k1, k2, k3>(action); | |
| 776 } | |
| 777 | |
| 778 template <int k1, int k2, int k3, int k4, typename InnerAction> | |
| 779 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4> | |
| 780 WithArgs(const InnerAction& action) { | |
| 781 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4>(action); | |
| 782 } | |
| 783 | |
| 784 template <int k1, int k2, int k3, int k4, int k5, typename InnerAction> | |
| 785 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5> | |
| 786 WithArgs(const InnerAction& action) { | |
| 787 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>(action); | |
| 788 } | |
| 789 | |
| 790 template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerAction> | |
| 791 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6> | |
| 792 WithArgs(const InnerAction& action) { | |
| 793 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>(action); | |
| 794 } | |
| 795 | |
| 796 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, | |
| 797 typename InnerAction> | |
| 798 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7> | |
| 799 WithArgs(const InnerAction& action) { | |
| 800 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, | |
| 801 k7>(action); | |
| 802 } | |
| 803 | |
| 804 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, | |
| 805 typename InnerAction> | |
| 806 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8> | |
| 807 WithArgs(const InnerAction& action) { | |
| 808 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, | |
| 809 k8>(action); | |
| 810 } | |
| 811 | |
| 812 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, | |
| 813 int k9, typename InnerAction> | |
| 814 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, k9> | |
| 815 WithArgs(const InnerAction& action) { | |
| 816 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, | |
| 817 k9>(action); | |
| 818 } | |
| 819 | |
| 820 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, | |
| 821 int k9, int k10, typename InnerAction> | |
| 822 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, | |
| 823 k9, k10> | |
| 824 WithArgs(const InnerAction& action) { | |
| 825 return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, | |
| 826 k9, k10>(action); | |
| 827 } | |
| 828 | |
| 829 // Creates an action that does actions a1, a2, ..., sequentially in | |
| 830 // each invocation. | |
| 831 template <typename Action1, typename Action2> | |
| 832 inline internal::DoBothAction<Action1, Action2> | |
| 833 DoAll(Action1 a1, Action2 a2) { | |
| 834 return internal::DoBothAction<Action1, Action2>(a1, a2); | |
| 835 } | |
| 836 | |
| 837 template <typename Action1, typename Action2, typename Action3> | |
| 838 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, | |
| 839 Action3> > | |
| 840 DoAll(Action1 a1, Action2 a2, Action3 a3) { | |
| 841 return DoAll(a1, DoAll(a2, a3)); | |
| 842 } | |
| 843 | |
| 844 template <typename Action1, typename Action2, typename Action3, | |
| 845 typename Action4> | |
| 846 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, | |
| 847 internal::DoBothAction<Action3, Action4> > > | |
| 848 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) { | |
| 849 return DoAll(a1, DoAll(a2, a3, a4)); | |
| 850 } | |
| 851 | |
| 852 template <typename Action1, typename Action2, typename Action3, | |
| 853 typename Action4, typename Action5> | |
| 854 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, | |
| 855 internal::DoBothAction<Action3, internal::DoBothAction<Action4, | |
| 856 Action5> > > > | |
| 857 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) { | |
| 858 return DoAll(a1, DoAll(a2, a3, a4, a5)); | |
| 859 } | |
| 860 | |
| 861 template <typename Action1, typename Action2, typename Action3, | |
| 862 typename Action4, typename Action5, typename Action6> | |
| 863 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, | |
| 864 internal::DoBothAction<Action3, internal::DoBothAction<Action4, | |
| 865 internal::DoBothAction<Action5, Action6> > > > > | |
| 866 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) { | |
| 867 return DoAll(a1, DoAll(a2, a3, a4, a5, a6)); | |
| 868 } | |
| 869 | |
| 870 template <typename Action1, typename Action2, typename Action3, | |
| 871 typename Action4, typename Action5, typename Action6, typename Action7> | |
| 872 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, | |
| 873 internal::DoBothAction<Action3, internal::DoBothAction<Action4, | |
| 874 internal::DoBothAction<Action5, internal::DoBothAction<Action6, | |
| 875 Action7> > > > > > | |
| 876 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, | |
| 877 Action7 a7) { | |
| 878 return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7)); | |
| 879 } | |
| 880 | |
| 881 template <typename Action1, typename Action2, typename Action3, | |
| 882 typename Action4, typename Action5, typename Action6, typename Action7, | |
| 883 typename Action8> | |
| 884 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, | |
| 885 internal::DoBothAction<Action3, internal::DoBothAction<Action4, | |
| 886 internal::DoBothAction<Action5, internal::DoBothAction<Action6, | |
| 887 internal::DoBothAction<Action7, Action8> > > > > > > | |
| 888 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, | |
| 889 Action7 a7, Action8 a8) { | |
| 890 return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8)); | |
| 891 } | |
| 892 | |
| 893 template <typename Action1, typename Action2, typename Action3, | |
| 894 typename Action4, typename Action5, typename Action6, typename Action7, | |
| 895 typename Action8, typename Action9> | |
| 896 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, | |
| 897 internal::DoBothAction<Action3, internal::DoBothAction<Action4, | |
| 898 internal::DoBothAction<Action5, internal::DoBothAction<Action6, | |
| 899 internal::DoBothAction<Action7, internal::DoBothAction<Action8, | |
| 900 Action9> > > > > > > > | |
| 901 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, | |
| 902 Action7 a7, Action8 a8, Action9 a9) { | |
| 903 return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9)); | |
| 904 } | |
| 905 | |
| 906 template <typename Action1, typename Action2, typename Action3, | |
| 907 typename Action4, typename Action5, typename Action6, typename Action7, | |
| 908 typename Action8, typename Action9, typename Action10> | |
| 909 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, | |
| 910 internal::DoBothAction<Action3, internal::DoBothAction<Action4, | |
| 911 internal::DoBothAction<Action5, internal::DoBothAction<Action6, | |
| 912 internal::DoBothAction<Action7, internal::DoBothAction<Action8, | |
| 913 internal::DoBothAction<Action9, Action10> > > > > > > > > | |
| 914 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, | |
| 915 Action7 a7, Action8 a8, Action9 a9, Action10 a10) { | |
| 916 return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10)); | |
| 917 } | |
| 918 | |
| 919 } // namespace testing | |
| 920 | |
| 921 // The ACTION* family of macros can be used in a namespace scope to | |
| 922 // define custom actions easily. The syntax: | |
| 923 // | |
| 924 // ACTION(name) { statements; } | |
| 925 // | |
| 926 // will define an action with the given name that executes the | |
| 927 // statements. The value returned by the statements will be used as | |
| 928 // the return value of the action. Inside the statements, you can | |
| 929 // refer to the K-th (0-based) argument of the mock function by | |
| 930 // 'argK', and refer to its type by 'argK_type'. For example: | |
| 931 // | |
| 932 // ACTION(IncrementArg1) { | |
| 933 // arg1_type temp = arg1; | |
| 934 // return ++(*temp); | |
| 935 // } | |
| 936 // | |
| 937 // allows you to write | |
| 938 // | |
| 939 // ...WillOnce(IncrementArg1()); | |
| 940 // | |
| 941 // You can also refer to the entire argument tuple and its type by | |
| 942 // 'args' and 'args_type', and refer to the mock function type and its | |
| 943 // return type by 'function_type' and 'return_type'. | |
| 944 // | |
| 945 // Note that you don't need to specify the types of the mock function | |
| 946 // arguments. However rest assured that your code is still type-safe: | |
| 947 // you'll get a compiler error if *arg1 doesn't support the ++ | |
| 948 // operator, or if the type of ++(*arg1) isn't compatible with the | |
| 949 // mock function's return type, for example. | |
| 950 // | |
| 951 // Sometimes you'll want to parameterize the action. For that you can use | |
| 952 // another macro: | |
| 953 // | |
| 954 // ACTION_P(name, param_name) { statements; } | |
| 955 // | |
| 956 // For example: | |
| 957 // | |
| 958 // ACTION_P(Add, n) { return arg0 + n; } | |
| 959 // | |
| 960 // will allow you to write: | |
| 961 // | |
| 962 // ...WillOnce(Add(5)); | |
| 963 // | |
| 964 // Note that you don't need to provide the type of the parameter | |
| 965 // either. If you need to reference the type of a parameter named | |
| 966 // 'foo', you can write 'foo_type'. For example, in the body of | |
| 967 // ACTION_P(Add, n) above, you can write 'n_type' to refer to the type | |
| 968 // of 'n'. | |
| 969 // | |
| 970 // We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support | |
| 971 // multi-parameter actions. | |
| 972 // | |
| 973 // For the purpose of typing, you can view | |
| 974 // | |
| 975 // ACTION_Pk(Foo, p1, ..., pk) { ... } | |
| 976 // | |
| 977 // as shorthand for | |
| 978 // | |
| 979 // template <typename p1_type, ..., typename pk_type> | |
| 980 // FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... } | |
| 981 // | |
| 982 // In particular, you can provide the template type arguments | |
| 983 // explicitly when invoking Foo(), as in Foo<long, bool>(5, false); | |
| 984 // although usually you can rely on the compiler to infer the types | |
| 985 // for you automatically. You can assign the result of expression | |
| 986 // Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ..., | |
| 987 // pk_type>. This can be useful when composing actions. | |
| 988 // | |
| 989 // You can also overload actions with different numbers of parameters: | |
| 990 // | |
| 991 // ACTION_P(Plus, a) { ... } | |
| 992 // ACTION_P2(Plus, a, b) { ... } | |
| 993 // | |
| 994 // While it's tempting to always use the ACTION* macros when defining | |
| 995 // a new action, you should also consider implementing ActionInterface | |
| 996 // or using MakePolymorphicAction() instead, especially if you need to | |
| 997 // use the action a lot. While these approaches require more work, | |
| 998 // they give you more control on the types of the mock function | |
| 999 // arguments and the action parameters, which in general leads to | |
| 1000 // better compiler error messages that pay off in the long run. They | |
| 1001 // also allow overloading actions based on parameter types (as opposed | |
| 1002 // to just based on the number of parameters). | |
| 1003 // | |
| 1004 // CAVEAT: | |
| 1005 // | |
| 1006 // ACTION*() can only be used in a namespace scope. The reason is | |
| 1007 // that C++ doesn't yet allow function-local types to be used to | |
| 1008 // instantiate templates. The up-coming C++0x standard will fix this. | |
| 1009 // Once that's done, we'll consider supporting using ACTION*() inside | |
| 1010 // a function. | |
| 1011 // | |
| 1012 // MORE INFORMATION: | |
| 1013 // | |
| 1014 // To learn more about using these macros, please search for 'ACTION' | |
| 1015 // on http://code.google.com/p/googlemock/wiki/CookBook. | |
| 1016 | |
| 1017 // An internal macro needed for implementing ACTION*(). | |
| 1018 #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ | |
| 1019 const args_type& args GTEST_ATTRIBUTE_UNUSED_,\ | |
| 1020 arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_,\ | |
| 1021 arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_,\ | |
| 1022 arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_,\ | |
| 1023 arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_,\ | |
| 1024 arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_,\ | |
| 1025 arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_,\ | |
| 1026 arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_,\ | |
| 1027 arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_,\ | |
| 1028 arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_,\ | |
| 1029 arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_ | |
| 1030 | |
| 1031 // Sometimes you want to give an action explicit template parameters | |
| 1032 // that cannot be inferred from its value parameters. ACTION() and | |
| 1033 // ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that | |
| 1034 // and can be viewed as an extension to ACTION() and ACTION_P*(). | |
| 1035 // | |
| 1036 // The syntax: | |
| 1037 // | |
| 1038 // ACTION_TEMPLATE(ActionName, | |
| 1039 // HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m), | |
| 1040 // AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; } | |
| 1041 // | |
| 1042 // defines an action template that takes m explicit template | |
| 1043 // parameters and n value parameters. name_i is the name of the i-th | |
| 1044 // template parameter, and kind_i specifies whether it's a typename, | |
| 1045 // an integral constant, or a template. p_i is the name of the i-th | |
| 1046 // value parameter. | |
| 1047 // | |
| 1048 // Example: | |
| 1049 // | |
| 1050 // // DuplicateArg<k, T>(output) converts the k-th argument of the mock | |
| 1051 // // function to type T and copies it to *output. | |
| 1052 // ACTION_TEMPLATE(DuplicateArg, | |
| 1053 // HAS_2_TEMPLATE_PARAMS(int, k, typename, T), | |
| 1054 // AND_1_VALUE_PARAMS(output)) { | |
| 1055 // *output = T(std::tr1::get<k>(args)); | |
| 1056 // } | |
| 1057 // ... | |
| 1058 // int n; | |
| 1059 // EXPECT_CALL(mock, Foo(_, _)) | |
| 1060 // .WillOnce(DuplicateArg<1, unsigned char>(&n)); | |
| 1061 // | |
| 1062 // To create an instance of an action template, write: | |
| 1063 // | |
| 1064 // ActionName<t1, ..., t_m>(v1, ..., v_n) | |
| 1065 // | |
| 1066 // where the ts are the template arguments and the vs are the value | |
| 1067 // arguments. The value argument types are inferred by the compiler. | |
| 1068 // If you want to explicitly specify the value argument types, you can | |
| 1069 // provide additional template arguments: | |
| 1070 // | |
| 1071 // ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n) | |
| 1072 // | |
| 1073 // where u_i is the desired type of v_i. | |
| 1074 // | |
| 1075 // ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the | |
| 1076 // number of value parameters, but not on the number of template | |
| 1077 // parameters. Without the restriction, the meaning of the following | |
| 1078 // is unclear: | |
| 1079 // | |
| 1080 // OverloadedAction<int, bool>(x); | |
| 1081 // | |
| 1082 // Are we using a single-template-parameter action where 'bool' refers | |
| 1083 // to the type of x, or are we using a two-template-parameter action | |
| 1084 // where the compiler is asked to infer the type of x? | |
| 1085 // | |
| 1086 // Implementation notes: | |
| 1087 // | |
| 1088 // GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and | |
| 1089 // GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for | |
| 1090 // implementing ACTION_TEMPLATE. The main trick we use is to create | |
| 1091 // new macro invocations when expanding a macro. For example, we have | |
| 1092 // | |
| 1093 // #define ACTION_TEMPLATE(name, template_params, value_params) | |
| 1094 // ... GMOCK_INTERNAL_DECL_##template_params ... | |
| 1095 // | |
| 1096 // which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...) | |
| 1097 // to expand to | |
| 1098 // | |
| 1099 // ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ... | |
| 1100 // | |
| 1101 // Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the | |
| 1102 // preprocessor will continue to expand it to | |
| 1103 // | |
| 1104 // ... typename T ... | |
| 1105 // | |
| 1106 // This technique conforms to the C++ standard and is portable. It | |
| 1107 // allows us to implement action templates using O(N) code, where N is | |
| 1108 // the maximum number of template/value parameters supported. Without | |
| 1109 // using it, we'd have to devote O(N^2) amount of code to implement all | |
| 1110 // combinations of m and n. | |
| 1111 | |
| 1112 // Declares the template parameters. | |
| 1113 #define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0 | |
| 1114 #define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ | |
| 1115 name1) kind0 name0, kind1 name1 | |
| 1116 #define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1117 kind2, name2) kind0 name0, kind1 name1, kind2 name2 | |
| 1118 #define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1119 kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \ | |
| 1120 kind3 name3 | |
| 1121 #define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1122 kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \ | |
| 1123 kind2 name2, kind3 name3, kind4 name4 | |
| 1124 #define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1125 kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \ | |
| 1126 kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5 | |
| 1127 #define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1128 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ | |
| 1129 name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \ | |
| 1130 kind5 name5, kind6 name6 | |
| 1131 #define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1132 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ | |
| 1133 kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \ | |
| 1134 kind4 name4, kind5 name5, kind6 name6, kind7 name7 | |
| 1135 #define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1136 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ | |
| 1137 kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \ | |
| 1138 kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \ | |
| 1139 kind8 name8 | |
| 1140 #define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ | |
| 1141 name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ | |
| 1142 name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \ | |
| 1143 kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \ | |
| 1144 kind6 name6, kind7 name7, kind8 name8, kind9 name9 | |
| 1145 | |
| 1146 // Lists the template parameters. | |
| 1147 #define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0 | |
| 1148 #define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ | |
| 1149 name1) name0, name1 | |
| 1150 #define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1151 kind2, name2) name0, name1, name2 | |
| 1152 #define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1153 kind2, name2, kind3, name3) name0, name1, name2, name3 | |
| 1154 #define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1155 kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \ | |
| 1156 name4 | |
| 1157 #define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1158 kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \ | |
| 1159 name2, name3, name4, name5 | |
| 1160 #define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1161 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ | |
| 1162 name6) name0, name1, name2, name3, name4, name5, name6 | |
| 1163 #define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1164 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ | |
| 1165 kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7 | |
| 1166 #define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ | |
| 1167 kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ | |
| 1168 kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \ | |
| 1169 name6, name7, name8 | |
| 1170 #define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ | |
| 1171 name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ | |
| 1172 name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \ | |
| 1173 name3, name4, name5, name6, name7, name8, name9 | |
| 1174 | |
| 1175 // Declares the types of value parameters. | |
| 1176 #define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS() | |
| 1177 #define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type | |
| 1178 #define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \ | |
| 1179 typename p0##_type, typename p1##_type | |
| 1180 #define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \ | |
| 1181 typename p0##_type, typename p1##_type, typename p2##_type | |
| 1182 #define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ | |
| 1183 typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1184 typename p3##_type | |
| 1185 #define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ | |
| 1186 typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1187 typename p3##_type, typename p4##_type | |
| 1188 #define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ | |
| 1189 typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1190 typename p3##_type, typename p4##_type, typename p5##_type | |
| 1191 #define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| 1192 p6) , typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1193 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 1194 typename p6##_type | |
| 1195 #define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| 1196 p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1197 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 1198 typename p6##_type, typename p7##_type | |
| 1199 #define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| 1200 p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1201 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 1202 typename p6##_type, typename p7##_type, typename p8##_type | |
| 1203 #define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| 1204 p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \ | |
| 1205 typename p2##_type, typename p3##_type, typename p4##_type, \ | |
| 1206 typename p5##_type, typename p6##_type, typename p7##_type, \ | |
| 1207 typename p8##_type, typename p9##_type | |
| 1208 | |
| 1209 // Initializes the value parameters. | |
| 1210 #define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\ | |
| 1211 () | |
| 1212 #define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\ | |
| 1213 (p0##_type gmock_p0) : p0(gmock_p0) | |
| 1214 #define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\ | |
| 1215 (p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1) | |
| 1216 #define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\ | |
| 1217 (p0##_type gmock_p0, p1##_type gmock_p1, \ | |
| 1218 p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) | |
| 1219 #define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\ | |
| 1220 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 1221 p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 1222 p3(gmock_p3) | |
| 1223 #define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\ | |
| 1224 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 1225 p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), \ | |
| 1226 p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) | |
| 1227 #define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\ | |
| 1228 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 1229 p3##_type gmock_p3, p4##_type gmock_p4, \ | |
| 1230 p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 1231 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) | |
| 1232 #define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\ | |
| 1233 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 1234 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ | |
| 1235 p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 1236 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) | |
| 1237 #define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\ | |
| 1238 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 1239 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ | |
| 1240 p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \ | |
| 1241 p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ | |
| 1242 p7(gmock_p7) | |
| 1243 #define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1244 p7, p8)\ | |
| 1245 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 1246 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ | |
| 1247 p6##_type gmock_p6, p7##_type gmock_p7, \ | |
| 1248 p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 1249 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ | |
| 1250 p8(gmock_p8) | |
| 1251 #define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1252 p7, p8, p9)\ | |
| 1253 (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 1254 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ | |
| 1255 p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ | |
| 1256 p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 1257 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ | |
| 1258 p8(gmock_p8), p9(gmock_p9) | |
| 1259 | |
| 1260 // Declares the fields for storing the value parameters. | |
| 1261 #define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS() | |
| 1262 #define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0; | |
| 1263 #define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \ | |
| 1264 p1##_type p1; | |
| 1265 #define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \ | |
| 1266 p1##_type p1; p2##_type p2; | |
| 1267 #define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \ | |
| 1268 p1##_type p1; p2##_type p2; p3##_type p3; | |
| 1269 #define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ | |
| 1270 p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; | |
| 1271 #define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ | |
| 1272 p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ | |
| 1273 p5##_type p5; | |
| 1274 #define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| 1275 p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ | |
| 1276 p5##_type p5; p6##_type p6; | |
| 1277 #define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1278 p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ | |
| 1279 p5##_type p5; p6##_type p6; p7##_type p7; | |
| 1280 #define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1281 p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ | |
| 1282 p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; | |
| 1283 #define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1284 p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ | |
| 1285 p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \ | |
| 1286 p9##_type p9; | |
| 1287 | |
| 1288 // Lists the value parameters. | |
| 1289 #define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS() | |
| 1290 #define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0 | |
| 1291 #define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1 | |
| 1292 #define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2 | |
| 1293 #define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3 | |
| 1294 #define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \ | |
| 1295 p2, p3, p4 | |
| 1296 #define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \ | |
| 1297 p1, p2, p3, p4, p5 | |
| 1298 #define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| 1299 p6) p0, p1, p2, p3, p4, p5, p6 | |
| 1300 #define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1301 p7) p0, p1, p2, p3, p4, p5, p6, p7 | |
| 1302 #define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1303 p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8 | |
| 1304 #define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1305 p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 | |
| 1306 | |
| 1307 // Lists the value parameter types. | |
| 1308 #define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS() | |
| 1309 #define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type | |
| 1310 #define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \ | |
| 1311 p1##_type | |
| 1312 #define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \ | |
| 1313 p1##_type, p2##_type | |
| 1314 #define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ | |
| 1315 p0##_type, p1##_type, p2##_type, p3##_type | |
| 1316 #define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ | |
| 1317 p0##_type, p1##_type, p2##_type, p3##_type, p4##_type | |
| 1318 #define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ | |
| 1319 p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type | |
| 1320 #define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| 1321 p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \ | |
| 1322 p6##_type | |
| 1323 #define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| 1324 p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ | |
| 1325 p5##_type, p6##_type, p7##_type | |
| 1326 #define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| 1327 p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ | |
| 1328 p5##_type, p6##_type, p7##_type, p8##_type | |
| 1329 #define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| 1330 p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ | |
| 1331 p5##_type, p6##_type, p7##_type, p8##_type, p9##_type | |
| 1332 | |
| 1333 // Declares the value parameters. | |
| 1334 #define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS() | |
| 1335 #define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0 | |
| 1336 #define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \ | |
| 1337 p1##_type p1 | |
| 1338 #define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \ | |
| 1339 p1##_type p1, p2##_type p2 | |
| 1340 #define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \ | |
| 1341 p1##_type p1, p2##_type p2, p3##_type p3 | |
| 1342 #define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ | |
| 1343 p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4 | |
| 1344 #define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ | |
| 1345 p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ | |
| 1346 p5##_type p5 | |
| 1347 #define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| 1348 p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ | |
| 1349 p5##_type p5, p6##_type p6 | |
| 1350 #define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1351 p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ | |
| 1352 p5##_type p5, p6##_type p6, p7##_type p7 | |
| 1353 #define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1354 p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ | |
| 1355 p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8 | |
| 1356 #define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1357 p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ | |
| 1358 p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ | |
| 1359 p9##_type p9 | |
| 1360 | |
| 1361 // The suffix of the class template implementing the action template. | |
| 1362 #define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS() | |
| 1363 #define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P | |
| 1364 #define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2 | |
| 1365 #define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3 | |
| 1366 #define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4 | |
| 1367 #define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5 | |
| 1368 #define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6 | |
| 1369 #define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7 | |
| 1370 #define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1371 p7) P8 | |
| 1372 #define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1373 p7, p8) P9 | |
| 1374 #define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ | |
| 1375 p7, p8, p9) P10 | |
| 1376 | |
| 1377 // The name of the class template implementing the action template. | |
| 1378 #define GMOCK_ACTION_CLASS_(name, value_params)\ | |
| 1379 GMOCK_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params) | |
| 1380 | |
| 1381 #define ACTION_TEMPLATE(name, template_params, value_params)\ | |
| 1382 template <GMOCK_INTERNAL_DECL_##template_params\ | |
| 1383 GMOCK_INTERNAL_DECL_TYPE_##value_params>\ | |
| 1384 class GMOCK_ACTION_CLASS_(name, value_params) {\ | |
| 1385 public:\ | |
| 1386 GMOCK_ACTION_CLASS_(name, value_params)\ | |
| 1387 GMOCK_INTERNAL_INIT_##value_params {}\ | |
| 1388 template <typename F>\ | |
| 1389 class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| 1390 public:\ | |
| 1391 typedef F function_type;\ | |
| 1392 typedef typename ::testing::internal::Function<F>::Result return_type;\ | |
| 1393 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| 1394 args_type;\ | |
| 1395 explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ | |
| 1396 virtual return_type Perform(const args_type& args) {\ | |
| 1397 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ | |
| 1398 Perform(this, args);\ | |
| 1399 }\ | |
| 1400 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1401 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1402 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1403 typename arg9_type>\ | |
| 1404 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ | |
| 1405 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ | |
| 1406 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ | |
| 1407 arg9_type arg9) const;\ | |
| 1408 GMOCK_INTERNAL_DEFN_##value_params\ | |
| 1409 };\ | |
| 1410 template <typename F> operator ::testing::Action<F>() const {\ | |
| 1411 return ::testing::Action<F>(\ | |
| 1412 new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\ | |
| 1413 }\ | |
| 1414 GMOCK_INTERNAL_DEFN_##value_params\ | |
| 1415 };\ | |
| 1416 template <GMOCK_INTERNAL_DECL_##template_params\ | |
| 1417 GMOCK_INTERNAL_DECL_TYPE_##value_params>\ | |
| 1418 inline GMOCK_ACTION_CLASS_(name, value_params)<\ | |
| 1419 GMOCK_INTERNAL_LIST_##template_params\ | |
| 1420 GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ | |
| 1421 GMOCK_INTERNAL_DECL_##value_params) {\ | |
| 1422 return GMOCK_ACTION_CLASS_(name, value_params)<\ | |
| 1423 GMOCK_INTERNAL_LIST_##template_params\ | |
| 1424 GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ | |
| 1425 GMOCK_INTERNAL_LIST_##value_params);\ | |
| 1426 }\ | |
| 1427 template <GMOCK_INTERNAL_DECL_##template_params\ | |
| 1428 GMOCK_INTERNAL_DECL_TYPE_##value_params>\ | |
| 1429 template <typename F>\ | |
| 1430 template <typename arg0_type, typename arg1_type, typename arg2_type,\ | |
| 1431 typename arg3_type, typename arg4_type, typename arg5_type,\ | |
| 1432 typename arg6_type, typename arg7_type, typename arg8_type,\ | |
| 1433 typename arg9_type>\ | |
| 1434 typename ::testing::internal::Function<F>::Result\ | |
| 1435 GMOCK_ACTION_CLASS_(name, value_params)<\ | |
| 1436 GMOCK_INTERNAL_LIST_##template_params\ | |
| 1437 GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\ | |
| 1438 gmock_PerformImpl(\ | |
| 1439 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 1440 | |
| 1441 #define ACTION(name)\ | |
| 1442 class name##Action {\ | |
| 1443 public:\ | |
| 1444 name##Action() {}\ | |
| 1445 template <typename F>\ | |
| 1446 class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| 1447 public:\ | |
| 1448 typedef F function_type;\ | |
| 1449 typedef typename ::testing::internal::Function<F>::Result return_type;\ | |
| 1450 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| 1451 args_type;\ | |
| 1452 gmock_Impl() {}\ | |
| 1453 virtual return_type Perform(const args_type& args) {\ | |
| 1454 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ | |
| 1455 Perform(this, args);\ | |
| 1456 }\ | |
| 1457 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1458 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1459 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1460 typename arg9_type>\ | |
| 1461 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ | |
| 1462 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ | |
| 1463 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ | |
| 1464 arg9_type arg9) const;\ | |
| 1465 };\ | |
| 1466 template <typename F> operator ::testing::Action<F>() const {\ | |
| 1467 return ::testing::Action<F>(new gmock_Impl<F>());\ | |
| 1468 }\ | |
| 1469 };\ | |
| 1470 inline name##Action name() {\ | |
| 1471 return name##Action();\ | |
| 1472 }\ | |
| 1473 template <typename F>\ | |
| 1474 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1475 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1476 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1477 typename arg9_type>\ | |
| 1478 typename ::testing::internal::Function<F>::Result\ | |
| 1479 name##Action::gmock_Impl<F>::gmock_PerformImpl(\ | |
| 1480 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 1481 | |
| 1482 #define ACTION_P(name, p0)\ | |
| 1483 template <typename p0##_type>\ | |
| 1484 class name##ActionP {\ | |
| 1485 public:\ | |
| 1486 name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\ | |
| 1487 template <typename F>\ | |
| 1488 class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| 1489 public:\ | |
| 1490 typedef F function_type;\ | |
| 1491 typedef typename ::testing::internal::Function<F>::Result return_type;\ | |
| 1492 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| 1493 args_type;\ | |
| 1494 explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\ | |
| 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 };\ | |
| 1509 template <typename F> operator ::testing::Action<F>() const {\ | |
| 1510 return ::testing::Action<F>(new gmock_Impl<F>(p0));\ | |
| 1511 }\ | |
| 1512 p0##_type p0;\ | |
| 1513 };\ | |
| 1514 template <typename p0##_type>\ | |
| 1515 inline name##ActionP<p0##_type> name(p0##_type p0) {\ | |
| 1516 return name##ActionP<p0##_type>(p0);\ | |
| 1517 }\ | |
| 1518 template <typename p0##_type>\ | |
| 1519 template <typename F>\ | |
| 1520 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1521 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1522 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1523 typename arg9_type>\ | |
| 1524 typename ::testing::internal::Function<F>::Result\ | |
| 1525 name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| 1526 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 1527 | |
| 1528 #define ACTION_P2(name, p0, p1)\ | |
| 1529 template <typename p0##_type, typename p1##_type>\ | |
| 1530 class name##ActionP2 {\ | |
| 1531 public:\ | |
| 1532 name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ | |
| 1533 p1(gmock_p1) {}\ | |
| 1534 template <typename F>\ | |
| 1535 class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| 1536 public:\ | |
| 1537 typedef F function_type;\ | |
| 1538 typedef typename ::testing::internal::Function<F>::Result return_type;\ | |
| 1539 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| 1540 args_type;\ | |
| 1541 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ | |
| 1542 p1(gmock_p1) {}\ | |
| 1543 virtual return_type Perform(const args_type& args) {\ | |
| 1544 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ | |
| 1545 Perform(this, args);\ | |
| 1546 }\ | |
| 1547 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1548 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1549 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1550 typename arg9_type>\ | |
| 1551 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ | |
| 1552 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ | |
| 1553 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ | |
| 1554 arg9_type arg9) const;\ | |
| 1555 p0##_type p0;\ | |
| 1556 p1##_type p1;\ | |
| 1557 };\ | |
| 1558 template <typename F> operator ::testing::Action<F>() const {\ | |
| 1559 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\ | |
| 1560 }\ | |
| 1561 p0##_type p0;\ | |
| 1562 p1##_type p1;\ | |
| 1563 };\ | |
| 1564 template <typename p0##_type, typename p1##_type>\ | |
| 1565 inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \ | |
| 1566 p1##_type p1) {\ | |
| 1567 return name##ActionP2<p0##_type, p1##_type>(p0, p1);\ | |
| 1568 }\ | |
| 1569 template <typename p0##_type, typename p1##_type>\ | |
| 1570 template <typename F>\ | |
| 1571 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1572 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1573 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1574 typename arg9_type>\ | |
| 1575 typename ::testing::internal::Function<F>::Result\ | |
| 1576 name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| 1577 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 1578 | |
| 1579 #define ACTION_P3(name, p0, p1, p2)\ | |
| 1580 template <typename p0##_type, typename p1##_type, typename p2##_type>\ | |
| 1581 class name##ActionP3 {\ | |
| 1582 public:\ | |
| 1583 name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \ | |
| 1584 p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ | |
| 1585 template <typename F>\ | |
| 1586 class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| 1587 public:\ | |
| 1588 typedef F function_type;\ | |
| 1589 typedef typename ::testing::internal::Function<F>::Result return_type;\ | |
| 1590 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| 1591 args_type;\ | |
| 1592 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \ | |
| 1593 p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ | |
| 1594 virtual return_type Perform(const args_type& args) {\ | |
| 1595 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ | |
| 1596 Perform(this, args);\ | |
| 1597 }\ | |
| 1598 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1599 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1600 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1601 typename arg9_type>\ | |
| 1602 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ | |
| 1603 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ | |
| 1604 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ | |
| 1605 arg9_type arg9) const;\ | |
| 1606 p0##_type p0;\ | |
| 1607 p1##_type p1;\ | |
| 1608 p2##_type p2;\ | |
| 1609 };\ | |
| 1610 template <typename F> operator ::testing::Action<F>() const {\ | |
| 1611 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\ | |
| 1612 }\ | |
| 1613 p0##_type p0;\ | |
| 1614 p1##_type p1;\ | |
| 1615 p2##_type p2;\ | |
| 1616 };\ | |
| 1617 template <typename p0##_type, typename p1##_type, typename p2##_type>\ | |
| 1618 inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \ | |
| 1619 p1##_type p1, p2##_type p2) {\ | |
| 1620 return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\ | |
| 1621 }\ | |
| 1622 template <typename p0##_type, typename p1##_type, typename p2##_type>\ | |
| 1623 template <typename F>\ | |
| 1624 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1625 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1626 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1627 typename arg9_type>\ | |
| 1628 typename ::testing::internal::Function<F>::Result\ | |
| 1629 name##ActionP3<p0##_type, p1##_type, \ | |
| 1630 p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| 1631 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 1632 | |
| 1633 #define ACTION_P4(name, p0, p1, p2, p3)\ | |
| 1634 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1635 typename p3##_type>\ | |
| 1636 class name##ActionP4 {\ | |
| 1637 public:\ | |
| 1638 name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \ | |
| 1639 p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ | |
| 1640 p2(gmock_p2), p3(gmock_p3) {}\ | |
| 1641 template <typename F>\ | |
| 1642 class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| 1643 public:\ | |
| 1644 typedef F function_type;\ | |
| 1645 typedef typename ::testing::internal::Function<F>::Result return_type;\ | |
| 1646 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| 1647 args_type;\ | |
| 1648 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 1649 p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 1650 p3(gmock_p3) {}\ | |
| 1651 virtual return_type Perform(const args_type& args) {\ | |
| 1652 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ | |
| 1653 Perform(this, args);\ | |
| 1654 }\ | |
| 1655 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1656 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1657 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1658 typename arg9_type>\ | |
| 1659 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ | |
| 1660 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ | |
| 1661 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ | |
| 1662 arg9_type arg9) const;\ | |
| 1663 p0##_type p0;\ | |
| 1664 p1##_type p1;\ | |
| 1665 p2##_type p2;\ | |
| 1666 p3##_type p3;\ | |
| 1667 };\ | |
| 1668 template <typename F> operator ::testing::Action<F>() const {\ | |
| 1669 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\ | |
| 1670 }\ | |
| 1671 p0##_type p0;\ | |
| 1672 p1##_type p1;\ | |
| 1673 p2##_type p2;\ | |
| 1674 p3##_type p3;\ | |
| 1675 };\ | |
| 1676 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1677 typename p3##_type>\ | |
| 1678 inline name##ActionP4<p0##_type, p1##_type, p2##_type, \ | |
| 1679 p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ | |
| 1680 p3##_type p3) {\ | |
| 1681 return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \ | |
| 1682 p2, p3);\ | |
| 1683 }\ | |
| 1684 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1685 typename p3##_type>\ | |
| 1686 template <typename F>\ | |
| 1687 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1688 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1689 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1690 typename arg9_type>\ | |
| 1691 typename ::testing::internal::Function<F>::Result\ | |
| 1692 name##ActionP4<p0##_type, p1##_type, p2##_type, \ | |
| 1693 p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| 1694 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 1695 | |
| 1696 #define ACTION_P5(name, p0, p1, p2, p3, p4)\ | |
| 1697 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1698 typename p3##_type, typename p4##_type>\ | |
| 1699 class name##ActionP5 {\ | |
| 1700 public:\ | |
| 1701 name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \ | |
| 1702 p2##_type gmock_p2, p3##_type gmock_p3, \ | |
| 1703 p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 1704 p3(gmock_p3), p4(gmock_p4) {}\ | |
| 1705 template <typename F>\ | |
| 1706 class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| 1707 public:\ | |
| 1708 typedef F function_type;\ | |
| 1709 typedef typename ::testing::internal::Function<F>::Result return_type;\ | |
| 1710 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| 1711 args_type;\ | |
| 1712 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 1713 p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \ | |
| 1714 p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\ | |
| 1715 virtual return_type Perform(const args_type& args) {\ | |
| 1716 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ | |
| 1717 Perform(this, args);\ | |
| 1718 }\ | |
| 1719 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1720 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1721 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1722 typename arg9_type>\ | |
| 1723 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ | |
| 1724 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ | |
| 1725 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ | |
| 1726 arg9_type arg9) const;\ | |
| 1727 p0##_type p0;\ | |
| 1728 p1##_type p1;\ | |
| 1729 p2##_type p2;\ | |
| 1730 p3##_type p3;\ | |
| 1731 p4##_type p4;\ | |
| 1732 };\ | |
| 1733 template <typename F> operator ::testing::Action<F>() const {\ | |
| 1734 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\ | |
| 1735 }\ | |
| 1736 p0##_type p0;\ | |
| 1737 p1##_type p1;\ | |
| 1738 p2##_type p2;\ | |
| 1739 p3##_type p3;\ | |
| 1740 p4##_type p4;\ | |
| 1741 };\ | |
| 1742 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1743 typename p3##_type, typename p4##_type>\ | |
| 1744 inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 1745 p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ | |
| 1746 p4##_type p4) {\ | |
| 1747 return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 1748 p4##_type>(p0, p1, p2, p3, p4);\ | |
| 1749 }\ | |
| 1750 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1751 typename p3##_type, typename p4##_type>\ | |
| 1752 template <typename F>\ | |
| 1753 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1754 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1755 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1756 typename arg9_type>\ | |
| 1757 typename ::testing::internal::Function<F>::Result\ | |
| 1758 name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 1759 p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| 1760 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 1761 | |
| 1762 #define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\ | |
| 1763 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1764 typename p3##_type, typename p4##_type, typename p5##_type>\ | |
| 1765 class name##ActionP6 {\ | |
| 1766 public:\ | |
| 1767 name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \ | |
| 1768 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ | |
| 1769 p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 1770 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ | |
| 1771 template <typename F>\ | |
| 1772 class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| 1773 public:\ | |
| 1774 typedef F function_type;\ | |
| 1775 typedef typename ::testing::internal::Function<F>::Result return_type;\ | |
| 1776 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| 1777 args_type;\ | |
| 1778 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 1779 p3##_type gmock_p3, p4##_type gmock_p4, \ | |
| 1780 p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 1781 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ | |
| 1782 virtual return_type Perform(const args_type& args) {\ | |
| 1783 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ | |
| 1784 Perform(this, args);\ | |
| 1785 }\ | |
| 1786 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1787 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1788 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1789 typename arg9_type>\ | |
| 1790 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ | |
| 1791 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ | |
| 1792 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ | |
| 1793 arg9_type arg9) const;\ | |
| 1794 p0##_type p0;\ | |
| 1795 p1##_type p1;\ | |
| 1796 p2##_type p2;\ | |
| 1797 p3##_type p3;\ | |
| 1798 p4##_type p4;\ | |
| 1799 p5##_type p5;\ | |
| 1800 };\ | |
| 1801 template <typename F> operator ::testing::Action<F>() const {\ | |
| 1802 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\ | |
| 1803 }\ | |
| 1804 p0##_type p0;\ | |
| 1805 p1##_type p1;\ | |
| 1806 p2##_type p2;\ | |
| 1807 p3##_type p3;\ | |
| 1808 p4##_type p4;\ | |
| 1809 p5##_type p5;\ | |
| 1810 };\ | |
| 1811 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1812 typename p3##_type, typename p4##_type, typename p5##_type>\ | |
| 1813 inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 1814 p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ | |
| 1815 p3##_type p3, p4##_type p4, p5##_type p5) {\ | |
| 1816 return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 1817 p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\ | |
| 1818 }\ | |
| 1819 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1820 typename p3##_type, typename p4##_type, typename p5##_type>\ | |
| 1821 template <typename F>\ | |
| 1822 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1823 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1824 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1825 typename arg9_type>\ | |
| 1826 typename ::testing::internal::Function<F>::Result\ | |
| 1827 name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ | |
| 1828 p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| 1829 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 1830 | |
| 1831 #define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\ | |
| 1832 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1833 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 1834 typename p6##_type>\ | |
| 1835 class name##ActionP7 {\ | |
| 1836 public:\ | |
| 1837 name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \ | |
| 1838 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ | |
| 1839 p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ | |
| 1840 p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ | |
| 1841 p6(gmock_p6) {}\ | |
| 1842 template <typename F>\ | |
| 1843 class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| 1844 public:\ | |
| 1845 typedef F function_type;\ | |
| 1846 typedef typename ::testing::internal::Function<F>::Result return_type;\ | |
| 1847 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| 1848 args_type;\ | |
| 1849 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 1850 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ | |
| 1851 p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 1852 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ | |
| 1853 virtual return_type Perform(const args_type& args) {\ | |
| 1854 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ | |
| 1855 Perform(this, args);\ | |
| 1856 }\ | |
| 1857 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1858 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1859 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1860 typename arg9_type>\ | |
| 1861 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ | |
| 1862 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ | |
| 1863 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ | |
| 1864 arg9_type arg9) const;\ | |
| 1865 p0##_type p0;\ | |
| 1866 p1##_type p1;\ | |
| 1867 p2##_type p2;\ | |
| 1868 p3##_type p3;\ | |
| 1869 p4##_type p4;\ | |
| 1870 p5##_type p5;\ | |
| 1871 p6##_type p6;\ | |
| 1872 };\ | |
| 1873 template <typename F> operator ::testing::Action<F>() const {\ | |
| 1874 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ | |
| 1875 p6));\ | |
| 1876 }\ | |
| 1877 p0##_type p0;\ | |
| 1878 p1##_type p1;\ | |
| 1879 p2##_type p2;\ | |
| 1880 p3##_type p3;\ | |
| 1881 p4##_type p4;\ | |
| 1882 p5##_type p5;\ | |
| 1883 p6##_type p6;\ | |
| 1884 };\ | |
| 1885 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1886 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 1887 typename p6##_type>\ | |
| 1888 inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 1889 p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \ | |
| 1890 p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ | |
| 1891 p6##_type p6) {\ | |
| 1892 return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 1893 p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\ | |
| 1894 }\ | |
| 1895 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1896 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 1897 typename p6##_type>\ | |
| 1898 template <typename F>\ | |
| 1899 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1900 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1901 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1902 typename arg9_type>\ | |
| 1903 typename ::testing::internal::Function<F>::Result\ | |
| 1904 name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ | |
| 1905 p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| 1906 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 1907 | |
| 1908 #define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\ | |
| 1909 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1910 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 1911 typename p6##_type, typename p7##_type>\ | |
| 1912 class name##ActionP8 {\ | |
| 1913 public:\ | |
| 1914 name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \ | |
| 1915 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ | |
| 1916 p5##_type gmock_p5, p6##_type gmock_p6, \ | |
| 1917 p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 1918 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ | |
| 1919 p7(gmock_p7) {}\ | |
| 1920 template <typename F>\ | |
| 1921 class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| 1922 public:\ | |
| 1923 typedef F function_type;\ | |
| 1924 typedef typename ::testing::internal::Function<F>::Result return_type;\ | |
| 1925 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| 1926 args_type;\ | |
| 1927 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 1928 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ | |
| 1929 p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \ | |
| 1930 p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \ | |
| 1931 p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ | |
| 1932 virtual return_type Perform(const args_type& args) {\ | |
| 1933 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ | |
| 1934 Perform(this, args);\ | |
| 1935 }\ | |
| 1936 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1937 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1938 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1939 typename arg9_type>\ | |
| 1940 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ | |
| 1941 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ | |
| 1942 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ | |
| 1943 arg9_type arg9) const;\ | |
| 1944 p0##_type p0;\ | |
| 1945 p1##_type p1;\ | |
| 1946 p2##_type p2;\ | |
| 1947 p3##_type p3;\ | |
| 1948 p4##_type p4;\ | |
| 1949 p5##_type p5;\ | |
| 1950 p6##_type p6;\ | |
| 1951 p7##_type p7;\ | |
| 1952 };\ | |
| 1953 template <typename F> operator ::testing::Action<F>() const {\ | |
| 1954 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ | |
| 1955 p6, p7));\ | |
| 1956 }\ | |
| 1957 p0##_type p0;\ | |
| 1958 p1##_type p1;\ | |
| 1959 p2##_type p2;\ | |
| 1960 p3##_type p3;\ | |
| 1961 p4##_type p4;\ | |
| 1962 p5##_type p5;\ | |
| 1963 p6##_type p6;\ | |
| 1964 p7##_type p7;\ | |
| 1965 };\ | |
| 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 inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 1970 p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \ | |
| 1971 p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ | |
| 1972 p6##_type p6, p7##_type p7) {\ | |
| 1973 return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 1974 p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \ | |
| 1975 p6, p7);\ | |
| 1976 }\ | |
| 1977 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1978 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 1979 typename p6##_type, typename p7##_type>\ | |
| 1980 template <typename F>\ | |
| 1981 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 1982 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 1983 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 1984 typename arg9_type>\ | |
| 1985 typename ::testing::internal::Function<F>::Result\ | |
| 1986 name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ | |
| 1987 p5##_type, p6##_type, \ | |
| 1988 p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| 1989 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 1990 | |
| 1991 #define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\ | |
| 1992 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 1993 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 1994 typename p6##_type, typename p7##_type, typename p8##_type>\ | |
| 1995 class name##ActionP9 {\ | |
| 1996 public:\ | |
| 1997 name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \ | |
| 1998 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ | |
| 1999 p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ | |
| 2000 p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 2001 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ | |
| 2002 p8(gmock_p8) {}\ | |
| 2003 template <typename F>\ | |
| 2004 class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| 2005 public:\ | |
| 2006 typedef F function_type;\ | |
| 2007 typedef typename ::testing::internal::Function<F>::Result return_type;\ | |
| 2008 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| 2009 args_type;\ | |
| 2010 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 2011 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ | |
| 2012 p6##_type gmock_p6, p7##_type gmock_p7, \ | |
| 2013 p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 2014 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ | |
| 2015 p7(gmock_p7), p8(gmock_p8) {}\ | |
| 2016 virtual return_type Perform(const args_type& args) {\ | |
| 2017 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ | |
| 2018 Perform(this, args);\ | |
| 2019 }\ | |
| 2020 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 2021 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 2022 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 2023 typename arg9_type>\ | |
| 2024 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ | |
| 2025 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ | |
| 2026 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ | |
| 2027 arg9_type arg9) const;\ | |
| 2028 p0##_type p0;\ | |
| 2029 p1##_type p1;\ | |
| 2030 p2##_type p2;\ | |
| 2031 p3##_type p3;\ | |
| 2032 p4##_type p4;\ | |
| 2033 p5##_type p5;\ | |
| 2034 p6##_type p6;\ | |
| 2035 p7##_type p7;\ | |
| 2036 p8##_type p8;\ | |
| 2037 };\ | |
| 2038 template <typename F> operator ::testing::Action<F>() const {\ | |
| 2039 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ | |
| 2040 p6, p7, p8));\ | |
| 2041 }\ | |
| 2042 p0##_type p0;\ | |
| 2043 p1##_type p1;\ | |
| 2044 p2##_type p2;\ | |
| 2045 p3##_type p3;\ | |
| 2046 p4##_type p4;\ | |
| 2047 p5##_type p5;\ | |
| 2048 p6##_type p6;\ | |
| 2049 p7##_type p7;\ | |
| 2050 p8##_type p8;\ | |
| 2051 };\ | |
| 2052 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 2053 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 2054 typename p6##_type, typename p7##_type, typename p8##_type>\ | |
| 2055 inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 2056 p4##_type, p5##_type, p6##_type, p7##_type, \ | |
| 2057 p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ | |
| 2058 p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \ | |
| 2059 p8##_type p8) {\ | |
| 2060 return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 2061 p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \ | |
| 2062 p3, p4, p5, p6, p7, p8);\ | |
| 2063 }\ | |
| 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 template <typename F>\ | |
| 2068 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 2069 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 2070 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 2071 typename arg9_type>\ | |
| 2072 typename ::testing::internal::Function<F>::Result\ | |
| 2073 name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ | |
| 2074 p5##_type, p6##_type, p7##_type, \ | |
| 2075 p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| 2076 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 2077 | |
| 2078 #define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\ | |
| 2079 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 2080 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 2081 typename p6##_type, typename p7##_type, typename p8##_type, \ | |
| 2082 typename p9##_type>\ | |
| 2083 class name##ActionP10 {\ | |
| 2084 public:\ | |
| 2085 name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \ | |
| 2086 p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ | |
| 2087 p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ | |
| 2088 p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ | |
| 2089 p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ | |
| 2090 p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ | |
| 2091 template <typename F>\ | |
| 2092 class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| 2093 public:\ | |
| 2094 typedef F function_type;\ | |
| 2095 typedef typename ::testing::internal::Function<F>::Result return_type;\ | |
| 2096 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| 2097 args_type;\ | |
| 2098 gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| 2099 p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ | |
| 2100 p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ | |
| 2101 p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| 2102 p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ | |
| 2103 p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ | |
| 2104 virtual return_type Perform(const args_type& args) {\ | |
| 2105 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ | |
| 2106 Perform(this, args);\ | |
| 2107 }\ | |
| 2108 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 2109 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 2110 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 2111 typename arg9_type>\ | |
| 2112 return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ | |
| 2113 arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ | |
| 2114 arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ | |
| 2115 arg9_type arg9) const;\ | |
| 2116 p0##_type p0;\ | |
| 2117 p1##_type p1;\ | |
| 2118 p2##_type p2;\ | |
| 2119 p3##_type p3;\ | |
| 2120 p4##_type p4;\ | |
| 2121 p5##_type p5;\ | |
| 2122 p6##_type p6;\ | |
| 2123 p7##_type p7;\ | |
| 2124 p8##_type p8;\ | |
| 2125 p9##_type p9;\ | |
| 2126 };\ | |
| 2127 template <typename F> operator ::testing::Action<F>() const {\ | |
| 2128 return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ | |
| 2129 p6, p7, p8, p9));\ | |
| 2130 }\ | |
| 2131 p0##_type p0;\ | |
| 2132 p1##_type p1;\ | |
| 2133 p2##_type p2;\ | |
| 2134 p3##_type p3;\ | |
| 2135 p4##_type p4;\ | |
| 2136 p5##_type p5;\ | |
| 2137 p6##_type p6;\ | |
| 2138 p7##_type p7;\ | |
| 2139 p8##_type p8;\ | |
| 2140 p9##_type p9;\ | |
| 2141 };\ | |
| 2142 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 2143 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 2144 typename p6##_type, typename p7##_type, typename p8##_type, \ | |
| 2145 typename p9##_type>\ | |
| 2146 inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 2147 p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ | |
| 2148 p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ | |
| 2149 p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ | |
| 2150 p9##_type p9) {\ | |
| 2151 return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| 2152 p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \ | |
| 2153 p1, p2, p3, p4, p5, p6, p7, p8, p9);\ | |
| 2154 }\ | |
| 2155 template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| 2156 typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| 2157 typename p6##_type, typename p7##_type, typename p8##_type, \ | |
| 2158 typename p9##_type>\ | |
| 2159 template <typename F>\ | |
| 2160 template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| 2161 typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| 2162 typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| 2163 typename arg9_type>\ | |
| 2164 typename ::testing::internal::Function<F>::Result\ | |
| 2165 name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ | |
| 2166 p5##_type, p6##_type, p7##_type, p8##_type, \ | |
| 2167 p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| 2168 GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 2169 | |
| 2170 // TODO(wan@google.com): move the following to a different .h file | |
| 2171 // such that we don't have to run 'pump' every time the code is | |
| 2172 // updated. | |
| 2173 namespace testing { | |
| 2174 | |
| 2175 // Various overloads for InvokeArgument<N>(). | |
| 2176 // | |
| 2177 // The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th | |
| 2178 // (0-based) argument, which must be a k-ary callable, of the mock | |
| 2179 // function, with arguments a1, a2, ..., a_k. | |
| 2180 // | |
| 2181 // Notes: | |
| 2182 // | |
| 2183 // 1. The arguments are passed by value by default. If you need to | |
| 2184 // pass an argument by reference, wrap it inside ByRef(). For | |
| 2185 // example, | |
| 2186 // | |
| 2187 // InvokeArgument<1>(5, string("Hello"), ByRef(foo)) | |
| 2188 // | |
| 2189 // passes 5 and string("Hello") by value, and passes foo by | |
| 2190 // reference. | |
| 2191 // | |
| 2192 // 2. If the callable takes an argument by reference but ByRef() is | |
| 2193 // not used, it will receive the reference to a copy of the value, | |
| 2194 // instead of the original value. For example, when the 0-th | |
| 2195 // argument of the mock function takes a const string&, the action | |
| 2196 // | |
| 2197 // InvokeArgument<0>(string("Hello")) | |
| 2198 // | |
| 2199 // makes a copy of the temporary string("Hello") object and passes a | |
| 2200 // reference of the copy, instead of the original temporary object, | |
| 2201 // to the callable. This makes it easy for a user to define an | |
| 2202 // InvokeArgument action from temporary values and have it performed | |
| 2203 // later. | |
| 2204 | |
| 2205 ACTION_TEMPLATE(InvokeArgument, | |
| 2206 HAS_1_TEMPLATE_PARAMS(int, k), | |
| 2207 AND_0_VALUE_PARAMS()) { | |
| 2208 return internal::CallableHelper<return_type>::Call( | |
| 2209 ::std::tr1::get<k>(args)); | |
| 2210 } | |
| 2211 | |
| 2212 ACTION_TEMPLATE(InvokeArgument, | |
| 2213 HAS_1_TEMPLATE_PARAMS(int, k), | |
| 2214 AND_1_VALUE_PARAMS(p0)) { | |
| 2215 return internal::CallableHelper<return_type>::Call( | |
| 2216 ::std::tr1::get<k>(args), p0); | |
| 2217 } | |
| 2218 | |
| 2219 ACTION_TEMPLATE(InvokeArgument, | |
| 2220 HAS_1_TEMPLATE_PARAMS(int, k), | |
| 2221 AND_2_VALUE_PARAMS(p0, p1)) { | |
| 2222 return internal::CallableHelper<return_type>::Call( | |
| 2223 ::std::tr1::get<k>(args), p0, p1); | |
| 2224 } | |
| 2225 | |
| 2226 ACTION_TEMPLATE(InvokeArgument, | |
| 2227 HAS_1_TEMPLATE_PARAMS(int, k), | |
| 2228 AND_3_VALUE_PARAMS(p0, p1, p2)) { | |
| 2229 return internal::CallableHelper<return_type>::Call( | |
| 2230 ::std::tr1::get<k>(args), p0, p1, p2); | |
| 2231 } | |
| 2232 | |
| 2233 ACTION_TEMPLATE(InvokeArgument, | |
| 2234 HAS_1_TEMPLATE_PARAMS(int, k), | |
| 2235 AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { | |
| 2236 return internal::CallableHelper<return_type>::Call( | |
| 2237 ::std::tr1::get<k>(args), p0, p1, p2, p3); | |
| 2238 } | |
| 2239 | |
| 2240 ACTION_TEMPLATE(InvokeArgument, | |
| 2241 HAS_1_TEMPLATE_PARAMS(int, k), | |
| 2242 AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { | |
| 2243 return internal::CallableHelper<return_type>::Call( | |
| 2244 ::std::tr1::get<k>(args), p0, p1, p2, p3, p4); | |
| 2245 } | |
| 2246 | |
| 2247 ACTION_TEMPLATE(InvokeArgument, | |
| 2248 HAS_1_TEMPLATE_PARAMS(int, k), | |
| 2249 AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { | |
| 2250 return internal::CallableHelper<return_type>::Call( | |
| 2251 ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5); | |
| 2252 } | |
| 2253 | |
| 2254 ACTION_TEMPLATE(InvokeArgument, | |
| 2255 HAS_1_TEMPLATE_PARAMS(int, k), | |
| 2256 AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { | |
| 2257 return internal::CallableHelper<return_type>::Call( | |
| 2258 ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6); | |
| 2259 } | |
| 2260 | |
| 2261 ACTION_TEMPLATE(InvokeArgument, | |
| 2262 HAS_1_TEMPLATE_PARAMS(int, k), | |
| 2263 AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { | |
| 2264 return internal::CallableHelper<return_type>::Call( | |
| 2265 ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7); | |
| 2266 } | |
| 2267 | |
| 2268 ACTION_TEMPLATE(InvokeArgument, | |
| 2269 HAS_1_TEMPLATE_PARAMS(int, k), | |
| 2270 AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { | |
| 2271 return internal::CallableHelper<return_type>::Call( | |
| 2272 ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8); | |
| 2273 } | |
| 2274 | |
| 2275 ACTION_TEMPLATE(InvokeArgument, | |
| 2276 HAS_1_TEMPLATE_PARAMS(int, k), | |
| 2277 AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { | |
| 2278 return internal::CallableHelper<return_type>::Call( | |
| 2279 ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); | |
| 2280 } | |
| 2281 | |
| 2282 // Various overloads for ReturnNew<T>(). | |
| 2283 // | |
| 2284 // The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new | |
| 2285 // instance of type T, constructed on the heap with constructor arguments | |
| 2286 // a1, a2, ..., and a_k. The caller assumes ownership of the returned value. | |
| 2287 ACTION_TEMPLATE(ReturnNew, | |
| 2288 HAS_1_TEMPLATE_PARAMS(typename, T), | |
| 2289 AND_0_VALUE_PARAMS()) { | |
| 2290 return new T(); | |
| 2291 } | |
| 2292 | |
| 2293 ACTION_TEMPLATE(ReturnNew, | |
| 2294 HAS_1_TEMPLATE_PARAMS(typename, T), | |
| 2295 AND_1_VALUE_PARAMS(p0)) { | |
| 2296 return new T(p0); | |
| 2297 } | |
| 2298 | |
| 2299 ACTION_TEMPLATE(ReturnNew, | |
| 2300 HAS_1_TEMPLATE_PARAMS(typename, T), | |
| 2301 AND_2_VALUE_PARAMS(p0, p1)) { | |
| 2302 return new T(p0, p1); | |
| 2303 } | |
| 2304 | |
| 2305 ACTION_TEMPLATE(ReturnNew, | |
| 2306 HAS_1_TEMPLATE_PARAMS(typename, T), | |
| 2307 AND_3_VALUE_PARAMS(p0, p1, p2)) { | |
| 2308 return new T(p0, p1, p2); | |
| 2309 } | |
| 2310 | |
| 2311 ACTION_TEMPLATE(ReturnNew, | |
| 2312 HAS_1_TEMPLATE_PARAMS(typename, T), | |
| 2313 AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { | |
| 2314 return new T(p0, p1, p2, p3); | |
| 2315 } | |
| 2316 | |
| 2317 ACTION_TEMPLATE(ReturnNew, | |
| 2318 HAS_1_TEMPLATE_PARAMS(typename, T), | |
| 2319 AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { | |
| 2320 return new T(p0, p1, p2, p3, p4); | |
| 2321 } | |
| 2322 | |
| 2323 ACTION_TEMPLATE(ReturnNew, | |
| 2324 HAS_1_TEMPLATE_PARAMS(typename, T), | |
| 2325 AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { | |
| 2326 return new T(p0, p1, p2, p3, p4, p5); | |
| 2327 } | |
| 2328 | |
| 2329 ACTION_TEMPLATE(ReturnNew, | |
| 2330 HAS_1_TEMPLATE_PARAMS(typename, T), | |
| 2331 AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { | |
| 2332 return new T(p0, p1, p2, p3, p4, p5, p6); | |
| 2333 } | |
| 2334 | |
| 2335 ACTION_TEMPLATE(ReturnNew, | |
| 2336 HAS_1_TEMPLATE_PARAMS(typename, T), | |
| 2337 AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { | |
| 2338 return new T(p0, p1, p2, p3, p4, p5, p6, p7); | |
| 2339 } | |
| 2340 | |
| 2341 ACTION_TEMPLATE(ReturnNew, | |
| 2342 HAS_1_TEMPLATE_PARAMS(typename, T), | |
| 2343 AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { | |
| 2344 return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8); | |
| 2345 } | |
| 2346 | |
| 2347 ACTION_TEMPLATE(ReturnNew, | |
| 2348 HAS_1_TEMPLATE_PARAMS(typename, T), | |
| 2349 AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { | |
| 2350 return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); | |
| 2351 } | |
| 2352 | |
| 2353 } // namespace testing | |
| 2354 | |
| 2355 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ | |
| OLD | NEW |