Command node which allows multiple registered callbacks. More...

#include <senf/Utils/Console/OverloadedCommand.hh>

Inheritance diagram for senf::console::OverloadedCommandNode:

Public Types

typedef boost::shared_ptr< OverloadedCommandNodeptr
 
typedef boost::shared_ptr< OverloadedCommandNode const > cptr
 
typedef boost::weak_ptr< OverloadedCommandNodeweak_ptr
 
typedef OverloadedCommandNode node_type
 
typedef OverloadedCommandNodereturn_type
 
typedef boost::iterator_range< Overloads::const_iteratorOverloadsRange
 
- Public Types inherited from senf::console::CommandNode
typedef boost::shared_ptr< CommandNodeptr
 
typedef boost::shared_ptr< CommandNode const > cptr
 
typedef boost::weak_ptr< CommandNodeweak_ptr
 
- Public Types inherited from senf::console::GenericNode
typedef boost::shared_ptr< GenericNodeptr
 
typedef boost::shared_ptr< GenericNode const > cptr
 
typedef boost::weak_ptr< GenericNodeweak_ptr
 

Public Member Functions

template<class Command >
Command & add (boost::intrusive_ptr< Command > overload)
 Add an additional overload. More...
 
OverloadedCommandNodedoc (std::string const &doc)
 Assign global help for all overloads. More...
 
OverloadedCommandNodeshortdoc (std::string const &doc)
 Assign short documentation for all overloads. More...
 
unsigned overloadIndex (CommandOverload const &overload)
 Return the overload index for overload. More...
 
OverloadsRange overloads () const
 Get all overloads. More...
 
ptr thisptr ()
 
cptr thisptr () const
 
- Public Member Functions inherited from senf::console::CommandNode
void execute (std::ostream &output, ParseCommandInfo const &command) const
 Execute the command. More...
 
void execute (boost::any &rv, std::ostream &output, ParseCommandInfo const &command) const
 Execute the command. More...
 
void operator() (std::ostream &output, ParseCommandInfo const &command) const
 Execute the command. More...
 
void operator() (boost::any &rv, std::ostream &output, ParseCommandInfo const &command) const
 
ptr thisptr ()
 
cptr thisptr () const
 
- Public Member Functions inherited from senf::console::GenericNode
virtual ~GenericNode ()
 
std::string const & name () const
 Node name. More...
 
boost::shared_ptr< DirectoryNodeparent () const
 Parent node. More...
 
std::string path () const
 Node path. More...
 
std::string path (DirectoryNode const &root) const
 Node path up to root. More...
 
ptr unlink ()
 Remove node from it's parent directory. More...
 
void rename (std::string const &newName)
 Rename node name in it's parent directory. More...
 
bool active () const
 true, if node is attached to the root() node More...
 
void help (std::ostream &output) const
 Write help info to output. More...
 
std::string shorthelp () const
 Get short (one-line) documentation. More...
 
ptr thisptr ()
 Get smart pointer to node. More...
 
cptr thisptr () const
 Get smart pointer to node (const) More...
 
bool isChildOf (DirectoryNode &parent) const
 true, if node is a child of parent More...
 
bool operator== (GenericNode &other) const
 true, if this and other are the same node More...
 
bool operator!= (GenericNode &other) const
 true, if this and other are different nodes More...
 
bool isDirectory () const
 true, if this is a directory node More...
 
bool isLink () const
 true, if this is a link node More...
 
bool isCommand () const
 true, if this is a command node More...
 
GenericNode const & followLink () const
 Follow link if this node is a link node. More...
 
GenericNodefollowLink ()
 Follow link if this node is a link node. More...
 

Static Public Member Functions

static OverloadedCommandNodeinsertOverload (DirectoryNode &dir, std::string const &name, CommandOverload::ptr overload)
 

Structors and default members

static ptr create ()
 

Additional Inherited Members

- Protected Member Functions inherited from senf::console::CommandNode
 CommandNode ()
 
- Protected Member Functions inherited from senf::console::GenericNode
 GenericNode ()
 
void name (std::string const &name)
 

Detailed Description

Command node which allows multiple registered callbacks.

OverloadedCommandNode is like SimpleCommandNode but allows to register multiple commands to a single node. This works by calling each command in the list consecutively until no 'SyntaxErrorException' exception is thrown.

This works by first adding an OverloadedCommandNode to the directory in question and then adding commands to that node. Commands are derived from CommandOverload.

    However, this facility is normally used not directly but indirectly (and automatically) when
    adding argument parsing callbacks.

    \warning For this to work, the commands <b>must</b> do all syntax checking before doing any
        operation

Definition at line 153 of file OverloadedCommand.hh.

Member Typedef Documentation

◆ cptr

Definition at line 163 of file OverloadedCommand.hh.

◆ node_type

◆ OverloadsRange

◆ ptr

Definition at line 162 of file OverloadedCommand.hh.

◆ return_type

◆ weak_ptr

Member Function Documentation

◆ add()

template<class Command >
Command& senf::console::OverloadedCommandNode::add ( boost::intrusive_ptr< Command >  overload)

Add an additional overload.

◆ create()

static ptr senf::console::OverloadedCommandNode::create ( )
static

◆ doc()

OverloadedCommandNode& senf::console::OverloadedCommandNode::doc ( std::string const &  doc)

Assign global help for all overloads.

◆ insertOverload()

senf::console::OverloadedCommandNode & senf::console::OverloadedCommandNode::insertOverload ( DirectoryNode dir,
std::string const &  name,
CommandOverload::ptr  overload 
)
static

Definition at line 84 of file OverloadedCommand.cc.

◆ overloadIndex()

unsigned senf::console::OverloadedCommandNode::overloadIndex ( CommandOverload const &  overload)

Return the overload index for overload.

overloadIndex returns the index of overload in the internal list of overloads.

◆ overloads()

OverloadsRange senf::console::OverloadedCommandNode::overloads ( ) const

Get all overloads.

◆ shortdoc()

OverloadedCommandNode& senf::console::OverloadedCommandNode::shortdoc ( std::string const &  doc)

Assign short documentation for all overloads.

◆ thisptr() [1/2]

ptr senf::console::OverloadedCommandNode::thisptr ( )

◆ thisptr() [2/2]

cptr senf::console::OverloadedCommandNode::thisptr ( ) const

The documentation for this class was generated from the following files: