Refactoring

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@153 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2010-05-07 12:20:28 +00:00
parent 348c60a757
commit a5e961c805
2 changed files with 14 additions and 9 deletions

View file

@ -20,6 +20,7 @@
#include <boost/preprocessor/repetition/enum_params.hpp> #include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp> #include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/function_types/parameter_types.hpp> #include <boost/function_types/parameter_types.hpp>
#include <boost/function_types/result_type.hpp>
#include <boost/mpl/at.hpp> #include <boost/mpl/at.hpp>
#include <ostream> #include <ostream>
#include <vector> #include <vector>
@ -105,7 +106,7 @@ namespace detail
int line_; int line_;
}; };
template< typename Result, typename Signature, int > template< typename Signature, int >
class expectation class expectation
{ {
}; };
@ -147,9 +148,11 @@ namespace detail
return *this; \ return *this; \
} }
template< typename Result, typename Signature > template< typename Signature >
class expectation< Result, Signature, 0 > class expectation< Signature, 0 >
: public expectation_base, public action< Result, Signature > : public expectation_base
, public action< BOOST_DEDUCED_TYPENAME
boost::function_types::result_type< Signature >::type, Signature >
{ {
public: public:
bool is_valid() const bool is_valid() const
@ -180,9 +183,11 @@ namespace detail
#define MOCK_EXPECTATION_IS_VALID(z, n, d) && c##n##_( a##n ) #define MOCK_EXPECTATION_IS_VALID(z, n, d) && c##n##_( a##n )
#define MOCK_EXPECTATION_SERIALIZE(z, n, d) BOOST_PP_IF(n, << ", " <<,) m.c##n##_ #define MOCK_EXPECTATION_SERIALIZE(z, n, d) BOOST_PP_IF(n, << ", " <<,) m.c##n##_
#define MOCK_EXPECTATION(z, n, d) \ #define MOCK_EXPECTATION(z, n, d) \
template< typename Result, typename Signature > \ template< typename Signature > \
class expectation< Result, Signature, n > \ class expectation< Signature, n > \
: public expectation_base, public action< Result, Signature > \ : public expectation_base \
, public action< BOOST_DEDUCED_TYPENAME \
boost::function_types::result_type< Signature >::type, Signature > \
{ \ { \
BOOST_PP_REPEAT_FROM_TO(0, n, MOCK_EXPECTATION_TYPEDEF, BOOST_PP_EMPTY) \ BOOST_PP_REPEAT_FROM_TO(0, n, MOCK_EXPECTATION_TYPEDEF, BOOST_PP_EMPTY) \
public: \ public: \

View file

@ -48,8 +48,8 @@ namespace mock
}; };
private: private:
typedef detail::expectation< result_type, Signature, arity::value > typedef BOOST_DEDUCED_TYPENAME
expectation_type; detail::expectation< Signature, arity::value > expectation_type;
public: public:
struct function_tag struct function_tag