ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::system::EnvironmentVariables Struct Reference

Description:

Simple struct providing one static method that reads an environment variable into an ALib string-type.

While under posix compatible operating systems, environment variable names are case-sensitive, under Microsoft windows they are not.

Definition at line 17 of file environment.inl.

Public Static Method Index:

static ALIB_DLL bool Get (const CString &varName, AString &target, lang::CurrentData targetData=lang::CurrentData::Clear)
 

Method Details:

◆ Get()

bool alib::system::EnvironmentVariables::Get ( const CString & varName,
AString & target,
lang::CurrentData targetData = lang::CurrentData::Clear )
static

Reads an environment variable into an ALib string.

Attention
  1. While under posix compatible operating systems, environment variable names are case-sensitive, under Microsoft windows they are not.

  2. As documented with std::getenv , the operation is not thread-safe against changes of the environment in parallel threads.
Note
When path-variables are requested, usually instead of passing an AString for parameter target, a reference of type Path may be given, which is derived from class AString. However, compatibility of both types depend on the platform and compilation flags of the ALib Build: The character-type of class Path equals C++ standard type std::filesystem::path::value_type, while the one of AString depends on compilation symbol ALIB_CHARACTERS_WIDE. On GNU/Linux and MacOS, both default to nchar, on WindowsOS both default to wchar and as such compatibility is given with the defaults. If compilation of ALib is explicitly switched to use a different character type, then conversion has to be performed.
Class Path provides built-in mechanics that uses the environment to retrieve certain default paths, and that performs conversion when necessary internally.
Parameters
varNameThe name of the variable to be retrieved.
targetAn AString to write the result to.
targetDataIf CurrentData::Keep, the parameter target is not cleared before the result is written. Defaults to CurrentData::Clear.
Returns
true if variable was found.

Definition at line 41 of file environment.cpp.

Here is the call graph for this function:

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