X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FConsole%2FVariables.hh;h=a2cf85532acd3622737d113e49dac072753516ee;hb=99c145da3884f5c20a74337927ef2cbc073d80d7;hp=a732b41f9decd131c27abf18d15b0e588bbaceda;hpb=b8a2a9d30d2c0aa986c6c86f9cc9288ead67ebdb;p=senf.git diff --git a/senf/Utils/Console/Variables.hh b/senf/Utils/Console/Variables.hh index a732b41..a2cf855 100644 --- a/senf/Utils/Console/Variables.hh +++ b/senf/Utils/Console/Variables.hh @@ -34,7 +34,7 @@ #include "Variables.ih" //#include "Variables.mpp" -///////////////////////////////hh.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// namespace senf { namespace console { @@ -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,9 +181,11 @@ namespace factory { template ConstVariableFactory Variable(boost::reference_wrapper var); +#endif + }}} -///////////////////////////////hh.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// //#include "Variables.cci" //#include "Variables.ct" #include "Variables.cti"