gmock-generated-matchers.h.pump revision 13481
12SN/A$$ -*- mode: c++; -*- 21762SN/A$$ This is a Pump source file. Please use Pump to convert it to 32SN/A$$ gmock-generated-actions.h. 42SN/A$$ 52SN/A$var n = 10 $$ The maximum arity we support. 62SN/A$$ }} This line fixes auto-indentation of the following code in Emacs. 72SN/A// Copyright 2008, Google Inc. 82SN/A// All rights reserved. 92SN/A// 102SN/A// Redistribution and use in source and binary forms, with or without 112SN/A// modification, are permitted provided that the following conditions are 122SN/A// met: 132SN/A// 142SN/A// * Redistributions of source code must retain the above copyright 152SN/A// notice, this list of conditions and the following disclaimer. 162SN/A// * Redistributions in binary form must reproduce the above 172SN/A// copyright notice, this list of conditions and the following disclaimer 182SN/A// in the documentation and/or other materials provided with the 192SN/A// distribution. 202SN/A// * Neither the name of Google Inc. nor the names of its 212SN/A// contributors may be used to endorse or promote products derived from 222SN/A// this software without specific prior written permission. 232SN/A// 242SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 252SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 262SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 272665Ssaidi@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 282665Ssaidi@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 292665Ssaidi@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 302SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 312SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 322SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 332SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 342SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 352SN/A 362SN/A// Google Mock - a framework for writing C++ mock classes. 372432SN/A// 381147SN/A// This file implements some commonly used variadic matchers. 392984Sgblack@eecs.umich.edu 402984Sgblack@eecs.umich.edu#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ 411147SN/A#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ 422517SN/A 432984Sgblack@eecs.umich.edu#include <iterator> 4456SN/A#include <sstream> 452SN/A#include <string> 462680Sktlim@umich.edu#include <vector> 472SN/A#include "gmock/gmock-matchers.h" 48674SN/A 492SN/Anamespace testing { 502SN/Anamespace internal { 512SN/A 522SN/A$range i 0..n-1 532SN/A 542SN/A// The type of the i-th (0-based) field of Tuple. 552SN/A#define GMOCK_FIELD_TYPE_(Tuple, i) \ 562SN/A typename ::testing::tuple_element<i, Tuple>::type 572SN/A 582SN/A// TupleFields<Tuple, k0, ..., kn> is for selecting fields from a 592SN/A// tuple of type Tuple. It has two members: 602SN/A// 612SN/A// type: a tuple type whose i-th field is the ki-th field of Tuple. 62674SN/A// GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple. 63674SN/A// 642SN/A// For example, in class TupleFields<tuple<bool, char, int>, 2, 0>, we have: 652SN/A// 662SN/A// type is tuple<int, bool>, and 67555SN/A// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true). 682SN/A 692SN/Atemplate <class Tuple$for i [[, int k$i = -1]]> 702SN/Aclass TupleFields; 712SN/A 722SN/A// This generic version is used when there are $n selectors. 732SN/Atemplate <class Tuple$for i [[, int k$i]]> 742SN/Aclass TupleFields { 752SN/A public: 762SN/A typedef ::testing::tuple<$for i, [[GMOCK_FIELD_TYPE_(Tuple, k$i)]]> type; 771147SN/A static type GetSelectedFields(const Tuple& t) { 781147SN/A return type($for i, [[get<k$i>(t)]]); 792SN/A } 802SN/A}; 812532SN/A 822SN/A// The following specialization is used for 0 ~ $(n-1) selectors. 832SN/A 84217SN/A$for i [[ 85237SN/A$$ }}} 862SN/A$range j 0..i-1 872SN/A$range k 0..n-1 88674SN/A 892SN/Atemplate <class Tuple$for j [[, int k$j]]> 902SN/Aclass TupleFields<Tuple, $for k, [[$if k < i [[k$k]] $else [[-1]]]]> { 91729SN/A public: 92729SN/A typedef ::testing::tuple<$for j, [[GMOCK_FIELD_TYPE_(Tuple, k$j)]]> type; 93729SN/A static type GetSelectedFields(const Tuple& $if i==0 [[/* t */]] $else [[t]]) { 94729SN/A return type($for j, [[get<k$j>(t)]]); 952SN/A } 962SN/A}; 97674SN/A 982SN/A]] 992SN/A 1002680Sktlim@umich.edu#undef GMOCK_FIELD_TYPE_ 1012SN/A 1022SN/A// Implements the Args() matcher. 103674SN/A 1042SN/A$var ks = [[$for i, [[k$i]]]] 1052SN/Atemplate <class ArgsTuple$for i [[, int k$i = -1]]> 106729SN/Aclass ArgsMatcherImpl : public MatcherInterface<ArgsTuple> { 107729SN/A public: 108729SN/A // ArgsTuple may have top-level const or reference modifiers. 109729SN/A typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple; 110729SN/A typedef typename internal::TupleFields<RawArgsTuple, $ks>::type SelectedArgs; 111729SN/A typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher; 112729SN/A 113729SN/A template <typename InnerMatcher> 114729SN/A explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher) 115729SN/A : inner_matcher_(SafeMatcherCast<const SelectedArgs&>(inner_matcher)) {} 116729SN/A 117729SN/A virtual bool MatchAndExplain(ArgsTuple args, 1182SN/A MatchResultListener* listener) const { 1192SN/A const SelectedArgs& selected_args = GetSelectedArgs(args); 120674SN/A if (!listener->IsInterested()) 1212SN/A return inner_matcher_.Matches(selected_args); 1222SN/A 1232680Sktlim@umich.edu PrintIndices(listener->stream()); 1242SN/A *listener << "are " << PrintToString(selected_args); 1252SN/A 1262SN/A StringMatchResultListener inner_listener; 127 const bool match = inner_matcher_.MatchAndExplain(selected_args, 128 &inner_listener); 129 PrintIfNotEmpty(inner_listener.str(), listener->stream()); 130 return match; 131 } 132 133 virtual void DescribeTo(::std::ostream* os) const { 134 *os << "are a tuple "; 135 PrintIndices(os); 136 inner_matcher_.DescribeTo(os); 137 } 138 139 virtual void DescribeNegationTo(::std::ostream* os) const { 140 *os << "are a tuple "; 141 PrintIndices(os); 142 inner_matcher_.DescribeNegationTo(os); 143 } 144 145 private: 146 static SelectedArgs GetSelectedArgs(ArgsTuple args) { 147 return TupleFields<RawArgsTuple, $ks>::GetSelectedFields(args); 148 } 149 150 // Prints the indices of the selected fields. 151 static void PrintIndices(::std::ostream* os) { 152 *os << "whose fields ("; 153 const int indices[$n] = { $ks }; 154 for (int i = 0; i < $n; i++) { 155 if (indices[i] < 0) 156 break; 157 158 if (i >= 1) 159 *os << ", "; 160 161 *os << "#" << indices[i]; 162 } 163 *os << ") "; 164 } 165 166 const MonomorphicInnerMatcher inner_matcher_; 167 168 GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl); 169}; 170 171template <class InnerMatcher$for i [[, int k$i = -1]]> 172class ArgsMatcher { 173 public: 174 explicit ArgsMatcher(const InnerMatcher& inner_matcher) 175 : inner_matcher_(inner_matcher) {} 176 177 template <typename ArgsTuple> 178 operator Matcher<ArgsTuple>() const { 179 return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, $ks>(inner_matcher_)); 180 } 181 182 private: 183 const InnerMatcher inner_matcher_; 184 185 GTEST_DISALLOW_ASSIGN_(ArgsMatcher); 186}; 187 188// A set of metafunctions for computing the result type of AllOf. 189// AllOf(m1, ..., mN) returns 190// AllOfResultN<decltype(m1), ..., decltype(mN)>::type. 191 192// Although AllOf isn't defined for one argument, AllOfResult1 is defined 193// to simplify the implementation. 194template <typename M1> 195struct AllOfResult1 { 196 typedef M1 type; 197}; 198 199$range i 1..n 200 201$range i 2..n 202$for i [[ 203$range j 2..i 204$var m = i/2 205$range k 1..m 206$range t m+1..i 207 208template <typename M1$for j [[, typename M$j]]> 209struct AllOfResult$i { 210 typedef BothOfMatcher< 211 typename AllOfResult$m<$for k, [[M$k]]>::type, 212 typename AllOfResult$(i-m)<$for t, [[M$t]]>::type 213 > type; 214}; 215 216]] 217 218// A set of metafunctions for computing the result type of AnyOf. 219// AnyOf(m1, ..., mN) returns 220// AnyOfResultN<decltype(m1), ..., decltype(mN)>::type. 221 222// Although AnyOf isn't defined for one argument, AnyOfResult1 is defined 223// to simplify the implementation. 224template <typename M1> 225struct AnyOfResult1 { 226 typedef M1 type; 227}; 228 229$range i 1..n 230 231$range i 2..n 232$for i [[ 233$range j 2..i 234$var m = i/2 235$range k 1..m 236$range t m+1..i 237 238template <typename M1$for j [[, typename M$j]]> 239struct AnyOfResult$i { 240 typedef EitherOfMatcher< 241 typename AnyOfResult$m<$for k, [[M$k]]>::type, 242 typename AnyOfResult$(i-m)<$for t, [[M$t]]>::type 243 > type; 244}; 245 246]] 247 248} // namespace internal 249 250// Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected 251// fields of it matches a_matcher. C++ doesn't support default 252// arguments for function templates, so we have to overload it. 253 254$range i 0..n 255$for i [[ 256$range j 1..i 257template <$for j [[int k$j, ]]typename InnerMatcher> 258inline internal::ArgsMatcher<InnerMatcher$for j [[, k$j]]> 259Args(const InnerMatcher& matcher) { 260 return internal::ArgsMatcher<InnerMatcher$for j [[, k$j]]>(matcher); 261} 262 263 264]] 265// ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with 266// n elements, where the i-th element in the container must 267// match the i-th argument in the list. Each argument of 268// ElementsAre() can be either a value or a matcher. We support up to 269// $n arguments. 270// 271// The use of DecayArray in the implementation allows ElementsAre() 272// to accept string literals, whose type is const char[N], but we 273// want to treat them as const char*. 274// 275// NOTE: Since ElementsAre() cares about the order of the elements, it 276// must not be used with containers whose elements's order is 277// undefined (e.g. hash_map). 278 279$range i 0..n 280$for i [[ 281 282$range j 1..i 283 284$if i>0 [[ 285 286template <$for j, [[typename T$j]]> 287]] 288 289inline internal::ElementsAreMatcher< 290 ::testing::tuple< 291$for j, [[ 292 293 typename internal::DecayArray<T$j[[]]>::type]]> > 294ElementsAre($for j, [[const T$j& e$j]]) { 295 typedef ::testing::tuple< 296$for j, [[ 297 298 typename internal::DecayArray<T$j[[]]>::type]]> Args; 299 return internal::ElementsAreMatcher<Args>(Args($for j, [[e$j]])); 300} 301 302]] 303 304// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension 305// that matches n elements in any order. We support up to n=$n arguments. 306 307$range i 0..n 308$for i [[ 309 310$range j 1..i 311 312$if i>0 [[ 313 314template <$for j, [[typename T$j]]> 315]] 316 317inline internal::UnorderedElementsAreMatcher< 318 ::testing::tuple< 319$for j, [[ 320 321 typename internal::DecayArray<T$j[[]]>::type]]> > 322UnorderedElementsAre($for j, [[const T$j& e$j]]) { 323 typedef ::testing::tuple< 324$for j, [[ 325 326 typename internal::DecayArray<T$j[[]]>::type]]> Args; 327 return internal::UnorderedElementsAreMatcher<Args>(Args($for j, [[e$j]])); 328} 329 330]] 331 332// AllOf(m1, m2, ..., mk) matches any value that matches all of the given 333// sub-matchers. AllOf is called fully qualified to prevent ADL from firing. 334 335$range i 2..n 336$for i [[ 337$range j 1..i 338$var m = i/2 339$range k 1..m 340$range t m+1..i 341 342template <$for j, [[typename M$j]]> 343inline typename internal::AllOfResult$i<$for j, [[M$j]]>::type 344AllOf($for j, [[M$j m$j]]) { 345 return typename internal::AllOfResult$i<$for j, [[M$j]]>::type( 346 $if m == 1 [[m1]] $else [[::testing::AllOf($for k, [[m$k]])]], 347 $if m+1 == i [[m$i]] $else [[::testing::AllOf($for t, [[m$t]])]]); 348} 349 350]] 351 352// AnyOf(m1, m2, ..., mk) matches any value that matches any of the given 353// sub-matchers. AnyOf is called fully qualified to prevent ADL from firing. 354 355$range i 2..n 356$for i [[ 357$range j 1..i 358$var m = i/2 359$range k 1..m 360$range t m+1..i 361 362template <$for j, [[typename M$j]]> 363inline typename internal::AnyOfResult$i<$for j, [[M$j]]>::type 364AnyOf($for j, [[M$j m$j]]) { 365 return typename internal::AnyOfResult$i<$for j, [[M$j]]>::type( 366 $if m == 1 [[m1]] $else [[::testing::AnyOf($for k, [[m$k]])]], 367 $if m+1 == i [[m$i]] $else [[::testing::AnyOf($for t, [[m$t]])]]); 368} 369 370]] 371 372} // namespace testing 373$$ } // This Pump meta comment fixes auto-indentation in Emacs. It will not 374$$ // show up in the generated code. 375 376 377// The MATCHER* family of macros can be used in a namespace scope to 378// define custom matchers easily. 379// 380// Basic Usage 381// =========== 382// 383// The syntax 384// 385// MATCHER(name, description_string) { statements; } 386// 387// defines a matcher with the given name that executes the statements, 388// which must return a bool to indicate if the match succeeds. Inside 389// the statements, you can refer to the value being matched by 'arg', 390// and refer to its type by 'arg_type'. 391// 392// The description string documents what the matcher does, and is used 393// to generate the failure message when the match fails. Since a 394// MATCHER() is usually defined in a header file shared by multiple 395// C++ source files, we require the description to be a C-string 396// literal to avoid possible side effects. It can be empty, in which 397// case we'll use the sequence of words in the matcher name as the 398// description. 399// 400// For example: 401// 402// MATCHER(IsEven, "") { return (arg % 2) == 0; } 403// 404// allows you to write 405// 406// // Expects mock_foo.Bar(n) to be called where n is even. 407// EXPECT_CALL(mock_foo, Bar(IsEven())); 408// 409// or, 410// 411// // Verifies that the value of some_expression is even. 412// EXPECT_THAT(some_expression, IsEven()); 413// 414// If the above assertion fails, it will print something like: 415// 416// Value of: some_expression 417// Expected: is even 418// Actual: 7 419// 420// where the description "is even" is automatically calculated from the 421// matcher name IsEven. 422// 423// Argument Type 424// ============= 425// 426// Note that the type of the value being matched (arg_type) is 427// determined by the context in which you use the matcher and is 428// supplied to you by the compiler, so you don't need to worry about 429// declaring it (nor can you). This allows the matcher to be 430// polymorphic. For example, IsEven() can be used to match any type 431// where the value of "(arg % 2) == 0" can be implicitly converted to 432// a bool. In the "Bar(IsEven())" example above, if method Bar() 433// takes an int, 'arg_type' will be int; if it takes an unsigned long, 434// 'arg_type' will be unsigned long; and so on. 435// 436// Parameterizing Matchers 437// ======================= 438// 439// Sometimes you'll want to parameterize the matcher. For that you 440// can use another macro: 441// 442// MATCHER_P(name, param_name, description_string) { statements; } 443// 444// For example: 445// 446// MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } 447// 448// will allow you to write: 449// 450// EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); 451// 452// which may lead to this message (assuming n is 10): 453// 454// Value of: Blah("a") 455// Expected: has absolute value 10 456// Actual: -9 457// 458// Note that both the matcher description and its parameter are 459// printed, making the message human-friendly. 460// 461// In the matcher definition body, you can write 'foo_type' to 462// reference the type of a parameter named 'foo'. For example, in the 463// body of MATCHER_P(HasAbsoluteValue, value) above, you can write 464// 'value_type' to refer to the type of 'value'. 465// 466// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P$n to 467// support multi-parameter matchers. 468// 469// Describing Parameterized Matchers 470// ================================= 471// 472// The last argument to MATCHER*() is a string-typed expression. The 473// expression can reference all of the matcher's parameters and a 474// special bool-typed variable named 'negation'. When 'negation' is 475// false, the expression should evaluate to the matcher's description; 476// otherwise it should evaluate to the description of the negation of 477// the matcher. For example, 478// 479// using testing::PrintToString; 480// 481// MATCHER_P2(InClosedRange, low, hi, 482// string(negation ? "is not" : "is") + " in range [" + 483// PrintToString(low) + ", " + PrintToString(hi) + "]") { 484// return low <= arg && arg <= hi; 485// } 486// ... 487// EXPECT_THAT(3, InClosedRange(4, 6)); 488// EXPECT_THAT(3, Not(InClosedRange(2, 4))); 489// 490// would generate two failures that contain the text: 491// 492// Expected: is in range [4, 6] 493// ... 494// Expected: is not in range [2, 4] 495// 496// If you specify "" as the description, the failure message will 497// contain the sequence of words in the matcher name followed by the 498// parameter values printed as a tuple. For example, 499// 500// MATCHER_P2(InClosedRange, low, hi, "") { ... } 501// ... 502// EXPECT_THAT(3, InClosedRange(4, 6)); 503// EXPECT_THAT(3, Not(InClosedRange(2, 4))); 504// 505// would generate two failures that contain the text: 506// 507// Expected: in closed range (4, 6) 508// ... 509// Expected: not (in closed range (2, 4)) 510// 511// Types of Matcher Parameters 512// =========================== 513// 514// For the purpose of typing, you can view 515// 516// MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } 517// 518// as shorthand for 519// 520// template <typename p1_type, ..., typename pk_type> 521// FooMatcherPk<p1_type, ..., pk_type> 522// Foo(p1_type p1, ..., pk_type pk) { ... } 523// 524// When you write Foo(v1, ..., vk), the compiler infers the types of 525// the parameters v1, ..., and vk for you. If you are not happy with 526// the result of the type inference, you can specify the types by 527// explicitly instantiating the template, as in Foo<long, bool>(5, 528// false). As said earlier, you don't get to (or need to) specify 529// 'arg_type' as that's determined by the context in which the matcher 530// is used. You can assign the result of expression Foo(p1, ..., pk) 531// to a variable of type FooMatcherPk<p1_type, ..., pk_type>. This 532// can be useful when composing matchers. 533// 534// While you can instantiate a matcher template with reference types, 535// passing the parameters by pointer usually makes your code more 536// readable. If, however, you still want to pass a parameter by 537// reference, be aware that in the failure message generated by the 538// matcher you will see the value of the referenced object but not its 539// address. 540// 541// Explaining Match Results 542// ======================== 543// 544// Sometimes the matcher description alone isn't enough to explain why 545// the match has failed or succeeded. For example, when expecting a 546// long string, it can be very helpful to also print the diff between 547// the expected string and the actual one. To achieve that, you can 548// optionally stream additional information to a special variable 549// named result_listener, whose type is a pointer to class 550// MatchResultListener: 551// 552// MATCHER_P(EqualsLongString, str, "") { 553// if (arg == str) return true; 554// 555// *result_listener << "the difference: " 556/// << DiffStrings(str, arg); 557// return false; 558// } 559// 560// Overloading Matchers 561// ==================== 562// 563// You can overload matchers with different numbers of parameters: 564// 565// MATCHER_P(Blah, a, description_string1) { ... } 566// MATCHER_P2(Blah, a, b, description_string2) { ... } 567// 568// Caveats 569// ======= 570// 571// When defining a new matcher, you should also consider implementing 572// MatcherInterface or using MakePolymorphicMatcher(). These 573// approaches require more work than the MATCHER* macros, but also 574// give you more control on the types of the value being matched and 575// the matcher parameters, which may leads to better compiler error 576// messages when the matcher is used wrong. They also allow 577// overloading matchers based on parameter types (as opposed to just 578// based on the number of parameters). 579// 580// MATCHER*() can only be used in a namespace scope. The reason is 581// that C++ doesn't yet allow function-local types to be used to 582// instantiate templates. The up-coming C++0x standard will fix this. 583// Once that's done, we'll consider supporting using MATCHER*() inside 584// a function. 585// 586// More Information 587// ================ 588// 589// To learn more about using these macros, please search for 'MATCHER' 590// on http://code.google.com/p/googlemock/wiki/CookBook. 591 592$range i 0..n 593$for i 594 595[[ 596$var macro_name = [[$if i==0 [[MATCHER]] $elif i==1 [[MATCHER_P]] 597 $else [[MATCHER_P$i]]]] 598$var class_name = [[name##Matcher[[$if i==0 [[]] $elif i==1 [[P]] 599 $else [[P$i]]]]]] 600$range j 0..i-1 601$var template = [[$if i==0 [[]] $else [[ 602 603 template <$for j, [[typename p$j##_type]]>\ 604]]]] 605$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] 606$var impl_ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] 607$var impl_inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] 608$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] 609$var params = [[$for j, [[p$j]]]] 610$var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]] 611$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] 612$var param_field_decls = [[$for j 613[[ 614 615 p$j##_type p$j;\ 616]]]] 617$var param_field_decls2 = [[$for j 618[[ 619 620 p$j##_type p$j;\ 621]]]] 622 623#define $macro_name(name$for j [[, p$j]], description)\$template 624 class $class_name {\ 625 public:\ 626 template <typename arg_type>\ 627 class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ 628 public:\ 629 [[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\ 630 $impl_inits {}\ 631 virtual bool MatchAndExplain(\ 632 arg_type arg, ::testing::MatchResultListener* result_listener) const;\ 633 virtual void DescribeTo(::std::ostream* gmock_os) const {\ 634 *gmock_os << FormatDescription(false);\ 635 }\ 636 virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ 637 *gmock_os << FormatDescription(true);\ 638 }\$param_field_decls 639 private:\ 640 ::testing::internal::string FormatDescription(bool negation) const {\ 641 const ::testing::internal::string gmock_description = (description);\ 642 if (!gmock_description.empty())\ 643 return gmock_description;\ 644 return ::testing::internal::FormatMatcherDescription(\ 645 negation, #name, \ 646 ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ 647 ::testing::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\ 648 }\ 649 GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ 650 };\ 651 template <typename arg_type>\ 652 operator ::testing::Matcher<arg_type>() const {\ 653 return ::testing::Matcher<arg_type>(\ 654 new gmock_Impl<arg_type>($params));\ 655 }\ 656 [[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {\ 657 }\$param_field_decls2 658 private:\ 659 GTEST_DISALLOW_ASSIGN_($class_name);\ 660 };\$template 661 inline $class_name$param_types name($param_types_and_names) {\ 662 return $class_name$param_types($params);\ 663 }\$template 664 template <typename arg_type>\ 665 bool $class_name$param_types::gmock_Impl<arg_type>::MatchAndExplain(\ 666 arg_type arg, \ 667 ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ 668 const 669]] 670 671 672#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ 673