00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
00042 #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
00043
00044 #include "gmock/internal/gmock-port.h"
00045
00046 namespace testing {
00047
00048 template <typename T>
00049 class Matcher;
00050
00051 namespace internal {
00052
00053
00054
00055 class IgnoredValue {
00056 public:
00057
00058
00059
00060
00061
00062 template <typename T>
00063 IgnoredValue(const T& ) {}
00064 };
00065
00066
00067
00068 template <typename Tuple>
00069 struct MatcherTuple;
00070
00071 template <>
00072 struct MatcherTuple< ::testing::tuple<> > {
00073 typedef ::testing::tuple< > type;
00074 };
00075
00076 template <typename A1>
00077 struct MatcherTuple< ::testing::tuple<A1> > {
00078 typedef ::testing::tuple<Matcher<A1> > type;
00079 };
00080
00081 template <typename A1, typename A2>
00082 struct MatcherTuple< ::testing::tuple<A1, A2> > {
00083 typedef ::testing::tuple<Matcher<A1>, Matcher<A2> > type;
00084 };
00085
00086 template <typename A1, typename A2, typename A3>
00087 struct MatcherTuple< ::testing::tuple<A1, A2, A3> > {
00088 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3> > type;
00089 };
00090
00091 template <typename A1, typename A2, typename A3, typename A4>
00092 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4> > {
00093 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>,
00094 Matcher<A4> > type;
00095 };
00096
00097 template <typename A1, typename A2, typename A3, typename A4, typename A5>
00098 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5> > {
00099 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
00100 Matcher<A5> > type;
00101 };
00102
00103 template <typename A1, typename A2, typename A3, typename A4, typename A5,
00104 typename A6>
00105 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
00106 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
00107 Matcher<A5>, Matcher<A6> > type;
00108 };
00109
00110 template <typename A1, typename A2, typename A3, typename A4, typename A5,
00111 typename A6, typename A7>
00112 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
00113 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
00114 Matcher<A5>, Matcher<A6>, Matcher<A7> > type;
00115 };
00116
00117 template <typename A1, typename A2, typename A3, typename A4, typename A5,
00118 typename A6, typename A7, typename A8>
00119 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
00120 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
00121 Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> > type;
00122 };
00123
00124 template <typename A1, typename A2, typename A3, typename A4, typename A5,
00125 typename A6, typename A7, typename A8, typename A9>
00126 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
00127 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
00128 Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9> > type;
00129 };
00130
00131 template <typename A1, typename A2, typename A3, typename A4, typename A5,
00132 typename A6, typename A7, typename A8, typename A9, typename A10>
00133 struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
00134 A10> > {
00135 typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
00136 Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9>,
00137 Matcher<A10> > type;
00138 };
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153 template <typename F>
00154 struct Function;
00155
00156 template <typename R>
00157 struct Function<R()> {
00158 typedef R Result;
00159 typedef ::testing::tuple<> ArgumentTuple;
00160 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
00161 typedef void MakeResultVoid();
00162 typedef IgnoredValue MakeResultIgnoredValue();
00163 };
00164
00165 template <typename R, typename A1>
00166 struct Function<R(A1)>
00167 : Function<R()> {
00168 typedef A1 Argument1;
00169 typedef ::testing::tuple<A1> ArgumentTuple;
00170 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
00171 typedef void MakeResultVoid(A1);
00172 typedef IgnoredValue MakeResultIgnoredValue(A1);
00173 };
00174
00175 template <typename R, typename A1, typename A2>
00176 struct Function<R(A1, A2)>
00177 : Function<R(A1)> {
00178 typedef A2 Argument2;
00179 typedef ::testing::tuple<A1, A2> ArgumentTuple;
00180 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
00181 typedef void MakeResultVoid(A1, A2);
00182 typedef IgnoredValue MakeResultIgnoredValue(A1, A2);
00183 };
00184
00185 template <typename R, typename A1, typename A2, typename A3>
00186 struct Function<R(A1, A2, A3)>
00187 : Function<R(A1, A2)> {
00188 typedef A3 Argument3;
00189 typedef ::testing::tuple<A1, A2, A3> ArgumentTuple;
00190 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
00191 typedef void MakeResultVoid(A1, A2, A3);
00192 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3);
00193 };
00194
00195 template <typename R, typename A1, typename A2, typename A3, typename A4>
00196 struct Function<R(A1, A2, A3, A4)>
00197 : Function<R(A1, A2, A3)> {
00198 typedef A4 Argument4;
00199 typedef ::testing::tuple<A1, A2, A3, A4> ArgumentTuple;
00200 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
00201 typedef void MakeResultVoid(A1, A2, A3, A4);
00202 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4);
00203 };
00204
00205 template <typename R, typename A1, typename A2, typename A3, typename A4,
00206 typename A5>
00207 struct Function<R(A1, A2, A3, A4, A5)>
00208 : Function<R(A1, A2, A3, A4)> {
00209 typedef A5 Argument5;
00210 typedef ::testing::tuple<A1, A2, A3, A4, A5> ArgumentTuple;
00211 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
00212 typedef void MakeResultVoid(A1, A2, A3, A4, A5);
00213 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5);
00214 };
00215
00216 template <typename R, typename A1, typename A2, typename A3, typename A4,
00217 typename A5, typename A6>
00218 struct Function<R(A1, A2, A3, A4, A5, A6)>
00219 : Function<R(A1, A2, A3, A4, A5)> {
00220 typedef A6 Argument6;
00221 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6> ArgumentTuple;
00222 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
00223 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6);
00224 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6);
00225 };
00226
00227 template <typename R, typename A1, typename A2, typename A3, typename A4,
00228 typename A5, typename A6, typename A7>
00229 struct Function<R(A1, A2, A3, A4, A5, A6, A7)>
00230 : Function<R(A1, A2, A3, A4, A5, A6)> {
00231 typedef A7 Argument7;
00232 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> ArgumentTuple;
00233 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
00234 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7);
00235 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7);
00236 };
00237
00238 template <typename R, typename A1, typename A2, typename A3, typename A4,
00239 typename A5, typename A6, typename A7, typename A8>
00240 struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8)>
00241 : Function<R(A1, A2, A3, A4, A5, A6, A7)> {
00242 typedef A8 Argument8;
00243 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> ArgumentTuple;
00244 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
00245 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8);
00246 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8);
00247 };
00248
00249 template <typename R, typename A1, typename A2, typename A3, typename A4,
00250 typename A5, typename A6, typename A7, typename A8, typename A9>
00251 struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
00252 : Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
00253 typedef A9 Argument9;
00254 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> ArgumentTuple;
00255 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
00256 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9);
00257 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
00258 A9);
00259 };
00260
00261 template <typename R, typename A1, typename A2, typename A3, typename A4,
00262 typename A5, typename A6, typename A7, typename A8, typename A9,
00263 typename A10>
00264 struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
00265 : Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
00266 typedef A10 Argument10;
00267 typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
00268 A10> ArgumentTuple;
00269 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
00270 typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
00271 typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
00272 A9, A10);
00273 };
00274
00275 }
00276
00277 }
00278
00279 #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_