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

#include <gmock-matchers.h>

Inheritance diagram for testing::internal::BothOfMatcherImpl< 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

 BothOfMatcherImpl (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
 
 BothOfMatcherImpl (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
 
 BothOfMatcherImpl (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_ (BothOfMatcherImpl)
 
 GTEST_DISALLOW_ASSIGN_ (BothOfMatcherImpl)
 
 GTEST_DISALLOW_ASSIGN_ (BothOfMatcherImpl)
 

Private Attributes

const Matcher< Tmatcher1_
 
const Matcher< Tmatcher2_
 

Detailed Description

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

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

Constructor & Destructor Documentation

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

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

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

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

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

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

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

Member Function Documentation

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

Reimplemented from testing::MatcherDescriberInterface.

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

1505  {
1506  *os << "(";
1507  matcher1_.DescribeNegationTo(os);
1508  *os << ") or (";
1509  matcher2_.DescribeNegationTo(os);
1510  *os << ")";
1511  }
template<typename T >
virtual void testing::internal::BothOfMatcherImpl< T >::DescribeNegationTo ( ::std::ostream *  os) const
inlinevirtual

Reimplemented from testing::MatcherDescriberInterface.

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

1505  {
1506  *os << "(";
1507  matcher1_.DescribeNegationTo(os);
1508  *os << ") or (";
1509  matcher2_.DescribeNegationTo(os);
1510  *os << ")";
1511  }
template<typename T >
virtual void testing::internal::BothOfMatcherImpl< T >::DescribeNegationTo ( ::std::ostream *  os) const
inlinevirtual

Reimplemented from testing::MatcherDescriberInterface.

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

1505  {
1506  *os << "(";
1507  matcher1_.DescribeNegationTo(os);
1508  *os << ") or (";
1509  matcher2_.DescribeNegationTo(os);
1510  *os << ")";
1511  }
template<typename T >
virtual void testing::internal::BothOfMatcherImpl< T >::DescribeTo ( ::std::ostream *  os) const
inlinevirtual

Implements testing::MatcherDescriberInterface.

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

1497  {
1498  *os << "(";
1499  matcher1_.DescribeTo(os);
1500  *os << ") and (";
1501  matcher2_.DescribeTo(os);
1502  *os << ")";
1503  }
template<typename T >
virtual void testing::internal::BothOfMatcherImpl< T >::DescribeTo ( ::std::ostream *  os) const
inlinevirtual

Implements testing::MatcherDescriberInterface.

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

1497  {
1498  *os << "(";
1499  matcher1_.DescribeTo(os);
1500  *os << ") and (";
1501  matcher2_.DescribeTo(os);
1502  *os << ")";
1503  }
template<typename T >
virtual void testing::internal::BothOfMatcherImpl< T >::DescribeTo ( ::std::ostream *  os) const
inlinevirtual

Implements testing::MatcherDescriberInterface.

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

1497  {
1498  *os << "(";
1499  matcher1_.DescribeTo(os);
1500  *os << ") and (";
1501  matcher2_.DescribeTo(os);
1502  *os << ")";
1503  }
template<typename T >
testing::internal::BothOfMatcherImpl< T >::GTEST_DISALLOW_ASSIGN_ ( BothOfMatcherImpl< T )
private
template<typename T >
testing::internal::BothOfMatcherImpl< T >::GTEST_DISALLOW_ASSIGN_ ( BothOfMatcherImpl< T )
private
template<typename T >
testing::internal::BothOfMatcherImpl< T >::GTEST_DISALLOW_ASSIGN_ ( BothOfMatcherImpl< T )
private
template<typename T >
virtual bool testing::internal::BothOfMatcherImpl< T >::MatchAndExplain ( T  x,
MatchResultListener listener 
) const
inlinevirtual

Implements testing::MatcherInterface< T >.

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

References testing::StringMatchResultListener::str().

1513  {
1514  // If either matcher1_ or matcher2_ doesn't match x, we only need
1515  // to explain why one of them fails.
1516  StringMatchResultListener listener1;
1517  if (!matcher1_.MatchAndExplain(x, &listener1)) {
1518  *listener << listener1.str();
1519  return false;
1520  }
1521 
1522  StringMatchResultListener listener2;
1523  if (!matcher2_.MatchAndExplain(x, &listener2)) {
1524  *listener << listener2.str();
1525  return false;
1526  }
1527 
1528  // Otherwise we need to explain why *both* of them match.
1529  const internal::string s1 = listener1.str();
1530  const internal::string s2 = listener2.str();
1531 
1532  if (s1 == "") {
1533  *listener << s2;
1534  } else {
1535  *listener << s1;
1536  if (s2 != "") {
1537  *listener << ", and " << s2;
1538  }
1539  }
1540  return true;
1541  }
Definition: InvokeTest.cpp:58
::std::string string
Definition: gtest-port.h:1097
template<typename T >
virtual bool testing::internal::BothOfMatcherImpl< T >::MatchAndExplain ( T  x,
MatchResultListener listener 
) const
inlinevirtual

Implements testing::MatcherInterface< T >.

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

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

1513  {
1514  // If either matcher1_ or matcher2_ doesn't match x, we only need
1515  // to explain why one of them fails.
1516  StringMatchResultListener listener1;
1517  if (!matcher1_.MatchAndExplain(x, &listener1)) {
1518  *listener << listener1.str();
1519  return false;
1520  }
1521 
1522  StringMatchResultListener listener2;
1523  if (!matcher2_.MatchAndExplain(x, &listener2)) {
1524  *listener << listener2.str();
1525  return false;
1526  }
1527 
1528  // Otherwise we need to explain why *both* of them match.
1529  const internal::string s1 = listener1.str();
1530  const internal::string s2 = listener2.str();
1531 
1532  if (s1 == "") {
1533  *listener << s2;
1534  } else {
1535  *listener << s1;
1536  if (s2 != "") {
1537  *listener << ", and " << s2;
1538  }
1539  }
1540  return true;
1541  }
Definition: InvokeTest.cpp:58
::std::string string
Definition: gtest-port.h:1097
template<typename T >
virtual bool testing::internal::BothOfMatcherImpl< T >::MatchAndExplain ( T  x,
MatchResultListener listener 
) const
inlinevirtual

Implements testing::MatcherInterface< T >.

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

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

1513  {
1514  // If either matcher1_ or matcher2_ doesn't match x, we only need
1515  // to explain why one of them fails.
1516  StringMatchResultListener listener1;
1517  if (!matcher1_.MatchAndExplain(x, &listener1)) {
1518  *listener << listener1.str();
1519  return false;
1520  }
1521 
1522  StringMatchResultListener listener2;
1523  if (!matcher2_.MatchAndExplain(x, &listener2)) {
1524  *listener << listener2.str();
1525  return false;
1526  }
1527 
1528  // Otherwise we need to explain why *both* of them match.
1529  const internal::string s1 = listener1.str();
1530  const internal::string s2 = listener2.str();
1531 
1532  if (s1 == "") {
1533  *listener << s2;
1534  } else {
1535  *listener << s1;
1536  if (s2 != "") {
1537  *listener << ", and " << s2;
1538  }
1539  }
1540  return true;
1541  }
Definition: InvokeTest.cpp:58
::std::string string
Definition: gtest-port.h:1097

Member Data Documentation

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

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

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

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


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