Refactoring

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@320 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2011-05-11 16:01:06 +00:00
parent 5ba2169ec3
commit 13cf400e82
2 changed files with 19 additions and 18 deletions

View file

@ -9,27 +9,28 @@
#ifndef MOCK_CONFIG_HPP_INCLUDED #ifndef MOCK_CONFIG_HPP_INCLUDED
#define MOCK_CONFIG_HPP_INCLUDED #define MOCK_CONFIG_HPP_INCLUDED
#include <boost/preprocessor/inc.hpp> #include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/comparison/less.hpp>
#ifndef MOCK_MAX_ARGS #ifndef MOCK_MAX_ARGS
# define MOCK_MAX_ARGS 9 # define MOCK_MAX_ARGS 9
#elif BOOST_PP_LESS(9, MOCK_MAX_ARGS)
# define MOCK_USE_BOOST_PHOENIX
#endif #endif
#define MOCK_NUM_ARGS BOOST_PP_INC(MOCK_MAX_ARGS) #define MOCK_NUM_ARGS BOOST_PP_INC(MOCK_MAX_ARGS)
#if defined(MOCK_USE_BOOST_PHOENIX) || (MOCK_MAX_ARGS > 9)
# ifndef PHOENIX_LIMIT
# define PHOENIX_LIMIT MOCK_MAX_ARGS
# elif (PHOENIX_LIMIT < MOCK_MAX_ARGS)
# error PHOENIX_LIMIT must be set to MOCK_MAX_ARGS or higher
# endif
#else
# define MOCK_USE_BOOST_BIND
#endif
#ifndef BOOST_FUNCTION_MAX_ARGS #ifndef BOOST_FUNCTION_MAX_ARGS
# define BOOST_FUNCTION_MAX_ARGS MOCK_MAX_ARGS # define BOOST_FUNCTION_MAX_ARGS MOCK_MAX_ARGS
#elif (BOOST_FUNCTION_MAX_ARGS < MOCK_MAX_ARGS) #elif BOOST_PP_LESS(BOOST_FUNCTION_MAX_ARGS, MOCK_MAX_ARGS)
# error BOOST_FUNCTION_MAX_ARGS must be set to MOCK_MAX_ARGS or higher # error BOOST_FUNCTION_MAX_ARGS must be set to MOCK_MAX_ARGS or higher
#endif #endif
#ifdef MOCK_USE_BOOST_PHOENIX
# ifndef PHOENIX_LIMIT
# define PHOENIX_LIMIT MOCK_MAX_ARGS
# elif BOOST_PP_LESS(PHOENIX_LIMIT, MOCK_MAX_ARGS)
# error PHOENIX_LIMIT must be set to MOCK_MAX_ARGS or higher
# endif
#endif
#endif // MOCK_CONFIG_HPP_INCLUDED #endif // MOCK_CONFIG_HPP_INCLUDED

View file

@ -10,10 +10,10 @@
#define MOCK_LAMBDA_HPP_INCLUDED #define MOCK_LAMBDA_HPP_INCLUDED
#include "config.hpp" #include "config.hpp"
#ifdef MOCK_USE_BOOST_BIND #ifdef MOCK_USE_BOOST_PHOENIX
#include <boost/bind.hpp>
#else
#include <boost/spirit/home/phoenix/bind.hpp> #include <boost/spirit/home/phoenix/bind.hpp>
#else
#include <boost/bind.hpp>
#endif #endif
#include <boost/function.hpp> #include <boost/function.hpp>
@ -21,10 +21,10 @@ namespace mock
{ {
namespace detail namespace detail
{ {
#ifdef MOCK_USE_BOOST_BIND #ifdef MOCK_USE_BOOST_PHOENIX
using boost::bind;
#else
using boost::phoenix::bind; using boost::phoenix::bind;
#else
using boost::bind;
#endif #endif
template< typename Result, typename Signature > template< typename Result, typename Signature >