Electroneum
testing::internal::UnorderedElementsAreMatcherImpl< Container > Class Template Reference

#include <gmock-matchers.h>

Inheritance diagram for testing::internal::UnorderedElementsAreMatcherImpl< Container >:
Collaboration diagram for testing::internal::UnorderedElementsAreMatcherImpl< Container >:

Public Types

typedef internal::StlContainerView< RawContainer > View
 
typedef View::type StlContainer
 
typedef View::const_reference StlContainerReference
 
typedef StlContainer::const_iterator StlContainerConstIterator
 
typedef StlContainer::value_type Element
 

Public Member Functions

typedef GTEST_REMOVE_REFERENCE_AND_CONST_ (Container) RawContainer
 
template<typename InputIter >
 UnorderedElementsAreMatcherImpl (InputIter first, InputIter last)
 
virtual void DescribeTo (::std::ostream *os) const
 
virtual void DescribeNegationTo (::std::ostream *os) const
 
virtual bool MatchAndExplain (Container container, MatchResultListener *listener) const
 
- Public Member Functions inherited from testing::MatcherDescriberInterface
virtual ~MatcherDescriberInterface ()
 

Additional Inherited Members

- Protected Types inherited from testing::internal::UnorderedElementsAreMatcherImplBase
typedef ::std::vector< const MatcherDescriberInterface * > MatcherDescriberVec
 
- Protected Member Functions inherited from testing::internal::UnorderedElementsAreMatcherImplBase
void DescribeToImpl (::std::ostream *os) const
 
void DescribeNegationToImpl (::std::ostream *os) const
 
bool VerifyAllElementsAndMatchersAreMatched (const ::std::vector< string > &element_printouts, const MatchMatrix &matrix, MatchResultListener *listener) const
 
MatcherDescriberVecmatcher_describers ()
 
- Static Protected Member Functions inherited from testing::internal::UnorderedElementsAreMatcherImplBase
static Message Elements (size_t n)
 

Detailed Description

template<typename Container>
class testing::internal::UnorderedElementsAreMatcherImpl< Container >

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

Member Typedef Documentation

◆ Element

template<typename Container >
typedef StlContainer::value_type testing::internal::UnorderedElementsAreMatcherImpl< Container >::Element

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

◆ StlContainer

template<typename Container >
typedef View::type testing::internal::UnorderedElementsAreMatcherImpl< Container >::StlContainer

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

◆ StlContainerConstIterator

template<typename Container >
typedef StlContainer::const_iterator testing::internal::UnorderedElementsAreMatcherImpl< Container >::StlContainerConstIterator

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

◆ StlContainerReference

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

◆ View

template<typename Container >
typedef internal::StlContainerView<RawContainer> testing::internal::UnorderedElementsAreMatcherImpl< Container >::View

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

Constructor & Destructor Documentation

◆ UnorderedElementsAreMatcherImpl()

template<typename Container >
template<typename InputIter >
testing::internal::UnorderedElementsAreMatcherImpl< Container >::UnorderedElementsAreMatcherImpl ( InputIter  first,
InputIter  last 
)
inline

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

3359  {
3360  for (; first != last; ++first) {
3361  matchers_.push_back(MatcherCast<const Element&>(*first));
3362  matcher_describers().push_back(matchers_.back().GetDescriber());
3363  }
3364  }
Here is the call graph for this function:

Member Function Documentation

◆ DescribeNegationTo()

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

Reimplemented from testing::MatcherDescriberInterface.

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

3372  {
3374  }
void DescribeNegationToImpl(::std::ostream *os) const
Here is the call graph for this function:

◆ DescribeTo()

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

Implements testing::MatcherDescriberInterface.

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

3367  {
3369  }
Here is the call graph for this function:

◆ GTEST_REMOVE_REFERENCE_AND_CONST_()

template<typename Container >
typedef testing::internal::UnorderedElementsAreMatcherImpl< Container >::GTEST_REMOVE_REFERENCE_AND_CONST_ ( Container  )

◆ MatchAndExplain()

template<typename Container >
virtual bool testing::internal::UnorderedElementsAreMatcherImpl< Container >::MatchAndExplain ( Container  container,
MatchResultListener listener 
) const
inlinevirtual

Implements testing::MatcherInterface< Container >.

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

3377  {
3378  StlContainerReference stl_container = View::ConstReference(container);
3379  ::std::vector<string> element_printouts;
3380  MatchMatrix matrix = AnalyzeElements(stl_container.begin(),
3381  stl_container.end(),
3382  &element_printouts,
3383  listener);
3384 
3385  const size_t actual_count = matrix.LhsSize();
3386  if (actual_count == 0 && matchers_.empty()) {
3387  return true;
3388  }
3389  if (actual_count != matchers_.size()) {
3390  // The element count doesn't match. If the container is empty,
3391  // there's no need to explain anything as Google Mock already
3392  // prints the empty container. Otherwise we just need to show
3393  // how many elements there actually are.
3394  if (actual_count != 0 && listener->IsInterested()) {
3395  *listener << "which has " << Elements(actual_count);
3396  }
3397  return false;
3398  }
3399 
3400  return VerifyAllElementsAndMatchersAreMatched(element_printouts,
3401  matrix, listener) &&
3402  FindPairing(matrix, listener);
3403  }
GTEST_API_ bool FindPairing(const MatchMatrix &matrix, MatchResultListener *listener)
bool VerifyAllElementsAndMatchersAreMatched(const ::std::vector< string > &element_printouts, const MatchMatrix &matrix, MatchResultListener *listener) const
static const_reference ConstReference(const RawContainer &container)
Here is the call graph for this function:

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