Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
|
Accessing and managing the environment dictionary.
Primitive Get/Put ... | |
const char * | EnvGet (const char *key) |
Generically read a setting; Returns 'NULL' on non-existence and never prints warnings. More... | |
const char * | EnvPut (const char *key, const char *value) |
Generically put a string into the dictionary; Passing 'value == NULL' removes the entry. More... | |
const char * | EnvPut (const char *key, int value) |
Put an integer or boolean variable into the dictionary. More... | |
static void | EnvDel (const char *key) |
Remove an entry from the environment dictionary. | |
Get with type ... | |
These functions get an environment parameter and convert them to a given type. For each type, there are two variants:
Note: The functions with implicit translation capabilities ('EnvGetPath*' and 'EnvGetHost*') convert their strings in place. This means:
| |
bool | EnvGetString (const char *key, const char **ret, bool warnIfMissing=false) |
Read a string (advanced variant). | |
const char * | EnvGetString (const char *key, const char *defaultVal, bool warnIfMissing=false) |
Read a string (simple variant). | |
static const char * | EnvGetString (const char *key, bool warnIfMissing) |
Read a string (simple variant) without default. | |
static const char * | EnvGetString (const char *key) |
Accelerator for 'EnvGetString (key, warnIfMissing = false)'. | |
bool | EnvGetPath (const char *key, const char **ret, const char *path=NULL, bool warnIfMissing=false) |
Read a path, eventually convert value to an absolute path before (advanced). The returned path is always absolute. Relative paths are interpreted as relative to 'path' or HOME2L_ROOT and made absolute. | |
const char * | EnvGetPath (const char *key, const char *path=NULL, bool warnIfMissing=false) |
Read a path, eventually convert value to an absolute path before (simple). | |
bool | EnvGetHostAndPort (const char *key, CString *retHost, int *retPort=NULL, int defaultPort=0, bool warnIfMissing=false) |
Get a host + port combination; host names are translated using the 'net.resolve.<name>' settings. | |
static bool | EnvGetHost (const char *key, CString *retHost, bool warnIfMissing=false) |
Get a host name; host names are translated using the 'net.resolve.<name>' settings. | |
bool | EnvGetInt (const char *key, int *ret, bool warnIfMissing=false) |
Read an integer (advanced). | |
int | EnvGetInt (const char *key, int defaultVal=0, bool warnIfMissing=false) |
Read an integer (simple). | |
bool | EnvGetFloat (const char *key, float *ret, bool warnIfMissing=false) |
Read a float value (advanced). | |
float | EnvGetFloat (const char *key, float defaultVal=0.0, bool warnIfMissing=false) |
Read a float value (simple). | |
bool | EnvGetBool (const char *key, bool *ret, bool warnIfMissing=false) |
Read a boolean value (advanced). | |
bool | EnvGetBool (const char *key, bool defaultVal=false, bool warnIfMissing=false) |
Read a boolean value (simple). | |
Advanced access to the dictionary ... | |
void | EnvGetPrefixInterval (const char *prefix, int *retIdx0, int *retIdx1) |
const char * | EnvGetKey (int idx) |
const char * | EnvGetVal (int idx) |
const CDictRaw * | EnvGetKeySet () |
Get the complete key set for direct key listing. More... | |
const char * EnvGet | ( | const char * | key | ) |
Generically read a setting; Returns 'NULL' on non-existence and never prints warnings.
'key' can optionally be a sequence of keys separated by a colon (":"). In this case, the keys are tried in sequential order and the first available value is returned.
const char * EnvPut | ( | const char * | key, |
const char * | value | ||
) |
Generically put a string into the dictionary; Passing 'value == NULL' removes the entry.
const char * EnvPut | ( | const char * | key, |
int | value | ||
) |
Put an integer or boolean variable into the dictionary.
const CDictRaw * EnvGetKeySet | ( | ) |
Get the complete key set for direct key listing.
Manipulations of the returned object are strictly forbidden!