Encapsulates access to the environment variables and command-line arguments at the time of execution. More...
#include "executionEnvironment.h"
Static Public Member Functions | |
static void | clear_shadow (const std::string &var) |
Removes a value set by a previous call to shadow_environment_variable(), and lets the actual value of the variable show again. More... | |
static std::string | expand_string (const std::string &str) |
Reads the string, looking for environment variable names marked by a $. More... | |
static std::string | get_arg (size_t n) |
static std::string | get_binary_name () |
static Filename | get_cwd () |
static std::string | get_dtool_name () |
static std::string | get_environment_variable (const std::string &var) |
static size_t | get_num_args () |
static bool | has_environment_variable (const std::string &var) |
static void | set_binary_name (const std::string &name) |
static void | set_dtool_name (const std::string &name) |
static void | set_environment_variable (const std::string &var, const std::string &value) |
static void | shadow_environment_variable (const std::string &var, const std::string &value) |
Changes the apparent definition of the indicated environment variable by masking it within this class with a new value. More... | |
Public Attributes | |
get_arg | |
Returns the nth command-line argument. More... | |
get_binary_name | |
Returns the name of the binary executable that started this program, if it can be determined. More... | |
get_cwd | |
Returns the name of the current working directory. More... | |
get_dtool_name | |
Returns the name of the libdtool DLL that is used in this program, if it can be determined. More... | |
get_environment_variable | |
Returns the definition of the indicated environment variable, or the empty string if the variable is undefined. More... | |
get_num_args | |
Returns the number of command-line arguments available, not counting arg 0, the binary name. More... | |
has_environment_variable | |
Returns true if the indicated environment variable is defined. More... | |
set_binary_name | |
Do not use. More... | |
set_dtool_name | |
Do not use. More... | |
set_environment_variable | |
Changes the definition of the indicated environment variable. More... | |
Encapsulates access to the environment variables and command-line arguments at the time of execution.
This is encapsulated to support accessing these things during static init time, which seems to be risky at best.
Definition at line 29 of file executionEnvironment.h.
|
inlinestatic |
Removes a value set by a previous call to shadow_environment_variable(), and lets the actual value of the variable show again.
Definition at line 55 of file executionEnvironment.I.
Referenced by ConfigDeclaration::get_filename_value().
|
static |
Reads the string, looking for environment variable names marked by a $.
Expands all such variable names. A repeated dollar sign ($$) is mapped to a single dollar sign.
Returns the expanded string.
Definition at line 112 of file executionEnvironment.cxx.
References get_environment_variable.
Referenced by Filename::expand_from(), and ConfigDeclaration::get_filename_value().
|
inlinestatic |
Changes the apparent definition of the indicated environment variable by masking it within this class with a new value.
This does not change the actual environment variable, but future calls to get_environment_variable() will return this new value.
Definition at line 46 of file executionEnvironment.I.
Referenced by ConfigDeclaration::get_filename_value().
|
inline |
Returns the nth command-line argument.
The index n must be in the range [0 .. get_num_args()). The first parameter, n == 0, is the first actual parameter, not the binary name.
Definition at line 58 of file executionEnvironment.h.
|
inline |
Returns the name of the binary executable that started this program, if it can be determined.
Definition at line 59 of file executionEnvironment.h.
Filename ExecutionEnvironment::get_cwd |
Returns the name of the current working directory.
Definition at line 61 of file executionEnvironment.h.
|
inline |
Returns the name of the libdtool DLL that is used in this program, if it can be determined.
Definition at line 60 of file executionEnvironment.h.
|
inline |
Returns the definition of the indicated environment variable, or the empty string if the variable is undefined.
Definition at line 56 of file executionEnvironment.h.
Referenced by expand_string().
|
inline |
Returns the number of command-line arguments available, not counting arg 0, the binary name.
Definition at line 58 of file executionEnvironment.h.
|
inline |
Returns true if the indicated environment variable is defined.
Definition at line 56 of file executionEnvironment.h.
|
inline |
Do not use.
Definition at line 59 of file executionEnvironment.h.
|
inline |
Do not use.
Definition at line 60 of file executionEnvironment.h.
|
inline |
Changes the definition of the indicated environment variable.
Definition at line 56 of file executionEnvironment.h.