X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FScopedDirectory.hh;h=91909b6bd773491cf5dc8db4ca3fb2dc3242bb90;hb=fe92380af7b511d398290e4ab0c535025006b57b;hp=cec50dbb9136d8bfc4ff710dc3cba63930b14700;hpb=30c1daf8a1c404209210f76a9a54bcfde443603b;p=senf.git diff --git a/Console/ScopedDirectory.hh b/Console/ScopedDirectory.hh index cec50db..91909b6 100644 --- a/Console/ScopedDirectory.hh +++ b/Console/ScopedDirectory.hh @@ -49,13 +49,16 @@ namespace console { * static_cast(0), * static_cast(0), * static_cast(0), - * static_cast(0)) ) result_type; + * static_cast(0), + * static_cast(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, Owner & owner, + static result_type create(DirectoryNode & node, Owner & owner, std::string const & name, Object const & ob); }; }; @@ -72,7 +75,10 @@ namespace console { ///\{ GenericNode::ptr remove(std::string const & name); + bool hasChild(std::string const & name) const; + DirectoryNode & getDirectory(std::string const & name) const; DirectoryNode & operator[](std::string const & name) const; + CommandNode & getCommand(std::string const & name) const; CommandNode & operator()(std::string const & name) const; GenericNode & get(std::string const & name) const; DirectoryNode & mkdir(std::string const & name); @@ -142,8 +148,8 @@ namespace console { /////////////////////////////////////////////////////////////////////////// template - typename OwnerNodeCreateTraits::NodeType & add(std::string const & name, - Object const & ob); + typename OwnerNodeCreateTraits::result_type add(std::string const & name, + Object const & ob); ///< Create new child node /**< Adds a new child node to the (proxied) DirectoryNode. How the node is added is configured @@ -157,24 +163,25 @@ namespace console { Owner * owner_; }; +#ifndef DOXYGEN + template <> class ScopedDirectory : public ScopedDirectoryBase { public: template - typename NodeCreateTraits::NodeType & add(std::string const & name, - Object const & ob); + typename NodeCreateTraits::result_type add(std::string const & name, + Object const & ob); }; -#ifndef DOXYGEN template SimpleCommandNode & senf_console_add_node( - DirectoryNode & node, Owner & owner, std::string const & name, Function const & fn); + DirectoryNode & node, Owner & owner, std::string const & name, Function const & fn, ...); template SimpleCommandNode & senf_console_add_node( - DirectoryNode & node, Owner & owner, std::string const & name, - void (Owner::*fn)(std::ostream & output, CommandNode::Arguments const & arguments)); + DirectoryNode & node, Owner & owner, std::string const & name, + void (Owner::*fn)(std::ostream &, ParseCommandInfo const &), int); template DirectoryNode & senf_console_add_node(