proxygen
testing::internal::EitherOfMatcherImpl< T > Class Template Reference

#include <gmock-matchers.h>

Inheritance diagram for testing::internal::EitherOfMatcherImpl< T >:
testing::MatcherInterface< T > testing::MatcherInterface< T > testing::MatcherInterface< T > testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface

Public Member Functions

 EitherOfMatcherImpl (const Matcher< T > &matcher1, const Matcher< T > &matcher2)
 
virtual void DescribeTo (::std::ostream *os) const
 
virtual void DescribeNegationTo (::std::ostream *os) const
 
virtual bool MatchAndExplain (T x, MatchResultListener *listener) const
 
 EitherOfMatcherImpl (const Matcher< T > &matcher1, const Matcher< T > &matcher2)
 
virtual void DescribeTo (::std::ostream *os) const
 
virtual void DescribeNegationTo (::std::ostream *os) const
 
virtual bool MatchAndExplain (T x, MatchResultListener *listener) const
 
 EitherOfMatcherImpl (const Matcher< T > &matcher1, const Matcher< T > &matcher2)
 
virtual void DescribeTo (::std::ostream *os) const
 
virtual void DescribeNegationTo (::std::ostream *os) const
 
virtual bool MatchAndExplain (T x, MatchResultListener *listener) const
 
- Public Member Functions inherited from testing::MatcherDescriberInterface
virtual ~MatcherDescriberInterface ()
 
virtual ~MatcherDescriberInterface ()
 
virtual ~MatcherDescriberInterface ()
 

Private Member Functions

 GTEST_DISALLOW_ASSIGN_ (EitherOfMatcherImpl)
 
 GTEST_DISALLOW_ASSIGN_ (EitherOfMatcherImpl)
 
 GTEST_DISALLOW_ASSIGN_ (EitherOfMatcherImpl)
 

Private Attributes

const Matcher< Tmatcher1_
 
const Matcher< Tmatcher2_
 

Detailed Description

template<typename T>
class testing::internal::EitherOfMatcherImpl< T >

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

Constructor & Destructor Documentation

template<typename T >
testing::internal::EitherOfMatcherImpl< T >::EitherOfMatcherImpl ( const Matcher< T > &  matcher1,
const Matcher< T > &  matcher2 
)
inline

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

1667  : matcher1_(matcher1), matcher2_(matcher2) {}
template<typename T >
testing::internal::EitherOfMatcherImpl< T >::EitherOfMatcherImpl ( const Matcher< T > &  matcher1,
const Matcher< T > &  matcher2 
)
inline

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

1667  : matcher1_(matcher1), matcher2_(matcher2) {}
template<typename T >
testing::internal::EitherOfMatcherImpl< T >::EitherOfMatcherImpl ( const Matcher< T > &  matcher1,
const Matcher< T > &  matcher2 
)
inline

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

1667  : matcher1_(matcher1), matcher2_(matcher2) {}

Member Function Documentation

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

Reimplemented from testing::MatcherDescriberInterface.

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

1677  {
1678  *os << "(";
1679  matcher1_.DescribeNegationTo(os);
1680  *os << ") and (";
1681  matcher2_.DescribeNegationTo(os);
1682  *os << ")";
1683  }
template<typename T >
virtual void testing::internal::EitherOfMatcherImpl< T >::DescribeNegationTo ( ::std::ostream *  os) const
inlinevirtual

Reimplemented from testing::MatcherDescriberInterface.

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

1677  {
1678  *os << "(";
1679  matcher1_.DescribeNegationTo(os);
1680  *os << ") and (";
1681  matcher2_.DescribeNegationTo(os);
1682  *os << ")";
1683  }
template<typename T >
virtual void testing::internal::EitherOfMatcherImpl< T >::DescribeNegationTo ( ::std::ostream *  os) const
inlinevirtual

Reimplemented from testing::MatcherDescriberInterface.

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

1677  {
1678  *os << "(";
1679  matcher1_.DescribeNegationTo(os);
1680  *os << ") and (";
1681  matcher2_.DescribeNegationTo(os);
1682  *os << ")";
1683  }
template<typename T >
virtual void testing::internal::EitherOfMatcherImpl< T >::DescribeTo ( ::std::ostream *  os) const
inlinevirtual

Implements testing::MatcherDescriberInterface.

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

1669  {
1670  *os << "(";
1671  matcher1_.DescribeTo(os);
1672  *os << ") or (";
1673  matcher2_.DescribeTo(os);
1674  *os << ")";
1675  }
template<typename T >
virtual void testing::internal::EitherOfMatcherImpl< T >::DescribeTo ( ::std::ostream *  os) const
inlinevirtual

Implements testing::MatcherDescriberInterface.

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

1669  {
1670  *os << "(";
1671  matcher1_.DescribeTo(os);
1672  *os << ") or (";
1673  matcher2_.DescribeTo(os);
1674  *os << ")";
1675  }
template<typename T >
virtual void testing::internal::EitherOfMatcherImpl< T >::DescribeTo ( ::std::ostream *  os) const
inlinevirtual

