/*-----------------------------------------------------------------------------+ Copyright (c) 2007-2009: Joachim Faulhaber +------------------------------------------------------------------------------+ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENCE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +-----------------------------------------------------------------------------*/ #ifndef BOOST_ICL_TYPE_TO_STRING_HPP_JOFA_080416 #define BOOST_ICL_TYPE_TO_STRING_HPP_JOFA_080416 #include #include #include #include #include #include namespace boost{ namespace icl { //-------------------------------------------------------------------------- template struct type_to_string { /** Convert the type to it's typestring */ static std::string apply(); }; //-------------------------------------------------------------------------- template<>inline std::string type_to_string::apply() { return "bool"; } template<>inline std::string type_to_string::apply() { return "char"; } template<>inline std::string type_to_string::apply(){ return "short"; } template<>inline std::string type_to_string::apply() { return "int"; } template<>inline std::string type_to_string::apply() { return "long"; } template<>inline std::string type_to_string::apply(){ return "Long"; } template<>inline std::string type_to_string::apply(){ return "char+"; } template<>inline std::string type_to_string::apply(){ return "short+"; } template<>inline std::string type_to_string::apply() { return "int+"; } template<>inline std::string type_to_string::apply() { return "long+"; } template<>inline std::string type_to_string::apply(){ return "Long+"; } template<>inline std::string type_to_string::apply() { return "flt"; } template<>inline std::string type_to_string::apply() { return "dbl"; } //------------------------------------------------------------------------- template class Templ> struct unary_template_to_string { static std::string apply(); }; template class Unary, class Type> struct type_to_string > { static std::string to_string() { return unary_template_to_string::apply()+"<"+type_to_string::apply()+">"; } }; // --------------------------------------------------------------------------- templateclass Templ> struct binary_template_to_string { static std::string apply(); }; template class Binary, class Type1, class Type2> struct type_to_string > { static std::string apply() { return binary_template_to_string::apply()+ "<"+type_to_string::apply()+","+type_to_string::apply()+">"; } }; // --------------------------------------------------------------------------- template<> struct type_to_string { static std::string apply() { return "string"; } }; }} // namespace boost icl #endif