1 // Copyright (C) 2018 Intel Corporation
3 // SPDX-License-Identifier: Apache-2.0
6 // This file was GENERATED by command:
7 // pump.py gmock-generated-internal-utils.h.pump
8 // DO NOT EDIT BY HAND!!!
10 // Copyright 2007, Google Inc.
11 // All rights reserved.
13 // Redistribution and use in source and binary forms, with or without
14 // modification, are permitted provided that the following conditions are
17 // * Redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer.
19 // * Redistributions in binary form must reproduce the above
20 // copyright notice, this list of conditions and the following disclaimer
21 // in the documentation and/or other materials provided with the
23 // * Neither the name of Google Inc. nor the names of its
24 // contributors may be used to endorse or promote products derived from
25 // this software without specific prior written permission.
27 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 // Author: wan@google.com (Zhanyong Wan)
41 // Google Mock - a framework for writing C++ mock classes.
43 // This file contains template meta-programming utility classes needed
44 // for implementing Google Mock.
46 #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
47 #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
49 #include "gmock/internal/gmock-port.h"
58 // An IgnoredValue object can be implicitly constructed from ANY value.
59 // This is used in implementing the IgnoreResult(a) action.
62 // This constructor template allows any value to be implicitly
63 // converted to IgnoredValue. The object has no data member and
64 // doesn't try to remember anything about the argument. We
65 // deliberately omit the 'explicit' keyword in order to allow the
66 // conversion to be implicit.
68 IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
71 // MatcherTuple<T>::type is a tuple type where each field is a Matcher
72 // for the corresponding field in tuple type T.
73 template <typename Tuple>
77 struct MatcherTuple< ::testing::tuple<> > {
78 typedef ::testing::tuple< > type;
81 template <typename A1>
82 struct MatcherTuple< ::testing::tuple<A1> > {
83 typedef ::testing::tuple<Matcher<A1> > type;
86 template <typename A1, typename A2>
87 struct MatcherTuple< ::testing::tuple<A1, A2> > {
88 typedef ::testing::tuple<Matcher<A1>, Matcher<A2> > type;
91 template <typename A1, typename A2, typename A3>
92 struct MatcherTuple< ::testing::tuple<A1, A2, A3> > {
93 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3> > type;
96 template <typename A1, typename A2, typename A3, typename A4>
97 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4> > {
98 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>,
102 template <typename A1, typename A2, typename A3, typename A4, typename A5>
103 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5> > {
104 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
108 template <typename A1, typename A2, typename A3, typename A4, typename A5,
110 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
111 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
112 Matcher<A5>, Matcher<A6> > type;
115 template <typename A1, typename A2, typename A3, typename A4, typename A5,
116 typename A6, typename A7>
117 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
118 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
119 Matcher<A5>, Matcher<A6>, Matcher<A7> > type;
122 template <typename A1, typename A2, typename A3, typename A4, typename A5,
123 typename A6, typename A7, typename A8>
124 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
125 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
126 Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> > type;
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>, Matcher<A9> > type;
136 template <typename A1, typename A2, typename A3, typename A4, typename A5,
137 typename A6, typename A7, typename A8, typename A9, typename A10>
138 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
140 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
141 Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9>,
145 // Template struct Function<F>, where F must be a function type, contains
146 // the following typedefs:
148 // Result: the function's return type.
149 // ArgumentN: the type of the N-th argument, where N starts with 1.
150 // ArgumentTuple: the tuple type consisting of all parameters of F.
151 // ArgumentMatcherTuple: the tuple type consisting of Matchers for all
153 // MakeResultVoid: the function type obtained by substituting void
154 // for the return type of F.
155 // MakeResultIgnoredValue:
156 // the function type obtained by substituting Something
157 // for the return type of F.
158 template <typename F>
161 template <typename R>
162 struct Function<R()> {
164 typedef ::testing::tuple<> ArgumentTuple;
165 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
166 typedef void MakeResultVoid();
167 typedef IgnoredValue MakeResultIgnoredValue();
170 template <typename R, typename A1>
171 struct Function<R(A1)>
173 typedef A1 Argument1;
174 typedef ::testing::tuple<A1> ArgumentTuple;
175 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
176 typedef void MakeResultVoid(A1);
177 typedef IgnoredValue MakeResultIgnoredValue(A1);
180 template <typename R, typename A1, typename A2>
181 struct Function<R(A1, A2)>
183 typedef A2 Argument2;
184 typedef ::testing::tuple<A1, A2> ArgumentTuple;
185 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
186 typedef void MakeResultVoid(A1, A2);
187 typedef IgnoredValue MakeResultIgnoredValue(A1, A2);
190 template <typename R, typename A1, typename A2, typename A3>
191 struct Function<R(A1, A2, A3)>
192 : Function<R(A1, A2)> {
193 typedef A3 Argument3;
194 typedef ::testing::tuple<A1, A2, A3> ArgumentTuple;
195 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
196 typedef void MakeResultVoid(A1, A2, A3);
197 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3);
200 template <typename R, typename A1, typename A2, typename A3, typename A4>
201 struct Function<R(A1, A2, A3, A4)>
202 : Function<R(A1, A2, A3)> {
203 typedef A4 Argument4;
204 typedef ::testing::tuple<A1, A2, A3, A4> ArgumentTuple;
205 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
206 typedef void MakeResultVoid(A1, A2, A3, A4);
207 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4);
210 template <typename R, typename A1, typename A2, typename A3, typename A4,
212 struct Function<R(A1, A2, A3, A4, A5)>
213 : Function<R(A1, A2, A3, A4)> {
214 typedef A5 Argument5;
215 typedef ::testing::tuple<A1, A2, A3, A4, A5> ArgumentTuple;
216 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
217 typedef void MakeResultVoid(A1, A2, A3, A4, A5);
218 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5);
221 template <typename R, typename A1, typename A2, typename A3, typename A4,
222 typename A5, typename A6>
223 struct Function<R(A1, A2, A3, A4, A5, A6)>
224 : Function<R(A1, A2, A3, A4, A5)> {
225 typedef A6 Argument6;
226 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6> ArgumentTuple;
227 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
228 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6);
229 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6);
232 template <typename R, typename A1, typename A2, typename A3, typename A4,
233 typename A5, typename A6, typename A7>
234 struct Function<R(A1, A2, A3, A4, A5, A6, A7)>
235 : Function<R(A1, A2, A3, A4, A5, A6)> {
236 typedef A7 Argument7;
237 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> ArgumentTuple;
238 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
239 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7);
240 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7);
243 template <typename R, typename A1, typename A2, typename A3, typename A4,
244 typename A5, typename A6, typename A7, typename A8>
245 struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8)>
246 : Function<R(A1, A2, A3, A4, A5, A6, A7)> {
247 typedef A8 Argument8;
248 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> ArgumentTuple;
249 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
250 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8);
251 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8);
254 template <typename R, typename A1, typename A2, typename A3, typename A4,
255 typename A5, typename A6, typename A7, typename A8, typename A9>
256 struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
257 : Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
258 typedef A9 Argument9;
259 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> ArgumentTuple;
260 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
261 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9);
262 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
266 template <typename R, typename A1, typename A2, typename A3, typename A4,
267 typename A5, typename A6, typename A7, typename A8, typename A9,
269 struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
270 : Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
271 typedef A10 Argument10;
272 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
274 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
275 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
276 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
280 } // namespace internal
282 } // namespace testing
284 #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_