X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FConsole%2FParsedCommand.ih;h=5ee1a84d0559b2207d3dfdde30ec24e3615a3544;hb=f13780e9e4da7df981d6f6542fbdc714beb34765;hp=0dbe33be296344602a924a35676ac716e58831f5;hpb=6019c18e7b74d3e91293f35df660a80346ef7a1e;p=senf.git diff --git a/senf/Utils/Console/ParsedCommand.ih b/senf/Utils/Console/ParsedCommand.ih index 0dbe33b..5ee1a84 100644 --- a/senf/Utils/Console/ParsedCommand.ih +++ b/senf/Utils/Console/ParsedCommand.ih @@ -158,6 +158,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 }}}