proxygen
testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer > Class Template Reference

#include <gmock-matchers.h>

Inheritance diagram for testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >:
testing::MatcherInterface< LhsContainer > testing::MatcherInterface< LhsContainer > testing::MatcherInterface< LhsContainer > testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface testing::MatcherDescriberInterface

Public Types

typedef internal::StlContainerView< GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView
 
typedef LhsView::type LhsStlContainer
 
typedef LhsView::const_reference LhsStlContainerReference
 
typedef RemoveConstFromKey< typename LhsStlContainer::value_type >::type LhsValue
 
typedef internal::StlContainerView< GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView
 
typedef LhsView::type LhsStlContainer
 
typedef LhsView::const_reference LhsStlContainerReference
 
typedef RemoveConstFromKey< typename LhsStlContainer::value_type >::type LhsValue
 
typedef internal::StlContainerView< GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView
 
typedef LhsView::type LhsStlContainer
 
typedef LhsView::const_reference LhsStlContainerReference
 
typedef RemoveConstFromKey< typename LhsStlContainer::value_type >::type LhsValue
 

Public Member Functions

 Impl (const Comparator &comparator, const ContainerMatcher &matcher)
 
virtual void DescribeTo (::std::ostream *os) const
 
virtual void DescribeNegationTo (::std::ostream *os) const
 
virtual bool MatchAndExplain (LhsContainer lhs, MatchResultListener *listener) const
 
 Impl (const Comparator &comparator, const ContainerMatcher &matcher)
 
virtual void DescribeTo (::std::ostream *os) const
 
virtual void DescribeNegationTo (::std::ostream *os) const
 
virtual bool MatchAndExplain (LhsContainer lhs, MatchResultListener *listener) const
 
 Impl (const Comparator &comparator, const ContainerMatcher &matcher)
 
virtual void DescribeTo (::std::ostream *os) const
 
virtual void DescribeNegationTo (::std::ostream *os) const
 
virtual bool MatchAndExplain (LhsContainer lhs, MatchResultListener *listener) const
 
- Public Member Functions inherited from testing::MatcherDescriberInterface
virtual ~MatcherDescriberInterface ()
 
virtual ~MatcherDescriberInterface ()
 
virtual ~MatcherDescriberInterface ()
 

Private Member Functions

 GTEST_DISALLOW_COPY_AND_ASSIGN_ (Impl)
 
 GTEST_DISALLOW_COPY_AND_ASSIGN_ (Impl)
 
 GTEST_DISALLOW_COPY_AND_ASSIGN_ (Impl)
 

Private Attributes

const Comparator comparator_
 
const Matcher< const ::std::vector< LhsValue > & > matcher_
 

Detailed Description

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer>
class testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >

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

Member Typedef Documentation

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
typedef LhsView::type testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::LhsStlContainer

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

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
typedef LhsView::type testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::LhsStlContainer

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

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
typedef LhsView::type testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::LhsStlContainer

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

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
typedef LhsView::const_reference testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::LhsStlContainerReference

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

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
typedef LhsView::const_reference testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::LhsStlContainerReference

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

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
typedef LhsView::const_reference testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::LhsStlContainerReference

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

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
typedef RemoveConstFromKey< typename LhsStlContainer::value_type>::type testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::LhsValue

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

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
typedef RemoveConstFromKey< typename LhsStlContainer::value_type>::type testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::LhsValue

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

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
typedef RemoveConstFromKey< typename LhsStlContainer::value_type>::type testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::LhsValue

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

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
typedef internal::StlContainerView< GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::LhsView

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

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
typedef internal::StlContainerView< GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::LhsView

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

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
typedef internal::StlContainerView< GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::LhsView

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

Constructor & Destructor Documentation

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::Impl ( const Comparator &  comparator,
const ContainerMatcher &  matcher 
)
inline

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

2637  : comparator_(comparator), matcher_(matcher) {}
const Matcher< const ::std::vector< LhsValue > & > matcher_
int comparator(const void *ap, const void *bp)
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::Impl ( const Comparator &  comparator,
const ContainerMatcher &  matcher 
)
inline

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

