X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FConsole%2FTraits.cti;h=f6dd8927dc72a3c3dee74693024417f7ed3a5b15;hb=52a6fb56dce12132287e181b787d2474d93b0183;hp=db9163fadbd553434e00c0b88937dc269441d2ec;hpb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;p=senf.git diff --git a/senf/Utils/Console/Traits.cti b/senf/Utils/Console/Traits.cti index db9163f..f6dd892 100644 --- a/senf/Utils/Console/Traits.cti +++ b/senf/Utils/Console/Traits.cti @@ -28,7 +28,7 @@ // Custom includes #include #include -#include "../../Utils/TypeInfo.hh" +#include #define prefix_ inline ///////////////////////////////cti.p/////////////////////////////////////// @@ -66,6 +66,12 @@ prefix_ void senf::console::parse(ParseCommandInfo::TokensRange const & tokens, } template +prefix_ std::string senf::console::str(Type const & value) +{ + return ArgumentTraits::str(value); +} + +template prefix_ void senf::console::format(Type const & value, std::ostream & os) { ReturnValueTraits::format(value, os); @@ -74,9 +80,7 @@ prefix_ void senf::console::format(Type const & value, std::ostream & os) template prefix_ std::string senf::console::ArgumentTraits::description() { - std::string type (prettyName(typeid(Type))); - std::string::size_type i (type.rfind(':')); - return i == std::string::npos ? type : type.substr(i+1); + return prettyBaseName(typeid(Type)); } template @@ -87,6 +91,24 @@ prefix_ std::string senf::console::ArgumentTraits::str(Type const & value) return ss.str(); } +/////////////////////////////////////////////////////////////////////////// +// senf::console::detail::CharArgumentTraits + +template +prefix_ void senf::console::detail::CharArgumentTraits:: +parse(ParseCommandInfo::TokensRange const & tokens, CharT & out) +{ + typename base::type v; + base::parse(tokens,v); + out = v; +} + +template +prefix_ std::string senf::console::detail::CharArgumentTraits::description() +{ + return std::numeric_limits::is_signed ? "byte" : "unsigned byte"; +} + ///////////////////////////////cti.e/////////////////////////////////////// #undef prefix_