File indexing completed on 2024-09-22 04:53:11

0001 /*
0002  * SPDX-FileCopyrightText: 2008 Trevor Pounds
0003  * SPDX-License-Identifier: MIT
0004  */
0005 
0006 #ifndef __MOCKITOPP_MATCHER_NULL_HPP__
0007 #define __MOCKITOPP_MATCHER_NULL_HPP__
0008 
0009 #include <mockitopp/matchers/Matcher.hpp>
0010 
0011 namespace mockitopp
0012 {
0013    namespace matcher
0014    {
0015       namespace detail
0016       {
0017          template <typename T>
0018          struct NullT : public Matcher<T>
0019          {
0020             NullT()
0021                {}
0022 
0023             virtual Matcher<T>* clone() const
0024                { return new NullT(); }
0025 
0026             virtual bool operator== (typename mockitopp::detail::tr1::add_reference<typename mockitopp::detail::tr1::add_const<T>::type>::type rhs) const
0027                { return rhs == 0; }
0028          };
0029       } // namespace detail
0030 
0031       template <typename T>
0032       detail::NullT<T> null()
0033          { return detail::NullT<T>(); }
0034    } // namespace matcher
0035 } // namespace mockitopp
0036 
0037 #endif //__MOCKITOPP_MATCHER_NULL_HPP__