2637  : comparator_(comparator), matcher_(matcher) {}
const Matcher< const ::std::vector< LhsValue > & > matcher_
int comparator(const void *ap, const void *bp)
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::Impl ( const Comparator &  comparator,
const ContainerMatcher &  matcher 
)
inline

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

2637  : comparator_(comparator), matcher_(matcher) {}
const Matcher< const ::std::vector< LhsValue > & > matcher_
int comparator(const void *ap, const void *bp)

Member Function Documentation

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
virtual void testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::DescribeNegationTo ( ::std::ostream *  os) const
inlinevirtual

Reimplemented from testing::MatcherDescriberInterface.

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

2644  {
2645  *os << "(when sorted) ";
2647  }
const Matcher< const ::std::vector< LhsValue > & > matcher_
void DescribeNegationTo(::std::ostream *os) const
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
virtual void testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::DescribeNegationTo ( ::std::ostream *  os) const
inlinevirtual

Reimplemented from testing::MatcherDescriberInterface.

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

2644  {
2645  *os << "(when sorted) ";
2647  }
const Matcher< const ::std::vector< LhsValue > & > matcher_
void DescribeNegationTo(::std::ostream *os) const
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
virtual void testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::DescribeNegationTo ( ::std::ostream *  os) const
inlinevirtual

Reimplemented from testing::MatcherDescriberInterface.

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

2644  {
2645  *os << "(when sorted) ";
2647  }
const Matcher< const ::std::vector< LhsValue > & > matcher_
void DescribeNegationTo(::std::ostream *os) const
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
virtual void testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::DescribeTo ( ::std::ostream *  os) const
inlinevirtual

Implements testing::MatcherDescriberInterface.

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

2639  {
2640  *os << "(when sorted) ";
2641  matcher_.DescribeTo(os);
2642  }
const Matcher< const ::std::vector< LhsValue > & > matcher_
void DescribeTo(::std::ostream *os) const
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
virtual void testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::DescribeTo ( ::std::ostream *  os) const
inlinevirtual

Implements testing::MatcherDescriberInterface.

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

2639  {
2640  *os << "(when sorted) ";
2641  matcher_.DescribeTo(os);
2642  }
const Matcher< const ::std::vector< LhsValue > & > matcher_
void DescribeTo(::std::ostream *os) const
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
virtual void testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::DescribeTo ( ::std::ostream *  os) const
inlinevirtual

Implements testing::MatcherDescriberInterface.

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

2639  {
2640  *os << "(when sorted) ";
2641  matcher_.DescribeTo(os);
2642  }
const Matcher< const ::std::vector< LhsValue > & > matcher_
void DescribeTo(::std::ostream *os) const
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::GTEST_DISALLOW_COPY_AND_ASSIGN_ ( Impl< LhsContainer >  )
private
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::GTEST_DISALLOW_COPY_AND_ASSIGN_ ( Impl< LhsContainer >  )
private
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::GTEST_DISALLOW_COPY_AND_ASSIGN_ ( Impl< LhsContainer >  )
private
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
virtual bool testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::MatchAndExplain ( LhsContainer  lhs,
MatchResultListener listener 
) const
inlinevirtual

Implements testing::MatcherInterface< LhsContainer >.

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

References testing::MatchResultListener::IsInterested(), testing::internal::PrintIfNotEmpty(), testing::StringMatchResultListener::str(), testing::MatchResultListener::stream(), and testing::internal::UniversalPrint().

2650  {
2651  LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
2652  ::std::vector<LhsValue> sorted_container(lhs_stl_container.begin(),
2653  lhs_stl_container.end());
2654  ::std::sort(
2655  sorted_container.begin(), sorted_container.end(), comparator_);
2656 
2657  if (!listener->IsInterested()) {
2658  // If the listener is not interested, we do not need to
2659  // construct the inner explanation.
2660  return matcher_.Matches(sorted_container);
2661  }
2662 
2663  *listener << "which is ";
2664  UniversalPrint(sorted_container, listener->stream());
2665  *listener << " when sorted";
2666 
2667  StringMatchResultListener inner_listener;
2668  const bool match = matcher_.MatchAndExplain(sorted_container,
2669  &inner_listener);
2670  PrintIfNotEmpty(inner_listener.str(), listener->stream());
2671  return match;
2672  }
LhsView::const_reference LhsStlContainerReference
const Matcher< const ::std::vector< LhsValue > & > matcher_
static const_reference ConstReference(const RawContainer &container)
bool MatchAndExplain(T x, MatchResultListener *listener) const
void PrintIfNotEmpty(const internal::string &explanation,::std::ostream *os)
void UniversalPrint(const T &value,::std::ostream *os)
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
virtual bool testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::MatchAndExplain ( LhsContainer  lhs,
MatchResultListener listener 
) const
inlinevirtual

