[9021] | 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 | GTEST_DISALLOW_ASSIGN_(WithArgsAction); |
---|
| 620 | }; |
---|
| 621 | |
---|
| 622 | // A macro from the ACTION* family (defined later in this file) |
---|
| 623 | // defines an action that can be used in a mock function. Typically, |
---|
| 624 | // these actions only care about a subset of the arguments of the mock |
---|
| 625 | // function. For example, if such an action only uses the second |
---|
| 626 | // argument, it can be used in any mock function that takes >= 2 |
---|
| 627 | // arguments where the type of the second argument is compatible. |
---|
| 628 | // |
---|
| 629 | // Therefore, the action implementation must be prepared to take more |
---|
| 630 | // arguments than it needs. The ExcessiveArg type is used to |
---|
| 631 | // represent those excessive arguments. In order to keep the compiler |
---|
| 632 | // error messages tractable, we define it in the testing namespace |
---|
| 633 | // instead of testing::internal. However, this is an INTERNAL TYPE |
---|
| 634 | // and subject to change without notice, so a user MUST NOT USE THIS |
---|
| 635 | // TYPE DIRECTLY. |
---|
| 636 | struct ExcessiveArg {}; |
---|
| 637 | |
---|
| 638 | // A helper class needed for implementing the ACTION* macros. |
---|
| 639 | template <typename Result, class Impl> |
---|
| 640 | class ActionHelper { |
---|
| 641 | public: |
---|
| 642 | static Result Perform(Impl* impl, const ::std::tr1::tuple<>& args) { |
---|
| 643 | using ::std::tr1::get; |
---|
| 644 | return impl->template gmock_PerformImpl<>(args, ExcessiveArg(), |
---|
| 645 | ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
---|
| 646 | ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
---|
| 647 | ExcessiveArg()); |
---|
| 648 | } |
---|
| 649 | |
---|
| 650 | template <typename A0> |
---|
| 651 | static Result Perform(Impl* impl, const ::std::tr1::tuple<A0>& args) { |
---|
| 652 | using ::std::tr1::get; |
---|
| 653 | return impl->template gmock_PerformImpl<A0>(args, get<0>(args), |
---|
| 654 | ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
---|
| 655 | ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
---|
| 656 | ExcessiveArg()); |
---|
| 657 | } |
---|
| 658 | |
---|
| 659 | template <typename A0, typename A1> |
---|
| 660 | static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1>& args) { |
---|
| 661 | using ::std::tr1::get; |
---|
| 662 | return impl->template gmock_PerformImpl<A0, A1>(args, get<0>(args), |
---|
| 663 | get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
---|
| 664 | ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
---|
| 665 | ExcessiveArg()); |
---|
| 666 | } |
---|
| 667 | |
---|
| 668 | template <typename A0, typename A1, typename A2> |
---|
| 669 | static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2>& args) { |
---|
| 670 | using ::std::tr1::get; |
---|
| 671 | return impl->template gmock_PerformImpl<A0, A1, A2>(args, get<0>(args), |
---|
| 672 | get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(), |
---|
| 673 | ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
---|
| 674 | ExcessiveArg()); |
---|
| 675 | } |
---|
| 676 | |
---|
| 677 | template <typename A0, typename A1, typename A2, typename A3> |
---|
| 678 | static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, |
---|
| 679 | A3>& args) { |
---|
| 680 | using ::std::tr1::get; |
---|
| 681 | return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, get<0>(args), |
---|
| 682 | get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(), |
---|
| 683 | ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
---|
| 684 | ExcessiveArg()); |
---|
| 685 | } |
---|
| 686 | |
---|
| 687 | template <typename A0, typename A1, typename A2, typename A3, typename A4> |
---|
| 688 | static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, |
---|
| 689 | A4>& args) { |
---|
| 690 | using ::std::tr1::get; |
---|
| 691 | return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args, |
---|
| 692 | get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), |
---|
| 693 | ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
---|
| 694 | ExcessiveArg()); |
---|
| 695 | } |
---|
| 696 | |
---|
| 697 | template <typename A0, typename A1, typename A2, typename A3, typename A4, |
---|
| 698 | typename A5> |
---|
| 699 | static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, |
---|
| 700 | A5>& args) { |
---|
| 701 | using ::std::tr1::get; |
---|
| 702 | return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args, |
---|
| 703 | get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), |
---|
| 704 | get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
---|
| 705 | ExcessiveArg()); |
---|
| 706 | } |
---|
| 707 | |
---|
| 708 | template <typename A0, typename A1, typename A2, typename A3, typename A4, |
---|
| 709 | typename A5, typename A6> |
---|
| 710 | static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, |
---|
| 711 | A5, A6>& args) { |
---|
| 712 | using ::std::tr1::get; |
---|
| 713 | return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args, |
---|
| 714 | get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), |
---|
| 715 | get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(), |
---|
| 716 | ExcessiveArg()); |
---|
| 717 | } |
---|
| 718 | |
---|
| 719 | template <typename A0, typename A1, typename A2, typename A3, typename A4, |
---|
| 720 | typename A5, typename A6, typename A7> |
---|
| 721 | static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, |
---|
| 722 | A5, A6, A7>& args) { |
---|
| 723 | using ::std::tr1::get; |
---|
| 724 | return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, |
---|
| 725 | A7>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), |
---|
| 726 | get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(), |
---|
| 727 | ExcessiveArg()); |
---|
| 728 | } |
---|
| 729 | |
---|
| 730 | template <typename A0, typename A1, typename A2, typename A3, typename A4, |
---|
| 731 | typename A5, typename A6, typename A7, typename A8> |
---|
| 732 | static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, |
---|
| 733 | A5, A6, A7, A8>& args) { |
---|
| 734 | using ::std::tr1::get; |
---|
| 735 | return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, |
---|
| 736 | A8>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), |
---|
| 737 | get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), |
---|
| 738 | ExcessiveArg()); |
---|
| 739 | } |
---|
| 740 | |
---|
| 741 | template <typename A0, typename A1, typename A2, typename A3, typename A4, |
---|
| 742 | typename A5, typename A6, typename A7, typename A8, typename A9> |
---|
| 743 | static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, |
---|
| 744 | A5, A6, A7, A8, A9>& args) { |
---|
| 745 | using ::std::tr1::get; |
---|
| 746 | return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8, |
---|
| 747 | A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), |
---|
| 748 | get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), |
---|
| 749 | get<9>(args)); |
---|
| 750 | } |
---|
| 751 | }; |
---|
| 752 | |
---|
| 753 | } // namespace internal |
---|
| 754 | |
---|
| 755 | // Various overloads for Invoke(). |
---|
| 756 | |
---|
| 757 | // WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes |
---|
| 758 | // the selected arguments of the mock function to an_action and |
---|
| 759 | // performs it. It serves as an adaptor between actions with |
---|
| 760 | // different argument lists. C++ doesn't support default arguments for |
---|
| 761 | // function templates, so we have to overload it. |
---|
| 762 | template <int k1, typename InnerAction> |
---|
| 763 | inline internal::WithArgsAction<InnerAction, k1> |
---|
| 764 | WithArgs(const InnerAction& action) { |
---|
| 765 | return internal::WithArgsAction<InnerAction, k1>(action); |
---|
| 766 | } |
---|
| 767 | |
---|
| 768 | template <int k1, int k2, typename InnerAction> |
---|
| 769 | inline internal::WithArgsAction<InnerAction, k1, k2> |
---|
| 770 | WithArgs(const InnerAction& action) { |
---|
| 771 | return internal::WithArgsAction<InnerAction, k1, k2>(action); |
---|
| 772 | } |
---|
| 773 | |
---|
| 774 | template <int k1, int k2, int k3, typename InnerAction> |
---|
| 775 | inline internal::WithArgsAction<InnerAction, k1, k2, k3> |
---|
| 776 | WithArgs(const InnerAction& action) { |
---|
| 777 | return internal::WithArgsAction<InnerAction, k1, k2, k3>(action); |
---|
| 778 | } |
---|
| 779 | |
---|
| 780 | template <int k1, int k2, int k3, int k4, typename InnerAction> |
---|
| 781 | inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4> |
---|
| 782 | WithArgs(const InnerAction& action) { |
---|
| 783 | return internal::WithArgsAction<InnerAction, k1, k2, k3, k4>(action); |
---|
| 784 | } |
---|
| 785 | |
---|
| 786 | template <int k1, int k2, int k3, int k4, int k5, typename InnerAction> |
---|
| 787 | inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5> |
---|
| 788 | WithArgs(const InnerAction& action) { |
---|
| 789 | return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>(action); |
---|
| 790 | } |
---|
| 791 | |
---|
| 792 | template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerAction> |
---|
| 793 | inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6> |
---|
| 794 | WithArgs(const InnerAction& action) { |
---|
| 795 | return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>(action); |
---|
| 796 | } |
---|
| 797 | |
---|
| 798 | template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, |
---|
| 799 | typename InnerAction> |
---|
| 800 | inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7> |
---|
| 801 | WithArgs(const InnerAction& action) { |
---|
| 802 | return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, |
---|
| 803 | k7>(action); |
---|
| 804 | } |
---|
| 805 | |
---|
| 806 | template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, |
---|
| 807 | typename InnerAction> |
---|
| 808 | inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8> |
---|
| 809 | WithArgs(const InnerAction& action) { |
---|
| 810 | return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, |
---|
| 811 | k8>(action); |
---|
| 812 | } |
---|
| 813 | |
---|
| 814 | template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, |
---|
| 815 | int k9, typename InnerAction> |
---|
| 816 | inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, k9> |
---|
| 817 | WithArgs(const InnerAction& action) { |
---|
| 818 | return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, |
---|
| 819 | k9>(action); |
---|
| 820 | } |
---|
| 821 | |
---|
| 822 | template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, |
---|
| 823 | int k9, int k10, typename InnerAction> |
---|
| 824 | inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, |
---|
| 825 | k9, k10> |
---|
| 826 | WithArgs(const InnerAction& action) { |
---|
| 827 | return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, |
---|
| 828 | k9, k10>(action); |
---|
| 829 | } |
---|
| 830 | |
---|
| 831 | // Creates an action that does actions a1, a2, ..., sequentially in |
---|
| 832 | // each invocation. |
---|
| 833 | template <typename Action1, typename Action2> |
---|
| 834 | inline internal::DoBothAction<Action1, Action2> |
---|
| 835 | DoAll(Action1 a1, Action2 a2) { |
---|
| 836 | return internal::DoBothAction<Action1, Action2>(a1, a2); |
---|
| 837 | } |
---|
| 838 | |
---|
| 839 | template <typename Action1, typename Action2, typename Action3> |
---|
| 840 | inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
---|
| 841 | Action3> > |
---|
| 842 | DoAll(Action1 a1, Action2 a2, Action3 a3) { |
---|
| 843 | return DoAll(a1, DoAll(a2, a3)); |
---|
| 844 | } |
---|
| 845 | |
---|
| 846 | template <typename Action1, typename Action2, typename Action3, |
---|
| 847 | typename Action4> |
---|
| 848 | inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
---|
| 849 | internal::DoBothAction<Action3, Action4> > > |
---|
| 850 | DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) { |
---|
| 851 | return DoAll(a1, DoAll(a2, a3, a4)); |
---|
| 852 | } |
---|
| 853 | |
---|
| 854 | template <typename Action1, typename Action2, typename Action3, |
---|
| 855 | typename Action4, typename Action5> |
---|
| 856 | inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
---|
| 857 | internal::DoBothAction<Action3, internal::DoBothAction<Action4, |
---|
| 858 | Action5> > > > |
---|
| 859 | DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) { |
---|
| 860 | return DoAll(a1, DoAll(a2, a3, a4, a5)); |
---|
| 861 | } |
---|
| 862 | |
---|
| 863 | template <typename Action1, typename Action2, typename Action3, |
---|
| 864 | typename Action4, typename Action5, typename Action6> |
---|
| 865 | inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
---|
| 866 | internal::DoBothAction<Action3, internal::DoBothAction<Action4, |
---|
| 867 | internal::DoBothAction<Action5, Action6> > > > > |
---|
| 868 | DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) { |
---|
| 869 | return DoAll(a1, DoAll(a2, a3, a4, a5, a6)); |
---|
| 870 | } |
---|
| 871 | |
---|
| 872 | template <typename Action1, typename Action2, typename Action3, |
---|
| 873 | typename Action4, typename Action5, typename Action6, typename Action7> |
---|
| 874 | inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
---|
| 875 | internal::DoBothAction<Action3, internal::DoBothAction<Action4, |
---|
| 876 | internal::DoBothAction<Action5, internal::DoBothAction<Action6, |
---|
| 877 | Action7> > > > > > |
---|
| 878 | DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, |
---|
| 879 | Action7 a7) { |
---|
| 880 | return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7)); |
---|
| 881 | } |
---|
| 882 | |
---|
| 883 | template <typename Action1, typename Action2, typename Action3, |
---|
| 884 | typename Action4, typename Action5, typename Action6, typename Action7, |
---|
| 885 | typename Action8> |
---|
| 886 | inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
---|
| 887 | internal::DoBothAction<Action3, internal::DoBothAction<Action4, |
---|
| 888 | internal::DoBothAction<Action5, internal::DoBothAction<Action6, |
---|
| 889 | internal::DoBothAction<Action7, Action8> > > > > > > |
---|
| 890 | DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, |
---|
| 891 | Action7 a7, Action8 a8) { |
---|
| 892 | return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8)); |
---|
| 893 | } |
---|
| 894 | |
---|
| 895 | template <typename Action1, typename Action2, typename Action3, |
---|
| 896 | typename Action4, typename Action5, typename Action6, typename Action7, |
---|
| 897 | typename Action8, typename Action9> |
---|
| 898 | inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
---|
| 899 | internal::DoBothAction<Action3, internal::DoBothAction<Action4, |
---|
| 900 | internal::DoBothAction<Action5, internal::DoBothAction<Action6, |
---|
| 901 | internal::DoBothAction<Action7, internal::DoBothAction<Action8, |
---|
| 902 | Action9> > > > > > > > |
---|
| 903 | DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, |
---|
| 904 | Action7 a7, Action8 a8, Action9 a9) { |
---|
| 905 | return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9)); |
---|
| 906 | } |
---|
| 907 | |
---|
| 908 | template <typename Action1, typename Action2, typename Action3, |
---|
| 909 | typename Action4, typename Action5, typename Action6, typename Action7, |
---|
| 910 | typename Action8, typename Action9, typename Action10> |
---|
| 911 | inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
---|
| 912 | internal::DoBothAction<Action3, internal::DoBothAction<Action4, |
---|
| 913 | internal::DoBothAction<Action5, internal::DoBothAction<Action6, |
---|
| 914 | internal::DoBothAction<Action7, internal::DoBothAction<Action8, |
---|
| 915 | internal::DoBothAction<Action9, Action10> > > > > > > > > |
---|
| 916 | DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, |
---|
| 917 | Action7 a7, Action8 a8, Action9 a9, Action10 a10) { |
---|
| 918 | return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10)); |
---|
| 919 | } |
---|
| 920 | |
---|
| 921 | } // namespace testing |
---|
| 922 | |
---|
| 923 | // The ACTION* family of macros can be used in a namespace scope to |
---|
| 924 | // define custom actions easily. The syntax: |
---|
| 925 | // |
---|
| 926 | // ACTION(name) { statements; } |
---|
| 927 | // |
---|
| 928 | // will define an action with the given name that executes the |
---|
| 929 | // statements. The value returned by the statements will be used as |
---|
| 930 | // the return value of the action. Inside the statements, you can |
---|
| 931 | // refer to the K-th (0-based) argument of the mock function by |
---|
| 932 | // 'argK', and refer to its type by 'argK_type'. For example: |
---|
| 933 | // |
---|
| 934 | // ACTION(IncrementArg1) { |
---|
| 935 | // arg1_type temp = arg1; |
---|
| 936 | // return ++(*temp); |
---|
| 937 | // } |
---|
| 938 | // |
---|
| 939 | // allows you to write |
---|
| 940 | // |
---|
| 941 | // ...WillOnce(IncrementArg1()); |
---|
| 942 | // |
---|
| 943 | // You can also refer to the entire argument tuple and its type by |
---|
| 944 | // 'args' and 'args_type', and refer to the mock function type and its |
---|
| 945 | // return type by 'function_type' and 'return_type'. |
---|
| 946 | // |
---|
| 947 | // Note that you don't need to specify the types of the mock function |
---|
| 948 | // arguments. However rest assured that your code is still type-safe: |
---|
| 949 | // you'll get a compiler error if *arg1 doesn't support the ++ |
---|
| 950 | // operator, or if the type of ++(*arg1) isn't compatible with the |
---|
| 951 | // mock function's return type, for example. |
---|
| 952 | // |
---|
| 953 | // Sometimes you'll want to parameterize the action. For that you can use |
---|
| 954 | // another macro: |
---|
| 955 | // |
---|
| 956 | // ACTION_P(name, param_name) { statements; } |
---|
| 957 | // |
---|
| 958 | // For example: |
---|
| 959 | // |
---|
| 960 | // ACTION_P(Add, n) { return arg0 + n; } |
---|
| 961 | // |
---|
| 962 | // will allow you to write: |
---|
| 963 | // |
---|
| 964 | // ...WillOnce(Add(5)); |
---|
| 965 | // |
---|
| 966 | // Note that you don't need to provide the type of the parameter |
---|
| 967 | // either. If you need to reference the type of a parameter named |
---|
| 968 | // 'foo', you can write 'foo_type'. For example, in the body of |
---|
| 969 | // ACTION_P(Add, n) above, you can write 'n_type' to refer to the type |
---|
| 970 | // of 'n'. |
---|
| 971 | // |
---|
| 972 | // We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support |
---|
| 973 | // multi-parameter actions. |
---|
| 974 | // |
---|
| 975 | // For the purpose of typing, you can view |
---|
| 976 | // |
---|
| 977 | // ACTION_Pk(Foo, p1, ..., pk) { ... } |
---|
| 978 | // |
---|
| 979 | // as shorthand for |
---|
| 980 | // |
---|
| 981 | // template <typename p1_type, ..., typename pk_type> |
---|
| 982 | // FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... } |
---|
| 983 | // |
---|
| 984 | // In particular, you can provide the template type arguments |
---|
| 985 | // explicitly when invoking Foo(), as in Foo<long, bool>(5, false); |
---|
| 986 | // although usually you can rely on the compiler to infer the types |
---|
| 987 | // for you automatically. You can assign the result of expression |
---|
| 988 | // Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ..., |
---|
| 989 | // pk_type>. This can be useful when composing actions. |
---|
| 990 | // |
---|
| 991 | // You can also overload actions with different numbers of parameters: |
---|
| 992 | // |
---|
| 993 | // ACTION_P(Plus, a) { ... } |
---|
| 994 | // ACTION_P2(Plus, a, b) { ... } |
---|
| 995 | // |
---|
| 996 | // While it's tempting to always use the ACTION* macros when defining |
---|
| 997 | // a new action, you should also consider implementing ActionInterface |
---|
| 998 | // or using MakePolymorphicAction() instead, especially if you need to |
---|
| 999 | // use the action a lot. While these approaches require more work, |
---|
| 1000 | // they give you more control on the types of the mock function |
---|
| 1001 | // arguments and the action parameters, which in general leads to |
---|
| 1002 | // better compiler error messages that pay off in the long run. They |
---|
| 1003 | // also allow overloading actions based on parameter types (as opposed |
---|
| 1004 | // to just based on the number of parameters). |
---|
| 1005 | // |
---|
| 1006 | // CAVEAT: |
---|
| 1007 | // |
---|
| 1008 | // ACTION*() can only be used in a namespace scope. The reason is |
---|
| 1009 | // that C++ doesn't yet allow function-local types to be used to |
---|
| 1010 | // instantiate templates. The up-coming C++0x standard will fix this. |
---|
| 1011 | // Once that's done, we'll consider supporting using ACTION*() inside |
---|
| 1012 | // a function. |
---|
| 1013 | // |
---|
| 1014 | // MORE INFORMATION: |
---|
| 1015 | // |
---|
| 1016 | // To learn more about using these macros, please search for 'ACTION' |
---|
| 1017 | // on http://code.google.com/p/googlemock/wiki/CookBook. |
---|
| 1018 | |
---|
| 1019 | // An internal macro needed for implementing ACTION*(). |
---|
| 1020 | #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ |
---|
| 1021 | const args_type& args GTEST_ATTRIBUTE_UNUSED_,\ |
---|
| 1022 | arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_,\ |
---|
| 1023 | arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_,\ |
---|
| 1024 | arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_,\ |
---|
| 1025 | arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_,\ |
---|
| 1026 | arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_,\ |
---|
| 1027 | arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_,\ |
---|
| 1028 | arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_,\ |
---|
| 1029 | arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_,\ |
---|
| 1030 | arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_,\ |
---|
| 1031 | arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_ |
---|
| 1032 | |
---|
| 1033 | // Sometimes you want to give an action explicit template parameters |
---|
| 1034 | // that cannot be inferred from its value parameters. ACTION() and |
---|
| 1035 | // ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that |
---|
| 1036 | // and can be viewed as an extension to ACTION() and ACTION_P*(). |
---|
| 1037 | // |
---|
| 1038 | // The syntax: |
---|
| 1039 | // |
---|
| 1040 | // ACTION_TEMPLATE(ActionName, |
---|
| 1041 | // HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m), |
---|
| 1042 | // AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; } |
---|
| 1043 | // |
---|
| 1044 | // defines an action template that takes m explicit template |
---|
| 1045 | // parameters and n value parameters. name_i is the name of the i-th |
---|
| 1046 | // template parameter, and kind_i specifies whether it's a typename, |
---|
| 1047 | // an integral constant, or a template. p_i is the name of the i-th |
---|
| 1048 | // value parameter. |
---|
| 1049 | // |
---|
| 1050 | // Example: |
---|
| 1051 | // |
---|
| 1052 | // // DuplicateArg<k, T>(output) converts the k-th argument of the mock |
---|
| 1053 | // // function to type T and copies it to *output. |
---|
| 1054 | // ACTION_TEMPLATE(DuplicateArg, |
---|
| 1055 | // HAS_2_TEMPLATE_PARAMS(int, k, typename, T), |
---|
| 1056 | // AND_1_VALUE_PARAMS(output)) { |
---|
| 1057 | // *output = T(std::tr1::get<k>(args)); |
---|
| 1058 | // } |
---|
| 1059 | // ... |
---|
| 1060 | // int n; |
---|
| 1061 | // EXPECT_CALL(mock, Foo(_, _)) |
---|
| 1062 | // .WillOnce(DuplicateArg<1, unsigned char>(&n)); |
---|
| 1063 | // |
---|
| 1064 | // To create an instance of an action template, write: |
---|
| 1065 | // |
---|
| 1066 | // ActionName<t1, ..., t_m>(v1, ..., v_n) |
---|
| 1067 | // |
---|
| 1068 | // where the ts are the template arguments and the vs are the value |
---|
| 1069 | // arguments. The value argument types are inferred by the compiler. |
---|
| 1070 | // If you want to explicitly specify the value argument types, you can |
---|
| 1071 | // provide additional template arguments: |
---|
| 1072 | // |
---|
| 1073 | // ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n) |
---|
| 1074 | // |
---|
| 1075 | // where u_i is the desired type of v_i. |
---|
| 1076 | // |
---|
| 1077 | // ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the |
---|
| 1078 | // number of value parameters, but not on the number of template |
---|
| 1079 | // parameters. Without the restriction, the meaning of the following |
---|
| 1080 | // is unclear: |
---|
| 1081 | // |
---|
| 1082 | // OverloadedAction<int, bool>(x); |
---|
| 1083 | // |
---|
| 1084 | // Are we using a single-template-parameter action where 'bool' refers |
---|
| 1085 | // to the type of x, or are we using a two-template-parameter action |
---|
| 1086 | // where the compiler is asked to infer the type of x? |
---|
| 1087 | // |
---|
| 1088 | // Implementation notes: |
---|
| 1089 | // |
---|
| 1090 | // GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and |
---|
| 1091 | // GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for |
---|
| 1092 | // implementing ACTION_TEMPLATE. The main trick we use is to create |
---|
| 1093 | // new macro invocations when expanding a macro. For example, we have |
---|
| 1094 | // |
---|
| 1095 | // #define ACTION_TEMPLATE(name, template_params, value_params) |
---|
| 1096 | // ... GMOCK_INTERNAL_DECL_##template_params ... |
---|
| 1097 | // |
---|
| 1098 | // which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...) |
---|
| 1099 | // to expand to |
---|
| 1100 | // |
---|
| 1101 | // ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ... |
---|
| 1102 | // |
---|
| 1103 | // Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the |
---|
| 1104 | // preprocessor will continue to expand it to |
---|
| 1105 | // |
---|
| 1106 | // ... typename T ... |
---|
| 1107 | // |
---|
| 1108 | // This technique conforms to the C++ standard and is portable. It |
---|
| 1109 | // allows us to implement action templates using O(N) code, where N is |
---|
| 1110 | // the maximum number of template/value parameters supported. Without |
---|
| 1111 | // using it, we'd have to devote O(N^2) amount of code to implement all |
---|
| 1112 | // combinations of m and n. |
---|
| 1113 | |
---|
| 1114 | // Declares the template parameters. |
---|
| 1115 | #define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0 |
---|
| 1116 | #define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ |
---|
| 1117 | name1) kind0 name0, kind1 name1 |
---|
| 1118 | #define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1119 | kind2, name2) kind0 name0, kind1 name1, kind2 name2 |
---|
| 1120 | #define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1121 | kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \ |
---|
| 1122 | kind3 name3 |
---|
| 1123 | #define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1124 | kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \ |
---|
| 1125 | kind2 name2, kind3 name3, kind4 name4 |
---|
| 1126 | #define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1127 | kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \ |
---|
| 1128 | kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5 |
---|
| 1129 | #define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1130 | kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ |
---|
| 1131 | name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \ |
---|
| 1132 | kind5 name5, kind6 name6 |
---|
| 1133 | #define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1134 | kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ |
---|
| 1135 | kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \ |
---|
| 1136 | kind4 name4, kind5 name5, kind6 name6, kind7 name7 |
---|
| 1137 | #define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1138 | kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ |
---|
| 1139 | kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \ |
---|
| 1140 | kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \ |
---|
| 1141 | kind8 name8 |
---|
| 1142 | #define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ |
---|
| 1143 | name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ |
---|
| 1144 | name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \ |
---|
| 1145 | kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \ |
---|
| 1146 | kind6 name6, kind7 name7, kind8 name8, kind9 name9 |
---|
| 1147 | |
---|
| 1148 | // Lists the template parameters. |
---|
| 1149 | #define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0 |
---|
| 1150 | #define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ |
---|
| 1151 | name1) name0, name1 |
---|
| 1152 | #define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1153 | kind2, name2) name0, name1, name2 |
---|
| 1154 | #define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1155 | kind2, name2, kind3, name3) name0, name1, name2, name3 |
---|
| 1156 | #define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1157 | kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \ |
---|
| 1158 | name4 |
---|
| 1159 | #define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1160 | kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \ |
---|
| 1161 | name2, name3, name4, name5 |
---|
| 1162 | #define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1163 | kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ |
---|
| 1164 | name6) name0, name1, name2, name3, name4, name5, name6 |
---|
| 1165 | #define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1166 | kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ |
---|
| 1167 | kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7 |
---|
| 1168 | #define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
---|
| 1169 | kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ |
---|
| 1170 | kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \ |
---|
| 1171 | name6, name7, name8 |
---|
| 1172 | #define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ |
---|
| 1173 | name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ |
---|
| 1174 | name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \ |
---|
| 1175 | name3, name4, name5, name6, name7, name8, name9 |
---|
| 1176 | |
---|
| 1177 | // Declares the types of value parameters. |
---|
| 1178 | #define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS() |
---|
| 1179 | #define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type |
---|
| 1180 | #define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \ |
---|
| 1181 | typename p0##_type, typename p1##_type |
---|
| 1182 | #define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \ |
---|
| 1183 | typename p0##_type, typename p1##_type, typename p2##_type |
---|
| 1184 | #define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ |
---|
| 1185 | typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1186 | typename p3##_type |
---|
| 1187 | #define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ |
---|
| 1188 | typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1189 | typename p3##_type, typename p4##_type |
---|
| 1190 | #define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ |
---|
| 1191 | typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1192 | typename p3##_type, typename p4##_type, typename p5##_type |
---|
| 1193 | #define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
---|
| 1194 | p6) , typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1195 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 1196 | typename p6##_type |
---|
| 1197 | #define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
---|
| 1198 | p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1199 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 1200 | typename p6##_type, typename p7##_type |
---|
| 1201 | #define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
---|
| 1202 | p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1203 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 1204 | typename p6##_type, typename p7##_type, typename p8##_type |
---|
| 1205 | #define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
---|
| 1206 | p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \ |
---|
| 1207 | typename p2##_type, typename p3##_type, typename p4##_type, \ |
---|
| 1208 | typename p5##_type, typename p6##_type, typename p7##_type, \ |
---|
| 1209 | typename p8##_type, typename p9##_type |
---|
| 1210 | |
---|
| 1211 | // Initializes the value parameters. |
---|
| 1212 | #define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\ |
---|
| 1213 | () |
---|
| 1214 | #define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\ |
---|
| 1215 | (p0##_type gmock_p0) : p0(gmock_p0) |
---|
| 1216 | #define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\ |
---|
| 1217 | (p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1) |
---|
| 1218 | #define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\ |
---|
| 1219 | (p0##_type gmock_p0, p1##_type gmock_p1, \ |
---|
| 1220 | p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) |
---|
| 1221 | #define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\ |
---|
| 1222 | (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 1223 | p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 1224 | p3(gmock_p3) |
---|
| 1225 | #define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\ |
---|
| 1226 | (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 1227 | p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), \ |
---|
| 1228 | p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) |
---|
| 1229 | #define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\ |
---|
| 1230 | (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 1231 | p3##_type gmock_p3, p4##_type gmock_p4, \ |
---|
| 1232 | p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 1233 | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) |
---|
| 1234 | #define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\ |
---|
| 1235 | (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 1236 | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
---|
| 1237 | p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 1238 | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) |
---|
| 1239 | #define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\ |
---|
| 1240 | (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 1241 | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
---|
| 1242 | p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \ |
---|
| 1243 | p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
---|
| 1244 | p7(gmock_p7) |
---|
| 1245 | #define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1246 | p7, p8)\ |
---|
| 1247 | (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 1248 | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
---|
| 1249 | p6##_type gmock_p6, p7##_type gmock_p7, \ |
---|
| 1250 | p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 1251 | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ |
---|
| 1252 | p8(gmock_p8) |
---|
| 1253 | #define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1254 | p7, p8, p9)\ |
---|
| 1255 | (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 1256 | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
---|
| 1257 | p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ |
---|
| 1258 | p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 1259 | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ |
---|
| 1260 | p8(gmock_p8), p9(gmock_p9) |
---|
| 1261 | |
---|
| 1262 | // Declares the fields for storing the value parameters. |
---|
| 1263 | #define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS() |
---|
| 1264 | #define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0; |
---|
| 1265 | #define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \ |
---|
| 1266 | p1##_type p1; |
---|
| 1267 | #define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \ |
---|
| 1268 | p1##_type p1; p2##_type p2; |
---|
| 1269 | #define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \ |
---|
| 1270 | p1##_type p1; p2##_type p2; p3##_type p3; |
---|
| 1271 | #define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ |
---|
| 1272 | p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; |
---|
| 1273 | #define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ |
---|
| 1274 | p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ |
---|
| 1275 | p5##_type p5; |
---|
| 1276 | #define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
---|
| 1277 | p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ |
---|
| 1278 | p5##_type p5; p6##_type p6; |
---|
| 1279 | #define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1280 | p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ |
---|
| 1281 | p5##_type p5; p6##_type p6; p7##_type p7; |
---|
| 1282 | #define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1283 | p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ |
---|
| 1284 | p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; |
---|
| 1285 | #define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1286 | p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ |
---|
| 1287 | p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \ |
---|
| 1288 | p9##_type p9; |
---|
| 1289 | |
---|
| 1290 | // Lists the value parameters. |
---|
| 1291 | #define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS() |
---|
| 1292 | #define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0 |
---|
| 1293 | #define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1 |
---|
| 1294 | #define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2 |
---|
| 1295 | #define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3 |
---|
| 1296 | #define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \ |
---|
| 1297 | p2, p3, p4 |
---|
| 1298 | #define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \ |
---|
| 1299 | p1, p2, p3, p4, p5 |
---|
| 1300 | #define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
---|
| 1301 | p6) p0, p1, p2, p3, p4, p5, p6 |
---|
| 1302 | #define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1303 | p7) p0, p1, p2, p3, p4, p5, p6, p7 |
---|
| 1304 | #define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1305 | p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8 |
---|
| 1306 | #define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1307 | p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 |
---|
| 1308 | |
---|
| 1309 | // Lists the value parameter types. |
---|
| 1310 | #define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS() |
---|
| 1311 | #define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type |
---|
| 1312 | #define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \ |
---|
| 1313 | p1##_type |
---|
| 1314 | #define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \ |
---|
| 1315 | p1##_type, p2##_type |
---|
| 1316 | #define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ |
---|
| 1317 | p0##_type, p1##_type, p2##_type, p3##_type |
---|
| 1318 | #define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ |
---|
| 1319 | p0##_type, p1##_type, p2##_type, p3##_type, p4##_type |
---|
| 1320 | #define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ |
---|
| 1321 | p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type |
---|
| 1322 | #define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
---|
| 1323 | p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \ |
---|
| 1324 | p6##_type |
---|
| 1325 | #define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
---|
| 1326 | p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
---|
| 1327 | p5##_type, p6##_type, p7##_type |
---|
| 1328 | #define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
---|
| 1329 | p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
---|
| 1330 | p5##_type, p6##_type, p7##_type, p8##_type |
---|
| 1331 | #define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
---|
| 1332 | p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
---|
| 1333 | p5##_type, p6##_type, p7##_type, p8##_type, p9##_type |
---|
| 1334 | |
---|
| 1335 | // Declares the value parameters. |
---|
| 1336 | #define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS() |
---|
| 1337 | #define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0 |
---|
| 1338 | #define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \ |
---|
| 1339 | p1##_type p1 |
---|
| 1340 | #define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \ |
---|
| 1341 | p1##_type p1, p2##_type p2 |
---|
| 1342 | #define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \ |
---|
| 1343 | p1##_type p1, p2##_type p2, p3##_type p3 |
---|
| 1344 | #define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ |
---|
| 1345 | p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4 |
---|
| 1346 | #define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ |
---|
| 1347 | p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ |
---|
| 1348 | p5##_type p5 |
---|
| 1349 | #define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
---|
| 1350 | p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ |
---|
| 1351 | p5##_type p5, p6##_type p6 |
---|
| 1352 | #define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1353 | p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ |
---|
| 1354 | p5##_type p5, p6##_type p6, p7##_type p7 |
---|
| 1355 | #define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1356 | p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
---|
| 1357 | p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8 |
---|
| 1358 | #define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1359 | p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
---|
| 1360 | p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ |
---|
| 1361 | p9##_type p9 |
---|
| 1362 | |
---|
| 1363 | // The suffix of the class template implementing the action template. |
---|
| 1364 | #define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS() |
---|
| 1365 | #define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P |
---|
| 1366 | #define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2 |
---|
| 1367 | #define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3 |
---|
| 1368 | #define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4 |
---|
| 1369 | #define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5 |
---|
| 1370 | #define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6 |
---|
| 1371 | #define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7 |
---|
| 1372 | #define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1373 | p7) P8 |
---|
| 1374 | #define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1375 | p7, p8) P9 |
---|
| 1376 | #define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
---|
| 1377 | p7, p8, p9) P10 |
---|
| 1378 | |
---|
| 1379 | // The name of the class template implementing the action template. |
---|
| 1380 | #define GMOCK_ACTION_CLASS_(name, value_params)\ |
---|
| 1381 | GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params) |
---|
| 1382 | |
---|
| 1383 | #define ACTION_TEMPLATE(name, template_params, value_params)\ |
---|
| 1384 | template <GMOCK_INTERNAL_DECL_##template_params\ |
---|
| 1385 | GMOCK_INTERNAL_DECL_TYPE_##value_params>\ |
---|
| 1386 | class GMOCK_ACTION_CLASS_(name, value_params) {\ |
---|
| 1387 | public:\ |
---|
| 1388 | GMOCK_ACTION_CLASS_(name, value_params)\ |
---|
| 1389 | GMOCK_INTERNAL_INIT_##value_params {}\ |
---|
| 1390 | template <typename F>\ |
---|
| 1391 | class gmock_Impl : public ::testing::ActionInterface<F> {\ |
---|
| 1392 | public:\ |
---|
| 1393 | typedef F function_type;\ |
---|
| 1394 | typedef typename ::testing::internal::Function<F>::Result return_type;\ |
---|
| 1395 | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
---|
| 1396 | args_type;\ |
---|
| 1397 | explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ |
---|
| 1398 | virtual return_type Perform(const args_type& args) {\ |
---|
| 1399 | return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
---|
| 1400 | Perform(this, args);\ |
---|
| 1401 | }\ |
---|
| 1402 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1403 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1404 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1405 | typename arg9_type>\ |
---|
| 1406 | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
---|
| 1407 | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
---|
| 1408 | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
---|
| 1409 | arg9_type arg9) const;\ |
---|
| 1410 | GMOCK_INTERNAL_DEFN_##value_params\ |
---|
| 1411 | private:\ |
---|
| 1412 | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
---|
| 1413 | };\ |
---|
| 1414 | template <typename F> operator ::testing::Action<F>() const {\ |
---|
| 1415 | return ::testing::Action<F>(\ |
---|
| 1416 | new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\ |
---|
| 1417 | }\ |
---|
| 1418 | GMOCK_INTERNAL_DEFN_##value_params\ |
---|
| 1419 | private:\ |
---|
| 1420 | GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\ |
---|
| 1421 | };\ |
---|
| 1422 | template <GMOCK_INTERNAL_DECL_##template_params\ |
---|
| 1423 | GMOCK_INTERNAL_DECL_TYPE_##value_params>\ |
---|
| 1424 | inline GMOCK_ACTION_CLASS_(name, value_params)<\ |
---|
| 1425 | GMOCK_INTERNAL_LIST_##template_params\ |
---|
| 1426 | GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ |
---|
| 1427 | GMOCK_INTERNAL_DECL_##value_params) {\ |
---|
| 1428 | return GMOCK_ACTION_CLASS_(name, value_params)<\ |
---|
| 1429 | GMOCK_INTERNAL_LIST_##template_params\ |
---|
| 1430 | GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ |
---|
| 1431 | GMOCK_INTERNAL_LIST_##value_params);\ |
---|
| 1432 | }\ |
---|
| 1433 | template <GMOCK_INTERNAL_DECL_##template_params\ |
---|
| 1434 | GMOCK_INTERNAL_DECL_TYPE_##value_params>\ |
---|
| 1435 | template <typename F>\ |
---|
| 1436 | template <typename arg0_type, typename arg1_type, typename arg2_type,\ |
---|
| 1437 | typename arg3_type, typename arg4_type, typename arg5_type,\ |
---|
| 1438 | typename arg6_type, typename arg7_type, typename arg8_type,\ |
---|
| 1439 | typename arg9_type>\ |
---|
| 1440 | typename ::testing::internal::Function<F>::Result\ |
---|
| 1441 | GMOCK_ACTION_CLASS_(name, value_params)<\ |
---|
| 1442 | GMOCK_INTERNAL_LIST_##template_params\ |
---|
| 1443 | GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\ |
---|
| 1444 | gmock_PerformImpl(\ |
---|
| 1445 | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
---|
| 1446 | |
---|
| 1447 | #define ACTION(name)\ |
---|
| 1448 | class name##Action {\ |
---|
| 1449 | public:\ |
---|
| 1450 | name##Action() {}\ |
---|
| 1451 | template <typename F>\ |
---|
| 1452 | class gmock_Impl : public ::testing::ActionInterface<F> {\ |
---|
| 1453 | public:\ |
---|
| 1454 | typedef F function_type;\ |
---|
| 1455 | typedef typename ::testing::internal::Function<F>::Result return_type;\ |
---|
| 1456 | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
---|
| 1457 | args_type;\ |
---|
| 1458 | gmock_Impl() {}\ |
---|
| 1459 | virtual return_type Perform(const args_type& args) {\ |
---|
| 1460 | return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
---|
| 1461 | Perform(this, args);\ |
---|
| 1462 | }\ |
---|
| 1463 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1464 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1465 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1466 | typename arg9_type>\ |
---|
| 1467 | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
---|
| 1468 | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
---|
| 1469 | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
---|
| 1470 | arg9_type arg9) const;\ |
---|
| 1471 | private:\ |
---|
| 1472 | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
---|
| 1473 | };\ |
---|
| 1474 | template <typename F> operator ::testing::Action<F>() const {\ |
---|
| 1475 | return ::testing::Action<F>(new gmock_Impl<F>());\ |
---|
| 1476 | }\ |
---|
| 1477 | private:\ |
---|
| 1478 | GTEST_DISALLOW_ASSIGN_(name##Action);\ |
---|
| 1479 | };\ |
---|
| 1480 | inline name##Action name() {\ |
---|
| 1481 | return name##Action();\ |
---|
| 1482 | }\ |
---|
| 1483 | template <typename F>\ |
---|
| 1484 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1485 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1486 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1487 | typename arg9_type>\ |
---|
| 1488 | typename ::testing::internal::Function<F>::Result\ |
---|
| 1489 | name##Action::gmock_Impl<F>::gmock_PerformImpl(\ |
---|
| 1490 | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
---|
| 1491 | |
---|
| 1492 | #define ACTION_P(name, p0)\ |
---|
| 1493 | template <typename p0##_type>\ |
---|
| 1494 | class name##ActionP {\ |
---|
| 1495 | public:\ |
---|
| 1496 | name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\ |
---|
| 1497 | template <typename F>\ |
---|
| 1498 | class gmock_Impl : public ::testing::ActionInterface<F> {\ |
---|
| 1499 | public:\ |
---|
| 1500 | typedef F function_type;\ |
---|
| 1501 | typedef typename ::testing::internal::Function<F>::Result return_type;\ |
---|
| 1502 | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
---|
| 1503 | args_type;\ |
---|
| 1504 | explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\ |
---|
| 1505 | virtual return_type Perform(const args_type& args) {\ |
---|
| 1506 | return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
---|
| 1507 | Perform(this, args);\ |
---|
| 1508 | }\ |
---|
| 1509 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1510 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1511 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1512 | typename arg9_type>\ |
---|
| 1513 | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
---|
| 1514 | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
---|
| 1515 | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
---|
| 1516 | arg9_type arg9) const;\ |
---|
| 1517 | p0##_type p0;\ |
---|
| 1518 | private:\ |
---|
| 1519 | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
---|
| 1520 | };\ |
---|
| 1521 | template <typename F> operator ::testing::Action<F>() const {\ |
---|
| 1522 | return ::testing::Action<F>(new gmock_Impl<F>(p0));\ |
---|
| 1523 | }\ |
---|
| 1524 | p0##_type p0;\ |
---|
| 1525 | private:\ |
---|
| 1526 | GTEST_DISALLOW_ASSIGN_(name##ActionP);\ |
---|
| 1527 | };\ |
---|
| 1528 | template <typename p0##_type>\ |
---|
| 1529 | inline name##ActionP<p0##_type> name(p0##_type p0) {\ |
---|
| 1530 | return name##ActionP<p0##_type>(p0);\ |
---|
| 1531 | }\ |
---|
| 1532 | template <typename p0##_type>\ |
---|
| 1533 | template <typename F>\ |
---|
| 1534 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1535 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1536 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1537 | typename arg9_type>\ |
---|
| 1538 | typename ::testing::internal::Function<F>::Result\ |
---|
| 1539 | name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
---|
| 1540 | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
---|
| 1541 | |
---|
| 1542 | #define ACTION_P2(name, p0, p1)\ |
---|
| 1543 | template <typename p0##_type, typename p1##_type>\ |
---|
| 1544 | class name##ActionP2 {\ |
---|
| 1545 | public:\ |
---|
| 1546 | name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ |
---|
| 1547 | p1(gmock_p1) {}\ |
---|
| 1548 | template <typename F>\ |
---|
| 1549 | class gmock_Impl : public ::testing::ActionInterface<F> {\ |
---|
| 1550 | public:\ |
---|
| 1551 | typedef F function_type;\ |
---|
| 1552 | typedef typename ::testing::internal::Function<F>::Result return_type;\ |
---|
| 1553 | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
---|
| 1554 | args_type;\ |
---|
| 1555 | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ |
---|
| 1556 | p1(gmock_p1) {}\ |
---|
| 1557 | virtual return_type Perform(const args_type& args) {\ |
---|
| 1558 | return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
---|
| 1559 | Perform(this, args);\ |
---|
| 1560 | }\ |
---|
| 1561 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1562 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1563 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1564 | typename arg9_type>\ |
---|
| 1565 | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
---|
| 1566 | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
---|
| 1567 | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
---|
| 1568 | arg9_type arg9) const;\ |
---|
| 1569 | p0##_type p0;\ |
---|
| 1570 | p1##_type p1;\ |
---|
| 1571 | private:\ |
---|
| 1572 | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
---|
| 1573 | };\ |
---|
| 1574 | template <typename F> operator ::testing::Action<F>() const {\ |
---|
| 1575 | return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\ |
---|
| 1576 | }\ |
---|
| 1577 | p0##_type p0;\ |
---|
| 1578 | p1##_type p1;\ |
---|
| 1579 | private:\ |
---|
| 1580 | GTEST_DISALLOW_ASSIGN_(name##ActionP2);\ |
---|
| 1581 | };\ |
---|
| 1582 | template <typename p0##_type, typename p1##_type>\ |
---|
| 1583 | inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \ |
---|
| 1584 | p1##_type p1) {\ |
---|
| 1585 | return name##ActionP2<p0##_type, p1##_type>(p0, p1);\ |
---|
| 1586 | }\ |
---|
| 1587 | template <typename p0##_type, typename p1##_type>\ |
---|
| 1588 | template <typename F>\ |
---|
| 1589 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1590 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1591 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1592 | typename arg9_type>\ |
---|
| 1593 | typename ::testing::internal::Function<F>::Result\ |
---|
| 1594 | name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
---|
| 1595 | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
---|
| 1596 | |
---|
| 1597 | #define ACTION_P3(name, p0, p1, p2)\ |
---|
| 1598 | template <typename p0##_type, typename p1##_type, typename p2##_type>\ |
---|
| 1599 | class name##ActionP3 {\ |
---|
| 1600 | public:\ |
---|
| 1601 | name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \ |
---|
| 1602 | p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ |
---|
| 1603 | template <typename F>\ |
---|
| 1604 | class gmock_Impl : public ::testing::ActionInterface<F> {\ |
---|
| 1605 | public:\ |
---|
| 1606 | typedef F function_type;\ |
---|
| 1607 | typedef typename ::testing::internal::Function<F>::Result return_type;\ |
---|
| 1608 | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
---|
| 1609 | args_type;\ |
---|
| 1610 | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \ |
---|
| 1611 | p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ |
---|
| 1612 | virtual return_type Perform(const args_type& args) {\ |
---|
| 1613 | return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
---|
| 1614 | Perform(this, args);\ |
---|
| 1615 | }\ |
---|
| 1616 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1617 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1618 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1619 | typename arg9_type>\ |
---|
| 1620 | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
---|
| 1621 | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
---|
| 1622 | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
---|
| 1623 | arg9_type arg9) const;\ |
---|
| 1624 | p0##_type p0;\ |
---|
| 1625 | p1##_type p1;\ |
---|
| 1626 | p2##_type p2;\ |
---|
| 1627 | private:\ |
---|
| 1628 | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
---|
| 1629 | };\ |
---|
| 1630 | template <typename F> operator ::testing::Action<F>() const {\ |
---|
| 1631 | return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\ |
---|
| 1632 | }\ |
---|
| 1633 | p0##_type p0;\ |
---|
| 1634 | p1##_type p1;\ |
---|
| 1635 | p2##_type p2;\ |
---|
| 1636 | private:\ |
---|
| 1637 | GTEST_DISALLOW_ASSIGN_(name##ActionP3);\ |
---|
| 1638 | };\ |
---|
| 1639 | template <typename p0##_type, typename p1##_type, typename p2##_type>\ |
---|
| 1640 | inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \ |
---|
| 1641 | p1##_type p1, p2##_type p2) {\ |
---|
| 1642 | return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\ |
---|
| 1643 | }\ |
---|
| 1644 | template <typename p0##_type, typename p1##_type, typename p2##_type>\ |
---|
| 1645 | template <typename F>\ |
---|
| 1646 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1647 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1648 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1649 | typename arg9_type>\ |
---|
| 1650 | typename ::testing::internal::Function<F>::Result\ |
---|
| 1651 | name##ActionP3<p0##_type, p1##_type, \ |
---|
| 1652 | p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
---|
| 1653 | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
---|
| 1654 | |
---|
| 1655 | #define ACTION_P4(name, p0, p1, p2, p3)\ |
---|
| 1656 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1657 | typename p3##_type>\ |
---|
| 1658 | class name##ActionP4 {\ |
---|
| 1659 | public:\ |
---|
| 1660 | name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \ |
---|
| 1661 | p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ |
---|
| 1662 | p2(gmock_p2), p3(gmock_p3) {}\ |
---|
| 1663 | template <typename F>\ |
---|
| 1664 | class gmock_Impl : public ::testing::ActionInterface<F> {\ |
---|
| 1665 | public:\ |
---|
| 1666 | typedef F function_type;\ |
---|
| 1667 | typedef typename ::testing::internal::Function<F>::Result return_type;\ |
---|
| 1668 | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
---|
| 1669 | args_type;\ |
---|
| 1670 | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 1671 | p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 1672 | p3(gmock_p3) {}\ |
---|
| 1673 | virtual return_type Perform(const args_type& args) {\ |
---|
| 1674 | return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
---|
| 1675 | Perform(this, args);\ |
---|
| 1676 | }\ |
---|
| 1677 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1678 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1679 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1680 | typename arg9_type>\ |
---|
| 1681 | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
---|
| 1682 | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
---|
| 1683 | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
---|
| 1684 | arg9_type arg9) const;\ |
---|
| 1685 | p0##_type p0;\ |
---|
| 1686 | p1##_type p1;\ |
---|
| 1687 | p2##_type p2;\ |
---|
| 1688 | p3##_type p3;\ |
---|
| 1689 | private:\ |
---|
| 1690 | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
---|
| 1691 | };\ |
---|
| 1692 | template <typename F> operator ::testing::Action<F>() const {\ |
---|
| 1693 | return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\ |
---|
| 1694 | }\ |
---|
| 1695 | p0##_type p0;\ |
---|
| 1696 | p1##_type p1;\ |
---|
| 1697 | p2##_type p2;\ |
---|
| 1698 | p3##_type p3;\ |
---|
| 1699 | private:\ |
---|
| 1700 | GTEST_DISALLOW_ASSIGN_(name##ActionP4);\ |
---|
| 1701 | };\ |
---|
| 1702 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1703 | typename p3##_type>\ |
---|
| 1704 | inline name##ActionP4<p0##_type, p1##_type, p2##_type, \ |
---|
| 1705 | p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ |
---|
| 1706 | p3##_type p3) {\ |
---|
| 1707 | return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \ |
---|
| 1708 | p2, p3);\ |
---|
| 1709 | }\ |
---|
| 1710 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1711 | typename p3##_type>\ |
---|
| 1712 | template <typename F>\ |
---|
| 1713 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1714 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1715 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1716 | typename arg9_type>\ |
---|
| 1717 | typename ::testing::internal::Function<F>::Result\ |
---|
| 1718 | name##ActionP4<p0##_type, p1##_type, p2##_type, \ |
---|
| 1719 | p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
---|
| 1720 | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
---|
| 1721 | |
---|
| 1722 | #define ACTION_P5(name, p0, p1, p2, p3, p4)\ |
---|
| 1723 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1724 | typename p3##_type, typename p4##_type>\ |
---|
| 1725 | class name##ActionP5 {\ |
---|
| 1726 | public:\ |
---|
| 1727 | name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \ |
---|
| 1728 | p2##_type gmock_p2, p3##_type gmock_p3, \ |
---|
| 1729 | p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 1730 | p3(gmock_p3), p4(gmock_p4) {}\ |
---|
| 1731 | template <typename F>\ |
---|
| 1732 | class gmock_Impl : public ::testing::ActionInterface<F> {\ |
---|
| 1733 | public:\ |
---|
| 1734 | typedef F function_type;\ |
---|
| 1735 | typedef typename ::testing::internal::Function<F>::Result return_type;\ |
---|
| 1736 | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
---|
| 1737 | args_type;\ |
---|
| 1738 | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 1739 | p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \ |
---|
| 1740 | p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\ |
---|
| 1741 | virtual return_type Perform(const args_type& args) {\ |
---|
| 1742 | return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
---|
| 1743 | Perform(this, args);\ |
---|
| 1744 | }\ |
---|
| 1745 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1746 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1747 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1748 | typename arg9_type>\ |
---|
| 1749 | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
---|
| 1750 | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
---|
| 1751 | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
---|
| 1752 | arg9_type arg9) const;\ |
---|
| 1753 | p0##_type p0;\ |
---|
| 1754 | p1##_type p1;\ |
---|
| 1755 | p2##_type p2;\ |
---|
| 1756 | p3##_type p3;\ |
---|
| 1757 | p4##_type p4;\ |
---|
| 1758 | private:\ |
---|
| 1759 | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
---|
| 1760 | };\ |
---|
| 1761 | template <typename F> operator ::testing::Action<F>() const {\ |
---|
| 1762 | return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\ |
---|
| 1763 | }\ |
---|
| 1764 | p0##_type p0;\ |
---|
| 1765 | p1##_type p1;\ |
---|
| 1766 | p2##_type p2;\ |
---|
| 1767 | p3##_type p3;\ |
---|
| 1768 | p4##_type p4;\ |
---|
| 1769 | private:\ |
---|
| 1770 | GTEST_DISALLOW_ASSIGN_(name##ActionP5);\ |
---|
| 1771 | };\ |
---|
| 1772 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1773 | typename p3##_type, typename p4##_type>\ |
---|
| 1774 | inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 1775 | p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
---|
| 1776 | p4##_type p4) {\ |
---|
| 1777 | return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 1778 | p4##_type>(p0, p1, p2, p3, p4);\ |
---|
| 1779 | }\ |
---|
| 1780 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1781 | typename p3##_type, typename p4##_type>\ |
---|
| 1782 | template <typename F>\ |
---|
| 1783 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1784 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1785 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1786 | typename arg9_type>\ |
---|
| 1787 | typename ::testing::internal::Function<F>::Result\ |
---|
| 1788 | name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 1789 | p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
---|
| 1790 | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
---|
| 1791 | |
---|
| 1792 | #define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\ |
---|
| 1793 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1794 | typename p3##_type, typename p4##_type, typename p5##_type>\ |
---|
| 1795 | class name##ActionP6 {\ |
---|
| 1796 | public:\ |
---|
| 1797 | name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \ |
---|
| 1798 | p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
---|
| 1799 | p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 1800 | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ |
---|
| 1801 | template <typename F>\ |
---|
| 1802 | class gmock_Impl : public ::testing::ActionInterface<F> {\ |
---|
| 1803 | public:\ |
---|
| 1804 | typedef F function_type;\ |
---|
| 1805 | typedef typename ::testing::internal::Function<F>::Result return_type;\ |
---|
| 1806 | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
---|
| 1807 | args_type;\ |
---|
| 1808 | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 1809 | p3##_type gmock_p3, p4##_type gmock_p4, \ |
---|
| 1810 | p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 1811 | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ |
---|
| 1812 | virtual return_type Perform(const args_type& args) {\ |
---|
| 1813 | return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
---|
| 1814 | Perform(this, args);\ |
---|
| 1815 | }\ |
---|
| 1816 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1817 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1818 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1819 | typename arg9_type>\ |
---|
| 1820 | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
---|
| 1821 | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
---|
| 1822 | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
---|
| 1823 | arg9_type arg9) const;\ |
---|
| 1824 | p0##_type p0;\ |
---|
| 1825 | p1##_type p1;\ |
---|
| 1826 | p2##_type p2;\ |
---|
| 1827 | p3##_type p3;\ |
---|
| 1828 | p4##_type p4;\ |
---|
| 1829 | p5##_type p5;\ |
---|
| 1830 | private:\ |
---|
| 1831 | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
---|
| 1832 | };\ |
---|
| 1833 | template <typename F> operator ::testing::Action<F>() const {\ |
---|
| 1834 | return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\ |
---|
| 1835 | }\ |
---|
| 1836 | p0##_type p0;\ |
---|
| 1837 | p1##_type p1;\ |
---|
| 1838 | p2##_type p2;\ |
---|
| 1839 | p3##_type p3;\ |
---|
| 1840 | p4##_type p4;\ |
---|
| 1841 | p5##_type p5;\ |
---|
| 1842 | private:\ |
---|
| 1843 | GTEST_DISALLOW_ASSIGN_(name##ActionP6);\ |
---|
| 1844 | };\ |
---|
| 1845 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1846 | typename p3##_type, typename p4##_type, typename p5##_type>\ |
---|
| 1847 | inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 1848 | p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ |
---|
| 1849 | p3##_type p3, p4##_type p4, p5##_type p5) {\ |
---|
| 1850 | return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 1851 | p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\ |
---|
| 1852 | }\ |
---|
| 1853 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1854 | typename p3##_type, typename p4##_type, typename p5##_type>\ |
---|
| 1855 | template <typename F>\ |
---|
| 1856 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1857 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1858 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1859 | typename arg9_type>\ |
---|
| 1860 | typename ::testing::internal::Function<F>::Result\ |
---|
| 1861 | name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
---|
| 1862 | p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
---|
| 1863 | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
---|
| 1864 | |
---|
| 1865 | #define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\ |
---|
| 1866 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1867 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 1868 | typename p6##_type>\ |
---|
| 1869 | class name##ActionP7 {\ |
---|
| 1870 | public:\ |
---|
| 1871 | name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \ |
---|
| 1872 | p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
---|
| 1873 | p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ |
---|
| 1874 | p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ |
---|
| 1875 | p6(gmock_p6) {}\ |
---|
| 1876 | template <typename F>\ |
---|
| 1877 | class gmock_Impl : public ::testing::ActionInterface<F> {\ |
---|
| 1878 | public:\ |
---|
| 1879 | typedef F function_type;\ |
---|
| 1880 | typedef typename ::testing::internal::Function<F>::Result return_type;\ |
---|
| 1881 | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
---|
| 1882 | args_type;\ |
---|
| 1883 | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 1884 | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
---|
| 1885 | p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 1886 | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ |
---|
| 1887 | virtual return_type Perform(const args_type& args) {\ |
---|
| 1888 | return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
---|
| 1889 | Perform(this, args);\ |
---|
| 1890 | }\ |
---|
| 1891 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1892 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1893 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1894 | typename arg9_type>\ |
---|
| 1895 | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
---|
| 1896 | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
---|
| 1897 | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
---|
| 1898 | arg9_type arg9) const;\ |
---|
| 1899 | p0##_type p0;\ |
---|
| 1900 | p1##_type p1;\ |
---|
| 1901 | p2##_type p2;\ |
---|
| 1902 | p3##_type p3;\ |
---|
| 1903 | p4##_type p4;\ |
---|
| 1904 | p5##_type p5;\ |
---|
| 1905 | p6##_type p6;\ |
---|
| 1906 | private:\ |
---|
| 1907 | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
---|
| 1908 | };\ |
---|
| 1909 | template <typename F> operator ::testing::Action<F>() const {\ |
---|
| 1910 | return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ |
---|
| 1911 | p6));\ |
---|
| 1912 | }\ |
---|
| 1913 | p0##_type p0;\ |
---|
| 1914 | p1##_type p1;\ |
---|
| 1915 | p2##_type p2;\ |
---|
| 1916 | p3##_type p3;\ |
---|
| 1917 | p4##_type p4;\ |
---|
| 1918 | p5##_type p5;\ |
---|
| 1919 | p6##_type p6;\ |
---|
| 1920 | private:\ |
---|
| 1921 | GTEST_DISALLOW_ASSIGN_(name##ActionP7);\ |
---|
| 1922 | };\ |
---|
| 1923 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1924 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 1925 | typename p6##_type>\ |
---|
| 1926 | inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 1927 | p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \ |
---|
| 1928 | p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ |
---|
| 1929 | p6##_type p6) {\ |
---|
| 1930 | return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 1931 | p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\ |
---|
| 1932 | }\ |
---|
| 1933 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1934 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 1935 | typename p6##_type>\ |
---|
| 1936 | template <typename F>\ |
---|
| 1937 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1938 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1939 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1940 | typename arg9_type>\ |
---|
| 1941 | typename ::testing::internal::Function<F>::Result\ |
---|
| 1942 | name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
---|
| 1943 | p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
---|
| 1944 | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
---|
| 1945 | |
---|
| 1946 | #define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\ |
---|
| 1947 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 1948 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 1949 | typename p6##_type, typename p7##_type>\ |
---|
| 1950 | class name##ActionP8 {\ |
---|
| 1951 | public:\ |
---|
| 1952 | name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \ |
---|
| 1953 | p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
---|
| 1954 | p5##_type gmock_p5, p6##_type gmock_p6, \ |
---|
| 1955 | p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 1956 | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
---|
| 1957 | p7(gmock_p7) {}\ |
---|
| 1958 | template <typename F>\ |
---|
| 1959 | class gmock_Impl : public ::testing::ActionInterface<F> {\ |
---|
| 1960 | public:\ |
---|
| 1961 | typedef F function_type;\ |
---|
| 1962 | typedef typename ::testing::internal::Function<F>::Result return_type;\ |
---|
| 1963 | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
---|
| 1964 | args_type;\ |
---|
| 1965 | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 1966 | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
---|
| 1967 | p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \ |
---|
| 1968 | p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \ |
---|
| 1969 | p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ |
---|
| 1970 | virtual return_type Perform(const args_type& args) {\ |
---|
| 1971 | return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
---|
| 1972 | Perform(this, args);\ |
---|
| 1973 | }\ |
---|
| 1974 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 1975 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 1976 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 1977 | typename arg9_type>\ |
---|
| 1978 | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
---|
| 1979 | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
---|
| 1980 | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
---|
| 1981 | arg9_type arg9) const;\ |
---|
| 1982 | p0##_type p0;\ |
---|
| 1983 | p1##_type p1;\ |
---|
| 1984 | p2##_type p2;\ |
---|
| 1985 | p3##_type p3;\ |
---|
| 1986 | p4##_type p4;\ |
---|
| 1987 | p5##_type p5;\ |
---|
| 1988 | p6##_type p6;\ |
---|
| 1989 | p7##_type p7;\ |
---|
| 1990 | private:\ |
---|
| 1991 | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
---|
| 1992 | };\ |
---|
| 1993 | template <typename F> operator ::testing::Action<F>() const {\ |
---|
| 1994 | return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ |
---|
| 1995 | p6, p7));\ |
---|
| 1996 | }\ |
---|
| 1997 | p0##_type p0;\ |
---|
| 1998 | p1##_type p1;\ |
---|
| 1999 | p2##_type p2;\ |
---|
| 2000 | p3##_type p3;\ |
---|
| 2001 | p4##_type p4;\ |
---|
| 2002 | p5##_type p5;\ |
---|
| 2003 | p6##_type p6;\ |
---|
| 2004 | p7##_type p7;\ |
---|
| 2005 | private:\ |
---|
| 2006 | GTEST_DISALLOW_ASSIGN_(name##ActionP8);\ |
---|
| 2007 | };\ |
---|
| 2008 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 2009 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 2010 | typename p6##_type, typename p7##_type>\ |
---|
| 2011 | inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 2012 | p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \ |
---|
| 2013 | p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ |
---|
| 2014 | p6##_type p6, p7##_type p7) {\ |
---|
| 2015 | return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 2016 | p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \ |
---|
| 2017 | p6, p7);\ |
---|
| 2018 | }\ |
---|
| 2019 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 2020 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 2021 | typename p6##_type, typename p7##_type>\ |
---|
| 2022 | template <typename F>\ |
---|
| 2023 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 2024 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 2025 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 2026 | typename arg9_type>\ |
---|
| 2027 | typename ::testing::internal::Function<F>::Result\ |
---|
| 2028 | name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
---|
| 2029 | p5##_type, p6##_type, \ |
---|
| 2030 | p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
---|
| 2031 | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
---|
| 2032 | |
---|
| 2033 | #define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\ |
---|
| 2034 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 2035 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 2036 | typename p6##_type, typename p7##_type, typename p8##_type>\ |
---|
| 2037 | class name##ActionP9 {\ |
---|
| 2038 | public:\ |
---|
| 2039 | name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \ |
---|
| 2040 | p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
---|
| 2041 | p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ |
---|
| 2042 | p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 2043 | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ |
---|
| 2044 | p8(gmock_p8) {}\ |
---|
| 2045 | template <typename F>\ |
---|
| 2046 | class gmock_Impl : public ::testing::ActionInterface<F> {\ |
---|
| 2047 | public:\ |
---|
| 2048 | typedef F function_type;\ |
---|
| 2049 | typedef typename ::testing::internal::Function<F>::Result return_type;\ |
---|
| 2050 | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
---|
| 2051 | args_type;\ |
---|
| 2052 | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 2053 | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
---|
| 2054 | p6##_type gmock_p6, p7##_type gmock_p7, \ |
---|
| 2055 | p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 2056 | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
---|
| 2057 | p7(gmock_p7), p8(gmock_p8) {}\ |
---|
| 2058 | virtual return_type Perform(const args_type& args) {\ |
---|
| 2059 | return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
---|
| 2060 | Perform(this, args);\ |
---|
| 2061 | }\ |
---|
| 2062 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 2063 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 2064 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 2065 | typename arg9_type>\ |
---|
| 2066 | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
---|
| 2067 | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
---|
| 2068 | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
---|
| 2069 | arg9_type arg9) const;\ |
---|
| 2070 | p0##_type p0;\ |
---|
| 2071 | p1##_type p1;\ |
---|
| 2072 | p2##_type p2;\ |
---|
| 2073 | p3##_type p3;\ |
---|
| 2074 | p4##_type p4;\ |
---|
| 2075 | p5##_type p5;\ |
---|
| 2076 | p6##_type p6;\ |
---|
| 2077 | p7##_type p7;\ |
---|
| 2078 | p8##_type p8;\ |
---|
| 2079 | private:\ |
---|
| 2080 | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
---|
| 2081 | };\ |
---|
| 2082 | template <typename F> operator ::testing::Action<F>() const {\ |
---|
| 2083 | return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ |
---|
| 2084 | p6, p7, p8));\ |
---|
| 2085 | }\ |
---|
| 2086 | p0##_type p0;\ |
---|
| 2087 | p1##_type p1;\ |
---|
| 2088 | p2##_type p2;\ |
---|
| 2089 | p3##_type p3;\ |
---|
| 2090 | p4##_type p4;\ |
---|
| 2091 | p5##_type p5;\ |
---|
| 2092 | p6##_type p6;\ |
---|
| 2093 | p7##_type p7;\ |
---|
| 2094 | p8##_type p8;\ |
---|
| 2095 | private:\ |
---|
| 2096 | GTEST_DISALLOW_ASSIGN_(name##ActionP9);\ |
---|
| 2097 | };\ |
---|
| 2098 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 2099 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 2100 | typename p6##_type, typename p7##_type, typename p8##_type>\ |
---|
| 2101 | inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 2102 | p4##_type, p5##_type, p6##_type, p7##_type, \ |
---|
| 2103 | p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
---|
| 2104 | p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \ |
---|
| 2105 | p8##_type p8) {\ |
---|
| 2106 | return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 2107 | p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \ |
---|
| 2108 | p3, p4, p5, p6, p7, p8);\ |
---|
| 2109 | }\ |
---|
| 2110 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 2111 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 2112 | typename p6##_type, typename p7##_type, typename p8##_type>\ |
---|
| 2113 | template <typename F>\ |
---|
| 2114 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 2115 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 2116 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 2117 | typename arg9_type>\ |
---|
| 2118 | typename ::testing::internal::Function<F>::Result\ |
---|
| 2119 | name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
---|
| 2120 | p5##_type, p6##_type, p7##_type, \ |
---|
| 2121 | p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
---|
| 2122 | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
---|
| 2123 | |
---|
| 2124 | #define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\ |
---|
| 2125 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 2126 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 2127 | typename p6##_type, typename p7##_type, typename p8##_type, \ |
---|
| 2128 | typename p9##_type>\ |
---|
| 2129 | class name##ActionP10 {\ |
---|
| 2130 | public:\ |
---|
| 2131 | name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \ |
---|
| 2132 | p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
---|
| 2133 | p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ |
---|
| 2134 | p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ |
---|
| 2135 | p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
---|
| 2136 | p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ |
---|
| 2137 | template <typename F>\ |
---|
| 2138 | class gmock_Impl : public ::testing::ActionInterface<F> {\ |
---|
| 2139 | public:\ |
---|
| 2140 | typedef F function_type;\ |
---|
| 2141 | typedef typename ::testing::internal::Function<F>::Result return_type;\ |
---|
| 2142 | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
---|
| 2143 | args_type;\ |
---|
| 2144 | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
---|
| 2145 | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
---|
| 2146 | p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ |
---|
| 2147 | p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
---|
| 2148 | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
---|
| 2149 | p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ |
---|
| 2150 | virtual return_type Perform(const args_type& args) {\ |
---|
| 2151 | return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
---|
| 2152 | Perform(this, args);\ |
---|
| 2153 | }\ |
---|
| 2154 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 2155 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 2156 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 2157 | typename arg9_type>\ |
---|
| 2158 | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
---|
| 2159 | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
---|
| 2160 | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
---|
| 2161 | arg9_type arg9) const;\ |
---|
| 2162 | p0##_type p0;\ |
---|
| 2163 | p1##_type p1;\ |
---|
| 2164 | p2##_type p2;\ |
---|
| 2165 | p3##_type p3;\ |
---|
| 2166 | p4##_type p4;\ |
---|
| 2167 | p5##_type p5;\ |
---|
| 2168 | p6##_type p6;\ |
---|
| 2169 | p7##_type p7;\ |
---|
| 2170 | p8##_type p8;\ |
---|
| 2171 | p9##_type p9;\ |
---|
| 2172 | private:\ |
---|
| 2173 | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
---|
| 2174 | };\ |
---|
| 2175 | template <typename F> operator ::testing::Action<F>() const {\ |
---|
| 2176 | return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ |
---|
| 2177 | p6, p7, p8, p9));\ |
---|
| 2178 | }\ |
---|
| 2179 | p0##_type p0;\ |
---|
| 2180 | p1##_type p1;\ |
---|
| 2181 | p2##_type p2;\ |
---|
| 2182 | p3##_type p3;\ |
---|
| 2183 | p4##_type p4;\ |
---|
| 2184 | p5##_type p5;\ |
---|
| 2185 | p6##_type p6;\ |
---|
| 2186 | p7##_type p7;\ |
---|
| 2187 | p8##_type p8;\ |
---|
| 2188 | p9##_type p9;\ |
---|
| 2189 | private:\ |
---|
| 2190 | GTEST_DISALLOW_ASSIGN_(name##ActionP10);\ |
---|
| 2191 | };\ |
---|
| 2192 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 2193 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 2194 | typename p6##_type, typename p7##_type, typename p8##_type, \ |
---|
| 2195 | typename p9##_type>\ |
---|
| 2196 | inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 2197 | p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ |
---|
| 2198 | p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
---|
| 2199 | p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ |
---|
| 2200 | p9##_type p9) {\ |
---|
| 2201 | return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \ |
---|
| 2202 | p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \ |
---|
| 2203 | p1, p2, p3, p4, p5, p6, p7, p8, p9);\ |
---|
| 2204 | }\ |
---|
| 2205 | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
---|
| 2206 | typename p3##_type, typename p4##_type, typename p5##_type, \ |
---|
| 2207 | typename p6##_type, typename p7##_type, typename p8##_type, \ |
---|
| 2208 | typename p9##_type>\ |
---|
| 2209 | template <typename F>\ |
---|
| 2210 | template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
---|
| 2211 | typename arg3_type, typename arg4_type, typename arg5_type, \ |
---|
| 2212 | typename arg6_type, typename arg7_type, typename arg8_type, \ |
---|
| 2213 | typename arg9_type>\ |
---|
| 2214 | typename ::testing::internal::Function<F>::Result\ |
---|
| 2215 | name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
---|
| 2216 | p5##_type, p6##_type, p7##_type, p8##_type, \ |
---|
| 2217 | p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
---|
| 2218 | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
---|
| 2219 | |
---|
| 2220 | // TODO(wan@google.com): move the following to a different .h file |
---|
| 2221 | // such that we don't have to run 'pump' every time the code is |
---|
| 2222 | // updated. |
---|
| 2223 | namespace testing { |
---|
| 2224 | |
---|
| 2225 | // The ACTION*() macros trigger warning C4100 (unreferenced formal |
---|
| 2226 | // parameter) in MSVC with -W4. Unfortunately they cannot be fixed in |
---|
| 2227 | // the macro definition, as the warnings are generated when the macro |
---|
| 2228 | // is expanded and macro expansion cannot contain #pragma. Therefore |
---|
| 2229 | // we suppress them here. |
---|
| 2230 | #ifdef _MSC_VER |
---|
| 2231 | # pragma warning(push) |
---|
| 2232 | # pragma warning(disable:4100) |
---|
| 2233 | #endif |
---|
| 2234 | |
---|
| 2235 | // Various overloads for InvokeArgument<N>(). |
---|
| 2236 | // |
---|
| 2237 | // The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th |
---|
| 2238 | // (0-based) argument, which must be a k-ary callable, of the mock |
---|
| 2239 | // function, with arguments a1, a2, ..., a_k. |
---|
| 2240 | // |
---|
| 2241 | // Notes: |
---|
| 2242 | // |
---|
| 2243 | // 1. The arguments are passed by value by default. If you need to |
---|
| 2244 | // pass an argument by reference, wrap it inside ByRef(). For |
---|
| 2245 | // example, |
---|
| 2246 | // |
---|
| 2247 | // InvokeArgument<1>(5, string("Hello"), ByRef(foo)) |
---|
| 2248 | // |
---|
| 2249 | // passes 5 and string("Hello") by value, and passes foo by |
---|
| 2250 | // reference. |
---|
| 2251 | // |
---|
| 2252 | // 2. If the callable takes an argument by reference but ByRef() is |
---|
| 2253 | // not used, it will receive the reference to a copy of the value, |
---|
| 2254 | // instead of the original value. For example, when the 0-th |
---|
| 2255 | // argument of the mock function takes a const string&, the action |
---|
| 2256 | // |
---|
| 2257 | // InvokeArgument<0>(string("Hello")) |
---|
| 2258 | // |
---|
| 2259 | // makes a copy of the temporary string("Hello") object and passes a |
---|
| 2260 | // reference of the copy, instead of the original temporary object, |
---|
| 2261 | // to the callable. This makes it easy for a user to define an |
---|
| 2262 | // InvokeArgument action from temporary values and have it performed |
---|
| 2263 | // later. |
---|
| 2264 | |
---|
| 2265 | ACTION_TEMPLATE(InvokeArgument, |
---|
| 2266 | HAS_1_TEMPLATE_PARAMS(int, k), |
---|
| 2267 | AND_0_VALUE_PARAMS()) { |
---|
| 2268 | return internal::CallableHelper<return_type>::Call( |
---|
| 2269 | ::std::tr1::get<k>(args)); |
---|
| 2270 | } |
---|
| 2271 | |
---|
| 2272 | ACTION_TEMPLATE(InvokeArgument, |
---|
| 2273 | HAS_1_TEMPLATE_PARAMS(int, k), |
---|
| 2274 | AND_1_VALUE_PARAMS(p0)) { |
---|
| 2275 | return internal::CallableHelper<return_type>::Call( |
---|
| 2276 | ::std::tr1::get<k>(args), p0); |
---|
| 2277 | } |
---|
| 2278 | |
---|
| 2279 | ACTION_TEMPLATE(InvokeArgument, |
---|
| 2280 | HAS_1_TEMPLATE_PARAMS(int, k), |
---|
| 2281 | AND_2_VALUE_PARAMS(p0, p1)) { |
---|
| 2282 | return internal::CallableHelper<return_type>::Call( |
---|
| 2283 | ::std::tr1::get<k>(args), p0, p1); |
---|
| 2284 | } |
---|
| 2285 | |
---|
| 2286 | ACTION_TEMPLATE(InvokeArgument, |
---|
| 2287 | HAS_1_TEMPLATE_PARAMS(int, k), |
---|
| 2288 | AND_3_VALUE_PARAMS(p0, p1, p2)) { |
---|
| 2289 | return internal::CallableHelper<return_type>::Call( |
---|
| 2290 | ::std::tr1::get<k>(args), p0, p1, p2); |
---|
| 2291 | } |
---|
| 2292 | |
---|
| 2293 | ACTION_TEMPLATE(InvokeArgument, |
---|
| 2294 | HAS_1_TEMPLATE_PARAMS(int, k), |
---|
| 2295 | AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { |
---|
| 2296 | return internal::CallableHelper<return_type>::Call( |
---|
| 2297 | ::std::tr1::get<k>(args), p0, p1, p2, p3); |
---|
| 2298 | } |
---|
| 2299 | |
---|
| 2300 | ACTION_TEMPLATE(InvokeArgument, |
---|
| 2301 | HAS_1_TEMPLATE_PARAMS(int, k), |
---|
| 2302 | AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { |
---|
| 2303 | return internal::CallableHelper<return_type>::Call( |
---|
| 2304 | ::std::tr1::get<k>(args), p0, p1, p2, p3, p4); |
---|
| 2305 | } |
---|
| 2306 | |
---|
| 2307 | ACTION_TEMPLATE(InvokeArgument, |
---|
| 2308 | HAS_1_TEMPLATE_PARAMS(int, k), |
---|
| 2309 | AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { |
---|
| 2310 | return internal::CallableHelper<return_type>::Call( |
---|
| 2311 | ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5); |
---|
| 2312 | } |
---|
| 2313 | |
---|
| 2314 | ACTION_TEMPLATE(InvokeArgument, |
---|
| 2315 | HAS_1_TEMPLATE_PARAMS(int, k), |
---|
| 2316 | AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { |
---|
| 2317 | return internal::CallableHelper<return_type>::Call( |
---|
| 2318 | ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6); |
---|
| 2319 | } |
---|
| 2320 | |
---|
| 2321 | ACTION_TEMPLATE(InvokeArgument, |
---|
| 2322 | HAS_1_TEMPLATE_PARAMS(int, k), |
---|
| 2323 | AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { |
---|
| 2324 | return internal::CallableHelper<return_type>::Call( |
---|
| 2325 | ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7); |
---|
| 2326 | } |
---|
| 2327 | |
---|
| 2328 | ACTION_TEMPLATE(InvokeArgument, |
---|
| 2329 | HAS_1_TEMPLATE_PARAMS(int, k), |
---|
| 2330 | AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { |
---|
| 2331 | return internal::CallableHelper<return_type>::Call( |
---|
| 2332 | ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8); |
---|
| 2333 | } |
---|
| 2334 | |
---|
| 2335 | ACTION_TEMPLATE(InvokeArgument, |
---|
| 2336 | HAS_1_TEMPLATE_PARAMS(int, k), |
---|
| 2337 | AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { |
---|
| 2338 | return internal::CallableHelper<return_type>::Call( |
---|
| 2339 | ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); |
---|
| 2340 | } |
---|
| 2341 | |
---|
| 2342 | // Various overloads for ReturnNew<T>(). |
---|
| 2343 | // |
---|
| 2344 | // The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new |
---|
| 2345 | // instance of type T, constructed on the heap with constructor arguments |
---|
| 2346 | // a1, a2, ..., and a_k. The caller assumes ownership of the returned value. |
---|
| 2347 | ACTION_TEMPLATE(ReturnNew, |
---|
| 2348 | HAS_1_TEMPLATE_PARAMS(typename, T), |
---|
| 2349 | AND_0_VALUE_PARAMS()) { |
---|
| 2350 | return new T(); |
---|
| 2351 | } |
---|
| 2352 | |
---|
| 2353 | ACTION_TEMPLATE(ReturnNew, |
---|
| 2354 | HAS_1_TEMPLATE_PARAMS(typename, T), |
---|
| 2355 | AND_1_VALUE_PARAMS(p0)) { |
---|
| 2356 | return new T(p0); |
---|
| 2357 | } |
---|
| 2358 | |
---|
| 2359 | ACTION_TEMPLATE(ReturnNew, |
---|
| 2360 | HAS_1_TEMPLATE_PARAMS(typename, T), |
---|
| 2361 | AND_2_VALUE_PARAMS(p0, p1)) { |
---|
| 2362 | return new T(p0, p1); |
---|
| 2363 | } |
---|
| 2364 | |
---|
| 2365 | ACTION_TEMPLATE(ReturnNew, |
---|
| 2366 | HAS_1_TEMPLATE_PARAMS(typename, T), |
---|
| 2367 | AND_3_VALUE_PARAMS(p0, p1, p2)) { |
---|
| 2368 | return new T(p0, p1, p2); |
---|
| 2369 | } |
---|
| 2370 | |
---|
| 2371 | ACTION_TEMPLATE(ReturnNew, |
---|
| 2372 | HAS_1_TEMPLATE_PARAMS(typename, T), |
---|
| 2373 | AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { |
---|
| 2374 | return new T(p0, p1, p2, p3); |
---|
| 2375 | } |
---|
| 2376 | |
---|
| 2377 | ACTION_TEMPLATE(ReturnNew, |
---|
| 2378 | HAS_1_TEMPLATE_PARAMS(typename, T), |
---|
| 2379 | AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { |
---|
| 2380 | return new T(p0, p1, p2, p3, p4); |
---|
| 2381 | } |
---|
| 2382 | |
---|
| 2383 | ACTION_TEMPLATE(ReturnNew, |
---|
| 2384 | HAS_1_TEMPLATE_PARAMS(typename, T), |
---|
| 2385 | AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { |
---|
| 2386 | return new T(p0, p1, p2, p3, p4, p5); |
---|
| 2387 | } |
---|
| 2388 | |
---|
| 2389 | ACTION_TEMPLATE(ReturnNew, |
---|
| 2390 | HAS_1_TEMPLATE_PARAMS(typename, T), |
---|
| 2391 | AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { |
---|
| 2392 | return new T(p0, p1, p2, p3, p4, p5, p6); |
---|
| 2393 | } |
---|
| 2394 | |
---|
| 2395 | ACTION_TEMPLATE(ReturnNew, |
---|
| 2396 | HAS_1_TEMPLATE_PARAMS(typename, T), |
---|
| 2397 | AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { |
---|
| 2398 | return new T(p0, p1, p2, p3, p4, p5, p6, p7); |
---|
| 2399 | } |
---|
| 2400 | |
---|
| 2401 | ACTION_TEMPLATE(ReturnNew, |
---|
| 2402 | HAS_1_TEMPLATE_PARAMS(typename, T), |
---|
| 2403 | AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { |
---|
| 2404 | return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8); |
---|
| 2405 | } |
---|
| 2406 | |
---|
| 2407 | ACTION_TEMPLATE(ReturnNew, |
---|
| 2408 | HAS_1_TEMPLATE_PARAMS(typename, T), |
---|
| 2409 | AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { |
---|
| 2410 | return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); |
---|
| 2411 | } |
---|
| 2412 | |
---|
| 2413 | #ifdef _MSC_VER |
---|
| 2414 | # pragma warning(pop) |
---|
| 2415 | #endif |
---|
| 2416 | |
---|
| 2417 | } // namespace testing |
---|
| 2418 | |
---|
| 2419 | #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ |
---|