From: g0dil Date: Fri, 14 Nov 2008 10:03:27 +0000 (+0000) Subject: Scheduler/Console: Fix adding variables to ScopedDirectory instances X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=c77d350c7bb263316c35f535542cdeaec3d2aab6;p=senf.git Scheduler/Console: Fix adding variables to ScopedDirectory instances git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@960 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Scheduler/Console/Variables.cti b/Scheduler/Console/Variables.cti index 0e9367f..ef846d5 100644 --- a/Scheduler/Console/Variables.cti +++ b/Scheduler/Console/Variables.cti @@ -195,6 +195,15 @@ senf::console::senf_console_add_node(DirectoryNode & node, std::string const & n return detail::VariableNodeCreator::add(node, name, var.get()); } +template +prefix_ senf::console::VariableAttributor senf::console:: +senf_console_add_node(DirectoryNode & node, Owner & owner, std::string const & name, + Variable & var, int, + typename boost::disable_if< boost::is_convertible >::type *) +{ + return detail::VariableNodeCreator::add(node, name, var); +} + #endif ///////////////////////////////cti.e/////////////////////////////////////// diff --git a/Scheduler/Console/Variables.hh b/Scheduler/Console/Variables.hh index 1afc654..74db97c 100644 --- a/Scheduler/Console/Variables.hh +++ b/Scheduler/Console/Variables.hh @@ -54,6 +54,11 @@ namespace console { senf_console_add_node(DirectoryNode & node, std::string const & name, boost::reference_wrapper var, int); + template + 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); + #endif /** \brief Variable command attributes (const) diff --git a/Scheduler/Console/Variables.test.cc b/Scheduler/Console/Variables.test.cc index 0bcebc7..58348f7 100644 --- a/Scheduler/Console/Variables.test.cc +++ b/Scheduler/Console/Variables.test.cc @@ -93,6 +93,27 @@ BOOST_AUTO_UNIT_TEST(variables) .formatter(&testFormatter); } +namespace { + + class Test2 + { + public: + senf::console::ScopedDirectory dir; + + Test2() : dir(this), var_(0) + { dir.add("var", var_); } + + private: + int var_; + }; + +} + +BOOST_AUTO_UNIT_TEST(memberVariables) +{ + Test2 test2ob; +} + #ifdef COMPILE_CHECK COMPILE_FAIL(constVariable)