#include <PosixEnvironment.h>
|
virtual std::string | queryRegistry (const std::string &path) const override |
|
virtual std::string | path (EnvironmentPath path) const override |
|
virtual std::string | getenv (const std::string &key) const override |
|
virtual void | setenv (const std::string &key, const std::string &value) const override |
|
virtual | ~Environment ()=default |
|
virtual std::string | queryRegistry (const std::string &path) const =0 |
|
virtual std::string | path (EnvironmentPath path) const =0 |
|
virtual std::string | getenv (const std::string &key) const =0 |
|
virtual void | setenv (const std::string &key, const std::string &value) const =0 |
|
◆ getenv()
std::string PosixEnvironment::getenv |
( |
const std::string & |
key | ) |
const |
|
overridevirtual |
Same as std::getenv
, but takes & returns UTF8-encoded keys and values on all platforms.
Note that on Windows std::getenv
doesn't switch to UTF8 even if UnicodeCrt
is used (aka std::setlocale(LC_ALL, ".UTF-8")
).
Returns an empty string for non-existent environment variables, and thus doesn't distinguish between empty and non-existent values (and you shouldn't, either).
- Parameters
-
key | UTF8-encoded name of the environment variable to query. |
- Returns
- UTF8-encoded value of the environment variable.
Implements Environment.
◆ path()
Accessor for various system paths.
- Parameters
-
- Returns
- UTF8-encoded path, or an empty string in case of an error.
Implements Environment.
◆ queryRegistry()
std::string PosixEnvironment::queryRegistry |
( |
const std::string & |
path | ) |
const |
|
overridevirtual |
Windows-only function for querying the registry. Always returns an empty string on non-Windows systems.
- Parameters
-
path | UTF8-encoded registry path to query. |
- Returns
- UTF8-encoded value at the given path, or an empty string in case of an error.
Implements Environment.
◆ setenv()
void PosixEnvironment::setenv |
( |
const std::string & |
key, |
|
|
const std::string & |
value |
|
) |
| const |
|
overridevirtual |
Same as POSIX setenv(key, value, 1)
. Takes UTF8-encoded keys and values on all platforms.
- Parameters
-
key | UTF8-encoded name of the environment variable to set. |
value | UTF8-encoded value of the environment variable. |
Implements Environment.
The documentation for this class was generated from the following files: