Class for holding computer information.
More...
#include <Utils.h>
|
static std::string | get () |
|
|
static std::string | user = "USER?" |
|
static std::string | name = "NAME?" |
|
static std::string | brand = "BRAND?" |
|
static std::string | model = "MODEL?" |
|
static std::string | os = "OS?" |
|
static std::string | osVer = "OSVER?" |
|
static std::string | arch = "ARCH?" |
|
static std::string | id = "ID?" |
|
Class for holding computer information.
Definition at line 287 of file Utils.h.
◆ get()
std::string Utils::ComputerInfos::get |
( |
| ) |
|
|
static |
Definition at line 1261 of file Utils.cpp.
1266 const char* envvar = std::getenv(
"USER");
1267 user = envvar ? string(envvar) :
"USER?";
1268 if (
user ==
"USER?")
1270 const char* envvar = std::getenv(
"USERNAME");
1271 user = envvar ? string(envvar) :
"USER?";
1276 SYSTEM_INFO siSysInfo;
1277 GetSystemInfo(&siSysInfo);
1278 switch (siSysInfo.wProcessorArchitecture)
1280 case PROCESSOR_ARCHITECTURE_AMD64:
arch =
"x64";
break;
1281 case PROCESSOR_ARCHITECTURE_ARM:
arch =
"ARM";
break;
1282 case 12:
arch =
"ARM64";
break;
1283 case PROCESSOR_ARCHITECTURE_IA64:
arch =
"IA64";
break;
1284 case PROCESSOR_ARCHITECTURE_INTEL:
arch =
"x86";
break;
1285 default:
arch =
"???";
1289 OSVERSIONINFO osInfo;
1290 ZeroMemory(&osInfo,
sizeof(OSVERSIONINFO));
1291 osInfo.dwOSVersionInfoSize =
sizeof(OSVERSIONINFO);
1292 GetVersionEx(&osInfo);
1294 sprintf(osVersion,
"%lu.%lu", osInfo.dwMajorVersion, osInfo.dwMinorVersion);
1295 osVer = string(osVersion);
1301 #elif defined(__APPLE__)
1302 # if defined(TARGET_OS_IOS) && (TARGET_OS_IOS == 1)
1306 const char* envvar = std::getenv(
"USER");
1307 user = envvar ? string(envvar) :
"USER?";
1308 if (
user ==
"USER?")
1310 const char* envvar = std::getenv(
"USERNAME");
1311 user = envvar ? string(envvar) :
"USER?";
1316 const char* envvar = std::getenv(
"USER");
1317 user = envvar ? string(envvar) :
"USER?";
1319 if (
user ==
"USER?")
1321 const char* envvarUN = std::getenv(
"USERNAME");
1322 user = envvarUN ? string(envvarUN) :
"USER?";
1346 #elif defined(ANDROID)
1376 char hostC[PROP_VALUE_MAX];
1377 len = __system_property_get(
"ro.build.host", hostC);
1378 name = !string(hostC).empty() ? string(hostC) :
"NAME?";
1380 char userC[PROP_VALUE_MAX];
1381 len = __system_property_get(
"ro.build.user", userC);
1382 user = !string(userC).empty() ? string(userC) :
"USER?";
1384 char brandC[PROP_VALUE_MAX];
1385 len = __system_property_get(
"ro.product.brand", brandC);
1386 brand = string(brandC);
1388 char modelC[PROP_VALUE_MAX];
1389 len = __system_property_get(
"ro.product.model", modelC);
1390 model = string(modelC);
1392 char osVerC[PROP_VALUE_MAX];
1393 len = __system_property_get(
"ro.build.version.release", osVerC);
1394 osVer = string(osVerC);
1396 char archC[PROP_VALUE_MAX];
1397 len = __system_property_get(
"ro.product.cpu.abi", archC);
1398 arch = string(archC);
1400 #elif defined(linux) || defined(__linux) || defined(__linux__)
1413 if (
model.find(
"SM-") != string::npos)
1419 std::replace(
id.begin(),
id.end(),
'_',
'-');
string getHostName()
Returns the computer name.
string replaceNonFilenameChars(string src, const char replaceChar)
replaces non-filename characters: /|?%*:"<>'
◆ arch
std::string Utils::ComputerInfos::arch = "ARCH?" |
|
static |
◆ brand
std::string Utils::ComputerInfos::brand = "BRAND?" |
|
static |
◆ id
std::string Utils::ComputerInfos::id = "ID?" |
|
static |
◆ model
std::string Utils::ComputerInfos::model = "MODEL?" |
|
static |
◆ name
std::string Utils::ComputerInfos::name = "NAME?" |
|
static |
◆ os
std::string Utils::ComputerInfos::os = "OS?" |
|
static |
◆ osVer
std::string Utils::ComputerInfos::osVer = "OSVER?" |
|
static |
◆ user
std::string Utils::ComputerInfos::user = "USER?" |
|
static |
The documentation for this class was generated from the following files: