diff options
Diffstat (limited to 'src/server/shared/Realm/ClientBuildInfo.h')
-rw-r--r-- | src/server/shared/Realm/ClientBuildInfo.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/server/shared/Realm/ClientBuildInfo.h b/src/server/shared/Realm/ClientBuildInfo.h index 9d99c28b744..56acd3af3de 100644 --- a/src/server/shared/Realm/ClientBuildInfo.h +++ b/src/server/shared/Realm/ClientBuildInfo.h @@ -25,21 +25,25 @@ namespace ClientBuild { -consteval uint32 operator""_fourcc(char const* chars, std::size_t length) +inline constexpr uint32 ToFourCC(std::string_view text) { - if (length > sizeof(uint32)) - throw "Text can only be max 4 characters long"; - uint32 uintValue = 0; - for (uint8 c : std::string_view(chars, length)) + for (uint8 c : text) { uintValue <<= 8; uintValue |= c; } - return uintValue; } +consteval uint32 operator""_fourcc(char const* chars, std::size_t length) +{ + if (length > sizeof(uint32)) + throw "Text can only be max 4 characters long"; + + return ToFourCC({ chars, length }); +} + TC_SHARED_API std::array<char, 5> ToCharArray(uint32 value); namespace Platform @@ -58,6 +62,8 @@ namespace PlatformType { inline constexpr uint32 Windows = "Win"_fourcc; inline constexpr uint32 macOS = "Mac"_fourcc; + + TC_SHARED_API bool IsValid(std::string_view platformType); } namespace Arch @@ -67,6 +73,8 @@ namespace Arch inline constexpr uint32 Arm32 = "A32"_fourcc; inline constexpr uint32 Arm64 = "A64"_fourcc; inline constexpr uint32 WA32 = "WA32"_fourcc; + + TC_SHARED_API bool IsValid(std::string_view arch); } namespace Type @@ -77,6 +85,8 @@ namespace Type inline constexpr uint32 BetaRelease = "WoWE"_fourcc; inline constexpr uint32 Ptr = "WoWT"_fourcc; inline constexpr uint32 PtrRelease = "WoWR"_fourcc; + + TC_SHARED_API bool IsValid(std::string_view type); } struct VariantId |