BashSpark
Loading...
Searching...
No Matches
bs::shell_node_command Class Referencefinal

Wraps a command expression and executes it as a command. More...

#include <shell_node.h>

Inheritance diagram for bs::shell_node_command:
Collaboration diagram for bs::shell_node_command:

Public Member Functions

 shell_node_command (std::unique_ptr< shell_node_command_expression > &&pCommand)
 Construct a command node.
 
shell_status evaluate (shell_session &oSession) const override
 Evaluate (execute) the command expression.
 
const shell_node_command_expressionget_command () const noexcept
 Get pointer to the underlying command expression.
 
- Public Member Functions inherited from bs::shell_node_evaluable
 shell_node_evaluable (const shell_node_type nType, const std::size_t nPos)
 Construct an evaluable node.
 
- Public Member Functions inherited from bs::shell_node
virtual ~shell_node ()=default
 Virtual default destructor for polymorphic deletion.
 
shell_node_type get_type () const noexcept
 Get the node type.
 
std::size_t get_pos () const noexcept
 Get node position in the original input stream.
 

Additional Inherited Members

- Protected Member Functions inherited from bs::shell_node
 shell_node (const shell_node_type nType, const std::size_t nPos)
 Protected constructor used by derived classes.
 
- Protected Attributes inherited from bs::shell_node
const shell_node_type m_nType
 Node type.
 
const std::size_t m_nPos
 Position in the input stream.
 

Detailed Description

Wraps a command expression and executes it as a command.

The command expression is an expandable node that will be expanded into argument tokens and then executed according to shell semantics.

Constructor & Destructor Documentation

◆ shell_node_command()

bs::shell_node_command::shell_node_command ( std::unique_ptr< shell_node_command_expression > &&  pCommand)
explicit

Construct a command node.

Exceptions
shell_node_invalid_argumentIf expression is null.
Parameters
pCommandOwned command expression.

Member Function Documentation

◆ evaluate()

shell_status bs::shell_node_command::evaluate ( shell_session oSession) const
overridevirtual

Evaluate (execute) the command expression.

Parameters
oSessionSession context.
Returns
shell_status Result of command execution.

Implements bs::shell_node_evaluable.

◆ get_command()

const shell_node_command_expression * bs::shell_node_command::get_command ( ) const
inlinenoexcept

Get pointer to the underlying command expression.

Returns
Non-owning pointer.

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