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

Command-substitution string node (backticks or $(...)). More...

#include <shell_node.h>

Inheritance diagram for bs::shell_node_str_back:
Collaboration diagram for bs::shell_node_str_back:

Public Member Functions

 shell_node_str_back (std::size_t nPos, std::unique_ptr< shell_node_evaluable > &&pCommand)
 Construct a command-substitution node.
 
void expand (std::vector< std::string > &vTokens, shell_session &oSession, bool bSplit) const override
 Expand by executing the subcommand and inserting its output. 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 shell_node_evaluableget_command () const noexcept
 Get the underlying evaluable subcommand.
 
- 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

Command-substitution string node (backticks or $(...)).

Holds an evaluable subcommand which is executed during expansion and its output used as the string fragment.

Constructor & Destructor Documentation

◆ shell_node_str_back()

bs::shell_node_str_back::shell_node_str_back ( std::size_t  nPos,
std::unique_ptr< shell_node_evaluable > &&  pCommand 
)

Construct a command-substitution node.

Exceptions
shell_node_invalid_argumentIf pCommand is null.
Parameters
nPosPosition of the opening quote in the stream.
pCommandSubcommand to evaluate when expanding.

Member Function Documentation

◆ expand()

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

Expand by executing the subcommand and inserting its output. 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_command()

const shell_node_evaluable * bs::shell_node_str_back::get_command ( ) const
inlinenoexcept

Get the underlying evaluable subcommand.

Returns
pointer to the evaluable node (non-owning).

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