Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
|
Go to the source code of this file.
Functions | |
Environment ... | |
const char * | EnvBuildOS () |
Operating software ("Debian", "Android", ...). | |
const char * | EnvBuildArch () |
Operating architecture (e.g. "i386", "armhf", ...). | |
const char * | EnvMachineName () |
Machine name (network host name). | |
const char * | EnvExecPathName () |
Full path name of the executable (== argv[0]). More... | |
const char * | EnvExecName () |
File name of the executable without path. | |
const char * | EnvInstanceName () |
Instance name - the identifier for the running process. More... | |
const char * | EnvDroidId () |
Droid ID. | |
int | EnvPid () |
Operating system's process identifier (PID). | |
bool | EnvHaveTerminal () |
'true', if the application has been started from an interactive terminal. | |
void | EnvReadIniFile (const char *fileName, CDictCompact< CString > *map) |
Read a .ini file. 'fileName' must be an absolute path name. | |
Directories ... | |
const char * | EnvHome2lRoot () |
Root installation path: all static data (blob + etc). | |
const char * | EnvHome2lEtc () |
'etc' root path: configuration data. | |
const char * | EnvHome2lVar () |
'var' root path: dynamic data (saved over reboots). | |
const char * | EnvHome2lTmp () |
'tmp' root path: dynamic data (not need to save over reboots). | |
const char * | EnvGetHome2lRootPath (CString *ret, const char *relOrAbsPath) |
Return an absolute path name in the root domain. A path starting with '/' is considered already absolute and is returned unchanged, but normalized. | |
const char * | EnvGetHome2lEtcPath (CString *ret, const char *relOrAbsPath) |
Return an absolute path name in the 'etc' domain. | |
const char * | EnvGetHome2lVarPath (CString *ret, const char *relOrAbsPath) |
Return an absolute path name in the 'var' domain. | |
const char * | EnvGetHome2lTmpPath (CString *ret, const char *relOrAbsPath) |
Return an absolute path name in the 'tmp' domain. | |
bool | EnvMkVarDir (const char *relOrAbsPath) |
Prepare (create) a directory in the 'var' domain. More... | |
bool | EnvMkTmpDir (const char *relOrAbsPath) |
Prepare (create) a directory in the 'tmp' domain. | |
Network ... | |
bool | EnvNetResolve (const char *hostAndPort, CString *retHost, int *retPort=NULL, int defaultPort=0, bool warn=true) |
Get a resolved host + port combination. More... | |
Location ... | |
float | EnvLocationLatitudeN () |
Get the WGS84 latitude north coordinate of the home (the 'location.latitudeN' setting). | |
float | EnvLocationLongitudeE () |
Get the WGS84 longitude east coordinate of the home (the 'location.longitudeE' setting). | |
Init/Done ... | |
void | EnvInit (int argc, char **argv, const char *specOptionsUsage=NULL, const char *instanceName=NULL, bool noBanner=false) |
Initialize the environment module. More... | |
void | EnvPrintBanner () |
Print the tool banner (only useful if banner was suppressed in the EnvInit() call). | |
void | EnvDone () |
Shutdown the environment module. | |
Persistence ... | |
void | EnvEnablePersistence (bool writeThrough=true, const char *_varFileName=NULL) |
Enable the persistence of all environment variables starting with "var.*". More... | |
void | EnvFlush () |
Write back any persistent variables now. | |
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... | |