X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FConsole%2FOverloadedCommand.hh;fp=senf%2FUtils%2FConsole%2FOverloadedCommand.hh;h=ab339f32323985e3e636e035f113f78d63e88d4a;hb=f13780e9e4da7df981d6f6542fbdc714beb34765;hp=349159cd6ccbe584e8781d5916b0273ee330dd79;hpb=6019c18e7b74d3e91293f35df660a80346ef7a1e;p=senf.git diff --git a/senf/Utils/Console/OverloadedCommand.hh b/senf/Utils/Console/OverloadedCommand.hh index 349159c..ab339f3 100644 --- a/senf/Utils/Console/OverloadedCommand.hh +++ b/senf/Utils/Console/OverloadedCommand.hh @@ -31,6 +31,7 @@ #include #include #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,7 +263,32 @@ 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_; + }; + +namespace factory { + + SimpleOverloadAttributor Command(SimpleCommandOverload::Function fn); + +}}} ///////////////////////////////hh.e//////////////////////////////////////// #include "OverloadedCommand.cci"