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.
34 // Author: wan@google.com (Zhanyong Wan)
36 // Google Mock - a framework for writing C++ mock classes.
38 // This file contains template meta-programming utility classes needed
39 // for implementing Google Mock.
41 // IWYU pragma: private, include "gmock/gmock.h"
43 #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
44 #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
46 #include "gmock/internal/gmock-port.h"
55 // An IgnoredValue object can be implicitly constructed from ANY value.
56 // This is used in implementing the IgnoreResult(a) action.
59 // This constructor template allows any value to be implicitly
60 // converted to IgnoredValue. The object has no data member and
61 // doesn't try to remember anything about the argument. We
62 // deliberately omit the 'explicit' keyword in order to allow the
63 // conversion to be implicit.
65 IgnoredValue(const T
& /* ignored */) {} // NOLINT(runtime/explicit)
68 // MatcherTuple<T>::type is a tuple type where each field is a Matcher
69 // for the corresponding field in tuple type T.
70 template <typename Tuple
>
74 struct MatcherTuple
< ::testing::tuple
<> > {
75 typedef ::testing::tuple
< > type
;
78 template <typename A1
>
79 struct MatcherTuple
< ::testing::tuple
<A1
> > {
80 typedef ::testing::tuple
<Matcher
<A1
> > type
;
83 template <typename A1
, typename A2
>
84 struct MatcherTuple
< ::testing::tuple
<A1
, A2
> > {
85 typedef ::testing::tuple
<Matcher
<A1
>, Matcher
<A2
> > type
;
88 template <typename A1
, typename A2
, typename A3
>
89 struct MatcherTuple
< ::testing::tuple
<A1
, A2
, A3
> > {
90 typedef ::testing::tuple
<Matcher
<A1
>, Matcher
<A2
>, Matcher
<A3
> > type
;
93 template <typename A1
, typename A2
, typename A3
, typename A4
>
94 struct MatcherTuple
< ::testing::tuple
<A1
, A2
, A3
, A4
> > {
95 typedef ::testing::tuple
<Matcher
<A1
>, Matcher
<A2
>, Matcher
<A3
>,
99 template <typename A1
, typename A2
, typename A3
, typename A4
, typename A5
>
100 struct MatcherTuple
< ::testing::tuple
<A1
, A2
, A3
, A4
, A5
> > {
101 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
> > type
;
112 template <typename A1
, typename A2
, typename A3
, typename A4
, typename A5
,
113 typename A6
, typename A7
>
114 struct MatcherTuple
< ::testing::tuple
<A1
, A2
, A3
, A4
, A5
, A6
, A7
> > {
115 typedef ::testing::tuple
<Matcher
<A1
>, Matcher
<A2
>, Matcher
<A3
>, Matcher
<A4
>,
116 Matcher
<A5
>, Matcher
<A6
>, Matcher
<A7
> > type
;
119 template <typename A1
, typename A2
, typename A3
, typename A4
, typename A5
,
120 typename A6
, typename A7
, typename A8
>
121 struct MatcherTuple
< ::testing::tuple
<A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
> > {
122 typedef ::testing::tuple
<Matcher
<A1
>, Matcher
<A2
>, Matcher
<A3
>, Matcher
<A4
>,
123 Matcher
<A5
>, Matcher
<A6
>, Matcher
<A7
>, Matcher
<A8
> > type
;
126 template <typename A1
, typename A2
, typename A3
, typename A4
, typename A5
,
127 typename A6
, typename A7
, typename A8
, typename A9
>
128 struct MatcherTuple
< ::testing::tuple
<A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
> > {
129 typedef ::testing::tuple
<Matcher
<A1
>, Matcher
<A2
>, Matcher
<A3
>, Matcher
<A4
>,
130 Matcher
<A5
>, Matcher
<A6
>, Matcher
<A7
>, Matcher
<A8
>, Matcher
<A9
> > type
;
133 template <typename A1
, typename A2
, typename A3
, typename A4
, typename A5
,
134 typename A6
, typename A7
, typename A8
, typename A9
, typename A10
>
135 struct MatcherTuple
< ::testing::tuple
<A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
,
137 typedef ::testing::tuple
<Matcher
<A1
>, Matcher
<A2
>, Matcher
<A3
>, Matcher
<A4
>,
138 Matcher
<A5
>, Matcher
<A6
>, Matcher
<A7
>, Matcher
<A8
>, Matcher
<A9
>,
142 // Template struct Function<F>, where F must be a function type, contains
143 // the following typedefs:
145 // Result: the function's return type.
146 // ArgumentN: the type of the N-th argument, where N starts with 1.
147 // ArgumentTuple: the tuple type consisting of all parameters of F.
148 // ArgumentMatcherTuple: the tuple type consisting of Matchers for all
150 // MakeResultVoid: the function type obtained by substituting void
151 // for the return type of F.
152 // MakeResultIgnoredValue:
153 // the function type obtained by substituting Something
154 // for the return type of F.
155 template <typename F
>
158 template <typename R
>
159 struct Function
<R()> {
161 typedef ::testing::tuple
<> ArgumentTuple
;
162 typedef typename MatcherTuple
<ArgumentTuple
>::type ArgumentMatcherTuple
;
163 typedef void MakeResultVoid();
164 typedef IgnoredValue
MakeResultIgnoredValue();
167 template <typename R
, typename A1
>
168 struct Function
<R(A1
)>
170 typedef A1 Argument1
;
171 typedef ::testing::tuple
<A1
> ArgumentTuple
;
172 typedef typename MatcherTuple
<ArgumentTuple
>::type ArgumentMatcherTuple
;
173 typedef void MakeResultVoid(A1
);
174 typedef IgnoredValue
MakeResultIgnoredValue(A1
);
177 template <typename R
, typename A1
, typename A2
>
178 struct Function
<R(A1
, A2
)>
180 typedef A2 Argument2
;
181 typedef ::testing::tuple
<A1
, A2
> ArgumentTuple
;
182 typedef typename MatcherTuple
<ArgumentTuple
>::type ArgumentMatcherTuple
;
183 typedef void MakeResultVoid(A1
, A2
);
184 typedef IgnoredValue
MakeResultIgnoredValue(A1
, A2
);
187 template <typename R
, typename A1
, typename A2
, typename A3
>
188 struct Function
<R(A1
, A2
, A3
)>
189 : Function
<R(A1
, A2
)> {
190 typedef A3 Argument3
;
191 typedef ::testing::tuple
<A1
, A2
, A3
> ArgumentTuple
;
192 typedef typename MatcherTuple
<ArgumentTuple
>::type ArgumentMatcherTuple
;
193 typedef void MakeResultVoid(A1
, A2
, A3
);
194 typedef IgnoredValue
MakeResultIgnoredValue(A1
, A2
, A3
);
197 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
>
198 struct Function
<R(A1
, A2
, A3
, A4
)>
199 : Function
<R(A1
, A2
, A3
)> {
200 typedef A4 Argument4
;
201 typedef ::testing::tuple
<A1
, A2
, A3
, A4
> ArgumentTuple
;
202 typedef typename MatcherTuple
<ArgumentTuple
>::type ArgumentMatcherTuple
;
203 typedef void MakeResultVoid(A1
, A2
, A3
, A4
);
204 typedef IgnoredValue
MakeResultIgnoredValue(A1
, A2
, A3
, A4
);
207 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
209 struct Function
<R(A1
, A2
, A3
, A4
, A5
)>
210 : Function
<R(A1
, A2
, A3
, A4
)> {
211 typedef A5 Argument5
;
212 typedef ::testing::tuple
<A1
, A2
, A3
, A4
, A5
> ArgumentTuple
;
213 typedef typename MatcherTuple
<ArgumentTuple
>::type ArgumentMatcherTuple
;
214 typedef void MakeResultVoid(A1
, A2
, A3
, A4
, A5
);
215 typedef IgnoredValue
MakeResultIgnoredValue(A1
, A2
, A3
, A4
, A5
);
218 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
219 typename A5
, typename A6
>
220 struct Function
<R(A1
, A2
, A3
, A4
, A5
, A6
)>
221 : Function
<R(A1
, A2
, A3
, A4
, A5
)> {
222 typedef A6 Argument6
;
223 typedef ::testing::tuple
<A1
, A2
, A3
, A4
, A5
, A6
> ArgumentTuple
;
224 typedef typename MatcherTuple
<ArgumentTuple
>::type ArgumentMatcherTuple
;
225 typedef void MakeResultVoid(A1
, A2
, A3
, A4
, A5
, A6
);
226 typedef IgnoredValue
MakeResultIgnoredValue(A1
, A2
, A3
, A4
, A5
, A6
);
229 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
230 typename A5
, typename A6
, typename A7
>
231 struct Function
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
)>
232 : Function
<R(A1
, A2
, A3
, A4
, A5
, A6
)> {
233 typedef A7 Argument7
;
234 typedef ::testing::tuple
<A1
, A2
, A3
, A4
, A5
, A6
, A7
> ArgumentTuple
;
235 typedef typename MatcherTuple
<ArgumentTuple
>::type ArgumentMatcherTuple
;
236 typedef void MakeResultVoid(A1
, A2
, A3
, A4
, A5
, A6
, A7
);
237 typedef IgnoredValue
MakeResultIgnoredValue(A1
, A2
, A3
, A4
, A5
, A6
, A7
);
240 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
241 typename A5
, typename A6
, typename A7
, typename A8
>
242 struct Function
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
)>
243 : Function
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
)> {
244 typedef A8 Argument8
;
245 typedef ::testing::tuple
<A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
> ArgumentTuple
;
246 typedef typename MatcherTuple
<ArgumentTuple
>::type ArgumentMatcherTuple
;
247 typedef void MakeResultVoid(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
);
248 typedef IgnoredValue
MakeResultIgnoredValue(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
);
251 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
252 typename A5
, typename A6
, typename A7
, typename A8
, typename A9
>
253 struct Function
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
)>
254 : Function
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
)> {
255 typedef A9 Argument9
;
256 typedef ::testing::tuple
<A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
> ArgumentTuple
;
257 typedef typename MatcherTuple
<ArgumentTuple
>::type ArgumentMatcherTuple
;
258 typedef void MakeResultVoid(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
);
259 typedef IgnoredValue
MakeResultIgnoredValue(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
,
263 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
264 typename A5
, typename A6
, typename A7
, typename A8
, typename A9
,
266 struct Function
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
, A10
)>
267 : Function
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
)> {
268 typedef A10 Argument10
;
269 typedef ::testing::tuple
<A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
,
271 typedef typename MatcherTuple
<ArgumentTuple
>::type ArgumentMatcherTuple
;
272 typedef void MakeResultVoid(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
, A10
);
273 typedef IgnoredValue
MakeResultIgnoredValue(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
,
277 } // namespace internal
279 } // namespace testing
281 #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_