// Custom includes
#include "Node.hh"
#include <boost/intrusive_ptr.hpp>
+#include <boost/range/iterator_range.hpp>
#include "../../Utils/intrusive_refcount.hh"
//#include "OverloadedCommand.mpp"
std::string type; ///< Argument type (string representation)
std::string defaultValue; ///< Default value (string representation) or empty string
std::string doc; ///< Documentation for this argument
+ bool singleToken; ///< \c true, if argument is parsed from single token
};
/** \brief Base class for command overload of OverloadedCommandNode
virtual ~CommandOverload();
- void execute(std::ostream & os, ParseCommandInfo const & command);
+ void execute(boost::any & rv, std::ostream & os, ParseCommandInfo const & command);
///< Call the overload
/**< If the \a arguments are not acceptable for this
overload, a SyntaxErrorException must be thrown.
Same as operator()() */
- void operator()(std::ostream & os, ParseCommandInfo const & command);
+ void operator()(boost::any & rv, std::ostream & os, ParseCommandInfo const & command);
///< Call the overload
/**< If the \a arguments are not acceptable for this
overload, a SyntaxErrorException must be thrown.
/**< This member must be implemented in the derived class to
return the overloads documentation string. */
- virtual void v_execute(std::ostream & os, ParseCommandInfo const & command) const = 0;
+ virtual void v_execute(boost::any & rv, std::ostream & os, ParseCommandInfo const & command)
+ const = 0;
///< Execute the overload
/**< This member must be implemented in the derived class
o execute the overload. */
class OverloadedCommandNode
: public CommandNode
{
+ typedef std::vector<CommandOverload::ptr> Overloads;
+
public:
///////////////////////////////////////////////////////////////////////////
// Types
typedef OverloadedCommandNode node_type;
typedef OverloadedCommandNode & return_type;
+ typedef boost::iterator_range<Overloads::const_iterator> OverloadsRange;
+
///////////////////////////////////////////////////////////////////////////
///\name Structors and default members
///@{
OverloadedCommandNode & doc(std::string const & doc);
///< Assign global help for all overloads
+ OverloadedCommandNode & shortdoc(std::string const & doc);
+ ///< Assign short documentation for all overloads
unsigned overloadIndex(CommandOverload const & overload);
///< Return the overload index for \a overload
/**< overloadIndex returns the index of \a overload in the
internal list of overloads. */
+ OverloadsRange overloads() const; ///< Get all overloads
+
ptr thisptr();
cptr thisptr() const;
OverloadedCommandNode();
virtual void v_help(std::ostream & output) const;
- virtual void v_execute(std::ostream & output, ParseCommandInfo const & command) const;
-
- typedef std::vector<CommandOverload::ptr> Overloads;
+ virtual std::string v_shorthelp() const;
+ virtual void v_execute(boost::any & rv, std::ostream & os, ParseCommandInfo const & command)
+ const;
Overloads overloads_;
std::string doc_;
+ std::string shortdoc_;
};
/** \brief Basic command overload
virtual unsigned v_numArguments() const;
virtual void v_argumentDoc(unsigned index, ArgumentDoc & doc) const;
virtual std::string v_doc() const;
- virtual void v_execute(std::ostream & os, ParseCommandInfo const & command) const;
+ virtual void v_execute(boost::any & rv, std::ostream & os, ParseCommandInfo const & command)
+ const;
Function fn_;
std::string doc_;