Merge pull request 'SystemInfo Get*Name return values change' (#179) from sysinfo_strings into master

Reviewed-on: https://git.madvoxel.net/OpenVulkano/OpenVulkano/pulls/179
Reviewed-by: Georg Hagen <georg.hagen@madvoxel.com>
This commit is contained in:
Vladyslav_Baranovskyi_EXT
2024-12-20 16:39:00 +01:00
5 changed files with 47 additions and 41 deletions

View File

@@ -112,7 +112,7 @@ namespace OpenVulkano
return vramMax; return vramMax;
} }
std::string SystemInfo::GetUserName() const std::string& SystemInfo::GetUserName()
{ {
static std::string userName; static std::string userName;
if (userName.empty()) if (userName.empty())
@@ -130,7 +130,7 @@ namespace OpenVulkano
return userName; return userName;
} }
std::string SystemInfo::GetHostName() const std::string& SystemInfo::GetHostName()
{ {
static std::string hostName; static std::string hostName;
if (hostName.empty()) if (hostName.empty())
@@ -142,12 +142,12 @@ namespace OpenVulkano
return hostName; return hostName;
} }
std::string SystemInfo::GetDeviceName() const std::string& SystemInfo::GetDeviceName()
{ {
return GetHostName(); return GetHostName();
} }
std::string SystemInfo::GetDeviceVendorName() const std::string& SystemInfo::GetDeviceVendorName()
{ {
static std::string vendor; static std::string vendor;
if (vendor.empty()) if (vendor.empty())
@@ -168,7 +168,7 @@ namespace OpenVulkano
return vendor; return vendor;
} }
std::string SystemInfo::GetDeviceModelName() const std::string& SystemInfo::GetDeviceModelName()
{ {
static std::string modelName; static std::string modelName;
if (modelName.empty()) if (modelName.empty())
@@ -283,7 +283,7 @@ namespace OpenVulkano
OsInfo osInfo; OsInfo osInfo;
} }
std::string SystemInfo::GetOsName() const std::string& SystemInfo::GetOsName()
{ {
return osInfo.osName; return osInfo.osName;
} }
@@ -293,7 +293,7 @@ namespace OpenVulkano
return osInfo.version; return osInfo.version;
} }
std::string SystemInfo::GetOsNameHumanReadable() const std::string& SystemInfo::GetOsNameHumanReadable()
{ {
return osInfo.osNameFormatted; return osInfo.osNameFormatted;
} }

View File

