X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FParsedCommand.ih;h=c2d887baa58bf4ee8d1c8c3ac5295353171bd74a;hb=fe92380af7b511d398290e4ab0c535025006b57b;hp=d8a72d28ab5715739957ddca477e4aa97c8d3138;hpb=63c40810b93b4d8f3d6dad5f987adc5f2bf5b5ed;p=senf.git diff --git a/Console/ParsedCommand.ih b/Console/ParsedCommand.ih index d8a72d2..c2d887b 100644 --- a/Console/ParsedCommand.ih +++ b/Console/ParsedCommand.ih @@ -27,11 +27,25 @@ #define IH_ParsedCommand_ 1 // Custom includes +#include +#include +#include "Parse.hh" ///////////////////////////////ih.p//////////////////////////////////////// namespace senf { namespace console { + + template < class FunctionTraits, + class ReturnType=typename FunctionTraits::result_type, + unsigned arity=FunctionTraits::arity > + class ParsedCommandOverload; + + template < class Overload, + unsigned index=0, + bool flag=(index < unsigned(Overload::traits::arity)) > + class ParsedArgumentAttributor; + namespace detail { #ifndef DOXYGEN @@ -43,6 +57,7 @@ namespace detail { std::string type; std::string name; + std::string defaultDoc; bool hasDefault; std::string doc; @@ -56,19 +71,18 @@ namespace detail { : public ArgumentInfoBase { typedef boost::intrusive_ptr ptr; + typedef boost::function Parser; static ptr create(); ArgumentInfo(); ParameterType defaultValue; + Parser parser; virtual std::string defaultValueStr() const; }; - template ::value> - struct ParsedCommandTraits - {}; - // FirstArgType returns void, if the function has no arguments, otherwise it returns arg1_type template 0)> @@ -83,10 +97,14 @@ namespace detail { typedef typename Traits::arg1_type type; }; - template - struct ParsedCommandTraits + template ::value> + struct ParsedCommandTraits + {}; + + template + struct ParsedCommandTraits { - typedef Function base_type; + typedef Fn base_type; typedef typename senf::remove_any_pointer::type function_type; typedef boost::function_traits base_traits; typedef typename FirstArgType::type first_arg_type; @@ -99,24 +117,17 @@ namespace detail { base_traits> ::type traits; + typedef typename senf::remove_cvref::type result_type; + static const bool is_member = boost::is_member_pointer::value; typedef typename senf::member_class::type class_type; - }; - template - struct CheckVoidReturn - { - template - static void call(Fn fn, std::ostream & os); + typedef ParsedCommandOverload Overload; + typedef ParsedArgumentAttributor Attributor; }; - template <> - struct CheckVoidReturn - { - template - static void call(Fn fn, std::ostream & os); - }; + struct ParsedCommandAddNodeAccess; #endif