X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FVariables.ih;h=3772fd0c7ae9033d4b27268146ba0870b5ddde05;hb=6e417a227d417cef20d55af94e2474fbe9c280b8;hp=e1a2ce8aa1d1526d1124358985312ee768bcbef7;hpb=80c83d2565c50f8ad33af2be0f4cb3e5735cafcf;p=senf.git diff --git a/Console/Variables.ih b/Console/Variables.ih index e1a2ce8..3772fd0 100644 --- a/Console/Variables.ih +++ b/Console/Variables.ih @@ -28,19 +28,27 @@ // Custom includes #include +#include ///////////////////////////////ih.p//////////////////////////////////////// namespace senf { namespace console { + + template class ConstVariableAttributor; + template class VariableAttributor; + namespace detail { +#ifndef DOXYGEN + template struct QueryVariable { typedef Variable const & Signature (); typedef boost::function Function; typedef detail::ParsedCommandTraits Traits; + typedef Variable const & result_type; QueryVariable(Variable const & var); @@ -56,16 +64,34 @@ namespace detail { typedef boost::function Function; typedef detail::ParsedCommandTraits Traits; typedef boost::function OnChangeHandler; + typedef void result_type; - SetVariable(Variable & var); + SetVariable(Variable & var, OnChangeHandler handler = OnChangeHandler()); void operator()(Variable const & value) const; - void onChange(OnChangeHandler handler); Variable & var_; OnChangeHandler handler_; }; + template ::value> + struct VariableNodeCreator + { + typedef VariableAttributor result_type; + static VariableAttributor add(DirectoryNode & node, std::string const & name, + Variable & var); + }; + + template + struct VariableNodeCreator + { + typedef ConstVariableAttributor result_type; + static ConstVariableAttributor add(DirectoryNode & node, std::string const & name, + Variable & var); + }; + +#endif + }}} ///////////////////////////////ih.e////////////////////////////////////////