Represents a variable map for shell commands.
More...
#include <shell_var.h>
|
|
| shell_var ()=default |
| | Default constructor.
|
| |
| std::string | get_var (const std::string &sVar) const |
| | Retrieves the value of a variable.
|
| |
| std::string | get_var_hop2 (const std::string &sVar) const |
| | Retrieves the value of a variable, whose value is another variable (1-hop resolution).
|
| |
| void | set_var (std::string sVar, std::string sValue) |
| | Sets the value of a variable.
|
| |
| bool | has_var (const std::string &sVar) const noexcept |
| | Checks if a variable exists.
|
| |
| std::size_t | get_var_size () const noexcept |
| | Gets the number of variables.
|
| |
| const std::unordered_map< std::string, std::string, shell_hash > & | get_var () const noexcept |
| | Retrieves all variables.
|
| |
Represents a variable map for shell commands.
This class manages variables.
◆ get_var() [1/2]
| const std::unordered_map< std::string, std::string, shell_hash > & bs::shell_var::get_var |
( |
| ) |
const |
|
inlinenoexcept |
Retrieves all variables.
- Returns
- A const reference to the map of variables.
◆ get_var() [2/2]
| std::string bs::shell_var::get_var |
( |
const std::string & |
sVar | ) |
const |
|
inline |
Retrieves the value of a variable.
- Parameters
-
| sVar | The name of the variable. |
- Returns
- The value of the variable, or an empty string if not found.
◆ get_var_hop2()
| std::string bs::shell_var::get_var_hop2 |
( |
const std::string & |
sVar | ) |
const |
|
inline |
Retrieves the value of a variable, whose value is another variable (1-hop resolution).
- Parameters
-
| sVar | The name of the variable. |
- Returns
- The value of the resolved variable, or an empty string if not found.
◆ get_var_size()
| std::size_t bs::shell_var::get_var_size |
( |
| ) |
const |
|
inlinenoexcept |
Gets the number of variables.
- Returns
- The size of the variables map.
◆ has_var()
| bool bs::shell_var::has_var |
( |
const std::string & |
sVar | ) |
const |
|
inlinenoexcept |
Checks if a variable exists.
- Parameters
-
| sVar | The name of the variable. |
- Returns
- True if the variable exists, false otherwise.
◆ set_var()
| void bs::shell_var::set_var |
( |
std::string |
sVar, |
|
|
std::string |
sValue |
|
) |
| |
|
inline |
Sets the value of a variable.
- Parameters
-
| sVar | The name of the variable. |
| sValue | The value to be set. |
The documentation for this class was generated from the following file:
- /home/runner/work/bashspark/bashspark/include/BashSpark/shell/shell_var.h