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

Represents a command expression composed of expandable children. More...

#include <shell_node.h>

Inheritance diagram for bs::shell_node_command_expression:
Collaboration diagram for bs::shell_node_command_expression:

Public Member Functions

 shell_node_command_expression (std::vector< std::unique_ptr< shell_node_expandable > > &&vChildren)
 Construct a command expression node.
 
void expand (std::vector< std::string > &vTokens, shell_session &oSession, bool bSplit) const override
 Expand the expression by expanding its children in order. Expand the node into textual tokens.
Parameters
vTokensVector where generated token strings will be appended.
oSessionSession context (used for variable/argument lookup, etc.).
bSplitWhen true apply word-splitting semantics; otherwise keep as single token.
.
 
const std::vector< std::unique_ptr< shell_node_expandable > > & get_children () const noexcept
 Access the child nodes.
 
- Public Member Functions inherited from bs::shell_node_expandable
 shell_node_expandable (const shell_node_type nType, const std::size_t nPos)
 Construct an expandable 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

Represents a command expression composed of expandable children.

The node holds ownership of a vector of expandable child nodes and expands by expanding each child in sequence.

Constructor & Destructor Documentation

◆ shell_node_command_expression()

bs::shell_node_command_expression::shell_node_command_expression ( std::vector< std::unique_ptr< shell_node_expandable > > &&  vChildren)
explicit

Construct a command expression node.

Exceptions
shell_node_invalid_argumentIf vChildren is empty.
shell_node_invalid_argumentIf first vChildren is null pointer.
shell_node_invalid_argumentIf all vChildren are null pointers.
Parameters
vChildrenVector of child expandable nodes (moved in).

Member Function Documentation

◆ expand()

void bs::shell_node_command_expression::expand ( std::vector< std::string > &  vTokens,
shell_session oSession,
bool  bSplit 
) const
overridevirtual

Expand the expression by expanding its children in order. Expand the node into textual tokens.

Parameters
vTokensVector where generated token strings will be appended.
oSessionSession context (used for variable/argument lookup, etc.).
bSplitWhen true apply word-splitting semantics; otherwise keep as single token.
.

Implements bs::shell_node_expandable.

◆ get_children()

const std::vector< std::unique_ptr< shell_node_expandable > > & bs::shell_node_command_expression::get_children ( ) const
inlinenoexcept

Access the child nodes.

Returns
const reference to the internal children vector.

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