Implements testing::MatcherInterface< LhsContainer >.

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

References GTEST_DISALLOW_ASSIGN_, testing::MatchResultListener::GTEST_DISALLOW_COPY_AND_ASSIGN_(), testing::internal::PrintIfNotEmpty(), testing::StringMatchResultListener::str(), and testing::internal::UniversalPrint().

2650  {
2651  LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
2652  ::std::vector<LhsValue> sorted_container(lhs_stl_container.begin(),
2653  lhs_stl_container.end());
2654  ::std::sort(
2655  sorted_container.begin(), sorted_container.end(), comparator_);
2656 
2657  if (!listener->IsInterested()) {
2658  // If the listener is not interested, we do not need to
2659  // construct the inner explanation.
2660  return matcher_.Matches(sorted_container);
2661  }
2662 
2663  *listener << "which is ";
2664  UniversalPrint(sorted_container, listener->stream());
2665  *listener << " when sorted";
2666 
2667  StringMatchResultListener inner_listener;
2668  const bool match = matcher_.MatchAndExplain(sorted_container,
2669  &inner_listener);
2670  PrintIfNotEmpty(inner_listener.str(), listener->stream());
2671  return match;
2672  }
LhsView::const_reference LhsStlContainerReference
const Matcher< const ::std::vector< LhsValue > & > matcher_
static const_reference ConstReference(const RawContainer &container)
bool MatchAndExplain(T x, MatchResultListener *listener) const
void PrintIfNotEmpty(const internal::string &explanation,::std::ostream *os)
void UniversalPrint(const T &value,::std::ostream *os)
template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
virtual bool testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::MatchAndExplain ( LhsContainer  lhs,
MatchResultListener listener 
) const
inlinevirtual

Implements testing::MatcherInterface< LhsContainer >.

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

References GTEST_DISALLOW_ASSIGN_, testing::MatchResultListener::GTEST_DISALLOW_COPY_AND_ASSIGN_(), testing::internal::PrintIfNotEmpty(), testing::StringMatchResultListener::str(), and testing::internal::UniversalPrint().

2650  {
2651  LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
2652  ::std::vector<LhsValue> sorted_container(lhs_stl_container.begin(),
2653  lhs_stl_container.end());
2654  ::std::sort(
2655  sorted_container.begin(), sorted_container.end(), comparator_);
2656 
2657  if (!listener->IsInterested()) {
2658  // If the listener is not interested, we do not need to
2659  // construct the inner explanation.
2660  return matcher_.Matches(sorted_container);
2661  }
2662 
2663  *listener << "which is ";
2664  UniversalPrint(sorted_container, listener->stream());
2665  *listener << " when sorted";
2666 
2667  StringMatchResultListener inner_listener;
2668  const bool match = matcher_.MatchAndExplain(sorted_container,
2669  &inner_listener);
2670  PrintIfNotEmpty(inner_listener.str(), listener->stream());
2671  return match;
2672  }
LhsView::const_reference LhsStlContainerReference
const Matcher< const ::std::vector< LhsValue > & > matcher_
static const_reference ConstReference(const RawContainer &container)
bool MatchAndExplain(T x, MatchResultListener *listener) const
void PrintIfNotEmpty(const internal::string &explanation,::std::ostream *os)
void UniversalPrint(const T &value,::std::ostream *os)

Member Data Documentation

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
const Comparator testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::comparator_
private

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

template<typename Comparator, typename ContainerMatcher>
template<typename LhsContainer >
const Matcher< const ::std::vector< LhsValue > & > testing::internal::WhenSortedByMatcher< Comparator, ContainerMatcher >::Impl< LhsContainer >::matcher_
private

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


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