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

#include <gmock-matchers.h>

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

Public Member Functions

 AnyOfMatcherImpl (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::AnyOfMatcherImpl< T >

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

Constructor & Destructor Documentation

◆ AnyOfMatcherImpl()

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

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

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

Member Function Documentation

◆ DescribeNegationTo()

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

Reimplemented from testing::MatcherDescriberInterface.

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

1872 {
1873 *os << "(";
1874 for (size_t i = 0; i < matchers_.size(); ++i) {
1875 if (i != 0) *os << ") and (";
1876 matchers_[i].DescribeNegationTo(os);
1877 }
1878 *os << ")";
1879 }
os_t os

◆ DescribeTo()

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

Implements testing::MatcherDescriberInterface.

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

1863 {
1864 *os << "(";
1865 for (size_t i = 0; i < matchers_.size(); ++i) {
1866 if (i != 0) *os << ") or (";
1867 matchers_[i].DescribeTo(os);
1868 }
1869 *os << ")";
1870 }

◆ MatchAndExplain()

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

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

1882 {
1883 std::string no_match_result;
1884
1885 // If either matcher1_ or matcher2_ matches x, we just need to
1886 // explain why *one* of them matches.
1887 for (size_t i = 0; i < matchers_.size(); ++i) {
1888 StringMatchResultListener slistener;
1889 if (matchers_[i].MatchAndExplain(x, &slistener)) {
1890 *listener << slistener.str();
1891 return true;
1892 } else {
1893 if (no_match_result.empty()) {
1894 no_match_result = slistener.str();
1895 } else {
1896 std::string result = slistener.str();
1897 if (!result.empty()) {
1898 no_match_result += ", and ";
1899 no_match_result += result;
1900 }
1901 }
1902 }
1903 }
1904
1905 // Otherwise we need to explain why *both* of them fail.
1906 *listener << no_match_result;
1907 return false;
1908 }
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: