prettier diagnostic information, using <boost/units/detail/utility.hpp>

[SVN r59398]
This commit is contained in:
Emil Dotchevski
2010-02-01 00:25:15 +00:00
parent ab7a4ebb1a
commit a955aa431e
4 changed files with 17 additions and 11 deletions

View File

@ -1,4 +1,4 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. //Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
//Distributed under the Boost Software License, Version 1.0. (See accompanying //Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -25,7 +25,7 @@ boost
{ {
public: public:
virtual char const * tag_typeid_name() const = 0; virtual std::string tag_typeid_name() const = 0;
virtual std::string value_as_string() const = 0; virtual std::string value_as_string() const = 0;
protected: protected:
@ -62,7 +62,7 @@ boost
private: private:
char const * tag_typeid_name() const; std::string tag_typeid_name() const;
std::string value_as_string() const; std::string value_as_string() const;
value_type value_; value_type value_;

View File

@ -1,4 +1,4 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. //Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
//Distributed under the Boost Software License, Version 1.0. (See accompanying //Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -15,19 +15,23 @@
#include <boost/detail/sp_typeinfo.hpp> #include <boost/detail/sp_typeinfo.hpp>
#include <boost/current_function.hpp> #include <boost/current_function.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#ifndef BOOST_NO_TYPEID
#include <boost/units/detail/utility.hpp>
#endif
#include <string>
namespace namespace
boost boost
{ {
template <class T> template <class T>
inline inline
char const * std::string
tag_type_name() tag_type_name()
{ {
#ifdef BOOST_NO_TYPEID #ifdef BOOST_NO_TYPEID
return BOOST_CURRENT_FUNCTION; return BOOST_CURRENT_FUNCTION;
#else #else
return typeid(T*).name(); return units::detail::demangle(typeid(T*).name());
#endif #endif
} }

View File

@ -1,4 +1,4 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. //Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
//Distributed under the Boost Software License, Version 1.0. (See accompanying //Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -15,7 +15,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/exception/get_error_info.hpp> #include <boost/exception/get_error_info.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/config.hpp> #ifndef BOOST_NO_RTTI
#include <boost/units/detail/utility.hpp>
#endif
#include <exception> #include <exception>
#include <sstream> #include <sstream>
#include <string> #include <string>
@ -135,7 +137,7 @@ boost
} }
#ifndef BOOST_NO_RTTI #ifndef BOOST_NO_RTTI
tmp << std::string("Dynamic exception type: ") << tmp << std::string("Dynamic exception type: ") <<
(be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).type_.name() << '\n'; units::detail::demangle((be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).type_.name()) << '\n';
#endif #endif
if( with_what && se ) if( with_what && se )
tmp << "std::exception::what: " << wh << '\n'; tmp << "std::exception::what: " << wh << '\n';

View File

@ -1,4 +1,4 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. //Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
//Distributed under the Boost Software License, Version 1.0. (See accompanying //Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -47,7 +47,7 @@ boost
template <class Tag,class T> template <class Tag,class T>
inline inline
char const * std::string
error_info<Tag,T>:: error_info<Tag,T>::
tag_typeid_name() const tag_typeid_name() const
{ {