X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FConsole%2FOverloadedCommand.hh;h=3d6b6fcde8ce0da915694493b5b41c9f333b463d;hb=941ca33da6ee01d78c07fa6b514de10da1ef3948;hp=3be6b42ab875cf78a43a814f4b4f01864de0163f;hpb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;p=senf.git diff --git a/senf/Utils/Console/OverloadedCommand.hh b/senf/Utils/Console/OverloadedCommand.hh index 3be6b42..3d6b6fc 100644 --- a/senf/Utils/Console/OverloadedCommand.hh +++ b/senf/Utils/Console/OverloadedCommand.hh @@ -30,7 +30,8 @@ #include "Node.hh" #include #include -#include "../../Utils/intrusive_refcount.hh" +#include +#include //#include "OverloadedCommand.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -203,6 +204,9 @@ namespace console { ptr thisptr(); cptr thisptr() const; + static OverloadedCommandNode & insertOverload(DirectoryNode & dir, std::string const & name, + CommandOverload::ptr overload); + private: OverloadedCommandNode(); @@ -259,6 +263,27 @@ namespace console { std::string doc_; }; + class SimpleOverloadAttributor + : public detail::NodeFactory + { + public: + typedef OverloadedCommandNode node_type; + typedef OverloadedCommandNode & result_type; + + explicit SimpleOverloadAttributor(SimpleCommandOverload::Function fn); + + SimpleOverloadAttributor const & doc(std::string const & doc) const; + SimpleOverloadAttributor const & shortdoc(std::string const & doc) const; + SimpleOverloadAttributor const & overloadDoc(std::string const & doc) const; + + OverloadedCommandNode & create(DirectoryNode & dir, std::string const & name) const; + + private: + SimpleCommandOverload::ptr overload_; + mutable boost::optional doc_; + mutable boost::optional shortdoc_; + }; + }} ///////////////////////////////hh.e////////////////////////////////////////