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

#include <gmock-matchers.h>

Inheritance diagram for testing::internal::PairMatcherImpl< PairType >:
testing::MatcherInterface< PairType > testing::MatcherInterface< PairType > testing::MatcherInterface< PairType > testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface

Public Types

typedef RawPairType::first_type FirstType
 
typedef RawPairType::second_type SecondType
 
typedef RawPairType::first_type FirstType
 
typedef RawPairType::second_type SecondType
 
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
 
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
 
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 ()
 
virtual ~MatcherDescriberInterface ()
 
virtual ~MatcherDescriberInterface ()
 

Private Member Functions

void ExplainSuccess (const internal::string &first_explanation, const internal::string &second_explanation, MatchResultListener *listener) const
 
 GTEST_DISALLOW_ASSIGN_ (PairMatcherImpl)
 
void ExplainSuccess (const internal::string &first_explanation, const internal::string &second_explanation, MatchResultListener *listener) const
 
 GTEST_DISALLOW_ASSIGN_ (PairMatcherImpl)
 
void ExplainSuccess (const internal::string &first_explanation, const internal::string &second_explanation, MatchResultListener *listener) const
 
 GTEST_DISALLOW_ASSIGN_ (PairMatcherImpl)
 

Private Attributes

const Matcher< const FirstType & > first_matcher_
 
const Matcher< const SecondType & > second_matcher_
 

Detailed Description

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

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

Member Typedef Documentation

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

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

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

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

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

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

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

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

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

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

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

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

Constructor & Destructor Documentation

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)),
3012  testing::SafeMatcherCast<const SecondType&>(second_matcher)) {
3013  }
const Matcher< const SecondType & > second_matcher_
const Matcher< const FirstType & > first_matcher_
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)),
3012  testing::SafeMatcherCast<const SecondType&>(second_matcher)) {
3013  }
const Matcher< const SecondType & > second_matcher_
const Matcher< const FirstType & > first_matcher_
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)),
3012  testing::SafeMatcherCast<const SecondType&>(second_matcher)) {
3013  }
const Matcher< const SecondType & > second_matcher_
const Matcher< const FirstType & > first_matcher_

Member Function Documentation

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 ";
3027  *os << ", or has a second field that ";
3029  }
const Matcher< const SecondType & > second_matcher_
const Matcher< const FirstType & > first_matcher_
void DescribeNegationTo(::std::ostream *os) const
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 ";
3027  *os << ", or has a second field that ";
3029  }
const Matcher< const SecondType & > second_matcher_
const Matcher< const FirstType & > first_matcher_
void DescribeNegationTo(::std::ostream *os) const
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 ";
3027  *os << ", or has a second field that ";
3029  }
const Matcher< const SecondType & > second_matcher_
const Matcher< const FirstType & > first_matcher_
void DescribeNegationTo(::std::ostream *os) const
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 ";
3019  *os << ", and has a second field that ";
3021  }
const Matcher< const SecondType & > second_matcher_
void DescribeTo(::std::ostream *os) const
const Matcher< const FirstType & > first_matcher_
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 ";
3019  *os << ", and has a second field that ";
3021  }
const Matcher< const SecondType & > second_matcher_
void DescribeTo(::std::ostream *os) const
const Matcher< const FirstType & > first_matcher_
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 ";
3019  *os << ", and has a second field that ";
3021  }
const Matcher< const SecondType & > second_matcher_
void DescribeTo(::std::ostream *os) const
const Matcher< const FirstType & > first_matcher_
template<typename PairType >
void testing::internal::PairMatcherImpl< PairType >::ExplainSuccess ( const internal::string first_explanation,
const internal::string second_explanation,
MatchResultListener listener 
) const
inlineprivate

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

References GTEST_DISALLOW_ASSIGN_.

3063  {
3064  *listener << "whose both fields match";
3065  if (first_explanation != "") {
3066  *listener << ", where the first field is a value " << first_explanation;
3067  }
3068  if (second_explanation != "") {
3069  *listener << ", ";
3070  if (first_explanation != "") {
3071  *listener << "and ";
3072  } else {
3073  *listener << "where ";
3074  }
3075  *listener << "the second field is a value " << second_explanation;
3076  }
3077  }
template<typename PairType >
void testing::internal::PairMatcherImpl< PairType >::ExplainSuccess ( const internal::string first_explanation,
const internal::string second_explanation,
MatchResultListener listener 
) const
inlineprivate

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

