NDEVR
API Documentation
EnvironmentalVariablefinal

Forward declaration of InfoPipe. More...

Inheritance diagram for EnvironmentalVariable:
[legend]
Collaboration diagram for EnvironmentalVariable:
[legend]

Public Member Functions

 EnvironmentalVariable (const StringView &variable)
 AllocConsole initializes standard input, standard output, and standard error handles for the new console.
 ~EnvironmentalVariable ()
 Destructor.
const Stringget ()
 Gets the current value of the environmental variable, fetching it from the OS if needed.
Resource< String > & resource ()
 Returns a reference to the underlying Resource that mirrors the environmental variable.

Static Public Member Functions

static String GetEnvironmentalVariable (const StringView &label)
 Gets an environmental variable from the OS.
static String ResolveEnvironmentalVariables (const StringView &string)
 Returns a string where all environmental variables have been resolved.
static void SetProgramEnvironmentalVariable (const StringView &label, const StringView &value)
 Sets an environmental variable to the OS, in a seperate thread if possible.
static void SetSystemEnvironmentalVariable (const StringView &label, const StringView &value, bool blocking=false, LogPtr log=LogPtr())
 Sets an environmental variable to the OS, in a seperate thread if possible.
static void SetUserEnvironmentalVariable (const StringView &label, const StringView &value, bool blocking=false, LogPtr log=LogPtr())
 Sets an environmental variable to the OS, in a seperate thread if possible.

Private Member Functions

void onValueChanged () final override
 Called when the Resource value changes, propagating the new value to the OS environmental variable.

Detailed Description

Forward declaration of InfoPipe.


A class that wraps an OS environmental variable with a Resource value. Any calls to set for this resource will also set the environmental variable via ApplicationResource::SetUserEnvironmentalVariable

Definition at line 17 of file EnvironmentalVariable.h.

Constructor & Destructor Documentation

◆ EnvironmentalVariable()

EnvironmentalVariable::EnvironmentalVariable ( const StringView & variable)

AllocConsole initializes standard input, standard output, and standard error handles for the new console.


The standard input handle is a handle to the console's input buffer, and the standard output and standard error handles are handles to the console's screen buffer. To retrieve these handles, use the GetStdHandle function.

◆ ~EnvironmentalVariable()

EnvironmentalVariable::~EnvironmentalVariable ( )

Destructor.

Cleans up the environmental variable wrapper.

Member Function Documentation

◆ get()

const String & EnvironmentalVariable::get ( )

Gets the current value of the environmental variable, fetching it from the OS if needed.

Returns
The current string value of the environmental variable.

◆ GetEnvironmentalVariable()

String EnvironmentalVariable::GetEnvironmentalVariable ( const StringView & label)
static

Gets an environmental variable from the OS.


◆ ResolveEnvironmentalVariables()

String EnvironmentalVariable::ResolveEnvironmentalVariables ( const StringView & string)
static

Returns a string where all environmental variables have been resolved.


◆ resource()

Resource< String > & EnvironmentalVariable::resource ( )

Returns a reference to the underlying Resource that mirrors the environmental variable.

Returns
A reference to the Resource<String> backing this variable.

◆ SetProgramEnvironmentalVariable()

void EnvironmentalVariable::SetProgramEnvironmentalVariable ( const StringView & label,
const StringView & value )
static

Sets an environmental variable to the OS, in a seperate thread if possible.


Program environmental variable

Warning
This function may fail. Use logs for more information. On Windows this function is executed via creating a batch script calling setx, otherwise uses std::setenv.

◆ SetSystemEnvironmentalVariable()

void EnvironmentalVariable::SetSystemEnvironmentalVariable ( const StringView & label,
const StringView & value,
bool blocking = false,
LogPtr log = LogPtr() )
static

Sets an environmental variable to the OS, in a seperate thread if possible.


Program environmental variable

Warning
This function may fail. Use logs for more information. On Windows this function is executed via creating a batch script calling setx, otherwise uses std::setenv.

◆ SetUserEnvironmentalVariable()

void EnvironmentalVariable::SetUserEnvironmentalVariable ( const StringView & label,
const StringView & value,
bool blocking = false,
LogPtr log = LogPtr() )
static

Sets an environmental variable to the OS, in a seperate thread if possible.


Program environmental variable

Warning
This function may fail. Use logs for more information. On Windows this function is executed via creating a batch script calling setx, otherwise uses std::setenv.

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