Warning, /JETSCAPE/external_packages/googletest/googlemock/include/gmock/gmock-generated-matchers.h.pump is written in an unsupported language. File is not indexed.
0001 $$ -*- mode: c++; -*-
0002 $$ This is a Pump source file. Please use Pump to convert it to
0003 $$ gmock-generated-actions.h.
0004 $$
0005 $var n = 10 $$ The maximum arity we support.
0006 $$ }} This line fixes auto-indentation of the following code in Emacs.
0007 // Copyright 2008, Google Inc.
0008 // All rights reserved.
0009 //
0010 // Redistribution and use in source and binary forms, with or without
0011 // modification, are permitted provided that the following conditions are
0012 // met:
0013 //
0014 // * Redistributions of source code must retain the above copyright
0015 // notice, this list of conditions and the following disclaimer.
0016 // * Redistributions in binary form must reproduce the above
0017 // copyright notice, this list of conditions and the following disclaimer
0018 // in the documentation and/or other materials provided with the
0019 // distribution.
0020 // * Neither the name of Google Inc. nor the names of its
0021 // contributors may be used to endorse or promote products derived from
0022 // this software without specific prior written permission.
0023 //
0024 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0025 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0026 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0027 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0028 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0029 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0030 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0031 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0032 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0033 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0034 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0035
0036 // Google Mock - a framework for writing C++ mock classes.
0037 //
0038 // This file implements some commonly used variadic matchers.
0039
0040 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
0041 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
0042
0043 #include <iterator>
0044 #include <sstream>
0045 #include <string>
0046 #include <vector>
0047 #include "gmock/gmock-matchers.h"
0048
0049 namespace testing {
0050 namespace internal {
0051
0052 $range i 0..n-1
0053
0054 // The type of the i-th (0-based) field of Tuple.
0055 #define GMOCK_FIELD_TYPE_(Tuple, i) \
0056 typename ::testing::tuple_element<i, Tuple>::type
0057
0058 // TupleFields<Tuple, k0, ..., kn> is for selecting fields from a
0059 // tuple of type Tuple. It has two members:
0060 //
0061 // type: a tuple type whose i-th field is the ki-th field of Tuple.
0062 // GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple.
0063 //
0064 // For example, in class TupleFields<tuple<bool, char, int>, 2, 0>, we have:
0065 //
0066 // type is tuple<int, bool>, and
0067 // GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true).
0068
0069 template <class Tuple$for i [[, int k$i = -1]]>
0070 class TupleFields;
0071
0072 // This generic version is used when there are $n selectors.
0073 template <class Tuple$for i [[, int k$i]]>
0074 class TupleFields {
0075 public:
0076 typedef ::testing::tuple<$for i, [[GMOCK_FIELD_TYPE_(Tuple, k$i)]]> type;
0077 static type GetSelectedFields(const Tuple& t) {
0078 return type($for i, [[get<k$i>(t)]]);
0079 }
0080 };
0081
0082 // The following specialization is used for 0 ~ $(n-1) selectors.
0083
0084 $for i [[
0085 $$ }}}
0086 $range j 0..i-1
0087 $range k 0..n-1
0088
0089 template <class Tuple$for j [[, int k$j]]>
0090 class TupleFields<Tuple, $for k, [[$if k < i [[k$k]] $else [[-1]]]]> {
0091 public:
0092 typedef ::testing::tuple<$for j, [[GMOCK_FIELD_TYPE_(Tuple, k$j)]]> type;
0093 static type GetSelectedFields(const Tuple& $if i==0 [[/* t */]] $else [[t]]) {
0094 return type($for j, [[get<k$j>(t)]]);
0095 }
0096 };
0097
0098 ]]
0099
0100 #undef GMOCK_FIELD_TYPE_
0101
0102 // Implements the Args() matcher.
0103
0104 $var ks = [[$for i, [[k$i]]]]
0105 template <class ArgsTuple$for i [[, int k$i = -1]]>
0106 class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
0107 public:
0108 // ArgsTuple may have top-level const or reference modifiers.
0109 typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple;
0110 typedef typename internal::TupleFields<RawArgsTuple, $ks>::type SelectedArgs;
0111 typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher;
0112
0113 template <typename InnerMatcher>
0114 explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher)
0115 : inner_matcher_(SafeMatcherCast<const SelectedArgs&>(inner_matcher)) {}
0116
0117 virtual bool MatchAndExplain(ArgsTuple args,
0118 MatchResultListener* listener) const {
0119 const SelectedArgs& selected_args = GetSelectedArgs(args);
0120 if (!listener->IsInterested())
0121 return inner_matcher_.Matches(selected_args);
0122
0123 PrintIndices(listener->stream());
0124 *listener << "are " << PrintToString(selected_args);
0125
0126 StringMatchResultListener inner_listener;
0127 const bool match = inner_matcher_.MatchAndExplain(selected_args,
0128 &inner_listener);
0129 PrintIfNotEmpty(inner_listener.str(), listener->stream());
0130 return match;
0131 }
0132
0133 virtual void DescribeTo(::std::ostream* os) const {
0134 *os << "are a tuple ";
0135 PrintIndices(os);
0136 inner_matcher_.DescribeTo(os);
0137 }
0138
0139 virtual void DescribeNegationTo(::std::ostream* os) const {
0140 *os << "are a tuple ";
0141 PrintIndices(os);
0142 inner_matcher_.DescribeNegationTo(os);
0143 }
0144
0145 private:
0146 static SelectedArgs GetSelectedArgs(ArgsTuple args) {
0147 return TupleFields<RawArgsTuple, $ks>::GetSelectedFields(args);
0148 }
0149
0150 // Prints the indices of the selected fields.
0151 static void PrintIndices(::std::ostream* os) {
0152 *os << "whose fields (";
0153 const int indices[$n] = { $ks };
0154 for (int i = 0; i < $n; i++) {
0155 if (indices[i] < 0)
0156 break;
0157
0158 if (i >= 1)
0159 *os << ", ";
0160
0161 *os << "#" << indices[i];
0162 }
0163 *os << ") ";
0164 }
0165
0166 const MonomorphicInnerMatcher inner_matcher_;
0167
0168 GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl);
0169 };
0170
0171 template <class InnerMatcher$for i [[, int k$i = -1]]>
0172 class ArgsMatcher {
0173 public:
0174 explicit ArgsMatcher(const InnerMatcher& inner_matcher)
0175 : inner_matcher_(inner_matcher) {}
0176
0177 template <typename ArgsTuple>
0178 operator Matcher<ArgsTuple>() const {
0179 return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, $ks>(inner_matcher_));
0180 }
0181
0182 private:
0183 const InnerMatcher inner_matcher_;
0184
0185 GTEST_DISALLOW_ASSIGN_(ArgsMatcher);
0186 };
0187
0188 // A set of metafunctions for computing the result type of AllOf.
0189 // AllOf(m1, ..., mN) returns
0190 // AllOfResultN<decltype(m1), ..., decltype(mN)>::type.
0191
0192 // Although AllOf isn't defined for one argument, AllOfResult1 is defined
0193 // to simplify the implementation.
0194 template <typename M1>
0195 struct AllOfResult1 {
0196 typedef M1 type;
0197 };
0198
0199 $range i 1..n
0200
0201 $range i 2..n
0202 $for i [[
0203 $range j 2..i
0204 $var m = i/2
0205 $range k 1..m
0206 $range t m+1..i
0207
0208 template <typename M1$for j [[, typename M$j]]>
0209 struct AllOfResult$i {
0210 typedef BothOfMatcher<
0211 typename AllOfResult$m<$for k, [[M$k]]>::type,
0212 typename AllOfResult$(i-m)<$for t, [[M$t]]>::type
0213 > type;
0214 };
0215
0216 ]]
0217
0218 // A set of metafunctions for computing the result type of AnyOf.
0219 // AnyOf(m1, ..., mN) returns
0220 // AnyOfResultN<decltype(m1), ..., decltype(mN)>::type.
0221
0222 // Although AnyOf isn't defined for one argument, AnyOfResult1 is defined
0223 // to simplify the implementation.
0224 template <typename M1>
0225 struct AnyOfResult1 {
0226 typedef M1 type;
0227 };
0228
0229 $range i 1..n
0230
0231 $range i 2..n
0232 $for i [[
0233 $range j 2..i
0234 $var m = i/2
0235 $range k 1..m
0236 $range t m+1..i
0237
0238 template <typename M1$for j [[, typename M$j]]>
0239 struct AnyOfResult$i {
0240 typedef EitherOfMatcher<
0241 typename AnyOfResult$m<$for k, [[M$k]]>::type,
0242 typename AnyOfResult$(i-m)<$for t, [[M$t]]>::type
0243 > type;
0244 };
0245
0246 ]]
0247
0248 } // namespace internal
0249
0250 // Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected
0251 // fields of it matches a_matcher. C++ doesn't support default
0252 // arguments for function templates, so we have to overload it.
0253
0254 $range i 0..n
0255 $for i [[
0256 $range j 1..i
0257 template <$for j [[int k$j, ]]typename InnerMatcher>
0258 inline internal::ArgsMatcher<InnerMatcher$for j [[, k$j]]>
0259 Args(const InnerMatcher& matcher) {
0260 return internal::ArgsMatcher<InnerMatcher$for j [[, k$j]]>(matcher);
0261 }
0262
0263
0264 ]]
0265 // ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with
0266 // n elements, where the i-th element in the container must
0267 // match the i-th argument in the list. Each argument of
0268 // ElementsAre() can be either a value or a matcher. We support up to
0269 // $n arguments.
0270 //
0271 // The use of DecayArray in the implementation allows ElementsAre()
0272 // to accept string literals, whose type is const char[N], but we
0273 // want to treat them as const char*.
0274 //
0275 // NOTE: Since ElementsAre() cares about the order of the elements, it
0276 // must not be used with containers whose elements's order is
0277 // undefined (e.g. hash_map).
0278
0279 $range i 0..n
0280 $for i [[
0281
0282 $range j 1..i
0283
0284 $if i>0 [[
0285
0286 template <$for j, [[typename T$j]]>
0287 ]]
0288
0289 inline internal::ElementsAreMatcher<
0290 ::testing::tuple<
0291 $for j, [[
0292
0293 typename internal::DecayArray<T$j[[]]>::type]]> >
0294 ElementsAre($for j, [[const T$j& e$j]]) {
0295 typedef ::testing::tuple<
0296 $for j, [[
0297
0298 typename internal::DecayArray<T$j[[]]>::type]]> Args;
0299 return internal::ElementsAreMatcher<Args>(Args($for j, [[e$j]]));
0300 }
0301
0302 ]]
0303
0304 // UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension
0305 // that matches n elements in any order. We support up to n=$n arguments.
0306
0307 $range i 0..n
0308 $for i [[
0309
0310 $range j 1..i
0311
0312 $if i>0 [[
0313
0314 template <$for j, [[typename T$j]]>
0315 ]]
0316
0317 inline internal::UnorderedElementsAreMatcher<
0318 ::testing::tuple<
0319 $for j, [[
0320
0321 typename internal::DecayArray<T$j[[]]>::type]]> >
0322 UnorderedElementsAre($for j, [[const T$j& e$j]]) {
0323 typedef ::testing::tuple<
0324 $for j, [[
0325
0326 typename internal::DecayArray<T$j[[]]>::type]]> Args;
0327 return internal::UnorderedElementsAreMatcher<Args>(Args($for j, [[e$j]]));
0328 }
0329
0330 ]]
0331
0332 // AllOf(m1, m2, ..., mk) matches any value that matches all of the given
0333 // sub-matchers. AllOf is called fully qualified to prevent ADL from firing.
0334
0335 $range i 2..n
0336 $for i [[
0337 $range j 1..i
0338 $var m = i/2
0339 $range k 1..m
0340 $range t m+1..i
0341
0342 template <$for j, [[typename M$j]]>
0343 inline typename internal::AllOfResult$i<$for j, [[M$j]]>::type
0344 AllOf($for j, [[M$j m$j]]) {
0345 return typename internal::AllOfResult$i<$for j, [[M$j]]>::type(
0346 $if m == 1 [[m1]] $else [[::testing::AllOf($for k, [[m$k]])]],
0347 $if m+1 == i [[m$i]] $else [[::testing::AllOf($for t, [[m$t]])]]);
0348 }
0349
0350 ]]
0351
0352 // AnyOf(m1, m2, ..., mk) matches any value that matches any of the given
0353 // sub-matchers. AnyOf is called fully qualified to prevent ADL from firing.
0354
0355 $range i 2..n
0356 $for i [[
0357 $range j 1..i
0358 $var m = i/2
0359 $range k 1..m
0360 $range t m+1..i
0361
0362 template <$for j, [[typename M$j]]>
0363 inline typename internal::AnyOfResult$i<$for j, [[M$j]]>::type
0364 AnyOf($for j, [[M$j m$j]]) {
0365 return typename internal::AnyOfResult$i<$for j, [[M$j]]>::type(
0366 $if m == 1 [[m1]] $else [[::testing::AnyOf($for k, [[m$k]])]],
0367 $if m+1 == i [[m$i]] $else [[::testing::AnyOf($for t, [[m$t]])]]);
0368 }
0369
0370 ]]
0371
0372 } // namespace testing
0373 $$ } // This Pump meta comment fixes auto-indentation in Emacs. It will not
0374 $$ // show up in the generated code.
0375
0376
0377 // The MATCHER* family of macros can be used in a namespace scope to
0378 // define custom matchers easily.
0379 //
0380 // Basic Usage
0381 // ===========
0382 //
0383 // The syntax
0384 //
0385 // MATCHER(name, description_string) { statements; }
0386 //
0387 // defines a matcher with the given name that executes the statements,
0388 // which must return a bool to indicate if the match succeeds. Inside
0389 // the statements, you can refer to the value being matched by 'arg',
0390 // and refer to its type by 'arg_type'.
0391 //
0392 // The description string documents what the matcher does, and is used
0393 // to generate the failure message when the match fails. Since a
0394 // MATCHER() is usually defined in a header file shared by multiple
0395 // C++ source files, we require the description to be a C-string
0396 // literal to avoid possible side effects. It can be empty, in which
0397 // case we'll use the sequence of words in the matcher name as the
0398 // description.
0399 //
0400 // For example:
0401 //
0402 // MATCHER(IsEven, "") { return (arg % 2) == 0; }
0403 //
0404 // allows you to write
0405 //
0406 // // Expects mock_foo.Bar(n) to be called where n is even.
0407 // EXPECT_CALL(mock_foo, Bar(IsEven()));
0408 //
0409 // or,
0410 //
0411 // // Verifies that the value of some_expression is even.
0412 // EXPECT_THAT(some_expression, IsEven());
0413 //
0414 // If the above assertion fails, it will print something like:
0415 //
0416 // Value of: some_expression
0417 // Expected: is even
0418 // Actual: 7
0419 //
0420 // where the description "is even" is automatically calculated from the
0421 // matcher name IsEven.
0422 //
0423 // Argument Type
0424 // =============
0425 //
0426 // Note that the type of the value being matched (arg_type) is
0427 // determined by the context in which you use the matcher and is
0428 // supplied to you by the compiler, so you don't need to worry about
0429 // declaring it (nor can you). This allows the matcher to be
0430 // polymorphic. For example, IsEven() can be used to match any type
0431 // where the value of "(arg % 2) == 0" can be implicitly converted to
0432 // a bool. In the "Bar(IsEven())" example above, if method Bar()
0433 // takes an int, 'arg_type' will be int; if it takes an unsigned long,
0434 // 'arg_type' will be unsigned long; and so on.
0435 //
0436 // Parameterizing Matchers
0437 // =======================
0438 //
0439 // Sometimes you'll want to parameterize the matcher. For that you
0440 // can use another macro:
0441 //
0442 // MATCHER_P(name, param_name, description_string) { statements; }
0443 //
0444 // For example:
0445 //
0446 // MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; }
0447 //
0448 // will allow you to write:
0449 //
0450 // EXPECT_THAT(Blah("a"), HasAbsoluteValue(n));
0451 //
0452 // which may lead to this message (assuming n is 10):
0453 //
0454 // Value of: Blah("a")
0455 // Expected: has absolute value 10
0456 // Actual: -9
0457 //
0458 // Note that both the matcher description and its parameter are
0459 // printed, making the message human-friendly.
0460 //
0461 // In the matcher definition body, you can write 'foo_type' to
0462 // reference the type of a parameter named 'foo'. For example, in the
0463 // body of MATCHER_P(HasAbsoluteValue, value) above, you can write
0464 // 'value_type' to refer to the type of 'value'.
0465 //
0466 // We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P$n to
0467 // support multi-parameter matchers.
0468 //
0469 // Describing Parameterized Matchers
0470 // =================================
0471 //
0472 // The last argument to MATCHER*() is a string-typed expression. The
0473 // expression can reference all of the matcher's parameters and a
0474 // special bool-typed variable named 'negation'. When 'negation' is
0475 // false, the expression should evaluate to the matcher's description;
0476 // otherwise it should evaluate to the description of the negation of
0477 // the matcher. For example,
0478 //
0479 // using testing::PrintToString;
0480 //
0481 // MATCHER_P2(InClosedRange, low, hi,
0482 // string(negation ? "is not" : "is") + " in range [" +
0483 // PrintToString(low) + ", " + PrintToString(hi) + "]") {
0484 // return low <= arg && arg <= hi;
0485 // }
0486 // ...
0487 // EXPECT_THAT(3, InClosedRange(4, 6));
0488 // EXPECT_THAT(3, Not(InClosedRange(2, 4)));
0489 //
0490 // would generate two failures that contain the text:
0491 //
0492 // Expected: is in range [4, 6]
0493 // ...
0494 // Expected: is not in range [2, 4]
0495 //
0496 // If you specify "" as the description, the failure message will
0497 // contain the sequence of words in the matcher name followed by the
0498 // parameter values printed as a tuple. For example,
0499 //
0500 // MATCHER_P2(InClosedRange, low, hi, "") { ... }
0501 // ...
0502 // EXPECT_THAT(3, InClosedRange(4, 6));
0503 // EXPECT_THAT(3, Not(InClosedRange(2, 4)));
0504 //
0505 // would generate two failures that contain the text:
0506 //
0507 // Expected: in closed range (4, 6)
0508 // ...
0509 // Expected: not (in closed range (2, 4))
0510 //
0511 // Types of Matcher Parameters
0512 // ===========================
0513 //
0514 // For the purpose of typing, you can view
0515 //
0516 // MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... }
0517 //
0518 // as shorthand for
0519 //
0520 // template <typename p1_type, ..., typename pk_type>
0521 // FooMatcherPk<p1_type, ..., pk_type>
0522 // Foo(p1_type p1, ..., pk_type pk) { ... }
0523 //
0524 // When you write Foo(v1, ..., vk), the compiler infers the types of
0525 // the parameters v1, ..., and vk for you. If you are not happy with
0526 // the result of the type inference, you can specify the types by
0527 // explicitly instantiating the template, as in Foo<long, bool>(5,
0528 // false). As said earlier, you don't get to (or need to) specify
0529 // 'arg_type' as that's determined by the context in which the matcher
0530 // is used. You can assign the result of expression Foo(p1, ..., pk)
0531 // to a variable of type FooMatcherPk<p1_type, ..., pk_type>. This
0532 // can be useful when composing matchers.
0533 //
0534 // While you can instantiate a matcher template with reference types,
0535 // passing the parameters by pointer usually makes your code more
0536 // readable. If, however, you still want to pass a parameter by
0537 // reference, be aware that in the failure message generated by the
0538 // matcher you will see the value of the referenced object but not its
0539 // address.
0540 //
0541 // Explaining Match Results
0542 // ========================
0543 //
0544 // Sometimes the matcher description alone isn't enough to explain why
0545 // the match has failed or succeeded. For example, when expecting a
0546 // long string, it can be very helpful to also print the diff between
0547 // the expected string and the actual one. To achieve that, you can
0548 // optionally stream additional information to a special variable
0549 // named result_listener, whose type is a pointer to class
0550 // MatchResultListener:
0551 //
0552 // MATCHER_P(EqualsLongString, str, "") {
0553 // if (arg == str) return true;
0554 //
0555 // *result_listener << "the difference: "
0556 /// << DiffStrings(str, arg);
0557 // return false;
0558 // }
0559 //
0560 // Overloading Matchers
0561 // ====================
0562 //
0563 // You can overload matchers with different numbers of parameters:
0564 //
0565 // MATCHER_P(Blah, a, description_string1) { ... }
0566 // MATCHER_P2(Blah, a, b, description_string2) { ... }
0567 //
0568 // Caveats
0569 // =======
0570 //
0571 // When defining a new matcher, you should also consider implementing
0572 // MatcherInterface or using MakePolymorphicMatcher(). These
0573 // approaches require more work than the MATCHER* macros, but also
0574 // give you more control on the types of the value being matched and
0575 // the matcher parameters, which may leads to better compiler error
0576 // messages when the matcher is used wrong. They also allow
0577 // overloading matchers based on parameter types (as opposed to just
0578 // based on the number of parameters).
0579 //
0580 // MATCHER*() can only be used in a namespace scope. The reason is
0581 // that C++ doesn't yet allow function-local types to be used to
0582 // instantiate templates. The up-coming C++0x standard will fix this.
0583 // Once that's done, we'll consider supporting using MATCHER*() inside
0584 // a function.
0585 //
0586 // More Information
0587 // ================
0588 //
0589 // To learn more about using these macros, please search for 'MATCHER'
0590 // on http://code.google.com/p/googlemock/wiki/CookBook.
0591
0592 $range i 0..n
0593 $for i
0594
0595 [[
0596 $var macro_name = [[$if i==0 [[MATCHER]] $elif i==1 [[MATCHER_P]]
0597 $else [[MATCHER_P$i]]]]
0598 $var class_name = [[name##Matcher[[$if i==0 [[]] $elif i==1 [[P]]
0599 $else [[P$i]]]]]]
0600 $range j 0..i-1
0601 $var template = [[$if i==0 [[]] $else [[
0602
0603 template <$for j, [[typename p$j##_type]]>\
0604 ]]]]
0605 $var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
0606 $var impl_ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
0607 $var impl_inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]]
0608 $var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]]
0609 $var params = [[$for j, [[p$j]]]]
0610 $var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]]
0611 $var param_types_and_names = [[$for j, [[p$j##_type p$j]]]]
0612 $var param_field_decls = [[$for j
0613 [[
0614
0615 p$j##_type p$j;\
0616 ]]]]
0617 $var param_field_decls2 = [[$for j
0618 [[
0619
0620 p$j##_type p$j;\
0621 ]]]]
0622
0623 #define $macro_name(name$for j [[, p$j]], description)\$template
0624 class $class_name {\
0625 public:\
0626 template <typename arg_type>\
0627 class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
0628 public:\
0629 [[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\
0630 $impl_inits {}\
0631 virtual bool MatchAndExplain(\
0632 arg_type arg, ::testing::MatchResultListener* result_listener) const;\
0633 virtual void DescribeTo(::std::ostream* gmock_os) const {\
0634 *gmock_os << FormatDescription(false);\
0635 }\
0636 virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
0637 *gmock_os << FormatDescription(true);\
0638 }\$param_field_decls
0639 private:\
0640 ::testing::internal::string FormatDescription(bool negation) const {\
0641 const ::testing::internal::string gmock_description = (description);\
0642 if (!gmock_description.empty())\
0643 return gmock_description;\
0644 return ::testing::internal::FormatMatcherDescription(\
0645 negation, #name, \
0646 ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
0647 ::testing::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\
0648 }\
0649 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
0650 };\
0651 template <typename arg_type>\
0652 operator ::testing::Matcher<arg_type>() const {\
0653 return ::testing::Matcher<arg_type>(\
0654 new gmock_Impl<arg_type>($params));\
0655 }\
0656 [[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {\
0657 }\$param_field_decls2
0658 private:\
0659 GTEST_DISALLOW_ASSIGN_($class_name);\
0660 };\$template
0661 inline $class_name$param_types name($param_types_and_names) {\
0662 return $class_name$param_types($params);\
0663 }\$template
0664 template <typename arg_type>\
0665 bool $class_name$param_types::gmock_Impl<arg_type>::MatchAndExplain(\
0666 arg_type arg, \
0667 ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
0668 const
0669 ]]
0670
0671
0672 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_