Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing::internal::AllOfMatcherImpl< T > Class Template Reference

#include <gmock-matchers.h>

Inheritance diagram for testing::internal::AllOfMatcherImpl< T >:
Collaboration diagram for testing::internal::AllOfMatcherImpl< T >:

Public Member Functions

 AllOfMatcherImpl (std::vector< Matcher< T > > matchers)
 
virtual void DescribeTo (::std::ostream *os) const
 
virtual void DescribeNegationTo (::std::ostream *os) const
 
virtual bool MatchAndExplain (GTEST_REFERENCE_TO_CONST_(T) x, MatchResultListener *listener) const
 
- Public Member Functions inherited from testing::MatcherInterface< GTEST_REFERENCE_TO_CONST_(T)>
virtual bool MatchAndExplain (T x, MatchResultListener *listener) const=0
 
- Public Member Functions inherited from testing::MatcherDescriberInterface
virtual ~MatcherDescriberInterface ()
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ AllOfMatcherImpl()

template<typename T >
testing::internal::AllOfMatcherImpl< T >::AllOfMatcherImpl ( std::vector< Matcher< T > > matchers)
inlineexplicit

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

1725 : matchers_(internal::move(matchers)) {}
const T & move(const T &t)

Member Function Documentation

◆ DescribeNegationTo()

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

Reimplemented from testing::MatcherDescriberInterface.

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

1736 {
1737 *os << "(";
1738 for (size_t i = 0; i < matchers_.size(); ++i) {
1739 if (i != 0) *os << ") or (";
1740 matchers_[i].DescribeNegationTo(os);
1741 }
1742 *os << ")";
1743 }
os_t os

◆ DescribeTo()

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

Implements testing::MatcherDescriberInterface.

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

1727 {
1728 *os << "(";
1729 for (size_t i = 0; i < matchers_.size(); ++i) {
1730 if (i != 0) *os << ") and (";
1731 matchers_[i].DescribeTo(os);
1732 }
1733 *os << ")";
1734 }

◆ MatchAndExplain()

template<typename T >
virtual bool testing::internal::AllOfMatcherImpl< T >::MatchAndExplain ( GTEST_REFERENCE_TO_CONST_(T) x,
MatchResultListener * listener ) const
inlinevirtual

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

1746 {
1747 // If either matcher1_ or matcher2_ doesn't match x, we only need
1748 // to explain why one of them fails.
1749 std::string all_match_result;
1750
1751 for (size_t i = 0; i < matchers_.size(); ++i) {
1752 StringMatchResultListener slistener;
1753 if (matchers_[i].MatchAndExplain(x, &slistener)) {
1754 if (all_match_result.empty()) {
1755 all_match_result = slistener.str();
1756 } else {
1757 std::string result = slistener.str();
1758 if (!result.empty()) {
1759 all_match_result += ", and ";
1760 all_match_result += result;
1761 }
1762 }
1763 } else {
1764 *listener << slistener.str();
1765 return false;
1766 }
1767 }
1768
1769 // Otherwise we need to explain why *both* of them match.
1770 *listener << all_match_result;
1771 return true;
1772 }
virtual bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x, MatchResultListener *listener) const
Here is the call graph for this function:
Here is the caller graph for this function:

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