Electroneum
testing::internal::PairMatcherImpl< PairType > Class Template Reference

#include <gmock-matchers.h>

Inheritance diagram for testing::internal::PairMatcherImpl< PairType >:
Collaboration diagram for testing::internal::PairMatcherImpl< PairType >:

Public Types

typedef RawPairType::first_type FirstType
 
typedef RawPairType::second_type SecondType
 

Public Member Functions

typedef GTEST_REMOVE_REFERENCE_AND_CONST_ (PairType) RawPairType
 
template<typename FirstMatcher , typename SecondMatcher >
 PairMatcherImpl (FirstMatcher first_matcher, SecondMatcher second_matcher)
 
virtual void DescribeTo (::std::ostream *os) const
 
virtual void DescribeNegationTo (::std::ostream *os) const
 
virtual bool MatchAndExplain (PairType a_pair, MatchResultListener *listener) const
 
- Public Member Functions inherited from testing::MatcherDescriberInterface
virtual ~MatcherDescriberInterface ()
 

Detailed Description

template<typename PairType>
class testing::internal::PairMatcherImpl< PairType >

Definition at line 3001 of file gmock-matchers.h.

Member Typedef Documentation

◆ FirstType

template<typename PairType >
typedef RawPairType::first_type testing::internal::PairMatcherImpl< PairType >::FirstType

Definition at line 3004 of file gmock-matchers.h.

◆ SecondType

template<typename PairType >
typedef RawPairType::second_type testing::internal::PairMatcherImpl< PairType >::SecondType

Definition at line 3005 of file gmock-matchers.h.

Constructor & Destructor Documentation

◆ PairMatcherImpl()

template<typename PairType >
template<typename FirstMatcher , typename SecondMatcher >
testing::internal::PairMatcherImpl< PairType >::PairMatcherImpl ( FirstMatcher  first_matcher,
SecondMatcher  second_matcher 
)
inline

Definition at line 3008 of file gmock-matchers.h.

3009  : first_matcher_(
3010  testing::SafeMatcherCast<const FirstType&>(first_matcher)),
3011  second_matcher_(
3012  testing::SafeMatcherCast<const SecondType&>(second_matcher)) {
3013  }

Member Function Documentation

◆ DescribeNegationTo()

template<typename PairType >
virtual void testing::internal::PairMatcherImpl< PairType >::DescribeNegationTo ( ::std::ostream *  os) const
inlinevirtual

Reimplemented from testing::MatcherDescriberInterface.

Definition at line 3024 of file gmock-matchers.h.

3024  {
3025  *os << "has a first field that ";
3026  first_matcher_.DescribeNegationTo(os);
3027  *os << ", or has a second field that ";
3028  second_matcher_.DescribeNegationTo(os);
3029  }
void DescribeNegationTo(::std::ostream *os) const
Here is the call graph for this function:

◆ DescribeTo()

template<typename PairType >
virtual void testing::internal::PairMatcherImpl< PairType >::DescribeTo ( ::std::ostream *  os) const
inlinevirtual

Implements testing::MatcherDescriberInterface.

Definition at line 3016 of file gmock-matchers.h.

3016  {
3017  *os << "has a first field that ";
3018  first_matcher_.DescribeTo(os);
3019  *os << ", and has a second field that ";
3020  second_matcher_.DescribeTo(os);
3021  }
void DescribeTo(::std::ostream *os) const
Here is the call graph for this function:

◆ GTEST_REMOVE_REFERENCE_AND_CONST_()

template<typename PairType >
typedef testing::internal::PairMatcherImpl< PairType >::GTEST_REMOVE_REFERENCE_AND_CONST_ ( PairType  )

◆ MatchAndExplain()

template<typename PairType >
virtual bool testing::internal::PairMatcherImpl< PairType >::MatchAndExplain ( PairType  a_pair,
MatchResultListener listener 
) const
inlinevirtual

Implements testing::MatcherInterface< PairType >.

Definition at line 3033 of file gmock-matchers.h.

3034  {
3035  if (!listener->IsInterested()) {
3036  // If the listener is not interested, we don't need to construct the
3037  // explanation.
3038  return first_matcher_.Matches(a_pair.first) &&
3039  second_matcher_.Matches(a_pair.second);
3040  }
3041  StringMatchResultListener first_inner_listener;
3042  if (!first_matcher_.MatchAndExplain(a_pair.first,
3043  &first_inner_listener)) {
3044  *listener << "whose first field does not match";
3045  PrintIfNotEmpty(first_inner_listener.str(), listener->stream());
3046  return false;
3047  }
3048  StringMatchResultListener second_inner_listener;
3049  if (!second_matcher_.MatchAndExplain(a_pair.second,
3050  &second_inner_listener)) {
3051  *listener << "whose second field does not match";
3052  PrintIfNotEmpty(second_inner_listener.str(), listener->stream());
3053  return false;
3054  }
3055  ExplainSuccess(first_inner_listener.str(), second_inner_listener.str(),
3056  listener);
3057  return true;
3058  }
bool MatchAndExplain(T x, MatchResultListener *listener) const
void PrintIfNotEmpty(const internal::string &explanation, ::std::ostream *os)
Here is the call graph for this function:

The documentation for this class was generated from the following file: