From: g0dil Date: Tue, 24 Mar 2009 14:23:58 +0000 (+0000) Subject: Utils/Console: Fix adding DirectoryNode's X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=61895b04f84c4c5ce8974d187bbc739c70fdf898;p=senf.git Utils/Console: Fix adding DirectoryNode's git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1167 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/PPI/Setup.cti b/PPI/Setup.cti index f18f8b4..509bbb1 100644 --- a/PPI/Setup.cti +++ b/PPI/Setup.cti @@ -26,6 +26,7 @@ //#include "Setup.ih" // Custom includes +#include "Jack.hh" #define prefix_ inline ///////////////////////////////cti.p/////////////////////////////////////// @@ -37,7 +38,7 @@ prefix_ void senf::ppi:: connect(T & source, C & target, typename boost::disable_if< boost::is_base_of >::type *, typename boost::enable_if< boost::is_base_of >::type *, - typename boost::disable_if< boost::is_base_of >:: type *) + typename boost::disable_if< boost::is_base_of >::type *) { connect(source.output, target); } @@ -47,7 +48,7 @@ prefix_ void senf::ppi:: connect(C & source, T & target, typename boost::enable_if< boost::is_base_of >::type *, typename boost::disable_if< boost::is_base_of >::type *, - typename boost::disable_if< boost::is_base_of >:: type *) + typename boost::disable_if< boost::is_base_of >::type *) { connect(source, target.input); } @@ -57,8 +58,8 @@ prefix_ void senf::ppi:: connect(T1 & source, T2 & target, typename boost::disable_if< boost::is_base_of >::type *, typename boost::disable_if< boost::is_base_of >::type *, - typename boost::disable_if< boost::is_base_of >:: type *, - typename boost::disable_if< boost::is_base_of >:: type *) + typename boost::disable_if< boost::is_base_of >::type *, + typename boost::disable_if< boost::is_base_of >::type *) { connect(source.output, target.input); } diff --git a/Utils/Console/Node.cci b/Utils/Console/Node.cci index 3c21bc9..59228c2 100644 --- a/Utils/Console/Node.cci +++ b/Utils/Console/Node.cci @@ -212,6 +212,12 @@ senf::console::DirectoryNode::mkdir(std::string const & name) return add(name, create()); } +prefix_ senf::console::DirectoryNode & +senf::console::DirectoryNode::provideDirectory(std::string const & name) +{ + return hasChild(name) ? getDirectory(name) : mkdir(name); +} + prefix_ senf::console::DirectoryNode::ChildrenRange senf::console::DirectoryNode::children() const { @@ -348,6 +354,13 @@ senf::console::senf_console_add_node(DirectoryNode & node, std::string const & n return node.add(name, SimpleCommandNode::create(fn)); } +prefix_ senf::console::DirectoryNode & +senf::console::senf_console_add_node(DirectoryNode & node, std::string const & name, + DirectoryNode & dir, int) +{ + return node.add(name, dir.thisptr()); +} + #endif ///////////////////////////////cci.e/////////////////////////////////////// diff --git a/Utils/Console/Node.hh b/Utils/Console/Node.hh index fcd44d0..3e796ec 100644 --- a/Utils/Console/Node.hh +++ b/Utils/Console/Node.hh @@ -538,6 +538,8 @@ namespace console { DirectoryNode & mkdir(std::string const & name); ///< Create sub-directory node + DirectoryNode & provideDirectory(std::string const & name); + ///< Return subdirectory, possibly creating it ChildrenRange children() const; ///< Return iterator range over all children. /**< The returned range is sorted by child name. */ @@ -711,6 +713,9 @@ namespace console { SimpleCommandNode & senf_console_add_node(DirectoryNode & node, std::string const & name, SimpleCommandNode::Function fn, int); + DirectoryNode & senf_console_add_node(DirectoryNode & node, std::string const & name, + DirectoryNode & dir, int); + #endif }} diff --git a/Utils/Console/ScopedDirectory.cti b/Utils/Console/ScopedDirectory.cti index 6fedea2..b93344c 100644 --- a/Utils/Console/ScopedDirectory.cti +++ b/Utils/Console/ScopedDirectory.cti @@ -88,6 +88,14 @@ senf_console_add_node(DirectoryNode & node, Owner & owner, std::string const & n return node.add(name, boost::bind(fn,boost::ref(owner),_1,_2)); } +template +prefix_ senf::console::DirectoryNode & +senf::console::senf_console_add_node(DirectoryNode & node, Owner & owner, + std::string const & name, DirectoryNode & dir, int) +{ + return node.add(name, dir.thisptr()); +} + template prefix_ senf::console::DirectoryNode & senf::console:: senf_console_add_node(DirectoryNode & dir, std::string const & name, Node const & node, int, diff --git a/Utils/Console/ScopedDirectory.hh b/Utils/Console/ScopedDirectory.hh index 512386e..1712f9f 100644 --- a/Utils/Console/ScopedDirectory.hh +++ b/Utils/Console/ScopedDirectory.hh @@ -197,6 +197,10 @@ namespace console { DirectoryNode & node, Owner & owner, std::string const & name, void (Owner::*fn)(std::ostream &, ParseCommandInfo const &), int); + template + DirectoryNode & senf_console_add_node(DirectoryNode & node, Owner & owner, + std::string const & name, DirectoryNode & dir, int); + template DirectoryNode & senf_console_add_node( DirectoryNode & dir, std::string const & name, Node const & node, int, diff --git a/Utils/Console/Variables.cti b/Utils/Console/Variables.cti index 3c7fd8e..f428842 100644 --- a/Utils/Console/Variables.cti +++ b/Utils/Console/Variables.cti @@ -199,6 +199,7 @@ template prefix_ senf::console::VariableAttributor senf::console:: senf_console_add_node(DirectoryNode & node, std::string const & name, Variable & var, int, typename boost::disable_if< boost::is_convertible >::type *, + typename boost::disable_if< boost::is_convertible >::type *, typename boost::disable_if_c::is_callable>::type *) { return detail::VariableNodeCreator::add(node, name, var); @@ -214,9 +215,10 @@ senf::console::senf_console_add_node(DirectoryNode & node, std::string const & n template prefix_ senf::console::VariableAttributor senf::console:: -senf_console_add_node(DirectoryNode & node, Owner &, std::string const & name, +senf_console_add_node(DirectoryNode & node, Owner & owner, std::string const & name, Variable & var, int, - typename boost::disable_if< boost::is_convertible >::type *, + typename boost::disable_if< boost::is_convertible >::type *, + typename boost::disable_if< boost::is_convertible >::type *, typename boost::disable_if_c::is_callable>::type *) { return detail::VariableNodeCreator::add(node, name, var); diff --git a/Utils/Console/Variables.hh b/Utils/Console/Variables.hh index 13fb787..870f2ed 100644 --- a/Utils/Console/Variables.hh +++ b/Utils/Console/Variables.hh @@ -42,12 +42,15 @@ namespace console { class ScopedDirectoryBase; template class VariableAttributor; + + #ifndef DOXYGEN template VariableAttributor senf_console_add_node( DirectoryNode & node, std::string const & name, Variable & var, int, typename boost::disable_if< boost::is_convertible >::type * = 0, + typename boost::disable_if< boost::is_convertible >::type * = 0, typename boost::disable_if_c::is_callable>::type * = 0); template @@ -59,6 +62,7 @@ namespace console { VariableAttributor senf_console_add_node( DirectoryNode & node, Owner & owner, std::string const & name, Variable & var, int, typename boost::disable_if< boost::is_convertible >::type * = 0, + typename boost::disable_if< boost::is_convertible >::type * = 0, typename boost::disable_if_c::is_callable>::type * = 0); template