Chris@16: // Boost.Units - A C++ library for zero-overhead dimensional analysis and Chris@16: // unit/quantity manipulation and conversion Chris@16: // Chris@16: // Copyright (C) 2003-2008 Matthias Christian Schabel Chris@16: // Copyright (C) 2008 Steven Watanabe Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_UNITS_UTILITY_HPP Chris@16: #define BOOST_UNITS_UTILITY_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@101: #include Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: namespace units { Chris@16: Chris@16: namespace detail { Chris@16: Chris@16: inline Chris@16: std::string Chris@16: demangle(const char* name) Chris@16: { Chris@101: std::string demangled = core::demangle(name); Chris@101: Chris@101: const std::string::size_type prefix_len = sizeof("boost::units::") - 1; Chris@101: std::string::size_type i = 0; Chris@101: for (;;) Chris@16: { Chris@101: std::string::size_type pos = demangled.find("boost::units::", i, prefix_len); Chris@101: if (pos == std::string::npos) Chris@101: break; Chris@101: Chris@101: demangled.erase(pos, prefix_len); Chris@101: i = pos; Chris@16: } Chris@101: Chris@101: return demangled; Chris@16: } Chris@16: Chris@16: } // namespace detail Chris@16: Chris@16: template Chris@101: inline std::string simplify_typename(const L& /*source*/) Chris@16: { Chris@101: return detail::demangle(typeid(L).name()); Chris@16: } Chris@16: Chris@16: } // namespace units Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #endif // BOOST_UNITS_UTILITY_HPP