1 |
2 |
jamieiles |
// 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 |
|
|
// Author: wan@google.com (Zhanyong Wan)
|
35 |
|
|
|
36 |
|
|
// Google Mock - a framework for writing C++ mock classes.
|
37 |
|
|
//
|
38 |
|
|
// This file contains template meta-programming utility classes needed
|
39 |
|
|
// for implementing Google Mock.
|
40 |
|
|
|
41 |
|
|
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
|
42 |
|
|
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
|
43 |
|
|
|
44 |
|
|
#include "gmock/internal/gmock-port.h"
|
45 |
|
|
|
46 |
|
|
namespace testing {
|
47 |
|
|
|
48 |
|
|
template <typename T>
|
49 |
|
|
class Matcher;
|
50 |
|
|
|
51 |
|
|
namespace internal {
|
52 |
|
|
|
53 |
|
|
// An IgnoredValue object can be implicitly constructed from ANY value.
|
54 |
|
|
// This is used in implementing the IgnoreResult(a) action.
|
55 |
|
|
class IgnoredValue {
|
56 |
|
|
public:
|
57 |
|
|
// This constructor template allows any value to be implicitly
|
58 |
|
|
// converted to IgnoredValue. The object has no data member and
|
59 |
|
|
// doesn't try to remember anything about the argument. We
|
60 |
|
|
// deliberately omit the 'explicit' keyword in order to allow the
|
61 |
|
|
// conversion to be implicit.
|
62 |
|
|
template <typename T>
|
63 |
|
|
IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
|
64 |
|
|
};
|
65 |
|
|
|
66 |
|
|
// MatcherTuple<T>::type is a tuple type where each field is a Matcher
|
67 |
|
|
// for the corresponding field in tuple type T.
|
68 |
|
|
template <typename Tuple>
|
69 |
|
|
struct MatcherTuple;
|
70 |
|
|
|
71 |
|
|
template <>
|
72 |
|
|
struct MatcherTuple< ::testing::tuple<> > {
|
73 |
|
|
typedef ::testing::tuple< > type;
|
74 |
|
|
};
|
75 |
|
|
|
76 |
|
|
template <typename A1>
|
77 |
|
|
struct MatcherTuple< ::testing::tuple<A1> > {
|
78 |
|
|
typedef ::testing::tuple<Matcher<A1> > type;
|
79 |
|
|
};
|
80 |
|
|
|
81 |
|
|
template <typename A1, typename A2>
|
82 |
|
|
struct MatcherTuple< ::testing::tuple<A1, A2> > {
|
83 |
|
|
typedef ::testing::tuple<Matcher<A1>, Matcher<A2> > type;
|
84 |
|
|
};
|
85 |
|
|
|
86 |
|
|
template <typename A1, typename A2, typename A3>
|
87 |
|
|
struct MatcherTuple< ::testing::tuple<A1, A2, A3> > {
|
88 |
|
|
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3> > type;
|
89 |
|
|
};
|
90 |
|
|
|
91 |
|
|
template <typename A1, typename A2, typename A3, typename A4>
|
92 |
|
|
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4> > {
|
93 |
|
|
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>,
|
94 |
|
|
Matcher<A4> > type;
|
95 |
|
|
};
|
96 |
|
|
|
97 |
|
|
template <typename A1, typename A2, typename A3, typename A4, typename A5>
|
98 |
|
|
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5> > {
|
99 |
|
|
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
|
100 |
|
|
Matcher<A5> > type;
|
101 |
|
|
};
|
102 |
|
|
|
103 |
|
|
template <typename A1, typename A2, typename A3, typename A4, typename A5,
|
104 |
|
|
typename A6>
|
105 |
|
|
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
|
106 |
|
|
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
|
107 |
|
|
Matcher<A5>, Matcher<A6> > type;
|
108 |
|
|
};
|
109 |
|
|
|
110 |
|
|
template <typename A1, typename A2, typename A3, typename A4, typename A5,
|
111 |
|
|
typename A6, typename A7>
|
112 |
|
|
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
|
113 |
|
|
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
|
114 |
|
|
Matcher<A5>, Matcher<A6>, Matcher<A7> > type;
|
115 |
|
|
};
|
116 |
|
|
|
117 |
|
|
template <typename A1, typename A2, typename A3, typename A4, typename A5,
|
118 |
|
|
typename A6, typename A7, typename A8>
|
119 |
|
|
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
|
120 |
|
|
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
|
121 |
|
|
Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> > type;
|
122 |
|
|
};
|
123 |
|
|
|
124 |
|
|
template <typename A1, typename A2, typename A3, typename A4, typename A5,
|
125 |
|
|
typename A6, typename A7, typename A8, typename A9>
|
126 |
|
|
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
|
127 |
|
|
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
|
128 |
|
|
Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9> > type;
|
129 |
|
|
};
|
130 |
|
|
|
131 |
|
|
template <typename A1, typename A2, typename A3, typename A4, typename A5,
|
132 |
|
|
typename A6, typename A7, typename A8, typename A9, typename A10>
|
133 |
|
|
struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
|
134 |
|
|
A10> > {
|
135 |
|
|
typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
|
136 |
|
|
Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9>,
|
137 |
|
|
Matcher<A10> > type;
|
138 |
|
|
};
|
139 |
|
|
|
140 |
|
|
// Template struct Function<F>, where F must be a function type, contains
|
141 |
|
|
// the following typedefs:
|
142 |
|
|
//
|
143 |
|
|
// Result: the function's return type.
|
144 |
|
|
// ArgumentN: the type of the N-th argument, where N starts with 1.
|
145 |
|
|
// ArgumentTuple: the tuple type consisting of all parameters of F.
|
146 |
|
|
// ArgumentMatcherTuple: the tuple type consisting of Matchers for all
|
147 |
|
|
// parameters of F.
|
148 |
|
|
// MakeResultVoid: the function type obtained by substituting void
|
149 |
|
|
// for the return type of F.
|
150 |
|
|
// MakeResultIgnoredValue:
|
151 |
|
|
// the function type obtained by substituting Something
|
152 |
|
|
// for the return type of F.
|
153 |
|
|
template <typename F>
|
154 |
|
|
struct Function;
|
155 |
|
|
|
156 |
|
|
template <typename R>
|
157 |
|
|
struct Function<R()> {
|
158 |
|
|
typedef R Result;
|
159 |
|
|
typedef ::testing::tuple<> ArgumentTuple;
|
160 |
|
|
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
|
161 |
|
|
typedef void MakeResultVoid();
|
162 |
|
|
typedef IgnoredValue MakeResultIgnoredValue();
|
163 |
|
|
};
|
164 |
|
|
|
165 |
|
|
template <typename R, typename A1>
|
166 |
|
|
struct Function<R(A1)>
|
167 |
|
|
: Function<R()> {
|
168 |
|
|
typedef A1 Argument1;
|
169 |
|
|
typedef ::testing::tuple<A1> ArgumentTuple;
|
170 |
|
|
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
|
171 |
|
|
typedef void MakeResultVoid(A1);
|
172 |
|
|
typedef IgnoredValue MakeResultIgnoredValue(A1);
|
173 |
|
|
};
|
174 |
|
|
|
175 |
|
|
template <typename R, typename A1, typename A2>
|
176 |
|
|
struct Function<R(A1, A2)>
|
177 |
|
|
: Function<R(A1)> {
|
178 |
|
|
typedef A2 Argument2;
|
179 |
|
|
typedef ::testing::tuple<A1, A2> ArgumentTuple;
|
180 |
|
|
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
|
181 |
|
|
typedef void MakeResultVoid(A1, A2);
|
182 |
|
|
typedef IgnoredValue MakeResultIgnoredValue(A1, A2);
|
183 |
|
|
};
|
184 |
|
|
|
185 |
|
|
template <typename R, typename A1, typename A2, typename A3>
|
186 |
|
|
struct Function<R(A1, A2, A3)>
|
187 |
|
|
: Function<R(A1, A2)> {
|
188 |
|
|
typedef A3 Argument3;
|
189 |
|
|
typedef ::testing::tuple<A1, A2, A3> ArgumentTuple;
|
190 |
|
|
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
|
191 |
|
|
typedef void MakeResultVoid(A1, A2, A3);
|
192 |
|
|
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3);
|
193 |
|
|
};
|
194 |
|
|
|
195 |
|
|
template <typename R, typename A1, typename A2, typename A3, typename A4>
|
196 |
|
|
struct Function<R(A1, A2, A3, A4)>
|
197 |
|
|
: Function<R(A1, A2, A3)> {
|
198 |
|
|
typedef A4 Argument4;
|
199 |
|
|
typedef ::testing::tuple<A1, A2, A3, A4> ArgumentTuple;
|
200 |
|
|
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
|
201 |
|
|
typedef void MakeResultVoid(A1, A2, A3, A4);
|
202 |
|
|
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4);
|
203 |
|
|
};
|
204 |
|
|
|
205 |
|
|
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
206 |
|
|
typename A5>
|
207 |
|
|
struct Function<R(A1, A2, A3, A4, A5)>
|
208 |
|
|
: Function<R(A1, A2, A3, A4)> {
|
209 |
|
|
typedef A5 Argument5;
|
210 |
|
|
typedef ::testing::tuple<A1, A2, A3, A4, A5> ArgumentTuple;
|
211 |
|
|
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
|
212 |
|
|
typedef void MakeResultVoid(A1, A2, A3, A4, A5);
|
213 |
|
|
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5);
|
214 |
|
|
};
|
215 |
|
|
|
216 |
|
|
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
217 |
|
|
typename A5, typename A6>
|
218 |
|
|
struct Function<R(A1, A2, A3, A4, A5, A6)>
|
219 |
|
|
: Function<R(A1, A2, A3, A4, A5)> {
|
220 |
|
|
typedef A6 Argument6;
|
221 |
|
|
typedef ::testing::tuple<A1, A2, A3, A4, A5, A6> ArgumentTuple;
|
222 |
|
|
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
|
223 |
|
|
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6);
|
224 |
|
|
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6);
|
225 |
|
|
};
|
226 |
|
|
|
227 |
|
|
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
228 |
|
|
typename A5, typename A6, typename A7>
|
229 |
|
|
struct Function<R(A1, A2, A3, A4, A5, A6, A7)>
|
230 |
|
|
: Function<R(A1, A2, A3, A4, A5, A6)> {
|
231 |
|
|
typedef A7 Argument7;
|
232 |
|
|
typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> ArgumentTuple;
|
233 |
|
|
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
|
234 |
|
|
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7);
|
235 |
|
|
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7);
|
236 |
|
|
};
|
237 |
|
|
|
238 |
|
|
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
239 |
|
|
typename A5, typename A6, typename A7, typename A8>
|
240 |
|
|
struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8)>
|
241 |
|
|
: Function<R(A1, A2, A3, A4, A5, A6, A7)> {
|
242 |
|
|
typedef A8 Argument8;
|
243 |
|
|
typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> ArgumentTuple;
|
244 |
|
|
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
|
245 |
|
|
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8);
|
246 |
|
|
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8);
|
247 |
|
|
};
|
248 |
|
|
|
249 |
|
|
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
250 |
|
|
typename A5, typename A6, typename A7, typename A8, typename A9>
|
251 |
|
|
struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
|
252 |
|
|
: Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
|
253 |
|
|
typedef A9 Argument9;
|
254 |
|
|
typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> ArgumentTuple;
|
255 |
|
|
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
|
256 |
|
|
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9);
|
257 |
|
|
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
|
258 |
|
|
A9);
|
259 |
|
|
};
|
260 |
|
|
|
261 |
|
|
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
262 |
|
|
typename A5, typename A6, typename A7, typename A8, typename A9,
|
263 |
|
|
typename A10>
|
264 |
|
|
struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
|
265 |
|
|
: Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
|
266 |
|
|
typedef A10 Argument10;
|
267 |
|
|
typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
|
268 |
|
|
A10> ArgumentTuple;
|
269 |
|
|
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
|
270 |
|
|
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
|
271 |
|
|
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
|
272 |
|
|
A9, A10);
|
273 |
|
|
};
|
274 |
|
|
|
275 |
|
|
} // namespace internal
|
276 |
|
|
|
277 |
|
|
} // namespace testing
|
278 |
|
|
|
279 |
|
|
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
|