X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FConsole%2FVariables.hh;h=13fb7872d5f1d5104e31cd697fe170b8d442d1ee;hb=f52075dad8b8291570fa2c61ef9b5ec0a04d1e5e;hp=d8a9468019d83344b0bf1d455a4d6bc85766d342;hpb=8488a803a9e1dfa293af161eb271503990d6fdd3;p=senf.git diff --git a/Scheduler/Console/Variables.hh b/Scheduler/Console/Variables.hh index d8a9468..13fb787 100644 --- a/Scheduler/Console/Variables.hh +++ b/Scheduler/Console/Variables.hh @@ -23,8 +23,8 @@ /** \file \brief Variables public header */ -#ifndef HH_Variables_ -#define HH_Variables_ 1 +#ifndef HH_SENF_Scheduler_Console_Variables_ +#define HH_SENF_Scheduler_Console_Variables_ 1 // Custom includes #include @@ -84,6 +84,9 @@ namespace console { ConstVariableAttributor doc(std::string const & doc); ConstVariableAttributor formatter(Formatter formatter); + OverloadedCommandNode & node() const; ///< Return the node object + operator OverloadedCommandNode & () const; ///< Automatically convert to node object + protected: explicit ConstVariableAttributor(QueryOverload & queryOverload); @@ -100,8 +103,8 @@ namespace console { variables type to set the variable and another one taking no arguments and just querying the current variable value. \code - int var; - ScopedDirectory<> dir; + int var; + ScopedDirectory<> dir; dir.add("var", var); \endcode @@ -118,12 +121,12 @@ namespace console { boost::cref(). Such a variable cannot be changed only queried. Therefore, it does not have the parser() and typeName() attributes. \code - dir.add("const_var", boost::cref(var)) + dir.add("const_var", boost::cref(var)) \endcode \ingroup console_commands */ - template + template class VariableAttributor : public ConstVariableAttributor { @@ -139,36 +142,36 @@ namespace console { VariableAttributor doc(std::string const & doc); ///< Set documentation of the variable VariableAttributor formatter(Formatter formatter); ///< Set formatter - /**< The \a formatter must be a callable with a signature - compatible with - \code - void formatter(Variable const & value, std::ostream & os); - \endcode - The \a formatter takes the return value of the call \a - value and writes it properly formated to \a os. */ + /**< The \a formatter must be a callable with a signature + compatible with + \code + void formatter(Variable const & value, std::ostream & os); + \endcode + The \a formatter takes the return value of the call \a + value and writes it properly formated to \a os. */ VariableAttributor parser(Parser parser); ///< Set argument parser - /**< The parser is an arbitrary callable object with - the signature - \code - void parser(senf::console::ParseCommandInfo::TokensRange const & tokens, value_type & out); - \endcode - - where \c value_type is the type of the overload - parameter. The parser must read and parse the complete - \a tokens range and return the parsed value in \a - out. If the parser fails, it must raise a - senf::console::SyntaxErrorException. */ + /**< The parser is an arbitrary callable object with + the signature + \code + void parser(senf::console::ParseCommandInfo::TokensRange const & tokens, value_type & out); + \endcode + + where \c value_type is the type of the overload + parameter. The parser must read and parse the complete + \a tokens range and return the parsed value in \a + out. If the parser fails, it must raise a + senf::console::SyntaxErrorException. */ VariableAttributor typeName(std::string const & name); ///< Set name of the variable type VariableAttributor onChange(OnChangeHandler handler); ///< Set change callback - /**< The \a handler callback is called, whenever the value - of the variable is changed. The new value has already - been set, when the callback is called, the old value is - passed to the callback. The callback must have a - signature compatible to - \code - void handler(Variable const & oldValue); - \endcode */ + /**< The \a handler callback is called, whenever the value + of the variable is changed. The new value has already + been set, when the callback is called, the old value is + passed to the callback. The callback must have a + signature compatible to + \code + void handler(Variable const & oldValue); + \endcode */ protected: