senf::console::CommandOverload Class Referenceabstract

Base class for command overload of OverloadedCommandNode. More...

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

Inheritance diagram for senf::console::CommandOverload:

Public Types

typedef boost::intrusive_ptr< CommandOverloadptr
 
typedef boost::intrusive_ptr< CommandOverload const > cptr
 
- Public Types inherited from senf::intrusive_refcount_base
typedef unsigned refcount_t
 

Public Member Functions

virtual ~CommandOverload ()
 
void execute (boost::any &rv, std::ostream &os, ParseCommandInfo const &command)
 Call the overload. More...
 
void operator() (boost::any &rv, std::ostream &os, ParseCommandInfo const &command)
 Call the overload. More...
 
unsigned numArguments () const
 Number of arguments this overload takes. More...
 
void argumentDoc (unsigned index, ArgumentDoc &doc) const
 Get information on argument index. More...
 
std::string doc () const
 Get overload documentation. More...
 
OverloadedCommandNodenode () const
 Access owning node. More...
 
unsigned overloadIndex () const
 Get index of overload in it's OverloadedCommandNode. More...
 
- Public Member Functions inherited from senf::intrusive_refcount_base
virtual ~intrusive_refcount_base ()
 
refcount_t refcount () const
 
bool is_shared () const
 

Protected Member Functions

 CommandOverload ()
 
virtual unsigned v_numArguments () const =0
 Return the number of arguments. More...
 
virtual void v_argumentDoc (unsigned index, ArgumentDoc &doc) const =0
 Return argument documentation. More...
 
virtual std::string v_doc () const =0
 Return overload documentation. More...
 
virtual void v_execute (boost::any &rv, std::ostream &os, ParseCommandInfo const &command) const =0
 Execute the overload. More...
 
- Protected Member Functions inherited from senf::intrusive_refcount
 intrusive_refcount ()
 
- Protected Member Functions inherited from intrusive_refcount_t< intrusive_refcount >
 intrusive_refcount_t ()
 
- Protected Member Functions inherited from senf::intrusive_refcount_base
 intrusive_refcount_base ()
 
void add_ref ()
 
bool release ()
 

Detailed Description

Base class for command overload of OverloadedCommandNode.

This class is the base class of the commands which may be added to an OverloadedCommandNode.

Definition at line 52 of file OverloadedCommand.hh.

Member Typedef Documentation

◆ cptr

typedef boost::intrusive_ptr<CommandOverload const> senf::console::CommandOverload::cptr

Definition at line 60 of file OverloadedCommand.hh.

◆ ptr

Definition at line 59 of file OverloadedCommand.hh.

Constructor & Destructor Documentation

◆ ~CommandOverload()

senf::console::CommandOverload::~CommandOverload ( )
virtual

Definition at line 29 of file OverloadedCommand.cc.

◆ CommandOverload()

senf::console::CommandOverload::CommandOverload ( )
protected

Definition at line 75 of file OverloadedCommand.cc.

Member Function Documentation

◆ argumentDoc()

void senf::console::CommandOverload::argumentDoc ( unsigned  index,
ArgumentDoc doc 
) const

Get information on argument index.

The information is returned in doc. doc must be empty before this call.

Precondition
index < numArguments()
Parameters
[in]indexArgument index
[out]docArgument documentation

Definition at line 50 of file OverloadedCommand.cc.

◆ doc()

std::string senf::console::CommandOverload::doc ( ) const

Get overload documentation.

Definition at line 56 of file OverloadedCommand.cc.

◆ execute()

void senf::console::CommandOverload::execute ( boost::any &  rv,
std::ostream &  os,
ParseCommandInfo const &  command 
)

Call the overload.

If the arguments are not acceptable for this overload, a SyntaxErrorException must be thrown. Same as operator()()

Definition at line 38 of file OverloadedCommand.cc.

◆ node()

senf::console::OverloadedCommandNode & senf::console::CommandOverload::node ( ) const

Access owning node.

Precondition
The command must have been added to an OverloadedCommandNode.

Definition at line 62 of file OverloadedCommand.cc.

◆ numArguments()

unsigned senf::console::CommandOverload::numArguments ( ) const

Number of arguments this overload takes.

Definition at line 44 of file OverloadedCommand.cc.

◆ operator()()

void senf::console::CommandOverload::operator() ( boost::any &  rv,
std::ostream &  os,
ParseCommandInfo const &  command 
)

Call the overload.

If the arguments are not acceptable for this overload, a SyntaxErrorException must be thrown. Same as execute()

Definition at line 32 of file OverloadedCommand.cc.

◆ overloadIndex()

unsigned senf::console::CommandOverload::overloadIndex ( ) const

Get index of overload in it's OverloadedCommandNode.

Definition at line 69 of file OverloadedCommand.cc.

◆ v_argumentDoc()

virtual void senf::console::CommandOverload::v_argumentDoc ( unsigned  index,
ArgumentDoc doc 
) const
protectedpure virtual

Return argument documentation.

The member must be implemented int the derived class to return all documentation information for the index'th parameter in doc.

◆ v_doc()

virtual std::string senf::console::CommandOverload::v_doc ( ) const
protectedpure virtual

Return overload documentation.

This member must be implemented in the derived class to return the overloads documentation string.

◆ v_execute()

virtual void senf::console::CommandOverload::v_execute ( boost::any &  rv,
std::ostream &  os,
ParseCommandInfo const &  command 
) const
protectedpure virtual

Execute the overload.

This member must be implemented in the derived class o execute the overload.

◆ v_numArguments()

virtual unsigned senf::console::CommandOverload::v_numArguments ( ) const
protectedpure virtual

Return the number of arguments.

This member must be implemented in the derived class to return the number of arguments, the command expects.


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