Utils/Console: Console UDPServer
[senf.git] / Utils / Console / Node.hh
index 3e796ec..4cd15d1 100644 (file)
@@ -224,6 +224,7 @@ namespace console {
     class CommandNode;
 
     DirectoryNode & root();
+    void dump(std::ostream & os, DirectoryNode & dir=root());
 
     /** \brief Config/console node tree base-class
 
@@ -278,7 +279,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 +314,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 +365,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 +563,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 +574,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 +704,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