BashSpark
Loading...
Searching...
No Matches
bs::shell_vtable Class Reference

Represents an environment for shell commands. More...

#include <shell_vtable.h>

Public Types

using func_type = shell_node_evaluable
 Sell function type.
 

Public Member Functions

 shell_vtable ()=default
 Default constructor (empty environment).
 
const func_typeget_func (const std::string &sVar) const
 Gets a function.
 
void set_func (const std::string &sName, const func_type *pFunction)
 Sets the a function.
 
bool has_func (const std::string &sName) const noexcept
 Checks if a function exists.
 
std::size_t get_vtable_size () const noexcept
 Gets the number of functions in the vtable.
 
const std::unordered_map< std::string, const func_type *, shell_hash > & get_env () const noexcept
 Retrieves all environment variables.
 

Detailed Description

Represents an environment for shell commands.

This class manages environment variables.

Member Function Documentation

◆ get_env()

const std::unordered_map< std::string, const func_type *, shell_hash > & bs::shell_vtable::get_env ( ) const
inlinenoexcept

Retrieves all environment variables.

Returns
A const reference to the map of environment variables.

◆ get_func()

const func_type * bs::shell_vtable::get_func ( const std::string &  sVar) const
inline

Gets a function.

Parameters
sVarThe name of the function to get
Returns
The function if there is or nullptr

◆ get_vtable_size()

std::size_t bs::shell_vtable::get_vtable_size ( ) const
inlinenoexcept

Gets the number of functions in the vtable.

Returns
The size of the function map.

◆ has_func()

bool bs::shell_vtable::has_func ( const std::string &  sName) const
inlinenoexcept

Checks if a function exists.

Parameters
sNameThe name of the function.
Returns
True if the function exists, false otherwise.

◆ set_func()

void bs::shell_vtable::set_func ( const std::string &  sName,
const func_type pFunction 
)
inline

Sets the a function.

Parameters
sNameThe name of the function.
pFunctionThe function to be set.

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