3063  {
3064  *listener << "whose both fields match";
3065  if (first_explanation != "") {
3066  *listener << ", where the first field is a value " << first_explanation;
3067  }
3068  if (second_explanation != "") {
3069  *listener << ", ";
3070  if (first_explanation != "") {
3071  *listener << "and ";
3072  } else {
3073  *listener << "where ";
3074  }
3075  *listener << "the second field is a value " << second_explanation;
3076  }
3077  }
template<typename PairType >
void testing::internal::PairMatcherImpl< PairType >::ExplainSuccess ( const internal::string first_explanation,
const internal::string second_explanation,
MatchResultListener listener 
) const
inlineprivate

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

References GTEST_DISALLOW_ASSIGN_.

3063  {
3064  *listener << "whose both fields match";
3065  if (first_explanation != "") {
3066  *listener << ", where the first field is a value " << first_explanation;
3067  }
3068  if (second_explanation != "") {
3069  *listener << ", ";
3070  if (first_explanation != "") {
3071  *listener << "and ";
3072  } else {
3073  *listener << "where ";
3074  }
3075  *listener << "the second field is a value " << second_explanation;
3076  }
3077  }
template<typename PairType >
testing::internal::PairMatcherImpl< PairType >::GTEST_DISALLOW_ASSIGN_ ( PairMatcherImpl< PairType >  )
private
template<typename PairType >
testing::internal::PairMatcherImpl< PairType >::GTEST_DISALLOW_ASSIGN_ ( PairMatcherImpl< PairType >  )
private
template<typename PairType >
testing::internal::PairMatcherImpl< PairType >::GTEST_DISALLOW_ASSIGN_ ( PairMatcherImpl< PairType >  )
private
template<typename PairType >
typedef testing::internal::PairMatcherImpl< PairType >::GTEST_REMOVE_REFERENCE_AND_CONST_ ( PairType  )
template<typename PairType >
typedef testing::internal::PairMatcherImpl< PairType >::GTEST_REMOVE_REFERENCE_AND_CONST_ ( PairType  )
template<typename PairType >
typedef testing::internal::PairMatcherImpl< PairType >::GTEST_REMOVE_REFERENCE_AND_CONST_ ( PairType  )
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.

References testing::internal::PrintIfNotEmpty(), and testing::StringMatchResultListener::str().

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  }
const Matcher< const SecondType & > second_matcher_
bool MatchAndExplain(T x, MatchResultListener *listener) const
void PrintIfNotEmpty(const internal::string &explanation,::std::ostream *os)
const Matcher< const FirstType & > first_matcher_
void ExplainSuccess(const internal::string &first_explanation, const internal::string &second_explanation, MatchResultListener *listener) const
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.

References testing::MatchResultListener::IsInterested(), testing::internal::PrintIfNotEmpty(), testing::StringMatchResultListener::str(), and testing::MatchResultListener::stream().

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  }
const Matcher< const SecondType & > second_matcher_
bool MatchAndExplain(T x, MatchResultListener *listener) const
void PrintIfNotEmpty(const internal::string &explanation,::std::ostream *os)
const Matcher< const FirstType & > first_matcher_
void ExplainSuccess(const internal::string &first_explanation, const internal::string &second_explanation, MatchResultListener *listener) const
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.

References testing::internal::PrintIfNotEmpty(), and testing::StringMatchResultListener::str().

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  }
const Matcher< const SecondType & > second_matcher_
bool MatchAndExplain(T x, MatchResultListener *listener) const
void PrintIfNotEmpty(const internal::string &explanation,::std::ostream *os)
const Matcher< const FirstType & > first_matcher_
void ExplainSuccess(const internal::string &first_explanation, const internal::string &second_explanation, MatchResultListener *listener) const

Member Data Documentation

template<typename PairType >
const Matcher< const FirstType & > testing::internal::PairMatcherImpl< PairType >::first_matcher_
private

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

template<typename PairType >
const Matcher< const SecondType & > testing::internal::PairMatcherImpl< PairType >::second_matcher_
private

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


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