gmock-generated-actions.h
Go to the documentation of this file.
00001 // This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
00002 
00003 // Copyright 2007, Google Inc.
00004 // All rights reserved.
00005 //
00006 // Redistribution and use in source and binary forms, with or without
00007 // modification, are permitted provided that the following conditions are
00008 // met:
00009 //
00010 //     * Redistributions of source code must retain the above copyright
00011 // notice, this list of conditions and the following disclaimer.
00012 //     * Redistributions in binary form must reproduce the above
00013 // copyright notice, this list of conditions and the following disclaimer
00014 // in the documentation and/or other materials provided with the
00015 // distribution.
00016 //     * Neither the name of Google Inc. nor the names of its
00017 // contributors may be used to endorse or promote products derived from
00018 // this software without specific prior written permission.
00019 //
00020 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00021 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00023 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00024 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00025 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00026 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00027 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00028 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00029 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00030 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031 //
00032 // Author: wan@google.com (Zhanyong Wan)
00033 
00034 // Google Mock - a framework for writing C++ mock classes.
00035 //
00036 // This file implements some commonly used variadic actions.
00037 
00038 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
00039 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
00040 
00041 #include "gmock/gmock-actions.h"
00042 #include "gmock/internal/gmock-port.h"
00043 
00044 namespace testing {
00045 namespace internal {
00046 
00047 // InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
00048 // function or method with the unpacked values, where F is a function
00049 // type that takes N arguments.
00050 template <typename Result, typename ArgumentTuple>
00051 class InvokeHelper;
00052 
00053 template <typename R>
00054 class InvokeHelper<R, ::std::tr1::tuple<> > {
00055  public:
00056   template <typename Function>
00057   static R Invoke(Function function, const ::std::tr1::tuple<>&) {
00058     return function();
00059   }
00060 
00061   template <class Class, typename MethodPtr>
00062   static R InvokeMethod(Class* obj_ptr,
00063                         MethodPtr method_ptr,
00064                         const ::std::tr1::tuple<>&) {
00065     return (obj_ptr->*method_ptr)();
00066   }
00067 };
00068 
00069 template <typename R, typename A1>
00070 class InvokeHelper<R, ::std::tr1::tuple<A1> > {
00071  public:
00072   template <typename Function>
00073   static R Invoke(Function function, const ::std::tr1::tuple<A1>& args) {
00074     using ::std::tr1::get;
00075     return function(get<0>(args));
00076   }
00077 
00078   template <class Class, typename MethodPtr>
00079   static R InvokeMethod(Class* obj_ptr,
00080                         MethodPtr method_ptr,
00081                         const ::std::tr1::tuple<A1>& args) {
00082     using ::std::tr1::get;
00083     return (obj_ptr->*method_ptr)(get<0>(args));
00084   }
00085 };
00086 
00087 template <typename R, typename A1, typename A2>
00088 class InvokeHelper<R, ::std::tr1::tuple<A1, A2> > {
00089  public:
00090   template <typename Function>
00091   static R Invoke(Function function, const ::std::tr1::tuple<A1, A2>& args) {
00092     using ::std::tr1::get;
00093     return function(get<0>(args), get<1>(args));
00094   }
00095 
00096   template <class Class, typename MethodPtr>
00097   static R InvokeMethod(Class* obj_ptr,
00098                         MethodPtr method_ptr,
00099                         const ::std::tr1::tuple<A1, A2>& args) {
00100     using ::std::tr1::get;
00101     return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
00102   }
00103 };
00104 
00105 template <typename R, typename A1, typename A2, typename A3>
00106 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3> > {
00107  public:
00108   template <typename Function>
00109   static R Invoke(Function function, const ::std::tr1::tuple<A1, A2,
00110       A3>& args) {
00111     using ::std::tr1::get;
00112     return function(get<0>(args), get<1>(args), get<2>(args));
00113   }
00114 
00115   template <class Class, typename MethodPtr>
00116   static R InvokeMethod(Class* obj_ptr,
00117                         MethodPtr method_ptr,
00118                         const ::std::tr1::tuple<A1, A2, A3>& args) {
00119     using ::std::tr1::get;
00120     return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args));
00121   }
00122 };
00123 
00124 template <typename R, typename A1, typename A2, typename A3, typename A4>
00125 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4> > {
00126  public:
00127   template <typename Function>
00128   static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3,
00129       A4>& args) {
00130     using ::std::tr1::get;
00131     return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args));
00132   }
00133 
00134   template <class Class, typename MethodPtr>
00135   static R InvokeMethod(Class* obj_ptr,
00136                         MethodPtr method_ptr,
00137                         const ::std::tr1::tuple<A1, A2, A3, A4>& args) {
00138     using ::std::tr1::get;
00139     return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
00140         get<3>(args));
00141   }
00142 };
00143 
00144 template <typename R, typename A1, typename A2, typename A3, typename A4,
00145     typename A5>
00146 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5> > {
00147  public:
00148   template <typename Function>
00149   static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
00150       A5>& args) {
00151     using ::std::tr1::get;
00152     return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
00153         get<4>(args));
00154   }
00155 
00156   template <class Class, typename MethodPtr>
00157   static R InvokeMethod(Class* obj_ptr,
00158                         MethodPtr method_ptr,
00159                         const ::std::tr1::tuple<A1, A2, A3, A4, A5>& args) {
00160     using ::std::tr1::get;
00161     return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
00162         get<3>(args), get<4>(args));
00163   }
00164 };
00165 
00166 template <typename R, typename A1, typename A2, typename A3, typename A4,
00167     typename A5, typename A6>
00168 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6> > {
00169  public:
00170   template <typename Function>
00171   static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
00172       A5, A6>& args) {
00173     using ::std::tr1::get;
00174     return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
00175         get<4>(args), get<5>(args));
00176   }
00177 
00178   template <class Class, typename MethodPtr>
00179   static R InvokeMethod(Class* obj_ptr,
00180                         MethodPtr method_ptr,
00181                         const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6>& args) {
00182     using ::std::tr1::get;
00183     return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
00184         get<3>(args), get<4>(args), get<5>(args));
00185   }
00186 };
00187 
00188 template <typename R, typename A1, typename A2, typename A3, typename A4,
00189     typename A5, typename A6, typename A7>
00190 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7> > {
00191  public:
00192   template <typename Function>
00193   static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
00194       A5, A6, A7>& args) {
00195     using ::std::tr1::get;
00196     return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
00197         get<4>(args), get<5>(args), get<6>(args));
00198   }
00199 
00200   template <class Class, typename MethodPtr>
00201   static R InvokeMethod(Class* obj_ptr,
00202                         MethodPtr method_ptr,
00203                         const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6,
00204                             A7>& args) {
00205     using ::std::tr1::get;
00206     return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
00207         get<3>(args), get<4>(args), get<5>(args), get<6>(args));
00208   }
00209 };
00210 
00211 template <typename R, typename A1, typename A2, typename A3, typename A4,
00212     typename A5, typename A6, typename A7, typename A8>
00213 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
00214  public:
00215   template <typename Function>
00216   static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
00217       A5, A6, A7, A8>& args) {
00218     using ::std::tr1::get;
00219     return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
00220         get<4>(args), get<5>(args), get<6>(args), get<7>(args));
00221   }
00222 
00223   template <class Class, typename MethodPtr>
00224   static R InvokeMethod(Class* obj_ptr,
00225                         MethodPtr method_ptr,
00226                         const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7,
00227                             A8>& args) {
00228     using ::std::tr1::get;
00229     return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
00230         get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args));
00231   }
00232 };
00233 
00234 template <typename R, typename A1, typename A2, typename A3, typename A4,
00235     typename A5, typename A6, typename A7, typename A8, typename A9>
00236 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
00237  public:
00238   template <typename Function>
00239   static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
00240       A5, A6, A7, A8, A9>& args) {
00241     using ::std::tr1::get;
00242     return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
00243         get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args));
00244   }
00245 
00246   template <class Class, typename MethodPtr>
00247   static R InvokeMethod(Class* obj_ptr,
00248                         MethodPtr method_ptr,
00249                         const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
00250                             A9>& args) {
00251     using ::std::tr1::get;
00252     return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
00253         get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args),
00254         get<8>(args));
00255   }
00256 };
00257 
00258 template <typename R, typename A1, typename A2, typename A3, typename A4,
00259     typename A5, typename A6, typename A7, typename A8, typename A9,
00260     typename A10>
00261 class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
00262     A10> > {
00263  public:
00264   template <typename Function>
00265   static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
00266       A5, A6, A7, A8, A9, A10>& args) {
00267     using ::std::tr1::get;
00268     return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
00269         get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
00270         get<9>(args));
00271   }
00272 
00273   template <class Class, typename MethodPtr>
00274   static R InvokeMethod(Class* obj_ptr,
00275                         MethodPtr method_ptr,
00276                         const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
00277                             A9, A10>& args) {
00278     using ::std::tr1::get;
00279     return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
00280         get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args),
00281         get<8>(args), get<9>(args));
00282   }
00283 };
00284 
00285 // CallableHelper has static methods for invoking "callables",
00286 // i.e. function pointers and functors.  It uses overloading to
00287 // provide a uniform interface for invoking different kinds of
00288 // callables.  In particular, you can use:
00289 //
00290 //   CallableHelper<R>::Call(callable, a1, a2, ..., an)
00291 //
00292 // to invoke an n-ary callable, where R is its return type.  If an
00293 // argument, say a2, needs to be passed by reference, you should write
00294 // ByRef(a2) instead of a2 in the above expression.
00295 template <typename R>
00296 class CallableHelper {
00297  public:
00298   // Calls a nullary callable.
00299   template <typename Function>
00300   static R Call(Function function) { return function(); }
00301 
00302   // Calls a unary callable.
00303 
00304   // We deliberately pass a1 by value instead of const reference here
00305   // in case it is a C-string literal.  If we had declared the
00306   // parameter as 'const A1& a1' and write Call(function, "Hi"), the
00307   // compiler would've thought A1 is 'char[3]', which causes trouble
00308   // when you need to copy a value of type A1.  By declaring the
00309   // parameter as 'A1 a1', the compiler will correctly infer that A1
00310   // is 'const char*' when it sees Call(function, "Hi").
00311   //
00312   // Since this function is defined inline, the compiler can get rid
00313   // of the copying of the arguments.  Therefore the performance won't
00314   // be hurt.
00315   template <typename Function, typename A1>
00316   static R Call(Function function, A1 a1) { return function(a1); }
00317 
00318   // Calls a binary callable.
00319   template <typename Function, typename A1, typename A2>
00320   static R Call(Function function, A1 a1, A2 a2) {
00321     return function(a1, a2);
00322   }
00323 
00324   // Calls a ternary callable.
00325   template <typename Function, typename A1, typename A2, typename A3>
00326   static R Call(Function function, A1 a1, A2 a2, A3 a3) {
00327     return function(a1, a2, a3);
00328   }
00329 
00330   // Calls a 4-ary callable.
00331   template <typename Function, typename A1, typename A2, typename A3,
00332       typename A4>
00333   static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4) {
00334     return function(a1, a2, a3, a4);
00335   }
00336 
00337   // Calls a 5-ary callable.
00338   template <typename Function, typename A1, typename A2, typename A3,
00339       typename A4, typename A5>
00340   static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
00341     return function(a1, a2, a3, a4, a5);
00342   }
00343 
00344   // Calls a 6-ary callable.
00345   template <typename Function, typename A1, typename A2, typename A3,
00346       typename A4, typename A5, typename A6>
00347   static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
00348     return function(a1, a2, a3, a4, a5, a6);
00349   }
00350 
00351   // Calls a 7-ary callable.
00352   template <typename Function, typename A1, typename A2, typename A3,
00353       typename A4, typename A5, typename A6, typename A7>
00354   static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
00355       A7 a7) {
00356     return function(a1, a2, a3, a4, a5, a6, a7);
00357   }
00358 
00359   // Calls a 8-ary callable.
00360   template <typename Function, typename A1, typename A2, typename A3,
00361       typename A4, typename A5, typename A6, typename A7, typename A8>
00362   static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
00363       A7 a7, A8 a8) {
00364     return function(a1, a2, a3, a4, a5, a6, a7, a8);
00365   }
00366 
00367   // Calls a 9-ary callable.
00368   template <typename Function, typename A1, typename A2, typename A3,
00369       typename A4, typename A5, typename A6, typename A7, typename A8,
00370       typename A9>
00371   static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
00372       A7 a7, A8 a8, A9 a9) {
00373     return function(a1, a2, a3, a4, a5, a6, a7, a8, a9);
00374   }
00375 
00376   // Calls a 10-ary callable.
00377   template <typename Function, typename A1, typename A2, typename A3,
00378       typename A4, typename A5, typename A6, typename A7, typename A8,
00379       typename A9, typename A10>
00380   static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
00381       A7 a7, A8 a8, A9 a9, A10 a10) {
00382     return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
00383   }
00384 };  // class CallableHelper
00385 
00386 // An INTERNAL macro for extracting the type of a tuple field.  It's
00387 // subject to change without notice - DO NOT USE IN USER CODE!
00388 #define GMOCK_FIELD_(Tuple, N) \
00389     typename ::std::tr1::tuple_element<N, Tuple>::type
00390 
00391 // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
00392 // type of an n-ary function whose i-th (1-based) argument type is the
00393 // k{i}-th (0-based) field of ArgumentTuple, which must be a tuple
00394 // type, and whose return type is Result.  For example,
00395 //   SelectArgs<int, ::std::tr1::tuple<bool, char, double, long>, 0, 3>::type
00396 // is int(bool, long).
00397 //
00398 // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
00399 // returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
00400 // For example,
00401 //   SelectArgs<int, ::std::tr1::tuple<bool, char, double>, 2, 0>::Select(
00402 //       ::std::tr1::make_tuple(true, 'a', 2.5))
00403 // returns ::std::tr1::tuple (2.5, true).
00404 //
00405 // The numbers in list k1, k2, ..., k_n must be >= 0, where n can be
00406 // in the range [0, 10].  Duplicates are allowed and they don't have
00407 // to be in an ascending or descending order.
00408 
00409 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
00410     int k4, int k5, int k6, int k7, int k8, int k9, int k10>
00411 class SelectArgs {
00412  public:
00413   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
00414       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
00415       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
00416       GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
00417       GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9),
00418       GMOCK_FIELD_(ArgumentTuple, k10));
00419   typedef typename Function<type>::ArgumentTuple SelectedArgs;
00420   static SelectedArgs Select(const ArgumentTuple& args) {
00421     using ::std::tr1::get;
00422     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
00423         get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
00424         get<k8>(args), get<k9>(args), get<k10>(args));
00425   }
00426 };
00427 
00428 template <typename Result, typename ArgumentTuple>
00429 class SelectArgs<Result, ArgumentTuple,
00430                  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
00431  public:
00432   typedef Result type();
00433   typedef typename Function<type>::ArgumentTuple SelectedArgs;
00434   static SelectedArgs Select(const ArgumentTuple& /* args */) {
00435     using ::std::tr1::get;
00436     return SelectedArgs();
00437   }
00438 };
00439 
00440 template <typename Result, typename ArgumentTuple, int k1>
00441 class SelectArgs<Result, ArgumentTuple,
00442                  k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
00443  public:
00444   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1));
00445   typedef typename Function<type>::ArgumentTuple SelectedArgs;
00446   static SelectedArgs Select(const ArgumentTuple& args) {
00447     using ::std::tr1::get;
00448     return SelectedArgs(get<k1>(args));
00449   }
00450 };
00451 
00452 template <typename Result, typename ArgumentTuple, int k1, int k2>
00453 class SelectArgs<Result, ArgumentTuple,
00454                  k1, k2, -1, -1, -1, -1, -1, -1, -1, -1> {
00455  public:
00456   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
00457       GMOCK_FIELD_(ArgumentTuple, k2));
00458   typedef typename Function<type>::ArgumentTuple SelectedArgs;
00459   static SelectedArgs Select(const ArgumentTuple& args) {
00460     using ::std::tr1::get;
00461     return SelectedArgs(get<k1>(args), get<k2>(args));
00462   }
00463 };
00464 
00465 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3>
00466 class SelectArgs<Result, ArgumentTuple,
00467                  k1, k2, k3, -1, -1, -1, -1, -1, -1, -1> {
00468  public:
00469   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
00470       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3));
00471   typedef typename Function<type>::ArgumentTuple SelectedArgs;
00472   static SelectedArgs Select(const ArgumentTuple& args) {
00473     using ::std::tr1::get;
00474     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args));
00475   }
00476 };
00477 
00478 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
00479     int k4>
00480 class SelectArgs<Result, ArgumentTuple,
00481                  k1, k2, k3, k4, -1, -1, -1, -1, -1, -1> {
00482  public:
00483   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
00484       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
00485       GMOCK_FIELD_(ArgumentTuple, k4));
00486   typedef typename Function<type>::ArgumentTuple SelectedArgs;
00487   static SelectedArgs Select(const ArgumentTuple& args) {
00488     using ::std::tr1::get;
00489     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
00490         get<k4>(args));
00491   }
00492 };
00493 
00494 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
00495     int k4, int k5>
00496 class SelectArgs<Result, ArgumentTuple,
00497                  k1, k2, k3, k4, k5, -1, -1, -1, -1, -1> {
00498  public:
00499   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
00500       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
00501       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5));
00502   typedef typename Function<type>::ArgumentTuple SelectedArgs;
00503   static SelectedArgs Select(const ArgumentTuple& args) {
00504     using ::std::tr1::get;
00505     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
00506         get<k4>(args), get<k5>(args));
00507   }
00508 };
00509 
00510 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
00511     int k4, int k5, int k6>
00512 class SelectArgs<Result, ArgumentTuple,
00513                  k1, k2, k3, k4, k5, k6, -1, -1, -1, -1> {
00514  public:
00515   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
00516       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
00517       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
00518       GMOCK_FIELD_(ArgumentTuple, k6));
00519   typedef typename Function<type>::ArgumentTuple SelectedArgs;
00520   static SelectedArgs Select(const ArgumentTuple& args) {
00521     using ::std::tr1::get;
00522     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
00523         get<k4>(args), get<k5>(args), get<k6>(args));
00524   }
00525 };
00526 
00527 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
00528     int k4, int k5, int k6, int k7>
00529 class SelectArgs<Result, ArgumentTuple,
00530                  k1, k2, k3, k4, k5, k6, k7, -1, -1, -1> {
00531  public:
00532   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
00533       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
00534       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
00535       GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7));
00536   typedef typename Function<type>::ArgumentTuple SelectedArgs;
00537   static SelectedArgs Select(const ArgumentTuple& args) {
00538     using ::std::tr1::get;
00539     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
00540         get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args));
00541   }
00542 };
00543 
00544 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
00545     int k4, int k5, int k6, int k7, int k8>
00546 class SelectArgs<Result, ArgumentTuple,
00547                  k1, k2, k3, k4, k5, k6, k7, k8, -1, -1> {
00548  public:
00549   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
00550       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
00551       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
00552       GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
00553       GMOCK_FIELD_(ArgumentTuple, k8));
00554   typedef typename Function<type>::ArgumentTuple SelectedArgs;
00555   static SelectedArgs Select(const ArgumentTuple& args) {
00556     using ::std::tr1::get;
00557     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
00558         get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
00559         get<k8>(args));
00560   }
00561 };
00562 
00563 template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
00564     int k4, int k5, int k6, int k7, int k8, int k9>
00565 class SelectArgs<Result, ArgumentTuple,
00566                  k1, k2, k3, k4, k5, k6, k7, k8, k9, -1> {
00567  public:
00568   typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
00569       GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
00570       GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
00571       GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
00572       GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9));
00573   typedef typename Function<type>::ArgumentTuple SelectedArgs;
00574   static SelectedArgs Select(const ArgumentTuple& args) {
00575     using ::std::tr1::get;
00576     return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
00577         get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
00578         get<k8>(args), get<k9>(args));
00579   }
00580 };
00581 
00582 #undef GMOCK_FIELD_
00583 
00584 // Implements the WithArgs action.
00585 template <typename InnerAction, int k1 = -1, int k2 = -1, int k3 = -1,
00586     int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
00587     int k9 = -1, int k10 = -1>
00588 class WithArgsAction {
00589  public:
00590   explicit WithArgsAction(const InnerAction& action) : action_(action) {}
00591 
00592   template <typename F>
00593   operator Action<F>() const { return MakeAction(new Impl<F>(action_)); }
00594 
00595  private:
00596   template <typename F>
00597   class Impl : public ActionInterface<F> {
00598    public:
00599     typedef typename Function<F>::Result Result;
00600     typedef typename Function<F>::ArgumentTuple ArgumentTuple;
00601 
00602     explicit Impl(const InnerAction& action) : action_(action) {}
00603 
00604     virtual Result Perform(const ArgumentTuple& args) {
00605       return action_.Perform(SelectArgs<Result, ArgumentTuple, k1, k2, k3, k4,
00606           k5, k6, k7, k8, k9, k10>::Select(args));
00607     }
00608 
00609    private:
00610     typedef typename SelectArgs<Result, ArgumentTuple,
00611         k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType;
00612 
00613     Action<InnerFunctionType> action_;
00614   };
00615 
00616   const InnerAction action_;
00617 
00618   GTEST_DISALLOW_ASSIGN_(WithArgsAction);
00619 };
00620 
00621 // A macro from the ACTION* family (defined later in this file)
00622 // defines an action that can be used in a mock function.  Typically,
00623 // these actions only care about a subset of the arguments of the mock
00624 // function.  For example, if such an action only uses the second
00625 // argument, it can be used in any mock function that takes >= 2
00626 // arguments where the type of the second argument is compatible.
00627 //
00628 // Therefore, the action implementation must be prepared to take more
00629 // arguments than it needs.  The ExcessiveArg type is used to
00630 // represent those excessive arguments.  In order to keep the compiler
00631 // error messages tractable, we define it in the testing namespace
00632 // instead of testing::internal.  However, this is an INTERNAL TYPE
00633 // and subject to change without notice, so a user MUST NOT USE THIS
00634 // TYPE DIRECTLY.
00635 struct ExcessiveArg {};
00636 
00637 // A helper class needed for implementing the ACTION* macros.
00638 template <typename Result, class Impl>
00639 class ActionHelper {
00640  public:
00641   static Result Perform(Impl* impl, const ::std::tr1::tuple<>& args) {
00642     using ::std::tr1::get;
00643     return impl->template gmock_PerformImpl<>(args, ExcessiveArg(),
00644         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
00645         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
00646         ExcessiveArg());
00647   }
00648 
00649   template <typename A0>
00650   static Result Perform(Impl* impl, const ::std::tr1::tuple<A0>& args) {
00651     using ::std::tr1::get;
00652     return impl->template gmock_PerformImpl<A0>(args, get<0>(args),
00653         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
00654         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
00655         ExcessiveArg());
00656   }
00657 
00658   template <typename A0, typename A1>
00659   static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1>& args) {
00660     using ::std::tr1::get;
00661     return impl->template gmock_PerformImpl<A0, A1>(args, get<0>(args),
00662         get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
00663         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
00664         ExcessiveArg());
00665   }
00666 
00667   template <typename A0, typename A1, typename A2>
00668   static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2>& args) {
00669     using ::std::tr1::get;
00670     return impl->template gmock_PerformImpl<A0, A1, A2>(args, get<0>(args),
00671         get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(),
00672         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
00673         ExcessiveArg());
00674   }
00675 
00676   template <typename A0, typename A1, typename A2, typename A3>
00677   static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2,
00678       A3>& args) {
00679     using ::std::tr1::get;
00680     return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, get<0>(args),
00681         get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(),
00682         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
00683         ExcessiveArg());
00684   }
00685 
00686   template <typename A0, typename A1, typename A2, typename A3, typename A4>
00687   static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3,
00688       A4>& args) {
00689     using ::std::tr1::get;
00690     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args,
00691         get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
00692         ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
00693         ExcessiveArg());
00694   }
00695 
00696   template <typename A0, typename A1, typename A2, typename A3, typename A4,
00697       typename A5>
00698   static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
00699       A5>& args) {
00700     using ::std::tr1::get;
00701     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args,
00702         get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
00703         get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
00704         ExcessiveArg());
00705   }
00706 
00707   template <typename A0, typename A1, typename A2, typename A3, typename A4,
00708       typename A5, typename A6>
00709   static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
00710       A5, A6>& args) {
00711     using ::std::tr1::get;
00712     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args,
00713         get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
00714         get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(),
00715         ExcessiveArg());
00716   }
00717 
00718   template <typename A0, typename A1, typename A2, typename A3, typename A4,
00719       typename A5, typename A6, typename A7>
00720   static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
00721       A5, A6, A7>& args) {
00722     using ::std::tr1::get;
00723     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6,
00724         A7>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
00725         get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(),
00726         ExcessiveArg());
00727   }
00728 
00729   template <typename A0, typename A1, typename A2, typename A3, typename A4,
00730       typename A5, typename A6, typename A7, typename A8>
00731   static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
00732       A5, A6, A7, A8>& args) {
00733     using ::std::tr1::get;
00734     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7,
00735         A8>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
00736         get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
00737         ExcessiveArg());
00738   }
00739 
00740   template <typename A0, typename A1, typename A2, typename A3, typename A4,
00741       typename A5, typename A6, typename A7, typename A8, typename A9>
00742   static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
00743       A5, A6, A7, A8, A9>& args) {
00744     using ::std::tr1::get;
00745     return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8,
00746         A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
00747         get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
00748         get<9>(args));
00749   }
00750 };
00751 
00752 }  // namespace internal
00753 
00754 // Various overloads for Invoke().
00755 
00756 // WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes
00757 // the selected arguments of the mock function to an_action and
00758 // performs it.  It serves as an adaptor between actions with
00759 // different argument lists.  C++ doesn't support default arguments for
00760 // function templates, so we have to overload it.
00761 template <int k1, typename InnerAction>
00762 inline internal::WithArgsAction<InnerAction, k1>
00763 WithArgs(const InnerAction& action) {
00764   return internal::WithArgsAction<InnerAction, k1>(action);
00765 }
00766 
00767 template <int k1, int k2, typename InnerAction>
00768 inline internal::WithArgsAction<InnerAction, k1, k2>
00769 WithArgs(const InnerAction& action) {
00770   return internal::WithArgsAction<InnerAction, k1, k2>(action);
00771 }
00772 
00773 template <int k1, int k2, int k3, typename InnerAction>
00774 inline internal::WithArgsAction<InnerAction, k1, k2, k3>
00775 WithArgs(const InnerAction& action) {
00776   return internal::WithArgsAction<InnerAction, k1, k2, k3>(action);
00777 }
00778 
00779 template <int k1, int k2, int k3, int k4, typename InnerAction>
00780 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4>
00781 WithArgs(const InnerAction& action) {
00782   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4>(action);
00783 }
00784 
00785 template <int k1, int k2, int k3, int k4, int k5, typename InnerAction>
00786 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>
00787 WithArgs(const InnerAction& action) {
00788   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>(action);
00789 }
00790 
00791 template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerAction>
00792 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>
00793 WithArgs(const InnerAction& action) {
00794   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>(action);
00795 }
00796 
00797 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
00798     typename InnerAction>
00799 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7>
00800 WithArgs(const InnerAction& action) {
00801   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6,
00802       k7>(action);
00803 }
00804 
00805 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
00806     typename InnerAction>
00807 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8>
00808 WithArgs(const InnerAction& action) {
00809   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7,
00810       k8>(action);
00811 }
00812 
00813 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
00814     int k9, typename InnerAction>
00815 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, k9>
00816 WithArgs(const InnerAction& action) {
00817   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
00818       k9>(action);
00819 }
00820 
00821 template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
00822     int k9, int k10, typename InnerAction>
00823 inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
00824     k9, k10>
00825 WithArgs(const InnerAction& action) {
00826   return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
00827       k9, k10>(action);
00828 }
00829 
00830 // Creates an action that does actions a1, a2, ..., sequentially in
00831 // each invocation.
00832 template <typename Action1, typename Action2>
00833 inline internal::DoBothAction<Action1, Action2>
00834 DoAll(Action1 a1, Action2 a2) {
00835   return internal::DoBothAction<Action1, Action2>(a1, a2);
00836 }
00837 
00838 template <typename Action1, typename Action2, typename Action3>
00839 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
00840     Action3> >
00841 DoAll(Action1 a1, Action2 a2, Action3 a3) {
00842   return DoAll(a1, DoAll(a2, a3));
00843 }
00844 
00845 template <typename Action1, typename Action2, typename Action3,
00846     typename Action4>
00847 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
00848     internal::DoBothAction<Action3, Action4> > >
00849 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) {
00850   return DoAll(a1, DoAll(a2, a3, a4));
00851 }
00852 
00853 template <typename Action1, typename Action2, typename Action3,
00854     typename Action4, typename Action5>
00855 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
00856     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
00857     Action5> > > >
00858 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) {
00859   return DoAll(a1, DoAll(a2, a3, a4, a5));
00860 }
00861 
00862 template <typename Action1, typename Action2, typename Action3,
00863     typename Action4, typename Action5, typename Action6>
00864 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
00865     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
00866     internal::DoBothAction<Action5, Action6> > > > >
00867 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) {
00868   return DoAll(a1, DoAll(a2, a3, a4, a5, a6));
00869 }
00870 
00871 template <typename Action1, typename Action2, typename Action3,
00872     typename Action4, typename Action5, typename Action6, typename Action7>
00873 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
00874     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
00875     internal::DoBothAction<Action5, internal::DoBothAction<Action6,
00876     Action7> > > > > >
00877 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
00878     Action7 a7) {
00879   return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7));
00880 }
00881 
00882 template <typename Action1, typename Action2, typename Action3,
00883     typename Action4, typename Action5, typename Action6, typename Action7,
00884     typename Action8>
00885 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
00886     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
00887     internal::DoBothAction<Action5, internal::DoBothAction<Action6,
00888     internal::DoBothAction<Action7, Action8> > > > > > >
00889 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
00890     Action7 a7, Action8 a8) {
00891   return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8));
00892 }
00893 
00894 template <typename Action1, typename Action2, typename Action3,
00895     typename Action4, typename Action5, typename Action6, typename Action7,
00896     typename Action8, typename Action9>
00897 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
00898     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
00899     internal::DoBothAction<Action5, internal::DoBothAction<Action6,
00900     internal::DoBothAction<Action7, internal::DoBothAction<Action8,
00901     Action9> > > > > > > >
00902 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
00903     Action7 a7, Action8 a8, Action9 a9) {
00904   return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9));
00905 }
00906 
00907 template <typename Action1, typename Action2, typename Action3,
00908     typename Action4, typename Action5, typename Action6, typename Action7,
00909     typename Action8, typename Action9, typename Action10>
00910 inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
00911     internal::DoBothAction<Action3, internal::DoBothAction<Action4,
00912     internal::DoBothAction<Action5, internal::DoBothAction<Action6,
00913     internal::DoBothAction<Action7, internal::DoBothAction<Action8,
00914     internal::DoBothAction<Action9, Action10> > > > > > > > >
00915 DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
00916     Action7 a7, Action8 a8, Action9 a9, Action10 a10) {
00917   return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10));
00918 }
00919 
00920 }  // namespace testing
00921 
00922 // The ACTION* family of macros can be used in a namespace scope to
00923 // define custom actions easily.  The syntax:
00924 //
00925 //   ACTION(name) { statements; }
00926 //
00927 // will define an action with the given name that executes the
00928 // statements.  The value returned by the statements will be used as
00929 // the return value of the action.  Inside the statements, you can
00930 // refer to the K-th (0-based) argument of the mock function by
00931 // 'argK', and refer to its type by 'argK_type'.  For example:
00932 //
00933 //   ACTION(IncrementArg1) {
00934 //     arg1_type temp = arg1;
00935 //     return ++(*temp);
00936 //   }
00937 //
00938 // allows you to write
00939 //
00940 //   ...WillOnce(IncrementArg1());
00941 //
00942 // You can also refer to the entire argument tuple and its type by
00943 // 'args' and 'args_type', and refer to the mock function type and its
00944 // return type by 'function_type' and 'return_type'.
00945 //
00946 // Note that you don't need to specify the types of the mock function
00947 // arguments.  However rest assured that your code is still type-safe:
00948 // you'll get a compiler error if *arg1 doesn't support the ++
00949 // operator, or if the type of ++(*arg1) isn't compatible with the
00950 // mock function's return type, for example.
00951 //
00952 // Sometimes you'll want to parameterize the action.   For that you can use
00953 // another macro:
00954 //
00955 //   ACTION_P(name, param_name) { statements; }
00956 //
00957 // For example:
00958 //
00959 //   ACTION_P(Add, n) { return arg0 + n; }
00960 //
00961 // will allow you to write:
00962 //
00963 //   ...WillOnce(Add(5));
00964 //
00965 // Note that you don't need to provide the type of the parameter
00966 // either.  If you need to reference the type of a parameter named
00967 // 'foo', you can write 'foo_type'.  For example, in the body of
00968 // ACTION_P(Add, n) above, you can write 'n_type' to refer to the type
00969 // of 'n'.
00970 //
00971 // We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support
00972 // multi-parameter actions.
00973 //
00974 // For the purpose of typing, you can view
00975 //
00976 //   ACTION_Pk(Foo, p1, ..., pk) { ... }
00977 //
00978 // as shorthand for
00979 //
00980 //   template <typename p1_type, ..., typename pk_type>
00981 //   FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
00982 //
00983 // In particular, you can provide the template type arguments
00984 // explicitly when invoking Foo(), as in Foo<long, bool>(5, false);
00985 // although usually you can rely on the compiler to infer the types
00986 // for you automatically.  You can assign the result of expression
00987 // Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ...,
00988 // pk_type>.  This can be useful when composing actions.
00989 //
00990 // You can also overload actions with different numbers of parameters:
00991 //
00992 //   ACTION_P(Plus, a) { ... }
00993 //   ACTION_P2(Plus, a, b) { ... }
00994 //
00995 // While it's tempting to always use the ACTION* macros when defining
00996 // a new action, you should also consider implementing ActionInterface
00997 // or using MakePolymorphicAction() instead, especially if you need to
00998 // use the action a lot.  While these approaches require more work,
00999 // they give you more control on the types of the mock function
01000 // arguments and the action parameters, which in general leads to
01001 // better compiler error messages that pay off in the long run.  They
01002 // also allow overloading actions based on parameter types (as opposed
01003 // to just based on the number of parameters).
01004 //
01005 // CAVEAT:
01006 //
01007 // ACTION*() can only be used in a namespace scope.  The reason is
01008 // that C++ doesn't yet allow function-local types to be used to
01009 // instantiate templates.  The up-coming C++0x standard will fix this.
01010 // Once that's done, we'll consider supporting using ACTION*() inside
01011 // a function.
01012 //
01013 // MORE INFORMATION:
01014 //
01015 // To learn more about using these macros, please search for 'ACTION'
01016 // on http://code.google.com/p/googlemock/wiki/CookBook.
01017 
01018 // An internal macro needed for implementing ACTION*().
01019 #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\
01020     const args_type& args GTEST_ATTRIBUTE_UNUSED_, \
01021     arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_, \
01022     arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_, \
01023     arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_, \
01024     arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_, \
01025     arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_, \
01026     arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_, \
01027     arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_, \
01028     arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_, \
01029     arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_, \
01030     arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_
01031 
01032 // Sometimes you want to give an action explicit template parameters
01033 // that cannot be inferred from its value parameters.  ACTION() and
01034 // ACTION_P*() don't support that.  ACTION_TEMPLATE() remedies that
01035 // and can be viewed as an extension to ACTION() and ACTION_P*().
01036 //
01037 // The syntax:
01038 //
01039 //   ACTION_TEMPLATE(ActionName,
01040 //                   HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m),
01041 //                   AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; }
01042 //
01043 // defines an action template that takes m explicit template
01044 // parameters and n value parameters.  name_i is the name of the i-th
01045 // template parameter, and kind_i specifies whether it's a typename,
01046 // an integral constant, or a template.  p_i is the name of the i-th
01047 // value parameter.
01048 //
01049 // Example:
01050 //
01051 //   // DuplicateArg<k, T>(output) converts the k-th argument of the mock
01052 //   // function to type T and copies it to *output.
01053 //   ACTION_TEMPLATE(DuplicateArg,
01054 //                   HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
01055 //                   AND_1_VALUE_PARAMS(output)) {
01056 //     *output = T(std::tr1::get<k>(args));
01057 //   }
01058 //   ...
01059 //     int n;
01060 //     EXPECT_CALL(mock, Foo(_, _))
01061 //         .WillOnce(DuplicateArg<1, unsigned char>(&n));
01062 //
01063 // To create an instance of an action template, write:
01064 //
01065 //   ActionName<t1, ..., t_m>(v1, ..., v_n)
01066 //
01067 // where the ts are the template arguments and the vs are the value
01068 // arguments.  The value argument types are inferred by the compiler.
01069 // If you want to explicitly specify the value argument types, you can
01070 // provide additional template arguments:
01071 //
01072 //   ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n)
01073 //
01074 // where u_i is the desired type of v_i.
01075 //
01076 // ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the
01077 // number of value parameters, but not on the number of template
01078 // parameters.  Without the restriction, the meaning of the following
01079 // is unclear:
01080 //
01081 //   OverloadedAction<int, bool>(x);
01082 //
01083 // Are we using a single-template-parameter action where 'bool' refers
01084 // to the type of x, or are we using a two-template-parameter action
01085 // where the compiler is asked to infer the type of x?
01086 //
01087 // Implementation notes:
01088 //
01089 // GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and
01090 // GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for
01091 // implementing ACTION_TEMPLATE.  The main trick we use is to create
01092 // new macro invocations when expanding a macro.  For example, we have
01093 //
01094 //   #define ACTION_TEMPLATE(name, template_params, value_params)
01095 //       ... GMOCK_INTERNAL_DECL_##template_params ...
01096 //
01097 // which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...)
01098 // to expand to
01099 //
01100 //       ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ...
01101 //
01102 // Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the
01103 // preprocessor will continue to expand it to
01104 //
01105 //       ... typename T ...
01106 //
01107 // This technique conforms to the C++ standard and is portable.  It
01108 // allows us to implement action templates using O(N) code, where N is
01109 // the maximum number of template/value parameters supported.  Without
01110 // using it, we'd have to devote O(N^2) amount of code to implement all
01111 // combinations of m and n.
01112 
01113 // Declares the template parameters.
01114 #define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0
01115 #define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
01116     name1) kind0 name0, kind1 name1
01117 #define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01118     kind2, name2) kind0 name0, kind1 name1, kind2 name2
01119 #define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01120     kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \
01121     kind3 name3
01122 #define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01123     kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \
01124     kind2 name2, kind3 name3, kind4 name4
01125 #define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01126     kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \
01127     kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5
01128 #define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01129     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
01130     name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \
01131     kind5 name5, kind6 name6
01132 #define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01133     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
01134     kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \
01135     kind4 name4, kind5 name5, kind6 name6, kind7 name7
01136 #define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01137     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
01138     kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \
01139     kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \
01140     kind8 name8
01141 #define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
01142     name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
01143     name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \
01144     kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \
01145     kind6 name6, kind7 name7, kind8 name8, kind9 name9
01146 
01147 // Lists the template parameters.
01148 #define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0
01149 #define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
01150     name1) name0, name1
01151 #define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01152     kind2, name2) name0, name1, name2
01153 #define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01154     kind2, name2, kind3, name3) name0, name1, name2, name3
01155 #define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01156     kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \
01157     name4
01158 #define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01159     kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \
01160     name2, name3, name4, name5
01161 #define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01162     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
01163     name6) name0, name1, name2, name3, name4, name5, name6
01164 #define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01165     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
01166     kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7
01167 #define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
01168     kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
01169     kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \
01170     name6, name7, name8
01171 #define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
01172     name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
01173     name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \
01174     name3, name4, name5, name6, name7, name8, name9
01175 
01176 // Declares the types of value parameters.
01177 #define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS()
01178 #define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type
01179 #define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \
01180     typename p0##_type, typename p1##_type
01181 #define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \
01182     typename p0##_type, typename p1##_type, typename p2##_type
01183 #define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
01184     typename p0##_type, typename p1##_type, typename p2##_type, \
01185     typename p3##_type
01186 #define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
01187     typename p0##_type, typename p1##_type, typename p2##_type, \
01188     typename p3##_type, typename p4##_type
01189 #define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
01190     typename p0##_type, typename p1##_type, typename p2##_type, \
01191     typename p3##_type, typename p4##_type, typename p5##_type
01192 #define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
01193     p6) , typename p0##_type, typename p1##_type, typename p2##_type, \
01194     typename p3##_type, typename p4##_type, typename p5##_type, \
01195     typename p6##_type
01196 #define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
01197     p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \
01198     typename p3##_type, typename p4##_type, typename p5##_type, \
01199     typename p6##_type, typename p7##_type
01200 #define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
01201     p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \
01202     typename p3##_type, typename p4##_type, typename p5##_type, \
01203     typename p6##_type, typename p7##_type, typename p8##_type
01204 #define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
01205     p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \
01206     typename p2##_type, typename p3##_type, typename p4##_type, \
01207     typename p5##_type, typename p6##_type, typename p7##_type, \
01208     typename p8##_type, typename p9##_type
01209 
01210 // Initializes the value parameters.
01211 #define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\
01212     ()
01213 #define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\
01214     (p0##_type gmock_p0) : p0(gmock_p0)
01215 #define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\
01216     (p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1)
01217 #define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\
01218     (p0##_type gmock_p0, p1##_type gmock_p1, \
01219         p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2)
01220 #define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\
01221     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
01222         p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
01223         p3(gmock_p3)
01224 #define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\
01225     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
01226         p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), \
01227         p2(gmock_p2), p3(gmock_p3), p4(gmock_p4)
01228 #define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\
01229     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
01230         p3##_type gmock_p3, p4##_type gmock_p4, \
01231         p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
01232         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5)
01233 #define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\
01234     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
01235         p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
01236         p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
01237         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6)
01238 #define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\
01239     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
01240         p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
01241         p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \
01242         p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
01243         p7(gmock_p7)
01244 #define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01245     p7, p8)\
01246     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
01247         p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
01248         p6##_type gmock_p6, p7##_type gmock_p7, \
01249         p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
01250         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
01251         p8(gmock_p8)
01252 #define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01253     p7, p8, p9)\
01254     (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
01255         p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
01256         p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
01257         p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
01258         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
01259         p8(gmock_p8), p9(gmock_p9)
01260 
01261 // Declares the fields for storing the value parameters.
01262 #define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS()
01263 #define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0;
01264 #define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \
01265     p1##_type p1;
01266 #define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \
01267     p1##_type p1; p2##_type p2;
01268 #define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \
01269     p1##_type p1; p2##_type p2; p3##_type p3;
01270 #define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
01271     p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4;
01272 #define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
01273     p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
01274     p5##_type p5;
01275 #define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
01276     p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
01277     p5##_type p5; p6##_type p6;
01278 #define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01279     p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
01280     p5##_type p5; p6##_type p6; p7##_type p7;
01281 #define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01282     p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
01283     p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8;
01284 #define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01285     p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
01286     p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \
01287     p9##_type p9;
01288 
01289 // Lists the value parameters.
01290 #define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS()
01291 #define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0
01292 #define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1
01293 #define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2
01294 #define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3
01295 #define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \
01296     p2, p3, p4
01297 #define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \
01298     p1, p2, p3, p4, p5
01299 #define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
01300     p6) p0, p1, p2, p3, p4, p5, p6
01301 #define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01302     p7) p0, p1, p2, p3, p4, p5, p6, p7
01303 #define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01304     p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8
01305 #define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01306     p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9
01307 
01308 // Lists the value parameter types.
01309 #define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS()
01310 #define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type
01311 #define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \
01312     p1##_type
01313 #define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \
01314     p1##_type, p2##_type
01315 #define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
01316     p0##_type, p1##_type, p2##_type, p3##_type
01317 #define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
01318     p0##_type, p1##_type, p2##_type, p3##_type, p4##_type
01319 #define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
01320     p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type
01321 #define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
01322     p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \
01323     p6##_type
01324 #define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
01325     p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
01326     p5##_type, p6##_type, p7##_type
01327 #define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
01328     p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
01329     p5##_type, p6##_type, p7##_type, p8##_type
01330 #define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
01331     p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
01332     p5##_type, p6##_type, p7##_type, p8##_type, p9##_type
01333 
01334 // Declares the value parameters.
01335 #define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS()
01336 #define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0
01337 #define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \
01338     p1##_type p1
01339 #define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \
01340     p1##_type p1, p2##_type p2
01341 #define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \
01342     p1##_type p1, p2##_type p2, p3##_type p3
01343 #define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
01344     p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4
01345 #define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
01346     p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
01347     p5##_type p5
01348 #define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
01349     p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
01350     p5##_type p5, p6##_type p6
01351 #define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01352     p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
01353     p5##_type p5, p6##_type p6, p7##_type p7
01354 #define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01355     p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
01356     p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8
01357 #define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01358     p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
01359     p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
01360     p9##_type p9
01361 
01362 // The suffix of the class template implementing the action template.
01363 #define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS()
01364 #define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P
01365 #define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2
01366 #define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3
01367 #define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4
01368 #define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5
01369 #define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6
01370 #define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7
01371 #define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01372     p7) P8
01373 #define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01374     p7, p8) P9
01375 #define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
01376     p7, p8, p9) P10
01377 
01378 // The name of the class template implementing the action template.
01379 #define GMOCK_ACTION_CLASS_(name, value_params)\
01380     GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params)
01381 
01382 #define ACTION_TEMPLATE(name, template_params, value_params)\
01383   template <GMOCK_INTERNAL_DECL_##template_params\
01384             GMOCK_INTERNAL_DECL_TYPE_##value_params>\
01385   class GMOCK_ACTION_CLASS_(name, value_params) {\
01386    public:\
01387     GMOCK_ACTION_CLASS_(name, value_params)\
01388         GMOCK_INTERNAL_INIT_##value_params {}\
01389     template <typename F>\
01390     class gmock_Impl : public ::testing::ActionInterface<F> {\
01391      public:\
01392       typedef F function_type;\
01393       typedef typename ::testing::internal::Function<F>::Result return_type;\
01394       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
01395           args_type;\
01396       explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\
01397       virtual return_type Perform(const args_type& args) {\
01398         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
01399             Perform(this, args);\
01400       }\
01401       template <typename arg0_type, typename arg1_type, typename arg2_type, \
01402           typename arg3_type, typename arg4_type, typename arg5_type, \
01403           typename arg6_type, typename arg7_type, typename arg8_type, \
01404           typename arg9_type>\
01405       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
01406           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
01407           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
01408           arg9_type arg9) const;\
01409       GMOCK_INTERNAL_DEFN_##value_params\
01410      private:\
01411       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
01412     };\
01413     template <typename F> operator ::testing::Action<F>() const {\
01414       return ::testing::Action<F>(\
01415           new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
01416     }\
01417     GMOCK_INTERNAL_DEFN_##value_params\
01418    private:\
01419     GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\
01420   };\
01421   template <GMOCK_INTERNAL_DECL_##template_params\
01422             GMOCK_INTERNAL_DECL_TYPE_##value_params>\
01423   inline GMOCK_ACTION_CLASS_(name, value_params)<\
01424       GMOCK_INTERNAL_LIST_##template_params\
01425       GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\
01426           GMOCK_INTERNAL_DECL_##value_params) {\
01427     return GMOCK_ACTION_CLASS_(name, value_params)<\
01428         GMOCK_INTERNAL_LIST_##template_params\
01429         GMOCK_INTERNAL_LIST_TYPE_##value_params>(\
01430             GMOCK_INTERNAL_LIST_##value_params);\
01431   }\
01432   template <GMOCK_INTERNAL_DECL_##template_params\
01433             GMOCK_INTERNAL_DECL_TYPE_##value_params>\
01434   template <typename F>\
01435   template <typename arg0_type, typename arg1_type, typename arg2_type, \
01436       typename arg3_type, typename arg4_type, typename arg5_type, \
01437       typename arg6_type, typename arg7_type, typename arg8_type, \
01438       typename arg9_type>\
01439   typename ::testing::internal::Function<F>::Result\
01440       GMOCK_ACTION_CLASS_(name, value_params)<\
01441           GMOCK_INTERNAL_LIST_##template_params\
01442           GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
01443               gmock_PerformImpl(\
01444           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
01445 
01446 #define ACTION(name)\
01447   class name##Action {\
01448    public:\
01449     name##Action() {}\
01450     template <typename F>\
01451     class gmock_Impl : public ::testing::ActionInterface<F> {\
01452      public:\
01453       typedef F function_type;\
01454       typedef typename ::testing::internal::Function<F>::Result return_type;\
01455       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
01456           args_type;\
01457       gmock_Impl() {}\
01458       virtual return_type Perform(const args_type& args) {\
01459         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
01460             Perform(this, args);\
01461       }\
01462       template <typename arg0_type, typename arg1_type, typename arg2_type, \
01463           typename arg3_type, typename arg4_type, typename arg5_type, \
01464           typename arg6_type, typename arg7_type, typename arg8_type, \
01465           typename arg9_type>\
01466       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
01467           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
01468           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
01469           arg9_type arg9) const;\
01470      private:\
01471       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
01472     };\
01473     template <typename F> operator ::testing::Action<F>() const {\
01474       return ::testing::Action<F>(new gmock_Impl<F>());\
01475     }\
01476    private:\
01477     GTEST_DISALLOW_ASSIGN_(name##Action);\
01478   };\
01479   inline name##Action name() {\
01480     return name##Action();\
01481   }\
01482   template <typename F>\
01483   template <typename arg0_type, typename arg1_type, typename arg2_type, \
01484       typename arg3_type, typename arg4_type, typename arg5_type, \
01485       typename arg6_type, typename arg7_type, typename arg8_type, \
01486       typename arg9_type>\
01487   typename ::testing::internal::Function<F>::Result\
01488       name##Action::gmock_Impl<F>::gmock_PerformImpl(\
01489           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
01490 
01491 #define ACTION_P(name, p0)\
01492   template <typename p0##_type>\
01493   class name##ActionP {\
01494    public:\
01495     name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\
01496     template <typename F>\
01497     class gmock_Impl : public ::testing::ActionInterface<F> {\
01498      public:\
01499       typedef F function_type;\
01500       typedef typename ::testing::internal::Function<F>::Result return_type;\
01501       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
01502           args_type;\
01503       explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\
01504       virtual return_type Perform(const args_type& args) {\
01505         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
01506             Perform(this, args);\
01507       }\
01508       template <typename arg0_type, typename arg1_type, typename arg2_type, \
01509           typename arg3_type, typename arg4_type, typename arg5_type, \
01510           typename arg6_type, typename arg7_type, typename arg8_type, \
01511           typename arg9_type>\
01512       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
01513           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
01514           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
01515           arg9_type arg9) const;\
01516       p0##_type p0;\
01517      private:\
01518       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
01519     };\
01520     template <typename F> operator ::testing::Action<F>() const {\
01521       return ::testing::Action<F>(new gmock_Impl<F>(p0));\
01522     }\
01523     p0##_type p0;\
01524    private:\
01525     GTEST_DISALLOW_ASSIGN_(name##ActionP);\
01526   };\
01527   template <typename p0##_type>\
01528   inline name##ActionP<p0##_type> name(p0##_type p0) {\
01529     return name##ActionP<p0##_type>(p0);\
01530   }\
01531   template <typename p0##_type>\
01532   template <typename F>\
01533   template <typename arg0_type, typename arg1_type, typename arg2_type, \
01534       typename arg3_type, typename arg4_type, typename arg5_type, \
01535       typename arg6_type, typename arg7_type, typename arg8_type, \
01536       typename arg9_type>\
01537   typename ::testing::internal::Function<F>::Result\
01538       name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\
01539           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
01540 
01541 #define ACTION_P2(name, p0, p1)\
01542   template <typename p0##_type, typename p1##_type>\
01543   class name##ActionP2 {\
01544    public:\
01545     name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
01546         p1(gmock_p1) {}\
01547     template <typename F>\
01548     class gmock_Impl : public ::testing::ActionInterface<F> {\
01549      public:\
01550       typedef F function_type;\
01551       typedef typename ::testing::internal::Function<F>::Result return_type;\
01552       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
01553           args_type;\
01554       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
01555           p1(gmock_p1) {}\
01556       virtual return_type Perform(const args_type& args) {\
01557         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
01558             Perform(this, args);\
01559       }\
01560       template <typename arg0_type, typename arg1_type, typename arg2_type, \
01561           typename arg3_type, typename arg4_type, typename arg5_type, \
01562           typename arg6_type, typename arg7_type, typename arg8_type, \
01563           typename arg9_type>\
01564       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
01565           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
01566           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
01567           arg9_type arg9) const;\
01568       p0##_type p0;\
01569       p1##_type p1;\
01570      private:\
01571       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
01572     };\
01573     template <typename F> operator ::testing::Action<F>() const {\
01574       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
01575     }\
01576     p0##_type p0;\
01577     p1##_type p1;\
01578    private:\
01579     GTEST_DISALLOW_ASSIGN_(name##ActionP2);\
01580   };\
01581   template <typename p0##_type, typename p1##_type>\
01582   inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
01583       p1##_type p1) {\
01584     return name##ActionP2<p0##_type, p1##_type>(p0, p1);\
01585   }\
01586   template <typename p0##_type, typename p1##_type>\
01587   template <typename F>\
01588   template <typename arg0_type, typename arg1_type, typename arg2_type, \
01589       typename arg3_type, typename arg4_type, typename arg5_type, \
01590       typename arg6_type, typename arg7_type, typename arg8_type, \
01591       typename arg9_type>\
01592   typename ::testing::internal::Function<F>::Result\
01593       name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\
01594           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
01595 
01596 #define ACTION_P3(name, p0, p1, p2)\
01597   template <typename p0##_type, typename p1##_type, typename p2##_type>\
01598   class name##ActionP3 {\
01599    public:\
01600     name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \
01601         p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
01602     template <typename F>\
01603     class gmock_Impl : public ::testing::ActionInterface<F> {\
01604      public:\
01605       typedef F function_type;\
01606       typedef typename ::testing::internal::Function<F>::Result return_type;\
01607       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
01608           args_type;\
01609       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \
01610           p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
01611       virtual return_type Perform(const args_type& args) {\
01612         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
01613             Perform(this, args);\
01614       }\
01615       template <typename arg0_type, typename arg1_type, typename arg2_type, \
01616           typename arg3_type, typename arg4_type, typename arg5_type, \
01617           typename arg6_type, typename arg7_type, typename arg8_type, \
01618           typename arg9_type>\
01619       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
01620           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
01621           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
01622           arg9_type arg9) const;\
01623       p0##_type p0;\
01624       p1##_type p1;\
01625       p2##_type p2;\
01626      private:\
01627       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
01628     };\
01629     template <typename F> operator ::testing::Action<F>() const {\
01630       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
01631     }\
01632     p0##_type p0;\
01633     p1##_type p1;\
01634     p2##_type p2;\
01635    private:\
01636     GTEST_DISALLOW_ASSIGN_(name##ActionP3);\
01637   };\
01638   template <typename p0##_type, typename p1##_type, typename p2##_type>\
01639   inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
01640       p1##_type p1, p2##_type p2) {\
01641     return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
01642   }\
01643   template <typename p0##_type, typename p1##_type, typename p2##_type>\
01644   template <typename F>\
01645   template <typename arg0_type, typename arg1_type, typename arg2_type, \
01646       typename arg3_type, typename arg4_type, typename arg5_type, \
01647       typename arg6_type, typename arg7_type, typename arg8_type, \
01648       typename arg9_type>\
01649   typename ::testing::internal::Function<F>::Result\
01650       name##ActionP3<p0##_type, p1##_type, \
01651           p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\
01652           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
01653 
01654 #define ACTION_P4(name, p0, p1, p2, p3)\
01655   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01656       typename p3##_type>\
01657   class name##ActionP4 {\
01658    public:\
01659     name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \
01660         p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \
01661         p2(gmock_p2), p3(gmock_p3) {}\
01662     template <typename F>\
01663     class gmock_Impl : public ::testing::ActionInterface<F> {\
01664      public:\
01665       typedef F function_type;\
01666       typedef typename ::testing::internal::Function<F>::Result return_type;\
01667       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
01668           args_type;\
01669       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
01670           p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
01671           p3(gmock_p3) {}\
01672       virtual return_type Perform(const args_type& args) {\
01673         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
01674             Perform(this, args);\
01675       }\
01676       template <typename arg0_type, typename arg1_type, typename arg2_type, \
01677           typename arg3_type, typename arg4_type, typename arg5_type, \
01678           typename arg6_type, typename arg7_type, typename arg8_type, \
01679           typename arg9_type>\
01680       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
01681           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
01682           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
01683           arg9_type arg9) const;\
01684       p0##_type p0;\
01685       p1##_type p1;\
01686       p2##_type p2;\
01687       p3##_type p3;\
01688      private:\
01689       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
01690     };\
01691     template <typename F> operator ::testing::Action<F>() const {\
01692       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
01693     }\
01694     p0##_type p0;\
01695     p1##_type p1;\
01696     p2##_type p2;\
01697     p3##_type p3;\
01698    private:\
01699     GTEST_DISALLOW_ASSIGN_(name##ActionP4);\
01700   };\
01701   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01702       typename p3##_type>\
01703   inline name##ActionP4<p0##_type, p1##_type, p2##_type, \
01704       p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
01705       p3##_type p3) {\
01706     return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \
01707         p2, p3);\
01708   }\
01709   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01710       typename p3##_type>\
01711   template <typename F>\
01712   template <typename arg0_type, typename arg1_type, typename arg2_type, \
01713       typename arg3_type, typename arg4_type, typename arg5_type, \
01714       typename arg6_type, typename arg7_type, typename arg8_type, \
01715       typename arg9_type>\
01716   typename ::testing::internal::Function<F>::Result\
01717       name##ActionP4<p0##_type, p1##_type, p2##_type, \
01718           p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\
01719           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
01720 
01721 #define ACTION_P5(name, p0, p1, p2, p3, p4)\
01722   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01723       typename p3##_type, typename p4##_type>\
01724   class name##ActionP5 {\
01725    public:\
01726     name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \
01727         p2##_type gmock_p2, p3##_type gmock_p3, \
01728         p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
01729         p3(gmock_p3), p4(gmock_p4) {}\
01730     template <typename F>\
01731     class gmock_Impl : public ::testing::ActionInterface<F> {\
01732      public:\
01733       typedef F function_type;\
01734       typedef typename ::testing::internal::Function<F>::Result return_type;\
01735       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
01736           args_type;\
01737       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
01738           p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \
01739           p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\
01740       virtual return_type Perform(const args_type& args) {\
01741         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
01742             Perform(this, args);\
01743       }\
01744       template <typename arg0_type, typename arg1_type, typename arg2_type, \
01745           typename arg3_type, typename arg4_type, typename arg5_type, \
01746           typename arg6_type, typename arg7_type, typename arg8_type, \
01747           typename arg9_type>\
01748       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
01749           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
01750           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
01751           arg9_type arg9) const;\
01752       p0##_type p0;\
01753       p1##_type p1;\
01754       p2##_type p2;\
01755       p3##_type p3;\
01756       p4##_type p4;\
01757      private:\
01758       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
01759     };\
01760     template <typename F> operator ::testing::Action<F>() const {\
01761       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\
01762     }\
01763     p0##_type p0;\
01764     p1##_type p1;\
01765     p2##_type p2;\
01766     p3##_type p3;\
01767     p4##_type p4;\
01768    private:\
01769     GTEST_DISALLOW_ASSIGN_(name##ActionP5);\
01770   };\
01771   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01772       typename p3##_type, typename p4##_type>\
01773   inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
01774       p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
01775       p4##_type p4) {\
01776     return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
01777         p4##_type>(p0, p1, p2, p3, p4);\
01778   }\
01779   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01780       typename p3##_type, typename p4##_type>\
01781   template <typename F>\
01782   template <typename arg0_type, typename arg1_type, typename arg2_type, \
01783       typename arg3_type, typename arg4_type, typename arg5_type, \
01784       typename arg6_type, typename arg7_type, typename arg8_type, \
01785       typename arg9_type>\
01786   typename ::testing::internal::Function<F>::Result\
01787       name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
01788           p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\
01789           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
01790 
01791 #define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\
01792   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01793       typename p3##_type, typename p4##_type, typename p5##_type>\
01794   class name##ActionP6 {\
01795    public:\
01796     name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \
01797         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
01798         p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
01799         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\
01800     template <typename F>\
01801     class gmock_Impl : public ::testing::ActionInterface<F> {\
01802      public:\
01803       typedef F function_type;\
01804       typedef typename ::testing::internal::Function<F>::Result return_type;\
01805       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
01806           args_type;\
01807       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
01808           p3##_type gmock_p3, p4##_type gmock_p4, \
01809           p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
01810           p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\
01811       virtual return_type Perform(const args_type& args) {\
01812         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
01813             Perform(this, args);\
01814       }\
01815       template <typename arg0_type, typename arg1_type, typename arg2_type, \
01816           typename arg3_type, typename arg4_type, typename arg5_type, \
01817           typename arg6_type, typename arg7_type, typename arg8_type, \
01818           typename arg9_type>\
01819       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
01820           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
01821           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
01822           arg9_type arg9) const;\
01823       p0##_type p0;\
01824       p1##_type p1;\
01825       p2##_type p2;\
01826       p3##_type p3;\
01827       p4##_type p4;\
01828       p5##_type p5;\
01829      private:\
01830       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
01831     };\
01832     template <typename F> operator ::testing::Action<F>() const {\
01833       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\
01834     }\
01835     p0##_type p0;\
01836     p1##_type p1;\
01837     p2##_type p2;\
01838     p3##_type p3;\
01839     p4##_type p4;\
01840     p5##_type p5;\
01841    private:\
01842     GTEST_DISALLOW_ASSIGN_(name##ActionP6);\
01843   };\
01844   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01845       typename p3##_type, typename p4##_type, typename p5##_type>\
01846   inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
01847       p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
01848       p3##_type p3, p4##_type p4, p5##_type p5) {\
01849     return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
01850         p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
01851   }\
01852   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01853       typename p3##_type, typename p4##_type, typename p5##_type>\
01854   template <typename F>\
01855   template <typename arg0_type, typename arg1_type, typename arg2_type, \
01856       typename arg3_type, typename arg4_type, typename arg5_type, \
01857       typename arg6_type, typename arg7_type, typename arg8_type, \
01858       typename arg9_type>\
01859   typename ::testing::internal::Function<F>::Result\
01860       name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
01861           p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\
01862           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
01863 
01864 #define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\
01865   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01866       typename p3##_type, typename p4##_type, typename p5##_type, \
01867       typename p6##_type>\
01868   class name##ActionP7 {\
01869    public:\
01870     name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \
01871         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
01872         p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \
01873         p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \
01874         p6(gmock_p6) {}\
01875     template <typename F>\
01876     class gmock_Impl : public ::testing::ActionInterface<F> {\
01877      public:\
01878       typedef F function_type;\
01879       typedef typename ::testing::internal::Function<F>::Result return_type;\
01880       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
01881           args_type;\
01882       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
01883           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
01884           p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
01885           p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\
01886       virtual return_type Perform(const args_type& args) {\
01887         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
01888             Perform(this, args);\
01889       }\
01890       template <typename arg0_type, typename arg1_type, typename arg2_type, \
01891           typename arg3_type, typename arg4_type, typename arg5_type, \
01892           typename arg6_type, typename arg7_type, typename arg8_type, \
01893           typename arg9_type>\
01894       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
01895           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
01896           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
01897           arg9_type arg9) const;\
01898       p0##_type p0;\
01899       p1##_type p1;\
01900       p2##_type p2;\
01901       p3##_type p3;\
01902       p4##_type p4;\
01903       p5##_type p5;\
01904       p6##_type p6;\
01905      private:\
01906       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
01907     };\
01908     template <typename F> operator ::testing::Action<F>() const {\
01909       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
01910           p6));\
01911     }\
01912     p0##_type p0;\
01913     p1##_type p1;\
01914     p2##_type p2;\
01915     p3##_type p3;\
01916     p4##_type p4;\
01917     p5##_type p5;\
01918     p6##_type p6;\
01919    private:\
01920     GTEST_DISALLOW_ASSIGN_(name##ActionP7);\
01921   };\
01922   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01923       typename p3##_type, typename p4##_type, typename p5##_type, \
01924       typename p6##_type>\
01925   inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
01926       p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
01927       p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
01928       p6##_type p6) {\
01929     return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
01930         p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
01931   }\
01932   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01933       typename p3##_type, typename p4##_type, typename p5##_type, \
01934       typename p6##_type>\
01935   template <typename F>\
01936   template <typename arg0_type, typename arg1_type, typename arg2_type, \
01937       typename arg3_type, typename arg4_type, typename arg5_type, \
01938       typename arg6_type, typename arg7_type, typename arg8_type, \
01939       typename arg9_type>\
01940   typename ::testing::internal::Function<F>::Result\
01941       name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
01942           p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\
01943           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
01944 
01945 #define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\
01946   template <typename p0##_type, typename p1##_type, typename p2##_type, \
01947       typename p3##_type, typename p4##_type, typename p5##_type, \
01948       typename p6##_type, typename p7##_type>\
01949   class name##ActionP8 {\
01950    public:\
01951     name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \
01952         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
01953         p5##_type gmock_p5, p6##_type gmock_p6, \
01954         p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
01955         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
01956         p7(gmock_p7) {}\
01957     template <typename F>\
01958     class gmock_Impl : public ::testing::ActionInterface<F> {\
01959      public:\
01960       typedef F function_type;\
01961       typedef typename ::testing::internal::Function<F>::Result return_type;\
01962       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
01963           args_type;\
01964       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
01965           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
01966           p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \
01967           p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \
01968           p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\
01969       virtual return_type Perform(const args_type& args) {\
01970         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
01971             Perform(this, args);\
01972       }\
01973       template <typename arg0_type, typename arg1_type, typename arg2_type, \
01974           typename arg3_type, typename arg4_type, typename arg5_type, \
01975           typename arg6_type, typename arg7_type, typename arg8_type, \
01976           typename arg9_type>\
01977       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
01978           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
01979           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
01980           arg9_type arg9) const;\
01981       p0##_type p0;\
01982       p1##_type p1;\
01983       p2##_type p2;\
01984       p3##_type p3;\
01985       p4##_type p4;\
01986       p5##_type p5;\
01987       p6##_type p6;\
01988       p7##_type p7;\
01989      private:\
01990       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
01991     };\
01992     template <typename F> operator ::testing::Action<F>() const {\
01993       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
01994           p6, p7));\
01995     }\
01996     p0##_type p0;\
01997     p1##_type p1;\
01998     p2##_type p2;\
01999     p3##_type p3;\
02000     p4##_type p4;\
02001     p5##_type p5;\
02002     p6##_type p6;\
02003     p7##_type p7;\
02004    private:\
02005     GTEST_DISALLOW_ASSIGN_(name##ActionP8);\
02006   };\
02007   template <typename p0##_type, typename p1##_type, typename p2##_type, \
02008       typename p3##_type, typename p4##_type, typename p5##_type, \
02009       typename p6##_type, typename p7##_type>\
02010   inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
02011       p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
02012       p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
02013       p6##_type p6, p7##_type p7) {\
02014     return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
02015         p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
02016         p6, p7);\
02017   }\
02018   template <typename p0##_type, typename p1##_type, typename p2##_type, \
02019       typename p3##_type, typename p4##_type, typename p5##_type, \
02020       typename p6##_type, typename p7##_type>\
02021   template <typename F>\
02022   template <typename arg0_type, typename arg1_type, typename arg2_type, \
02023       typename arg3_type, typename arg4_type, typename arg5_type, \
02024       typename arg6_type, typename arg7_type, typename arg8_type, \
02025       typename arg9_type>\
02026   typename ::testing::internal::Function<F>::Result\
02027       name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
02028           p5##_type, p6##_type, \
02029           p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\
02030           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
02031 
02032 #define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\
02033   template <typename p0##_type, typename p1##_type, typename p2##_type, \
02034       typename p3##_type, typename p4##_type, typename p5##_type, \
02035       typename p6##_type, typename p7##_type, typename p8##_type>\
02036   class name##ActionP9 {\
02037    public:\
02038     name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \
02039         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
02040         p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
02041         p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
02042         p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
02043         p8(gmock_p8) {}\
02044     template <typename F>\
02045     class gmock_Impl : public ::testing::ActionInterface<F> {\
02046      public:\
02047       typedef F function_type;\
02048       typedef typename ::testing::internal::Function<F>::Result return_type;\
02049       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
02050           args_type;\
02051       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
02052           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
02053           p6##_type gmock_p6, p7##_type gmock_p7, \
02054           p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
02055           p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
02056           p7(gmock_p7), p8(gmock_p8) {}\
02057       virtual return_type Perform(const args_type& args) {\
02058         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
02059             Perform(this, args);\
02060       }\
02061       template <typename arg0_type, typename arg1_type, typename arg2_type, \
02062           typename arg3_type, typename arg4_type, typename arg5_type, \
02063           typename arg6_type, typename arg7_type, typename arg8_type, \
02064           typename arg9_type>\
02065       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
02066           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
02067           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
02068           arg9_type arg9) const;\
02069       p0##_type p0;\
02070       p1##_type p1;\
02071       p2##_type p2;\
02072       p3##_type p3;\
02073       p4##_type p4;\
02074       p5##_type p5;\
02075       p6##_type p6;\
02076       p7##_type p7;\
02077       p8##_type p8;\
02078      private:\
02079       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
02080     };\
02081     template <typename F> operator ::testing::Action<F>() const {\
02082       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
02083           p6, p7, p8));\
02084     }\
02085     p0##_type p0;\
02086     p1##_type p1;\
02087     p2##_type p2;\
02088     p3##_type p3;\
02089     p4##_type p4;\
02090     p5##_type p5;\
02091     p6##_type p6;\
02092     p7##_type p7;\
02093     p8##_type p8;\
02094    private:\
02095     GTEST_DISALLOW_ASSIGN_(name##ActionP9);\
02096   };\
02097   template <typename p0##_type, typename p1##_type, typename p2##_type, \
02098       typename p3##_type, typename p4##_type, typename p5##_type, \
02099       typename p6##_type, typename p7##_type, typename p8##_type>\
02100   inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
02101       p4##_type, p5##_type, p6##_type, p7##_type, \
02102       p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
02103       p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
02104       p8##_type p8) {\
02105     return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
02106         p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
02107         p3, p4, p5, p6, p7, p8);\
02108   }\
02109   template <typename p0##_type, typename p1##_type, typename p2##_type, \
02110       typename p3##_type, typename p4##_type, typename p5##_type, \
02111       typename p6##_type, typename p7##_type, typename p8##_type>\
02112   template <typename F>\
02113   template <typename arg0_type, typename arg1_type, typename arg2_type, \
02114       typename arg3_type, typename arg4_type, typename arg5_type, \
02115       typename arg6_type, typename arg7_type, typename arg8_type, \
02116       typename arg9_type>\
02117   typename ::testing::internal::Function<F>::Result\
02118       name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
02119           p5##_type, p6##_type, p7##_type, \
02120           p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\
02121           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
02122 
02123 #define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\
02124   template <typename p0##_type, typename p1##_type, typename p2##_type, \
02125       typename p3##_type, typename p4##_type, typename p5##_type, \
02126       typename p6##_type, typename p7##_type, typename p8##_type, \
02127       typename p9##_type>\
02128   class name##ActionP10 {\
02129    public:\
02130     name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \
02131         p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
02132         p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
02133         p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \
02134         p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
02135         p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\
02136     template <typename F>\
02137     class gmock_Impl : public ::testing::ActionInterface<F> {\
02138      public:\
02139       typedef F function_type;\
02140       typedef typename ::testing::internal::Function<F>::Result return_type;\
02141       typedef typename ::testing::internal::Function<F>::ArgumentTuple\
02142           args_type;\
02143       gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
02144           p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
02145           p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
02146           p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
02147           p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
02148           p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\
02149       virtual return_type Perform(const args_type& args) {\
02150         return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
02151             Perform(this, args);\
02152       }\
02153       template <typename arg0_type, typename arg1_type, typename arg2_type, \
02154           typename arg3_type, typename arg4_type, typename arg5_type, \
02155           typename arg6_type, typename arg7_type, typename arg8_type, \
02156           typename arg9_type>\
02157       return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
02158           arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
02159           arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
02160           arg9_type arg9) const;\
02161       p0##_type p0;\
02162       p1##_type p1;\
02163       p2##_type p2;\
02164       p3##_type p3;\
02165       p4##_type p4;\
02166       p5##_type p5;\
02167       p6##_type p6;\
02168       p7##_type p7;\
02169       p8##_type p8;\
02170       p9##_type p9;\
02171      private:\
02172       GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
02173     };\
02174     template <typename F> operator ::testing::Action<F>() const {\
02175       return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
02176           p6, p7, p8, p9));\
02177     }\
02178     p0##_type p0;\
02179     p1##_type p1;\
02180     p2##_type p2;\
02181     p3##_type p3;\
02182     p4##_type p4;\
02183     p5##_type p5;\
02184     p6##_type p6;\
02185     p7##_type p7;\
02186     p8##_type p8;\
02187     p9##_type p9;\
02188    private:\
02189     GTEST_DISALLOW_ASSIGN_(name##ActionP10);\
02190   };\
02191   template <typename p0##_type, typename p1##_type, typename p2##_type, \
02192       typename p3##_type, typename p4##_type, typename p5##_type, \
02193       typename p6##_type, typename p7##_type, typename p8##_type, \
02194       typename p9##_type>\
02195   inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
02196       p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
02197       p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
02198       p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
02199       p9##_type p9) {\
02200     return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
02201         p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
02202         p1, p2, p3, p4, p5, p6, p7, p8, p9);\
02203   }\
02204   template <typename p0##_type, typename p1##_type, typename p2##_type, \
02205       typename p3##_type, typename p4##_type, typename p5##_type, \
02206       typename p6##_type, typename p7##_type, typename p8##_type, \
02207       typename p9##_type>\
02208   template <typename F>\
02209   template <typename arg0_type, typename arg1_type, typename arg2_type, \
02210       typename arg3_type, typename arg4_type, typename arg5_type, \
02211       typename arg6_type, typename arg7_type, typename arg8_type, \
02212       typename arg9_type>\
02213   typename ::testing::internal::Function<F>::Result\
02214       name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
02215           p5##_type, p6##_type, p7##_type, p8##_type, \
02216           p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\
02217           GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
02218 
02219 namespace testing {
02220 
02221 // The ACTION*() macros trigger warning C4100 (unreferenced formal
02222 // parameter) in MSVC with -W4.  Unfortunately they cannot be fixed in
02223 // the macro definition, as the warnings are generated when the macro
02224 // is expanded and macro expansion cannot contain #pragma.  Therefore
02225 // we suppress them here.
02226 #ifdef _MSC_VER
02227 # pragma warning(push)
02228 # pragma warning(disable:4100)
02229 #endif
02230 
02231 // Various overloads for InvokeArgument<N>().
02232 //
02233 // The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
02234 // (0-based) argument, which must be a k-ary callable, of the mock
02235 // function, with arguments a1, a2, ..., a_k.
02236 //
02237 // Notes:
02238 //
02239 //   1. The arguments are passed by value by default.  If you need to
02240 //   pass an argument by reference, wrap it inside ByRef().  For
02241 //   example,
02242 //
02243 //     InvokeArgument<1>(5, string("Hello"), ByRef(foo))
02244 //
02245 //   passes 5 and string("Hello") by value, and passes foo by
02246 //   reference.
02247 //
02248 //   2. If the callable takes an argument by reference but ByRef() is
02249 //   not used, it will receive the reference to a copy of the value,
02250 //   instead of the original value.  For example, when the 0-th
02251 //   argument of the mock function takes a const string&, the action
02252 //
02253 //     InvokeArgument<0>(string("Hello"))
02254 //
02255 //   makes a copy of the temporary string("Hello") object and passes a
02256 //   reference of the copy, instead of the original temporary object,
02257 //   to the callable.  This makes it easy for a user to define an
02258 //   InvokeArgument action from temporary values and have it performed
02259 //   later.
02260 
02261 ACTION_TEMPLATE(InvokeArgument,
02262                 HAS_1_TEMPLATE_PARAMS(int, k),
02263                 AND_0_VALUE_PARAMS()) {
02264   return internal::CallableHelper<return_type>::Call(
02265       ::std::tr1::get<k>(args));
02266 }
02267 
02268 ACTION_TEMPLATE(InvokeArgument,
02269                 HAS_1_TEMPLATE_PARAMS(int, k),
02270                 AND_1_VALUE_PARAMS(p0)) {
02271   return internal::CallableHelper<return_type>::Call(
02272       ::std::tr1::get<k>(args), p0);
02273 }
02274 
02275 ACTION_TEMPLATE(InvokeArgument,
02276                 HAS_1_TEMPLATE_PARAMS(int, k),
02277                 AND_2_VALUE_PARAMS(p0, p1)) {
02278   return internal::CallableHelper<return_type>::Call(
02279       ::std::tr1::get<k>(args), p0, p1);
02280 }
02281 
02282 ACTION_TEMPLATE(InvokeArgument,
02283                 HAS_1_TEMPLATE_PARAMS(int, k),
02284                 AND_3_VALUE_PARAMS(p0, p1, p2)) {
02285   return internal::CallableHelper<return_type>::Call(
02286       ::std::tr1::get<k>(args), p0, p1, p2);
02287 }
02288 
02289 ACTION_TEMPLATE(InvokeArgument,
02290                 HAS_1_TEMPLATE_PARAMS(int, k),
02291                 AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
02292   return internal::CallableHelper<return_type>::Call(
02293       ::std::tr1::get<k>(args), p0, p1, p2, p3);
02294 }
02295 
02296 ACTION_TEMPLATE(InvokeArgument,
02297                 HAS_1_TEMPLATE_PARAMS(int, k),
02298                 AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
02299   return internal::CallableHelper<return_type>::Call(
02300       ::std::tr1::get<k>(args), p0, p1, p2, p3, p4);
02301 }
02302 
02303 ACTION_TEMPLATE(InvokeArgument,
02304                 HAS_1_TEMPLATE_PARAMS(int, k),
02305                 AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
02306   return internal::CallableHelper<return_type>::Call(
02307       ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5);
02308 }
02309 
02310 ACTION_TEMPLATE(InvokeArgument,
02311                 HAS_1_TEMPLATE_PARAMS(int, k),
02312                 AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
02313   return internal::CallableHelper<return_type>::Call(
02314       ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6);
02315 }
02316 
02317 ACTION_TEMPLATE(InvokeArgument,
02318                 HAS_1_TEMPLATE_PARAMS(int, k),
02319                 AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
02320   return internal::CallableHelper<return_type>::Call(
02321       ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7);
02322 }
02323 
02324 ACTION_TEMPLATE(InvokeArgument,
02325                 HAS_1_TEMPLATE_PARAMS(int, k),
02326                 AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
02327   return internal::CallableHelper<return_type>::Call(
02328       ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8);
02329 }
02330 
02331 ACTION_TEMPLATE(InvokeArgument,
02332                 HAS_1_TEMPLATE_PARAMS(int, k),
02333                 AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
02334   return internal::CallableHelper<return_type>::Call(
02335       ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
02336 }
02337 
02338 // Various overloads for ReturnNew<T>().
02339 //
02340 // The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new
02341 // instance of type T, constructed on the heap with constructor arguments
02342 // a1, a2, ..., and a_k. The caller assumes ownership of the returned value.
02343 ACTION_TEMPLATE(ReturnNew,
02344                 HAS_1_TEMPLATE_PARAMS(typename, T),
02345                 AND_0_VALUE_PARAMS()) {
02346   return new T();
02347 }
02348 
02349 ACTION_TEMPLATE(ReturnNew,
02350                 HAS_1_TEMPLATE_PARAMS(typename, T),
02351                 AND_1_VALUE_PARAMS(p0)) {
02352   return new T(p0);
02353 }
02354 
02355 ACTION_TEMPLATE(ReturnNew,
02356                 HAS_1_TEMPLATE_PARAMS(typename, T),
02357                 AND_2_VALUE_PARAMS(p0, p1)) {
02358   return new T(p0, p1);
02359 }
02360 
02361 ACTION_TEMPLATE(ReturnNew,
02362                 HAS_1_TEMPLATE_PARAMS(typename, T),
02363                 AND_3_VALUE_PARAMS(p0, p1, p2)) {
02364   return new T(p0, p1, p2);
02365 }
02366 
02367 ACTION_TEMPLATE(ReturnNew,
02368                 HAS_1_TEMPLATE_PARAMS(typename, T),
02369                 AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
02370   return new T(p0, p1, p2, p3);
02371 }
02372 
02373 ACTION_TEMPLATE(ReturnNew,
02374                 HAS_1_TEMPLATE_PARAMS(typename, T),
02375                 AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
02376   return new T(p0, p1, p2, p3, p4);
02377 }
02378 
02379 ACTION_TEMPLATE(ReturnNew,
02380                 HAS_1_TEMPLATE_PARAMS(typename, T),
02381                 AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
02382   return new T(p0, p1, p2, p3, p4, p5);
02383 }
02384 
02385 ACTION_TEMPLATE(ReturnNew,
02386                 HAS_1_TEMPLATE_PARAMS(typename, T),
02387                 AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
02388   return new T(p0, p1, p2, p3, p4, p5, p6);
02389 }
02390 
02391 ACTION_TEMPLATE(ReturnNew,
02392                 HAS_1_TEMPLATE_PARAMS(typename, T),
02393                 AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
02394   return new T(p0, p1, p2, p3, p4, p5, p6, p7);
02395 }
02396 
02397 ACTION_TEMPLATE(ReturnNew,
02398                 HAS_1_TEMPLATE_PARAMS(typename, T),
02399                 AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
02400   return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8);
02401 }
02402 
02403 ACTION_TEMPLATE(ReturnNew,
02404                 HAS_1_TEMPLATE_PARAMS(typename, T),
02405                 AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
02406   return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
02407 }
02408 
02409 #ifdef _MSC_VER
02410 # pragma warning(pop)
02411 #endif
02412 
02413 }  // namespace testing
02414 
02415 #endif  // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Sat Jun 8 2019 18:24:40