X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FNode.hh;h=9bf37ecb2f5300ea154e4f3f0e3693f6dab76201;hb=869df8df564cd4f4934d4cd1c1b290c2aeabbd92;hp=29c5511fc5cfc98446ffa0b95f032e0f9c5ab0fe;hpb=7527fa188b41bd1e1ce1eb55777bfe360eb8373e;p=senf.git diff --git a/Console/Node.hh b/Console/Node.hh index 29c5511..9bf37ec 100644 --- a/Console/Node.hh +++ b/Console/Node.hh @@ -205,6 +205,7 @@ #include "../Utils/Exception.hh" #include "../Utils/mpl.hh" #include "../Utils/Logger/SenfLog.hh" +#include "../Utils/type_traits.hh" #include "Parse.hh" //#include "Node.mpp" @@ -306,14 +307,16 @@ namespace console { * static_cast(0), * static_cast(0), * static_cast(0), - 0) ) result_type; + 0) ) base_type; + typedef typename senf::remove_cvref::type value_type; - typedef typename boost::remove_reference::type NodeType; + typedef typename value_type::node_type NodeType; + typedef typename value_type::return_type result_type; /// Internal struct Creator { - static NodeType & create(DirectoryNode & node, std::string const & name, - Object const & ob); + static result_type create(DirectoryNode & node, std::string const & name, + Object const & ob); }; }; @@ -353,6 +356,9 @@ namespace console { typedef boost::iterator_range ChildrenRange; typedef ChildMap::const_iterator child_iterator; + typedef DirectoryNode node_type; + typedef DirectoryNode & return_type; + /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members ///\{ @@ -376,8 +382,8 @@ namespace console { \a name is empty, it is set to 'unnamed'. */ template - typename NodeCreateTraits::NodeType & add (std::string const & name, - Object const & ob); + typename NodeCreateTraits::result_type add (std::string const & name, + Object const & ob); ///< Generic child node factory /**< This member is used to create a new child node of the current directory. The type of node created depends on @@ -584,6 +590,9 @@ namespace console { typedef boost::function Function; + typedef SimpleCommandNode node_type; + typedef SimpleCommandNode & return_type; + /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members ///\{