X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FConsole%2FNode.hh;h=b8702be8f0ccd7ec484f7e5e79ff994cc5d2bc4e;hb=5443435c4c2b6e4386c5334b5b8358273f2bae93;hp=9a44c5af43fe5bba92576f9d82f7e8e7f54ccbf1;hpb=f5eba06e0b792b9e70555def60b0b98b8139381c;p=senf.git diff --git a/Utils/Console/Node.hh b/Utils/Console/Node.hh index 9a44c5a..b8702be 100644 --- a/Utils/Console/Node.hh +++ b/Utils/Console/Node.hh @@ -223,8 +223,19 @@ namespace console { class DirectoryNode; class CommandNode; + /** \brief Get console root node */ DirectoryNode & root(); + /** \brief Dump console directory structure + + Recursively dumps the console directory structure starting at \a dir. By default, dumps the + complete tree beginning at the root node. + + In contrast to the console 'lr' command, links are dumped by showing the \e absolute path + to the target node. + */ + void dump(std::ostream & os, DirectoryNode & dir=root()); + /** \brief Config/console node tree base-class GenericNode is the base class of all node objects. There are two basic node types derived @@ -279,6 +290,7 @@ 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 + 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 +324,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 +375,7 @@ namespace console { explicit LinkNode(GenericNode & node); virtual void v_help(std::ostream &) const; + virtual std::string v_shorthelp() const; GenericNode::ptr node_; }; @@ -556,6 +573,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; @@ -566,9 +584,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(); }; @@ -694,18 +714,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