gmock-generated-internal-utils.h 11 KB

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