X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FConsole%2FVariables.hh;fp=senf%2FUtils%2FConsole%2FVariables.hh;h=ee78fbce7d29312f8d1c8173c511ad4c64323d9f;hb=45d5b4cfa79eee57d5de832960cdac2c6a114f71;hp=a732b41f9decd131c27abf18d15b0e588bbaceda;hpb=a9c9fa201ef6a90e40a7acc690e8c0c12a901736;p=senf.git diff --git a/senf/Utils/Console/Variables.hh b/senf/Utils/Console/Variables.hh index a732b41..ee78fbc 100644 --- a/senf/Utils/Console/Variables.hh +++ b/senf/Utils/Console/Variables.hh @@ -44,10 +44,8 @@ namespace console { namespace factory { - /** \brief Variable command attributes (const) +#ifndef DOXYGEN - \see VariableFactory - */ template class ConstVariableFactory : public detail::NodeFactory @@ -72,7 +70,9 @@ namespace factory { boost::optional shortdoc_; }; - /** \brief Variable command attributes +#endif + + /** \brief Variable node factory Variable commands allow to register any arbitrary variable as a command node. The variable will be registered as two command overloads: One which takes a single argument of the @@ -94,17 +94,24 @@ namespace factory { variable. It is also possible, to register a variable read-only. To achieve this, just wrap it with \c - boost::cref(). Such a variable cannot be changed only queried. Therefore, it does not have - the parser() and typeName() attributes. + boost::cref(). Such a variable only queried. Therefore, it does not have the parser() and + typeName() attributes. \code dir.add("const_var", fty::Variable(boost::cref(var))); \endcode - \ingroup console_commands + \note Even though the interface is documented as a class, in reality it is implemented using + factory functions returning instances of an internal factory class. + + \see \ref console_variables */ +#ifdef DOXYGEN + class Variable +#else template class VariableFactory : public ConstVariableFactory +#endif { public: typedef typename detail::SetVariable::Traits::Overload SetOverload; @@ -147,17 +154,21 @@ namespace factory { void handler(Variable const & oldValue); \endcode */ - OverloadedCommandNode & create(DirectoryNode & dir, std::string const & name) const; - - explicit VariableFactory(Variable & var); + explicit VariableFactory(Variable & var); ///< Create Variable node protected: private: + OverloadedCommandNode & create(DirectoryNode & dir, std::string const & name) const; + typename SetOverload::ptr setOverload_; Variable & var_; + + friend class senf::console::DirectoryNode; }; +#ifndef DOXYGEN + template VariableFactory Variable(Var & var); @@ -170,6 +181,8 @@ namespace factory { template ConstVariableFactory Variable(boost::reference_wrapper var); +#endif + }}} ///////////////////////////////hh.e////////////////////////////////////////