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 #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
42 #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
44 #include "gmock/internal/gmock-port.h"
53 // An IgnoredValue object can be implicitly constructed from ANY value.
54 // This is used in implementing the IgnoreResult(a) action.
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.
63 IgnoredValue(const T
& /* ignored */) {} // NOLINT(runtime/explicit)
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
>
72 struct MatcherTuple
< ::testing::tuple
<> > {
73 typedef ::testing::tuple
< > type
;
76 template <typename A1
>
77 struct MatcherTuple
< ::testing::tuple
<A1
> > {
78 typedef ::testing::tuple
<Matcher
<A1
> > type
;
81 template <typename A1
, typename A2
>
82 struct MatcherTuple
< ::testing::tuple
<A1
, A2
> > {
83 typedef ::testing::tuple
<Matcher
<A1
>, Matcher
<A2
> > type
;
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
;
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
>,
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
>,
103 template <typename A1
, typename A2
, typename A3
, typename A4
, typename A5
,
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
;
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
;
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
;
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
;
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
,
135 typedef ::testing::tuple
<Matcher
<A1
>, Matcher
<A2
>, Matcher
<A3
>, Matcher
<A4
>,
136 Matcher
<A5
>, Matcher
<A6
>, Matcher
<A7
>, Matcher
<A8
>, Matcher
<A9
>,
140 // Template struct Function<F>, where F must be a function type, contains
141 // the following typedefs:
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
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
>
156 template <typename R
>
157 struct Function
<R()> {
159 typedef ::testing::tuple
<> ArgumentTuple
;
160 typedef typename MatcherTuple
<ArgumentTuple
>::type ArgumentMatcherTuple
;
161 typedef void MakeResultVoid();
162 typedef IgnoredValue
MakeResultIgnoredValue();
165 template <typename R
, typename A1
>
166 struct Function
<R(A1
)>
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
);
175 template <typename R
, typename A1
, typename A2
>
176 struct Function
<R(A1
, A2
)>
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
);
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
);
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
);
205 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
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
);
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
);
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
);
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
);
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
,
261 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
262 typename A5
, typename A6
, typename A7
, typename A8
, typename A9
,
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
,
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
,
275 } // namespace internal
277 } // namespace testing
279 #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_