X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FConsole%2FNode.hh;h=4772b45ba912840c905ef05c16070f2ffc77c27a;hb=fd3a0e8ac95d1158e9ea661ddf9187b67c70169f;hp=0367f5a872aa56a0db636a908cca829a1fd6517b;hpb=a22f6d21df6c911d65f76d7731bcf92b1906bb09;p=senf.git diff --git a/Utils/Console/Node.hh b/Utils/Console/Node.hh index 0367f5a..4772b45 100644 --- a/Utils/Console/Node.hh +++ b/Utils/Console/Node.hh @@ -278,7 +278,8 @@ namespace console { bool active() const; ///< \c true, if node is attached to the root() node - void help(std::ostream & output) const; /// Write help info to \a output + void help(std::ostream & output) const; ///< Write help info to \a output + std::string shorthelp() const; ///< Get short (one-line) documentation ptr thisptr(); ///< Get smart pointer to node cptr thisptr() const; ///< Get smart pointer to node (const) @@ -312,8 +313,12 @@ namespace console { #endif virtual void v_help(std::ostream & output) const = 0; ///< Provide help information - /**< This member must be implemented in derived classes - to provide node specific help information. */ + /**< This member must be implemented in derived classes to + provide node specific help information. */ + virtual std::string v_shorthelp() const = 0; + ///< Provide short documentation + /**< This member must be implemented in derived classes to + provide node specific documentation. */ private: std::string name_; @@ -359,6 +364,7 @@ namespace console { explicit LinkNode(GenericNode & node); virtual void v_help(std::ostream &) const; + virtual std::string v_shorthelp() const; GenericNode::ptr node_; }; @@ -436,6 +442,7 @@ namespace console { static ptr create(); ///< Create node object. /**< You should normally use either mkdir() or ScopedDirectory instead of create() */ + ~DirectoryNode(); ///\} /////////////////////////////////////////////////////////////////////////// @@ -537,6 +544,8 @@ namespace console { DirectoryNode & mkdir(std::string const & name); ///< Create sub-directory node + DirectoryNode & provideDirectory(std::string const & name); + ///< Return subdirectory, possibly creating it ChildrenRange children() const; ///< Return iterator range over all children. /**< The returned range is sorted by child name. */ @@ -553,6 +562,7 @@ namespace console { /////////////////////////////////////////////////////////////////////////// DirectoryNode & doc(std::string const & doc); ///< Set node documentation + DirectoryNode & shortdoc(std::string const & doc); ///< Set node short documentation ptr thisptr(); cptr thisptr() const; @@ -563,9 +573,11 @@ namespace console { private: void add(GenericNode::ptr node); virtual void v_help(std::ostream & output) const; + virtual std::string v_shorthelp() const; ChildMap children_; std::string doc_; + std::string shortdoc_; friend DirectoryNode & root(); }; @@ -691,18 +703,21 @@ namespace console { cptr thisptr() const; SimpleCommandNode & doc(std::string const & doc); + SimpleCommandNode & shortdoc(std::string const & doc); protected: SimpleCommandNode(Function const & fn); private: virtual void v_help(std::ostream & output) const; + virtual std::string v_shorthelp() const; virtual void v_execute(boost::any & rv, std::ostream & os, ParseCommandInfo const & command) const; Function fn_; std::string doc_; + std::string shortdoc_; }; #ifndef DOXYGEN @@ -710,6 +725,9 @@ namespace console { SimpleCommandNode & senf_console_add_node(DirectoryNode & node, std::string const & name, SimpleCommandNode::Function fn, int); + DirectoryNode & senf_console_add_node(DirectoryNode & node, std::string const & name, + DirectoryNode & dir, int); + #endif }}