template <class Function>
typename senf::console::detail::ParsedCommandTraits<Function>::Attributor
senf::console::senf_console_add_node(DirectoryNode & node, std::string const & name,
- Function fn, int)
+ Function fn, int,
+ typename boost::enable_if_c<detail::ParsedCommandTraits<Function>::is_callable>::type *)
{
return senf::console::detail::addOverloadedCommandNode<Function>(node, name, fn);
}
template <class Function>
typename detail::ParsedCommandTraits<Function>::Attributor
- senf_console_add_node(DirectoryNode & node, std::string const & name, Function fn, int);
+ senf_console_add_node(DirectoryNode & node, std::string const & name, Function fn, int,
+ typename boost::enable_if_c<
+ detail::ParsedCommandTraits<Function>::is_callable>::type * = 0);
template <class Signature>
typename detail::ParsedCommandTraits<Signature>::Attributor
template <class FnunctionP, class Function, bool isFN=boost::is_function<Function>::value>
struct ParsedCommandTraits_i
- {};
+ {
+ static const bool is_callable = false;
+ static const bool is_member = false;
+ };
template <class FunctionP, class Function>
struct ParsedCommandTraits_i<FunctionP, Function, true>
typedef typename senf::remove_cvref<typename base_traits::result_type>::type result_type;
+ static const bool is_callable = true;
static const bool is_member = boost::is_member_pointer<base_type>::value;
typedef typename senf::member_class<base_type>::type class_type;
template <class Owner, class Function>
prefix_ senf::console::SimpleCommandNode & senf::console::
senf_console_add_node(DirectoryNode & node, Owner & , std::string const & name,
- Function const & fn, ...)
+ SimpleCommandNode::Function fn, int)
{
return node.add(name,fn);
}
template <class Owner, class Function>
SimpleCommandNode & senf_console_add_node(
- DirectoryNode & node, Owner & owner, std::string const & name, Function const & fn, ...);
+ DirectoryNode & node, Owner & owner, std::string const & name,
+ SimpleCommandNode::Function fn, int);
template <class Owner>
SimpleCommandNode & senf_console_add_node(
template <class Variable>
prefix_ senf::console::VariableAttributor<Variable> senf::console::
senf_console_add_node(DirectoryNode & node, std::string const & name, Variable & var, int,
- typename boost::disable_if< boost::is_convertible<Variable*, ScopedDirectoryBase*> >::type *)
+ typename boost::disable_if< boost::is_convertible<Variable*, ScopedDirectoryBase*> >::type *,
+ typename boost::disable_if_c<detail::ParsedCommandTraits<Variable>::is_callable>::type *)
{
return detail::VariableNodeCreator<Variable>::add(node, name, var);
}
template <class Variable, class Owner>
prefix_ senf::console::VariableAttributor<Variable> senf::console::
-senf_console_add_node(DirectoryNode & node, Owner & owner, std::string const & name,
+senf_console_add_node(DirectoryNode & node, Owner &, std::string const & name,
Variable & var, int,
- typename boost::disable_if< boost::is_convertible<Variable*, ScopedDirectoryBase*> >::type *)
+ typename boost::disable_if< boost::is_convertible<Variable*, ScopedDirectoryBase*> >::type *,
+ typename boost::disable_if_c<detail::ParsedCommandTraits<Variable>::is_callable>::type *)
{
return detail::VariableNodeCreator<Variable>::add(node, name, var);
}
+template <class Variable, class Owner>
+prefix_ typename senf::console::detail::VariableNodeCreator<Variable>::result_type
+senf::console::senf_console_add_node(DirectoryNode & node, Owner &,
+ std::string const & name,
+ boost::reference_wrapper<Variable> var, int)
+{
+ return detail::VariableNodeCreator<Variable>::add(node, name, var.get());
+}
+
#endif
///////////////////////////////cti.e///////////////////////////////////////
template <class Variable>
VariableAttributor<Variable> senf_console_add_node(
DirectoryNode & node, std::string const & name, Variable & var, int,
- typename boost::disable_if< boost::is_convertible<Variable*, ScopedDirectoryBase*> >::type * = 0);
+ typename boost::disable_if< boost::is_convertible<Variable*, ScopedDirectoryBase*> >::type * = 0,
+ typename boost::disable_if_c<detail::ParsedCommandTraits<Variable>::is_callable>::type * = 0);
template <class Variable>
typename detail::VariableNodeCreator<Variable>::result_type
template <class Variable, class Owner>
VariableAttributor<Variable> senf_console_add_node(
DirectoryNode & node, Owner & owner, std::string const & name, Variable & var, int,
- typename boost::disable_if< boost::is_convertible<Variable*, ScopedDirectoryBase*> >::type * = 0);
+ typename boost::disable_if< boost::is_convertible<Variable*, ScopedDirectoryBase*> >::type * = 0,
+ typename boost::disable_if_c<detail::ParsedCommandTraits<Variable>::is_callable>::type * = 0);
+
+ template <class Variable, class Owner>
+ typename detail::VariableNodeCreator<Variable>::result_type
+ senf_console_add_node(DirectoryNode & node, Owner & owner, std::string const & name,
+ boost::reference_wrapper<Variable> var, int);
#endif
// Custom includes
#include <iostream>
#include <sstream>
-#include "Variables.hh"
-#include "Executor.hh"
-#include "Parse.hh"
-#include "ScopedDirectory.hh"
+#include "Console.hh"
#include "../../Utils/auto_unit_test.hh"
#include <boost/test/test_tools.hpp>
typedef T type;
};
+ template < class C, class T > struct remove_member_pointer <T (C::* const) >
+ {
+ typedef T type;
+ };
+
#endif
/** \brief Get class of a member pointer
typedef C type;
};
+ template < class C, class T > struct member_class <T (C::* const) >
+ {
+ typedef C type;
+ };
+
#endif
/** \brief Remove any type of pointer from type