#define IH_ParsedCommand_ 1
// Custom includes
+#include <boost/function.hpp>
+#include <boost/intrusive_ptr.hpp>
+#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
std::string type;
std::string name;
+ std::string defaultDoc;
bool hasDefault;
std::string doc;
: public ArgumentInfoBase
{
typedef boost::intrusive_ptr<ArgumentInfo> ptr;
+ typedef boost::function<void (ParseCommandInfo::TokensRange const &,
+ ParameterType &)> Parser;
static ptr create();
ArgumentInfo();
ParameterType defaultValue;
+ Parser parser;
virtual std::string defaultValueStr() const;
};
- template <class Function, bool isFN=senf::is_any_function<Function>::value>
- struct ParsedCommandTraits
- {};
-
// FirstArgType returns void, if the function has no arguments, otherwise it returns arg1_type
template <class Traits, bool flag=(Traits::arity>0)>
typedef typename Traits::arg1_type type;
};
- template <class Function>
- struct ParsedCommandTraits<Function, true>
+ template <class Function, bool isFN=senf::is_any_function<Function>::value>
+ struct ParsedCommandTraits
+ {};
+
+ template <class Fn>
+ struct ParsedCommandTraits<Fn, true>
{
- typedef Function base_type;
+ typedef Fn base_type;
typedef typename senf::remove_any_pointer<base_type>::type function_type;
typedef boost::function_traits<function_type> base_traits;
typedef typename FirstArgType<base_traits>::type first_arg_type;
base_traits>
::type traits;
+ typedef typename senf::remove_cvref<typename base_traits::result_type>::type result_type;
+
static const bool is_member = boost::is_member_pointer<base_type>::value;
typedef typename senf::member_class<base_type>::type class_type;
- };
- template <class Type>
- struct CheckVoidReturn
- {
- template <class Fn>
- static void call(Fn fn, std::ostream & os);
+ typedef ParsedCommandOverload<traits> Overload;
+ typedef ParsedArgumentAttributor<Overload> Attributor;
};
- template <>
- struct CheckVoidReturn<void>
- {
- template <class Fn>
- static void call(Fn fn, std::ostream & os);
- };
+ struct ParsedCommandAddNodeAccess;
#endif