eDSP  0.0.1
A cross-platform DSP library written in C++.
Public Types | Static Public Member Functions | List of all members
edsp::core::system_env Struct Reference

#include <system.hpp>

Public Types

enum  SystemEnvironmentError {
  NoError = 0, Empty, NotFound, InvalidArgument = EINVAL,
  NoMemory = ENOMEM, Unknown = -1
}
 

Static Public Member Functions

static edsp::expected< std::string, SystemEnvironmentErrorget_env (const edsp::string_view &variable_name) noexcept
 Searches in the system environment for the value of the variable name. More...
 
static SystemEnvironmentError set_env (const edsp::string_view &variable_name, const edsp::string_view &variable_value, bool overwrite=true) noexcept
 Shall update or add a variable in the environment of the calling process. More...
 
static bool exist (const edsp::string_view &variable_name) noexcept
 Checks if a variable name is defined in the system environment. More...
 

Member Enumeration Documentation

◆ SystemEnvironmentError

The SystemEnvironmentError describes the possible error while reading/writting variables in the system environment.

Enumerator
NoError 

No error

Empty 

Variable name is empty

NotFound 

Variable not found

InvalidArgument 

Invalid argument

NoMemory 

Out of memory

Unknown 

Unknown error

Member Function Documentation

◆ exist()

static bool edsp::core::system_env::exist ( const edsp::string_view &  variable_name)
inlinestaticnoexcept

Checks if a variable name is defined in the system environment.

Parameters
variable_nameVariable name.
Returns
true if the variable exist in the system environment.

◆ get_env()

static edsp::expected<std::string, SystemEnvironmentError> edsp::core::system_env::get_env ( const edsp::string_view &  variable_name)
inlinestaticnoexcept

Searches in the system environment for the value of the variable name.

Parameters
variable_nameVariable name
Returns
If it fails, the associated error. If not, the value of the variable.

◆ set_env()

static SystemEnvironmentError edsp::core::system_env::set_env ( const edsp::string_view &  variable_name,
const edsp::string_view &  variable_value,
bool  overwrite = true 
)
inlinestaticnoexcept

Shall update or add a variable in the environment of the calling process.

Parameters
variable_nameVariable name.
variable_valueVariable value.
overwriteIf true, overwrites the existing value.
Returns
If it fails, the error associated with the operation.

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