?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. // This file was GENERATED by command:
  2. //     pump.py gmock-generated-internal-utils.h.pump
  3. // DO NOT EDIT BY HAND!!!
  4.  
  5. // Copyright 2007, Google Inc.
  6. // All rights reserved.
  7. //
  8. // Redistribution and use in source and binary forms, with or without
  9. // modification, are permitted provided that the following conditions are
  10. // met:
  11. //
  12. //     * Redistributions of source code must retain the above copyright
  13. // notice, this list of conditions and the following disclaimer.
  14. //     * Redistributions in binary form must reproduce the above
  15. // copyright notice, this list of conditions and the following disclaimer
  16. // in the documentation and/or other materials provided with the
  17. // distribution.
  18. //     * Neither the name of Google Inc. nor the names of its
  19. // contributors may be used to endorse or promote products derived from
  20. // this software without specific prior written permission.
  21. //
  22. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  26. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  28. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  29. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  30. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  32. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33.  
  34.  
  35. // Google Mock - a framework for writing C++ mock classes.
  36. //
  37. // This file contains template meta-programming utility classes needed
  38. // for implementing Google Mock.
  39.  
  40. // GOOGLETEST_CM0002 DO NOT DELETE
  41.  
  42. #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
  43. #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
  44.  
  45. #include "gmock/internal/gmock-port.h"
  46.  
  47. namespace testing {
  48.  
  49. template <typename T>
  50. class Matcher;
  51.  
  52. namespace internal {
  53.  
  54. // An IgnoredValue object can be implicitly constructed from ANY value.
  55. // This is used in implementing the IgnoreResult(a) action.
  56. class IgnoredValue {
  57.  public:
  58.   // This constructor template allows any value to be implicitly
  59.   // converted to IgnoredValue.  The object has no data member and
  60.   // doesn't try to remember anything about the argument.  We
  61.   // deliberately omit the 'explicit' keyword in order to allow the
  62.   // conversion to be implicit.
  63.   template <typename T>
  64.   IgnoredValue(const T& /* ignored */) {}  // NOLINT(runtime/explicit)
  65. };
  66.  
  67. // MatcherTuple<T>::type is a tuple type where each field is a Matcher
  68. // for the corresponding field in tuple type T.
  69. template <typename Tuple>
  70. struct MatcherTuple;
  71.  
  72. template <>
  73. struct MatcherTuple< ::testing::tuple<> > {
  74.   typedef ::testing::tuple< > type;
  75. };
  76.  
  77. template <typename A1>
  78. struct MatcherTuple< ::testing::tuple<A1> > {
  79.   typedef ::testing::tuple<Matcher<A1> > type;
  80. };
  81.  
  82. template <typename A1, typename A2>
  83. struct MatcherTuple< ::testing::tuple<A1, A2> > {
  84.   typedef ::testing::tuple<Matcher<A1>, Matcher<A2> > type;
  85. };
  86.  
  87. template <typename A1, typename A2, typename A3>
  88. struct MatcherTuple< ::testing::tuple<A1, A2, A3> > {
  89.   typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3> > type;
  90. };
  91.  
  92. template <typename A1, typename A2, typename A3, typename A4>
  93. struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4> > {
  94.   typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4> >
  95.       type;
  96. };
  97.  
  98. template <typename A1, typename A2, typename A3, typename A4, typename A5>
  99. struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5> > {
  100.   typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
  101.                            Matcher<A5> >
  102.       type;
  103. };
  104.  
  105. template <typename A1, typename A2, typename A3, typename A4, typename A5,
  106.     typename A6>
  107. struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
  108.   typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
  109.                            Matcher<A5>, Matcher<A6> >
  110.       type;
  111. };
  112.  
  113. template <typename A1, typename A2, typename A3, typename A4, typename A5,
  114.     typename A6, typename A7>
  115. struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
  116.   typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
  117.                            Matcher<A5>, Matcher<A6>, Matcher<A7> >
  118.       type;
  119. };
  120.  
  121. template <typename A1, typename A2, typename A3, typename A4, typename A5,
  122.     typename A6, typename A7, typename A8>
  123. struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
  124.   typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
  125.                            Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> >
  126.       type;
  127. };
  128.  
  129. template <typename A1, typename A2, typename A3, typename A4, typename A5,
  130.     typename A6, typename A7, typename A8, typename A9>
  131. struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
  132.   typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
  133.                            Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>,
  134.                            Matcher<A9> >
  135.       type;
  136. };
  137.  
  138. template <typename A1, typename A2, typename A3, typename A4, typename A5,
  139.     typename A6, typename A7, typename A8, typename A9, typename A10>
  140. struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
  141.     A10> > {
  142.   typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
  143.                            Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>,
  144.                            Matcher<A9>, Matcher<A10> >
  145.       type;
  146. };
  147.  
  148. // Template struct Function<F>, where F must be a function type, contains
  149. // the following typedefs:
  150. //
  151. //   Result:               the function's return type.
  152. //   ArgumentN:            the type of the N-th argument, where N starts with 1.
  153. //   ArgumentTuple:        the tuple type consisting of all parameters of F.
  154. //   ArgumentMatcherTuple: the tuple type consisting of Matchers for all
  155. //                         parameters of F.
  156. //   MakeResultVoid:       the function type obtained by substituting void
  157. //                         for the return type of F.
  158. //   MakeResultIgnoredValue:
  159. //                         the function type obtained by substituting Something
  160. //                         for the return type of F.
  161. template <typename F>
  162. struct Function;
  163.  
  164. template <typename R>
  165. struct Function<R()> {
  166.   typedef R Result;
  167.   typedef ::testing::tuple<> ArgumentTuple;
  168.   typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
  169.   typedef void MakeResultVoid();
  170.   typedef IgnoredValue MakeResultIgnoredValue();
  171. };
  172.  
  173. template <typename R, typename A1>
  174. struct Function<R(A1)>
  175.     : Function<R()> {
  176.   typedef A1 Argument1;
  177.   typedef ::testing::tuple<A1> ArgumentTuple;
  178.   typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
  179.   typedef void MakeResultVoid(A1);
  180.   typedef IgnoredValue MakeResultIgnoredValue(A1);
  181. };
  182.  
  183. template <typename R, typename A1, typename A2>
  184. struct Function<R(A1, A2)>
  185.     : Function<R(A1)> {
  186.   typedef A2 Argument2;
  187.   typedef ::testing::tuple<A1, A2> ArgumentTuple;
  188.   typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
  189.   typedef void MakeResultVoid(A1, A2);
  190.   typedef IgnoredValue MakeResultIgnoredValue(A1, A2);
  191. };
  192.  
  193. template <typename R, typename A1, typename A2, typename A3>
  194. struct Function<R(A1, A2, A3)>
  195.     : Function<R(A1, A2)> {
  196.   typedef A3 Argument3;
  197.   typedef ::testing::tuple<A1, A2, A3> ArgumentTuple;
  198.   typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
  199.   typedef void MakeResultVoid(A1, A2, A3);
  200.   typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3);
  201. };
  202.  
  203. template <typename R, typename A1, typename A2, typename A3, typename A4>
  204. struct Function<R(A1, A2, A3, A4)>
  205.     : Function<R(A1, A2, A3)> {
  206.   typedef A4 Argument4;
  207.   typedef ::testing::tuple<A1, A2, A3, A4> ArgumentTuple;
  208.   typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
  209.   typedef void MakeResultVoid(A1, A2, A3, A4);
  210.   typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4);
  211. };
  212.  
  213. template <typename R, typename A1, typename A2, typename A3, typename A4,
  214.     typename A5>
  215. struct Function<R(A1, A2, A3, A4, A5)>
  216.     : Function<R(A1, A2, A3, A4)> {
  217.   typedef A5 Argument5;
  218.   typedef ::testing::tuple<A1, A2, A3, A4, A5> ArgumentTuple;
  219.   typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
  220.   typedef void MakeResultVoid(A1, A2, A3, A4, A5);
  221.   typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5);
  222. };
  223.  
  224. template <typename R, typename A1, typename A2, typename A3, typename A4,
  225.     typename A5, typename A6>
  226. struct Function<R(A1, A2, A3, A4, A5, A6)>
  227.     : Function<R(A1, A2, A3, A4, A5)> {
  228.   typedef A6 Argument6;
  229.   typedef ::testing::tuple<A1, A2, A3, A4, A5, A6> ArgumentTuple;
  230.   typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
  231.   typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6);
  232.   typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6);
  233. };
  234.  
  235. template <typename R, typename A1, typename A2, typename A3, typename A4,
  236.     typename A5, typename A6, typename A7>
  237. struct Function<R(A1, A2, A3, A4, A5, A6, A7)>
  238.     : Function<R(A1, A2, A3, A4, A5, A6)> {
  239.   typedef A7 Argument7;
  240.   typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> ArgumentTuple;
  241.   typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
  242.   typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7);
  243.   typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7);
  244. };
  245.  
  246. template <typename R, typename A1, typename A2, typename A3, typename A4,
  247.     typename A5, typename A6, typename A7, typename A8>
  248. struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8)>
  249.     : Function<R(A1, A2, A3, A4, A5, A6, A7)> {
  250.   typedef A8 Argument8;
  251.   typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> ArgumentTuple;
  252.   typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
  253.   typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8);
  254.   typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8);
  255. };
  256.  
  257. template <typename R, typename A1, typename A2, typename A3, typename A4,
  258.     typename A5, typename A6, typename A7, typename A8, typename A9>
  259. struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
  260.     : Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
  261.   typedef A9 Argument9;
  262.   typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> ArgumentTuple;
  263.   typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
  264.   typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9);
  265.   typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
  266.       A9);
  267. };
  268.  
  269. template <typename R, typename A1, typename A2, typename A3, typename A4,
  270.     typename A5, typename A6, typename A7, typename A8, typename A9,
  271.     typename A10>
  272. struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
  273.     : Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
  274.   typedef A10 Argument10;
  275.   typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
  276.       A10> ArgumentTuple;
  277.   typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
  278.   typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
  279.   typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
  280.       A9, A10);
  281. };
  282.  
  283. }  // namespace internal
  284.  
  285. }  // namespace testing
  286.  
  287. #endif  // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
  288.