X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FParsedCommand.ih;h=90231c20dfeb69d4673b84a90e6b12945bf2c6a2;hb=1b1d76302a5d61e918ef71f1c8e11f80ac1262e2;hp=d4a89f83207a670ecedc012d9e5a141963695043;hpb=81a550d520e8531b7f353e1ce0da5b99c249cecb;p=senf.git diff --git a/Console/ParsedCommand.ih b/Console/ParsedCommand.ih index d4a89f8..90231c2 100644 --- a/Console/ParsedCommand.ih +++ b/Console/ParsedCommand.ih @@ -35,10 +35,25 @@ 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 + /** \brief Internal: Argument information structure + + This class is used to hold argument information for automatically parsed commands. + \see ParsedCommandOverloadBase + */ struct ArgumentInfoBase : public intrusive_refcount { @@ -55,6 +70,12 @@ namespace detail { virtual std::string defaultValueStr() const = 0; }; + /** \brief Internal: Argument information structure + + This class is used to hold argument information for automatically parsed commands. + + \see ParsedCommandOverloadBase + */ template struct ArgumentInfo : public ArgumentInfoBase @@ -72,6 +93,8 @@ namespace detail { virtual std::string defaultValueStr() const; }; +#ifndef DOXYGEN + // FirstArgType returns void, if the function has no arguments, otherwise it returns arg1_type template 0)> @@ -86,14 +109,14 @@ namespace detail { typedef typename Traits::arg1_type type; }; - template ::value> - struct ParsedCommandTraits + template ::value> + struct ParsedCommandTraits_i {}; - template - struct ParsedCommandTraits + template + struct ParsedCommandTraits_i { - typedef Function base_type; + typedef FunctionP base_type; typedef typename senf::remove_any_pointer::type function_type; typedef boost::function_traits base_traits; typedef typename FirstArgType::type first_arg_type; @@ -111,8 +134,24 @@ namespace detail { static const bool is_member = boost::is_member_pointer::value; typedef typename senf::member_class::type class_type; + + typedef ParsedCommandOverload Overload; + typedef ParsedArgumentAttributor Attributor; }; + // Disable auto-parsing for ParseCommandInfo arg -> register manually parsed command + template + struct ParsedCommandTraits_i + {}; + + template + struct ParsedCommandTraits + : public ParsedCommandTraits_i< FunctionP, + typename senf::remove_any_pointer::type > + {}; + + struct ParsedCommandAddNodeAccess; + #endif }}}