|
BashSpark
|
While-loop node executing the iterative block while the condition succeeds. More...
#include <shell_node.h>


Public Member Functions | |
| shell_node_while (std::size_t nPos, std::unique_ptr< shell_node_evaluable > &&pCondition, std::unique_ptr< shell_node_evaluable > &&pIterative) | |
| Construct a while-loop node. | |
| shell_status | evaluate (shell_session &oSession) const override |
| Evaluate the while-loop. | |
| const shell_node_evaluable * | get_condition () const noexcept |
| Get the condition node. | |
| const shell_node_evaluable * | get_iterative () const noexcept |
| Get the iterative block node. | |
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. | |
While-loop node executing the iterative block while the condition succeeds.
The node repeatedly evaluates the condition and runs the iterative block while the condition returns a success status. Behavior follows shell semantics including support for loop control commands.
Ownership: owns both condition and iterative nodes.
| bs::shell_node_while::shell_node_while | ( | std::size_t | nPos, |
| std::unique_ptr< shell_node_evaluable > && | pCondition, | ||
| std::unique_ptr< shell_node_evaluable > && | pIterative | ||
| ) |
Construct a while-loop node.
| shell_node_invalid_argument | If pCondition or pIterative is null. |
| nPos | Position in the input stream where the while loop starts. |
| pCondition | Owned evaluable node representing the loop condition. |
| pIterative | Owned evaluable block executed while the condition succeeds. |
|
overridevirtual |
Evaluate the while-loop.
Repeatedly evaluates m_pCondition and executes m_pIterative for as long as the condition returns a success status. Returns the last executed command's status or a control-related status if loop control statements are used.
| oSession | Session context used for evaluation. |
Implements bs::shell_node_evaluable.
|
inlinenoexcept |
Get the condition node.
|
inlinenoexcept |
Get the iterative block node.