X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FParseParameter.cti;h=a88d7f34d747534b6444038412f791a5f0f4a8f5;hb=869df8df564cd4f4934d4cd1c1b290c2aeabbd92;hp=a36a08cd5b82628b65876f4fe35501f3fd11c083;hpb=bf1d8ba5ce6fc6a169a938183f8d01c8bdbccf32;p=senf.git diff --git a/Console/ParseParameter.cti b/Console/ParseParameter.cti index a36a08c..a88d7f3 100644 --- a/Console/ParseParameter.cti +++ b/Console/ParseParameter.cti @@ -54,6 +54,13 @@ prefix_ senf::console::detail::ParameterInfo::ParameterInfo() defaultValue () {} +template +prefix_ std::string senf::console::detail::ParameterInfo::defaultValueStr() + const +{ + return hasDefault ? ParameterTraits::dump(defaultValue) : ""; +} + /////////////////////////////////////////////////////////////////////////// // senf::console::detail::ReturnValueTraits @@ -92,7 +99,15 @@ parse(ParseCommandInfo::TokensRange const & tokens, Type & out) template prefix_ std::string senf::console::detail::ParameterTraits::typeDescription() { - return prettyName(typeid(Type)); + std::string type (prettyName(typeid(Type))); + std::string::size_type i (type.rfind(':')); + return i == std::string::npos ? type : type.substr(i+1); +} + +template +prefix_ std::string senf::console::detail::ParameterTraits::dump(Type const & value) +{ + return boost::lexical_cast(value); } ///////////////////////////////cti.e///////////////////////////////////////