|
BashSpark
|
Base class for binary operator nodes (pipe, and, or) with priority handling. More...
#include <shell_node.h>


Public Member Functions | |
| int | get_priority () const noexcept |
| Get the operator priority. | |
| const shell_node_evaluable * | get_left () const noexcept |
| Get (non-owning) pointer to the left operand. | |
| const shell_node_evaluable * | get_right () const noexcept |
| Get (non-owning) pointer to the right operand. | |
| std::unique_ptr< shell_node_evaluable > | swap_left (std::unique_ptr< shell_node_evaluable > &&pLeft) |
| Swap-in a new left operand, returning the old one. | |
| std::unique_ptr< shell_node_evaluable > | swap_right (std::unique_ptr< shell_node_evaluable > &&pRight) |
| Swap-in a new right operand, returning the old one. | |
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. | |
| virtual shell_status | evaluate (shell_session &oSession) const =0 |
| Evaluate (execute) the 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. | |
Static Public Member Functions | |
| static std::unique_ptr< shell_node_evaluable > | make (shell_node_type nType, std::size_t nPos, std::unique_ptr< shell_node_evaluable > &&pLeft, std::unique_ptr< shell_node_evaluable > &&pRight) |
| Makes an operator node. | |
Protected Member Functions | |
| shell_node_operator (shell_node_type nType, std::size_t nPos, int nPriority, std::unique_ptr< shell_node_evaluable > &&pLeft, std::unique_ptr< shell_node_evaluable > &&pRight) | |
| Construct an operator with both operands. | |
| shell_node_operator (shell_node_type nType, std::size_t nPos, int nPriority) | |
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. | |
Additional Inherited Members | |
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. | |
Base class for binary operator nodes (pipe, and, or) with priority handling.
Operator nodes hold left and right evaluable children and a priority used when building or reorganizing operator trees.
|
protected |
Construct an operator with both operands.
| shell_node_invalid_argument | If pLeft or pRight is null. |
| nType | Node type (operator). |
| nPos | Position in stream. |
| nPriority | Operator priority. |
| pLeft | Left operand. |
| pRight | Right operand. |
|
protected |
| nType | Node type (must be operator). |
| nPos | Position in stream. |
| nPriority | Priority of the operator. |
|
inlinenoexcept |
Get (non-owning) pointer to the left operand.
|
inlinenoexcept |
Get the operator priority.
|
inlinenoexcept |
Get (non-owning) pointer to the right operand.
|
static |
Makes an operator node.
Utility that constructs an appropriate operator subclass and performs priority handling if left/right are operator nodes too.
| shell_node_invalid_argument | If pLeft or pRight is null. |
| shell_node_invalid_argument | If nType is not an operator node type. |
| nType | Operator node type. |
| nPos | Node position in stream. |
| pLeft | Left operand (moved in). |
| pRight | Right operand (moved in). |
| std::unique_ptr< shell_node_evaluable > bs::shell_node_operator::swap_left | ( | std::unique_ptr< shell_node_evaluable > && | pLeft | ) |
Swap-in a new left operand, returning the old one.
| shell_node_invalid_argument | If pLeft is null. |
| pLeft | New left operand (moved in). |
| std::unique_ptr< shell_node_evaluable > bs::shell_node_operator::swap_right | ( | std::unique_ptr< shell_node_evaluable > && | pRight | ) |
Swap-in a new right operand, returning the old one.
| shell_node_invalid_argument | If pRight is null. |
| pRight | New right operand (moved in). |