Implements testing::MatcherDescriberInterface.

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

1669  {
1670  *os << "(";
1671  matcher1_.DescribeTo(os);
1672  *os << ") or (";
1673  matcher2_.DescribeTo(os);
1674  *os << ")";
1675  }
template<typename T >
testing::internal::EitherOfMatcherImpl< T >::GTEST_DISALLOW_ASSIGN_ ( EitherOfMatcherImpl< T )
private
template<typename T >
testing::internal::EitherOfMatcherImpl< T >::GTEST_DISALLOW_ASSIGN_ ( EitherOfMatcherImpl< T )
private
template<typename T >
testing::internal::EitherOfMatcherImpl< T >::GTEST_DISALLOW_ASSIGN_ ( EitherOfMatcherImpl< T )
private
template<typename T >
virtual bool testing::internal::EitherOfMatcherImpl< T >::MatchAndExplain ( T  x,
MatchResultListener listener 
) const
inlinevirtual

Implements testing::MatcherInterface< T >.

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

References testing::StringMatchResultListener::str().

1685  {
1686  // If either matcher1_ or matcher2_ matches x, we just need to
1687  // explain why *one* of them matches.
1688  StringMatchResultListener listener1;
1689  if (matcher1_.MatchAndExplain(x, &listener1)) {
1690  *listener << listener1.str();
1691  return true;
1692  }
1693 
1694  StringMatchResultListener listener2;
1695  if (matcher2_.MatchAndExplain(x, &listener2)) {
1696  *listener << listener2.str();
1697  return true;
1698  }
1699 
1700  // Otherwise we need to explain why *both* of them fail.
1701  const internal::string s1 = listener1.str();
1702  const internal::string s2 = listener2.str();
1703 
1704  if (s1 == "") {
1705  *listener << s2;
1706  } else {
1707  *listener << s1;
1708  if (s2 != "") {
1709  *listener << ", and " << s2;
1710  }
1711  }
1712  return false;
1713  }
Definition: InvokeTest.cpp:58
::std::string string
Definition: gtest-port.h:1097
template<typename T >
virtual bool testing::internal::EitherOfMatcherImpl< T >::MatchAndExplain ( T  x,
MatchResultListener listener 
) const
inlinevirtual

Implements testing::MatcherInterface< T >.

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

References testing::Args(), GTEST_DISALLOW_ASSIGN_, and testing::StringMatchResultListener::str().

1685  {
1686  // If either matcher1_ or matcher2_ matches x, we just need to
1687  // explain why *one* of them matches.
1688  StringMatchResultListener listener1;
1689  if (matcher1_.MatchAndExplain(x, &listener1)) {
1690  *listener << listener1.str();
1691  return true;
1692  }
1693 
1694  StringMatchResultListener listener2;
1695  if (matcher2_.MatchAndExplain(x, &listener2)) {
1696  *listener << listener2.str();
1697  return true;
1698  }
1699 
1700  // Otherwise we need to explain why *both* of them fail.
1701  const internal::string s1 = listener1.str();
1702  const internal::string s2 = listener2.str();
1703 
1704  if (s1 == "") {
1705  *listener << s2;
1706  } else {
1707  *listener << s1;
1708  if (s2 != "") {
1709  *listener << ", and " << s2;
1710  }
1711  }
1712  return false;
1713  }
Definition: InvokeTest.cpp:58
::std::string string
Definition: gtest-port.h:1097
template<typename T >
virtual bool testing::internal::EitherOfMatcherImpl< T >::MatchAndExplain ( T  x,
MatchResultListener listener 
) const
inlinevirtual

Implements testing::MatcherInterface< T >.

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

References testing::Args(), GTEST_DISALLOW_ASSIGN_, and testing::StringMatchResultListener::str().

1685  {
1686  // If either matcher1_ or matcher2_ matches x, we just need to
1687  // explain why *one* of them matches.
1688  StringMatchResultListener listener1;
1689  if (matcher1_.MatchAndExplain(x, &listener1)) {
1690  *listener << listener1.str();
1691  return true;
1692  }
1693 
1694  StringMatchResultListener listener2;
1695  if (matcher2_.MatchAndExplain(x, &listener2)) {
1696  *listener << listener2.str();
1697  return true;
1698  }
1699 
1700  // Otherwise we need to explain why *both* of them fail.
1701  const internal::string s1 = listener1.str();
1702  const internal::string s2 = listener2.str();
1703 
1704  if (s1 == "") {
1705  *listener << s2;
1706  } else {
1707  *listener << s1;
1708  if (s2 != "") {
1709  *listener << ", and " << s2;
1710  }
1711  }
1712  return false;
1713  }
Definition: InvokeTest.cpp:58
::std::string string
Definition: gtest-port.h:1097

Member Data Documentation

template<typename T >
const Matcher< T > testing::internal::EitherOfMatcherImpl< T >::matcher1_
private

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

template<typename T >
const Matcher< T > testing::internal::EitherOfMatcherImpl< T >::matcher2_
private

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


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