Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
gmock-generated-internal-utils.h
Go to the documentation of this file.
1// 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
45
46namespace testing {
47
48template <typename T>
49class Matcher;
50
51namespace internal {
52
53// An IgnoredValue object can be implicitly constructed from ANY value.
54// This is used in implementing the IgnoreResult(a) action.
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.
68template <typename Tuple>
70
71template <>
72struct MatcherTuple< ::testing::tuple<> > {
73 typedef ::testing::tuple< > type;
74};
75
76template <typename A1>
77struct MatcherTuple< ::testing::tuple<A1> > {
78 typedef ::testing::tuple<Matcher<A1> > type;
79};
80
81template <typename A1, typename A2>
82struct MatcherTuple< ::testing::tuple<A1, A2> > {
83 typedef ::testing::tuple<Matcher<A1>, Matcher<A2> > type;
84};
85
86template <typename A1, typename A2, typename A3>
87struct MatcherTuple< ::testing::tuple<A1, A2, A3> > {
88 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3> > type;
89};
90
91template <typename A1, typename A2, typename A3, typename A4>
92struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4> > {
93 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4> >
95};
96
97template <typename A1, typename A2, typename A3, typename A4, typename A5>
98struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5> > {
99 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
102};
103
104template <typename A1, typename A2, typename A3, typename A4, typename A5,
105 typename A6>
106struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
107 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
110};
111
112template <typename A1, typename A2, typename A3, typename A4, typename A5,
113 typename A6, typename A7>
114struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
115 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
118};
119
120template <typename A1, typename A2, typename A3, typename A4, typename A5,
121 typename A6, typename A7, typename A8>
122struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
123 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
126};
127
128template <typename A1, typename A2, typename A3, typename A4, typename A5,
129 typename A6, typename A7, typename A8, typename A9>
130struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
131 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
135};
136
137template <typename A1, typename A2, typename A3, typename A4, typename A5,
138 typename A6, typename A7, typename A8, typename A9, typename A10>
139struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
140 A10> > {
141 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
145};
146
147// Template struct Function<F>, where F must be a function type, contains
148// the following typedefs:
149//
150// Result: the function's return type.
151// ArgumentN: the type of the N-th argument, where N starts with 1.
152// ArgumentTuple: the tuple type consisting of all parameters of F.
153// ArgumentMatcherTuple: the tuple type consisting of Matchers for all
154// parameters of F.
155// MakeResultVoid: the function type obtained by substituting void
156// for the return type of F.
157// MakeResultIgnoredValue:
158// the function type obtained by substituting Something
159// for the return type of F.
160template <typename F>
161struct Function;
162
163template <typename R>
164struct Function<R()> {
165 typedef R Result;
166 typedef ::testing::tuple<> ArgumentTuple;
168 typedef void MakeResultVoid();
170};
171
172template <typename R, typename A1>
173struct Function<R(A1)>
174 : Function<R()> {
175 typedef A1 Argument1;
176 typedef ::testing::tuple<A1> ArgumentTuple;
178 typedef void MakeResultVoid(A1);
180};
181
182template <typename R, typename A1, typename A2>
183struct Function<R(A1, A2)>
184 : Function<R(A1)> {
185 typedef A2 Argument2;
186 typedef ::testing::tuple<A1, A2> ArgumentTuple;
188 typedef void MakeResultVoid(A1, A2);
190};
191
192template <typename R, typename A1, typename A2, typename A3>
193struct Function<R(A1, A2, A3)>
194 : Function<R(A1, A2)> {
195 typedef A3 Argument3;
196 typedef ::testing::tuple<A1, A2, A3> ArgumentTuple;
198 typedef void MakeResultVoid(A1, A2, A3);
200};
201
202template <typename R, typename A1, typename A2, typename A3, typename A4>
203struct Function<R(A1, A2, A3, A4)>
204 : Function<R(A1, A2, A3)> {
205 typedef A4 Argument4;
206 typedef ::testing::tuple<A1, A2, A3, A4> ArgumentTuple;
208 typedef void MakeResultVoid(A1, A2, A3, A4);
209 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4);
210};
211
212template <typename R, typename A1, typename A2, typename A3, typename A4,
213 typename A5>
214struct Function<R(A1, A2, A3, A4, A5)>
215 : Function<R(A1, A2, A3, A4)> {
216 typedef A5 Argument5;
217 typedef ::testing::tuple<A1, A2, A3, A4, A5> ArgumentTuple;
219 typedef void MakeResultVoid(A1, A2, A3, A4, A5);
220 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5);
221};
222
223template <typename R, typename A1, typename A2, typename A3, typename A4,
224 typename A5, typename A6>
225struct Function<R(A1, A2, A3, A4, A5, A6)>
226 : Function<R(A1, A2, A3, A4, A5)> {
227 typedef A6 Argument6;
228 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6> ArgumentTuple;
230 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6);
231 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6);
232};
233
234template <typename R, typename A1, typename A2, typename A3, typename A4,
235 typename A5, typename A6, typename A7>
236struct Function<R(A1, A2, A3, A4, A5, A6, A7)>
237 : Function<R(A1, A2, A3, A4, A5, A6)> {
238 typedef A7 Argument7;
239 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> ArgumentTuple;
241 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7);
242 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7);
243};
244
245template <typename R, typename A1, typename A2, typename A3, typename A4,
246 typename A5, typename A6, typename A7, typename A8>
247struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8)>
248 : Function<R(A1, A2, A3, A4, A5, A6, A7)> {
249 typedef A8 Argument8;
250 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> ArgumentTuple;
252 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8);
253 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8);
254};
255
256template <typename R, typename A1, typename A2, typename A3, typename A4,
257 typename A5, typename A6, typename A7, typename A8, typename A9>
258struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
259 : Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
260 typedef A9 Argument9;
261 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> ArgumentTuple;
263 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9);
264 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
265 A9);
266};
267
268template <typename R, typename A1, typename A2, typename A3, typename A4,
269 typename A5, typename A6, typename A7, typename A8, typename A9,
270 typename A10>
271struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
272 : Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
273 typedef A10 Argument10;
274 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
277 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
278 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
279 A9, A10);
280};
281
282} // namespace internal
283
284} // namespace testing
285
286#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
#define T(meth, val, expected)
MatcherTuple< ArgumentTuple >::type ArgumentMatcherTuple
::testing::tuple< A1, A2, A3, A4, A5, A6, A7, A8, A9 > ArgumentTuple
::testing::tuple< A1, A2, A3, A4, A5, A6, A7, A8, A9, A10 > ArgumentTuple
MatcherTuple< ArgumentTuple >::type ArgumentMatcherTuple
MatcherTuple< ArgumentTuple >::type ArgumentMatcherTuple
::testing::tuple< Matcher< A1 >, Matcher< A2 >, Matcher< A3 >, Matcher< A4 >, Matcher< A5 >, Matcher< A6 >, Matcher< A7 > > type
::testing::tuple< Matcher< A1 >, Matcher< A2 >, Matcher< A3 >, Matcher< A4 >, Matcher< A5 > > type
::testing::tuple< Matcher< A1 >, Matcher< A2 >, Matcher< A3 >, Matcher< A4 > > type
::testing::tuple< Matcher< A1 >, Matcher< A2 >, Matcher< A3 > > type
::testing::tuple< Matcher< A1 >, Matcher< A2 >, Matcher< A3 >, Matcher< A4 >, Matcher< A5 >, Matcher< A6 >, Matcher< A7 >, Matcher< A8 >, Matcher< A9 > > type
::testing::tuple< Matcher< A1 >, Matcher< A2 >, Matcher< A3 >, Matcher< A4 >, Matcher< A5 >, Matcher< A6 >, Matcher< A7 >, Matcher< A8 >, Matcher< A9 >, Matcher< A10 > > type
::testing::tuple< Matcher< A1 >, Matcher< A2 >, Matcher< A3 >, Matcher< A4 >, Matcher< A5 >, Matcher< A6 >, Matcher< A7 >, Matcher< A8 > > type
::testing::tuple< Matcher< A1 >, Matcher< A2 >, Matcher< A3 >, Matcher< A4 >, Matcher< A5 >, Matcher< A6 > > type
#define R