Move the boost-deprecation-switch to the config.hpp

and use better naming
This commit is contained in:
Dirk Faust 2019-12-20 10:24:13 +01:00
parent d140e31f6f
commit f6f24a9c39
2 changed files with 13 additions and 12 deletions

View file

@ -101,4 +101,13 @@
# endif # endif
#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 #endif // MOCK_CONFIG_HPP_INCLUDED

View file

@ -28,15 +28,7 @@
#include <cstdlib> #include <cstdlib>
#endif #endif
#if BOOST_VERSION >= 107000 #define MOCK_TYPE_NAME( t ) mock::detail::type_name( MOCK_TYPEID(t) )
#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) )
namespace mock namespace mock
{ {
@ -45,7 +37,7 @@ namespace detail
class type_name class type_name
{ {
public: public:
explicit type_name( const TYPEINFO& info ) explicit type_name( const MOCK_TYPEINFO& info )
: info_( &info ) : info_( &info )
{} {}
friend std::ostream& operator<<( std::ostream& s, const type_name& t ) friend std::ostream& operator<<( std::ostream& s, const type_name& t )
@ -55,7 +47,7 @@ namespace detail
} }
private: private:
void serialize( std::ostream& s, void serialize( std::ostream& s,
const TYPEINFO& info ) const const MOCK_TYPEINFO& info ) const
{ {
const char* name = info.name(); const char* name = info.name();
#ifdef __GNUC__ #ifdef __GNUC__
@ -120,7 +112,7 @@ namespace detail
return std::string::npos; return std::string::npos;
} }
const TYPEINFO* info_; const MOCK_TYPEINFO* info_;
}; };
} }
} // mock } // mock