7 #ifndef __FWTOOLS_STRINGIZER_HPP__ 8 #define __FWTOOLS_STRINGIZER_HPP__ 10 #include "fwTools/config.hpp" 11 #include "fwTools/TypeInfo.hpp" 13 #include <fwCore/Demangler.hpp> 15 #include <boost/lexical_cast.hpp> 16 #include <boost/mpl/if.hpp> 17 #include <boost/type_traits/is_arithmetic.hpp> 20 #include <type_traits> 33 static std::string eval(
const T& t)
37 return ::boost::lexical_cast<std::string>(t);
46 static std::string eval(
const T& t)
66 inline std::string getString(
const T& t)
68 typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< std::is_arithmetic<T>::value,
73 return Choice::eval(t);
84 template<
class T1,
class T2>
85 inline std::string getString(
const std::pair<T1, T2>& t)
87 std::string res = (
"[");
88 res += getString(t.first) +
"," + getString(t.second) +
"]";
101 template<
class ForwardIterator>
102 inline std::string getString(ForwardIterator begin, ForwardIterator end)
104 std::string result(
"[");
107 result += getString( *begin );
108 while (++begin != end)
110 result +=
"," + getString( *begin );
119 FWTOOLS_API std::string getString(
const std::string& aString);
122 FWTOOLS_API std::string getString(
const std::type_info& ti);
125 FWTOOLS_API std::string getString(
const TypeInfo& ti);
129 FWTOOLS_API std::string getString(
const signed char& c);
133 FWTOOLS_API std::string getString(
const char& c);
137 FWTOOLS_API std::string getString(
const unsigned char& c);
140 FWTOOLS_API std::string getString(
const std::string& aString);
146 #endif // __FWTOOLS_STRINGIZER_HPP__
FWCORE_API std::string getClassname() const
Returns "::some::long::namespace::Object" from "::some::long::namespace::Object". ...
typeid, string or object name demangler.