|
BashSpark
|
Prints on stdout the result of a mathematical operation. More...
#include <command_math.h>


Public Member Functions | |
| command_math () | |
| Constructs command. | |
| shell_status | run (const std::span< const std::string > &vArgs, shell_session &oSession) const override |
| Prints on stdout the result of a mathematical operation. | |
| virtual void | msg_error_math (std::ostream &oStdErr, shell_status nStatus) const |
| Displays the error message for math errors. | |
Public Member Functions inherited from bs::command | |
| command (std::string sName) | |
| Construct a command with a given name. | |
| virtual | ~command ()=default |
| Virtual destructor. | |
| std::string | get_name () const |
| Get the command name (copy). | |
| const std::string & | get_name_ref () const noexcept |
| Get the command name (reference). | |
Prints on stdout the result of a mathematical operation.
Syntax: math mathematics expression
Supports:
Possible errors:
bs::shell_status::SHELL_CMD_ERROR_MATH_NOT_AN_INTEGERbs::shell_status::SHELL_CMD_ERROR_MATH_OVERFLOWbs::shell_status::SHELL_CMD_ERROR_MATH_UNDERFLOWbs::shell_status::SHELL_CMD_ERROR_MATH_DIV_BY_ZERObs::shell_status::SHELL_CMD_ERROR_MATH_POW_0_EXP_0bs::shell_status::SHELL_CMD_ERROR_MATH_FACTORIAL_NEGATIVEbs::shell_status::SHELL_CMD_ERROR_MATH_MALFORMED_EXPRESSIONbs::shell_status::SHELL_CMD_ERROR_MATH_MAX_DEPTH_REACHEDbs::shell_status::SHELL_CMD_ERROR_MATH_INVALID_VARIABLE_NAMEbs::shell_status::SHELL_CMD_ERROR_MATH_SEQ_ITERATION_LOGIC
|
virtual |
Displays the error message for math errors.
Can be overwritten with custom behaviour.
| oStdErr | Error output stream |
| nStatus | Status code |
|
overridevirtual |
Prints on stdout the result of a mathematical operation.
| vArgs | Arguments for the command. |
| oSession | The shell session context. |
Implements bs::command.