Replace deprecated boost sp_typeinfo.hpp

This commit is contained in:
Dirk Faust 2019-12-17 08:46:59 +01:00
parent e78d548e04
commit b3c4829f15

View file

@ -14,7 +14,11 @@
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/erase.hpp> #include <boost/algorithm/string/erase.hpp>
#include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/trim.hpp>
#if BOOST_VERSION >= 107000
#include <boost/core/typeinfo.hpp>
#else
#include <boost/detail/sp_typeinfo.hpp> #include <boost/detail/sp_typeinfo.hpp>
#endif
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <stdexcept> #include <stdexcept>
#include <typeinfo> #include <typeinfo>
@ -24,7 +28,7 @@
#include <cstdlib> #include <cstdlib>
#endif #endif
#define MOCK_TYPE_NAME( t ) mock::detail::type_name( BOOST_SP_TYPEID(t) ) #define MOCK_TYPE_NAME( t ) mock::detail::type_name( BOOST_CORE_TYPEID(t) )
namespace mock namespace mock
{ {
@ -33,7 +37,7 @@ namespace detail
class type_name class type_name
{ {
public: public:
explicit type_name( const boost::detail::sp_typeinfo& info ) explicit type_name( const boost::core::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 )
@ -43,7 +47,7 @@ namespace detail
} }
private: private:
void serialize( std::ostream& s, void serialize( std::ostream& s,
const boost::detail::sp_typeinfo& info ) const const boost::core::typeinfo& info ) const
{ {
const char* name = info.name(); const char* name = info.name();
#ifdef __GNUC__ #ifdef __GNUC__
@ -108,7 +112,7 @@ namespace detail
return std::string::npos; return std::string::npos;
} }
const boost::detail::sp_typeinfo* info_; const boost::core::typeinfo* info_;
}; };
} }
} // mock } // mock