1 // This file was GENERATED by command:
2 // pump.py gmock-generated-internal-utils.h.pump
3 // DO NOT EDIT BY HAND!!!
5 // Copyright 2007, Google Inc.
6 // All rights reserved.
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions are
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
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.
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.
35 // Google Mock - a framework for writing C++ mock classes.
37 // This file contains template meta-programming utility classes needed
38 // for implementing Google Mock.
40 // GOOGLETEST_CM0002 DO NOT DELETE
42 #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
43 #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
45 #include "gmock/internal/gmock-port.h"
54 // An IgnoredValue object can be implicitly constructed from ANY value.
55 // This is used in implementing the IgnoreResult(a) action.
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.
64 IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
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>
73 struct MatcherTuple< ::testing::tuple<> > {
74 typedef ::testing::tuple< > type;
77 template <typename A1>
78 struct MatcherTuple< ::testing::tuple<A1> > {
79 typedef ::testing::tuple<Matcher<A1> > type;
82 template <typename A1, typename A2>
83 struct MatcherTuple< ::testing::tuple<A1, A2> > {
84 typedef ::testing::tuple<Matcher<A1>, Matcher<A2> > type;
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;
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> >
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>,
105 template <typename A1, typename A2, typename A3, typename A4, typename A5,
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> >
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> >
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> >
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>,
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,
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> >
148 // Template struct Function<F>, where F must be a function type, contains
149 // the following typedefs:
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
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>
164 template <typename R>
165 struct Function<R()> {
167 typedef ::testing::tuple<> ArgumentTuple;
168 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
169 typedef void MakeResultVoid();
170 typedef IgnoredValue MakeResultIgnoredValue();
173 template <typename R, typename A1>
174 struct Function<R(A1)>
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);
183 template <typename R, typename A1, typename A2>
184 struct Function<R(A1, A2)>
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);
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);
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);
213 template <typename R, typename A1, typename A2, typename A3, typename A4,
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);
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);
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);
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);
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,
269 template <typename R, typename A1, typename A2, typename A3, typename A4,
270 typename A5, typename A6, typename A7, typename A8, typename A9,
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,
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,
283 } // namespace internal
285 } // namespace testing
287 #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_