X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FConsole%2FParsedCommand.ih;h=3fbb1b5e8a33088b61166fb602a5c133ccc12fcf;hb=941ca33da6ee01d78c07fa6b514de10da1ef3948;hp=0dbe33be296344602a924a35676ac716e58831f5;hpb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;p=senf.git diff --git a/senf/Utils/Console/ParsedCommand.ih b/senf/Utils/Console/ParsedCommand.ih index 0dbe33b..3fbb1b5 100644 --- a/senf/Utils/Console/ParsedCommand.ih +++ b/senf/Utils/Console/ParsedCommand.ih @@ -116,6 +116,7 @@ namespace detail { { static const bool is_callable = false; static const bool is_member = false; + static const bool is_simple = false; }; template @@ -138,6 +139,7 @@ namespace detail { static const bool is_callable = true; static const bool is_member = boost::is_member_pointer::value; + static const bool is_simple = false; typedef typename senf::member_class::type class_type; @@ -148,7 +150,9 @@ namespace detail { // Disable auto-parsing for ParseCommandInfo arg -> register manually parsed command template struct ParsedCommandTraits_i - {}; + { + static const bool is_simple = true; + }; template struct ParsedCommandTraits @@ -158,6 +162,41 @@ namespace detail { struct ParsedCommandAddNodeAccess; + // What is THIS about ?? + + // Ok, here's the dope: parsed commands may optionally have an std::ostream & first argument. If + // this argument is given, then the function will be called with the console output stream as + // it's first argument. + // + // This is implemented in the following way: ParsedCommandOverload (the class responsible for + // calling the callback) will ALWAYS pass the stream as first argument. If the user callback + // expects os as it's first argument, 'ignoreOneArg' will be false and the user supplied + // function will be directly passed to ParsedCommandOverload. + // + // If however, it does NOT take an std::ostream first argument, 'ignoreOneArg' will be true and + // the create member will use boost::bind to DROP the first argument. + + template + struct CreateParsedCommandOverload + {}; + + template + struct CreateParsedCommandOverload + { + typedef typename Traits::traits traits; + + template + static typename senf::console::ParsedCommandOverload::ptr create(Function fn) + { return senf::console::ParsedCommandOverload::create(fn); }; + }; + +# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, SENF_CONSOLE_MAX_COMMAND_ARITY, \ + SENF_ABSOLUTE_INCLUDE_PATH(Utils/Console/ParsedCommand.mpp), \ + 4)) +# include BOOST_PP_ITERATE() + #endif }}}