@@ -62,29 +62,31 @@ namespace OpenVulkano
return 0; return 0;
} }
std::string SystemInfo::GetUserName() const std::string& SystemInfo::GetUserName()
{ {
return ""; static const std::string userName = "";
return userName;
} }
std::string SystemInfo::GetHostName() const std::string& SystemInfo::GetHostName()
{ {
static const std::string hostName = [[NSProcessInfo processInfo].hostName UTF8String]; static const std::string hostName = [[NSProcessInfo processInfo].hostName UTF8String];
return hostName; return hostName;
} }
std::string SystemInfo::GetDeviceName() const std::string& SystemInfo::GetDeviceName()
{ {
static const std::string devName = "Mac"; //TODO static const std::string devName = "Mac"; //TODO
return devName; return devName;
} }
std::string SystemInfo::GetDeviceVendorName() const std::string& SystemInfo::GetDeviceVendorName()
{ {
return "Apple"; static const std::string vendorName = "Apple";
return vendorName;
} }
std::string SystemInfo::GetDeviceModelName() const std::string& SystemInfo::GetDeviceModelName()
{ {
static std::string machine; static std::string machine;
if (machine.empty()) if (machine.empty())
@@ -96,9 +98,10 @@ namespace OpenVulkano
return machine; return machine;
} }
std::string SystemInfo::GetOsName() const std::string& SystemInfo::GetOsName()
{ {
return "MacOS"; static const std::string osName = "MacOS";
return osName;
} }
OsVersion SystemInfo::GetOsVersion() OsVersion SystemInfo::GetOsVersion()
@@ -113,7 +116,7 @@ namespace OpenVulkano
return osVersion; return osVersion;
} }
std::string SystemInfo::GetOsNameHumanReadable() const std::string& SystemInfo::GetOsNameHumanReadable()
{ {
static const std::string hrName = fmt::format("{} {}", GetOsName(), GetOsVersion().major); static const std::string hrName = fmt::format("{} {}", GetOsName(), GetOsVersion().major);
return hrName; return hrName;

View File

@@ -36,16 +36,16 @@ namespace OpenVulkano
static size_t GetAppRamAvailable(); static size_t GetAppRamAvailable();
static size_t GetAppRamUsed(); static size_t GetAppRamUsed();
static std::string GetUserName(); static const std::string& GetUserName();
static std::string GetHostName(); static const std::string& GetHostName();
// Device name as given by the user // Device name as given by the user
static std::string GetDeviceName(); static const std::string& GetDeviceName();
static std::string GetDeviceVendorName(); static const std::string& GetDeviceVendorName();
static std::string GetDeviceModelName(); static const std::string& GetDeviceModelName();
static std::string GetOsName(); static const std::string& GetOsName();
static OsVersion GetOsVersion(); static OsVersion GetOsVersion();
static std::string GetOsNameHumanReadable(); static const std::string& GetOsNameHumanReadable();
static DeviceType GetDeviceType(); static DeviceType GetDeviceType();
static size_t GetCpuCoreCount(); static size_t GetCpuCoreCount();

View File

@@ -359,7 +359,7 @@ namespace OpenVulkano
return ReadAppMemInfo(APP_MEM_TYPE::VM_MAX); return ReadAppMemInfo(APP_MEM_TYPE::VM_MAX);
} }
std::string SystemInfo::GetUserName() const std::string& SystemInfo::GetUserName()
{ {
static std::string userName; static std::string userName;
if (userName.empty()) if (userName.empty())
@@ -372,7 +372,7 @@ namespace OpenVulkano
return userName; return userName;
} }
std::string SystemInfo::GetHostName() const std::string& SystemInfo::GetHostName()
{ {
static std::string hostName; static std::string hostName;
if (hostName.empty()) if (hostName.empty())
@@ -384,7 +384,7 @@ namespace OpenVulkano
return hostName; return hostName;
} }
std::string SystemInfo::GetDeviceName() const std::string& SystemInfo::GetDeviceName()
{ {
static std::string devName; static std::string devName;
if (devName.empty()) if (devName.empty())
@@ -397,7 +397,7 @@ namespace OpenVulkano
return devName; return devName;
} }
std::string SystemInfo::GetDeviceVendorName() const std::string& SystemInfo::GetDeviceVendorName()
{ {
static std::string vendorName; static std::string vendorName;
if (vendorName.empty()) if (vendorName.empty())
@@ -408,7 +408,7 @@ namespace OpenVulkano
return vendorName; return vendorName;
} }
std::string SystemInfo::GetDeviceModelName() const std::string& SystemInfo::GetDeviceModelName()
{ {
static std::string deviceModelName; static std::string deviceModelName;
if (deviceModelName.empty()) if (deviceModelName.empty())
@@ -419,9 +419,10 @@ namespace OpenVulkano
return deviceModelName; return deviceModelName;
} }
std::string SystemInfo::GetOsName() const std::string& SystemInfo::GetOsName()
{ {
return "Windows"; static const std::string osName = "Windows";
return osName;
} }
OsVersion SystemInfo::GetOsVersion() OsVersion SystemInfo::GetOsVersion()
@@ -439,7 +440,7 @@ namespace OpenVulkano
return osVersion; return osVersion;
} }
std::string SystemInfo::GetOsNameHumanReadable() const std::string& SystemInfo::GetOsNameHumanReadable()
{ {
static const std::string osName = GetHumanReadableOSName(); static const std::string osName = GetHumanReadableOSName();
return osName; return osName;

View File

@@ -64,29 +64,31 @@ namespace OpenVulkano
return 0; return 0;
} }
std::string SystemInfo::GetUserName() const std::string& SystemInfo::GetUserName()
{ {
return ""; static const std::string userName = "";
return userName;
} }
std::string SystemInfo::GetHostName() const std::string& SystemInfo::GetHostName()
{ {
static const std::string hostName = [[NSProcessInfo processInfo].hostName UTF8String]; static const std::string hostName = [[NSProcessInfo processInfo].hostName UTF8String];
return hostName; return hostName;
} }
std::string SystemInfo::GetDeviceName() const std::string& SystemInfo::GetDeviceName()
{ {
static const std::string devName = [[[UIDevice currentDevice] name] UTF8String]; static const std::string devName = [[[UIDevice currentDevice] name] UTF8String];
return devName; return devName;
} }
std::string SystemInfo::GetDeviceVendorName() const std::string& SystemInfo::GetDeviceVendorName()
{ {
return "Apple"; static const std::string vendorName = "Apple";
return vendorName;
} }
std::string SystemInfo::GetDeviceModelName() const std::string& SystemInfo::GetDeviceModelName()
{ {
static std::string modelName; static std::string modelName;
if (modelName.empty()) if (modelName.empty())
@@ -99,7 +101,7 @@ namespace OpenVulkano
return modelName; return modelName;
} }
std::string SystemInfo::GetOsName() const std::string& SystemInfo::GetOsName()
{ {
static const std::string osName = [[[UIDevice currentDevice] systemName] UTF8String]; static const std::string osName = [[[UIDevice currentDevice] systemName] UTF8String];
return osName; return osName;
@@ -117,7 +119,7 @@ namespace OpenVulkano
return osv; return osv;
} }
std::string SystemInfo::GetOsNameHumanReadable() const std::string& SystemInfo::GetOsNameHumanReadable()
{ {
static std::string hrName; static std::string hrName;
if (hrName.empty()) if (hrName.empty())