From f6f24a9c39721212c8d501ea2ca931bcc27d8dc9 Mon Sep 17 00:00:00 2001 From: Dirk Faust Date: Fri, 20 Dec 2019 10:24:13 +0100 Subject: [PATCH] Move the boost-deprecation-switch to the config.hpp and use better naming --- include/turtle/config.hpp | 9 +++++++++ include/turtle/detail/type_name.hpp | 16 ++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/include/turtle/config.hpp b/include/turtle/config.hpp index 16b0ed5..232c7cd 100644 --- a/include/turtle/config.hpp +++ b/include/turtle/config.hpp @@ -101,4 +101,13 @@ # endif #endif +#if BOOST_VERSION >= 107000 +# define MOCK_TYPEID( t ) BOOST_CORE_TYPEID(t) +# define MOCK_TYPEINFO boost::core::typeinfo +#else +# define MOCK_TYPEID( t ) BOOST_SP_TYPEID(t) +# define MOCK_TYPEINFO boost::detail::sp_typeinfo +#endif + + #endif // MOCK_CONFIG_HPP_INCLUDED diff --git a/include/turtle/detail/type_name.hpp b/include/turtle/detail/type_name.hpp index b9c6a6a..e0e5f8b 100644 --- a/include/turtle/detail/type_name.hpp +++ b/include/turtle/detail/type_name.hpp @@ -28,15 +28,7 @@ #include #endif -#if BOOST_VERSION >= 107000 -#define MOCK_TYPE_ID( t ) BOOST_CORE_TYPEID(t) -#define TYPEINFO boost::core::typeinfo -#else -#define MOCK_TYPE_ID( t ) BOOST_SP_TYPEID(t) -#define TYPEINFO boost::detail::sp_typeinfo -#endif - -#define MOCK_TYPE_NAME( t ) mock::detail::type_name( MOCK_TYPE_ID(t) ) +#define MOCK_TYPE_NAME( t ) mock::detail::type_name( MOCK_TYPEID(t) ) namespace mock { @@ -45,7 +37,7 @@ namespace detail class type_name { public: - explicit type_name( const TYPEINFO& info ) + explicit type_name( const MOCK_TYPEINFO& info ) : info_( &info ) {} friend std::ostream& operator<<( std::ostream& s, const type_name& t ) @@ -55,7 +47,7 @@ namespace detail } private: void serialize( std::ostream& s, - const TYPEINFO& info ) const + const MOCK_TYPEINFO& info ) const { const char* name = info.name(); #ifdef __GNUC__ @@ -120,7 +112,7 @@ namespace detail return std::string::npos; } - const TYPEINFO* info_; + const MOCK_TYPEINFO* info_; }; } } // mock