senf::console::CommandNode Class Referenceabstract

Config/console tree command node. More...

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

Inheritance diagram for senf::console::CommandNode:

Public Types

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

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...
 
virtual void v_help (std::ostream &output) const =0
 Provide help information. More...
 
virtual std::string v_shorthelp () const =0
 Provide short documentation. More...
 

Protected Member Functions

 CommandNode ()
 
virtual void v_execute (boost::any &rv, std::ostream &os, ParseCommandInfo const &command) const =0
 Called to execute the command. More...
 
- Protected Member Functions inherited from senf::console::GenericNode
 GenericNode ()
 
void name (std::string const &name)
 

Detailed Description

Config/console tree command node.

The CommandNode is the base-class for the tree leaf nodes. Concrete command node implementations are derived from this class.

To execute a command, CommandNode::operator()() or CommandNode::execute() is called.

Subclass instances of this node type are automatically created when adding commands to the tree. See Supported command types.

Definition at line 563 of file Node.hh.

Member Typedef Documentation

◆ cptr

typedef boost::shared_ptr<CommandNode const> senf::console::CommandNode::cptr

Definition at line 571 of file Node.hh.

◆ ptr

typedef boost::shared_ptr<CommandNode> senf::console::CommandNode::ptr

Definition at line 565 of file Node.hh.

◆ weak_ptr

Definition at line 572 of file Node.hh.

Constructor & Destructor Documentation

◆ CommandNode()

senf::console::CommandNode::CommandNode ( )
protected

Member Function Documentation

◆ execute() [1/2]

void senf::console::CommandNode::execute ( std::ostream &  output,
ParseCommandInfo const &  command 
) const

Execute the command.

Parameters
[in]outputstream where result messages may be written to
[in]commandcommand arguments. This is a range of ranges of Token instances.

◆ execute() [2/2]

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

Execute the command.

Parameters
[out]rvcommand return value
[in]outputstream where result messages may be written to
[in]commandcommand arguments. This is a range of ranges of Token instances.

◆ operator()() [1/2]

void senf::console::CommandNode::operator() ( std::ostream &  output,
ParseCommandInfo const &  command 
) const

Execute the command.

Same as execute()

Parameters
[in]outputstream where result messages may be written to
[in]commandcommand arguments. This is a range of ranges of Token instances.

◆ operator()() [2/2]

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

◆ thisptr() [1/2]

ptr senf::console::CommandNode::thisptr ( )

◆ thisptr() [2/2]

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

◆ v_execute()

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

Called to execute the command.

Parameters
[out]rvreturn value holder
[in]osstream where result messages may be written to
[in]commandcommand arguments. This is a range of ranges of Token instances.

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