Added support for movable only types as parameters

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@676 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2013-07-09 06:58:18 +00:00
parent 8c26729399
commit 068f73b0bc
5 changed files with 35 additions and 2 deletions

View file

@ -71,4 +71,10 @@
# endif
#endif
#if !defined(BOOST_NO_CXX11_SMART_PTR) && !defined(BOOST_NO_SMART_PTR)
# ifndef MOCK_NO_SMART_PTR
# define MOCK_SMART_PTR
# endif
#endif
#endif // MOCK_CONFIG_HPP_INCLUDED

View file

@ -28,6 +28,7 @@
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
#include <boost/test/utils/lazy_ostream.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/call_traits.hpp>
#include <boost/optional.hpp>
#include <ostream>
#include <vector>

View file

@ -8,6 +8,13 @@
#include "function_impl_template.hpp"
#define MOCK_FUNCTION_CALL(z, n, d ) \
BOOST_PP_COMMA_IF(n) BOOST_DEDUCED_TYPENAME \
boost::call_traits< T##n >::param_type
#define MOCK_FUNCTION_PARAM(z, n, d) \
MOCK_FUNCTION_CALL(z, n, d) t##n
namespace mock
{
namespace detail
@ -29,7 +36,8 @@ namespace detail
private:
typedef function_impl<
R ( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) > impl_type;
R ( BOOST_PP_REPEAT(MOCK_NUM_ARGS, MOCK_FUNCTION_CALL, _) )
> impl_type;
typedef BOOST_DEDUCED_TYPENAME
impl_type::expectation_type expectation_type;
typedef BOOST_DEDUCED_TYPENAME impl_type::error_type error_type;
@ -68,7 +76,8 @@ namespace detail
return impl_->expect();
}
R operator()( BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, T, t) ) const
R operator()(
BOOST_PP_REPEAT(MOCK_NUM_ARGS, MOCK_FUNCTION_PARAM, _) ) const
{
return (*impl_)( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, t) );
}
@ -105,3 +114,6 @@ namespace detail
};
}
} // mock
#undef MOCK_FUNCTION_CALL
#undef MOCK_FUNCTION_PARAM