13 #ifndef __STOUT_OS_WINDOWS_ENVIRONMENT_HPP__ 14 #define __STOUT_OS_WINDOWS_ENVIRONMENT_HPP__ 24 inline std::map<std::string, std::string>
environment()
33 const std::unique_ptr<wchar_t[], decltype(&::FreeEnvironmentStringsW)> env(
34 ::GetEnvironmentStringsW(), &::FreeEnvironmentStringsW);
35 std::map<std::string, std::string> result;
37 for (
size_t i = 0; env[i] != L
'\0' && env[i+1] != L
'\0';
39 std::wstring entry(&env[i]);
42 i = i + entry.size() + 1;
46 size_t position = entry.find_first_of(L
'=', 1);
47 if (position == std::string::npos) {
51 result[
stringify(entry.substr(0, position))] =
60 #endif // __STOUT_OS_WINDOWS_ENVIRONMENT_HPP__ Definition: posix_signalhandler.hpp:23
std::map< std::string, std::string > environment()
Definition: environment.hpp:24
std::string stringify(int flags)