TrinityCore
Loading...
Searching...
No Matches
ClientBuildInfo.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_CLIENT_BUILD_INFO_H
19#define TRINITYCORE_CLIENT_BUILD_INFO_H
20
21#include "Define.h"
22#include <array>
23#include <string_view>
24#include <vector>
25
26namespace ClientBuild
27{
28inline constexpr uint32 ToFourCC(std::string_view text)
29{
30 uint32 uintValue = 0;
31 for (uint8 c : text)
32 {
33 uintValue <<= 8;
34 uintValue |= c;
35 }
36 return uintValue;
37}
38
39consteval uint32 operator""_fourcc(char const* chars, std::size_t length)
40{
41 if (length > sizeof(uint32))
42 throw "Text can only be max 4 characters long";
43
44 return ToFourCC({ chars, length });
45}
46
47TC_SHARED_API std::array<char, 5> ToCharArray(uint32 value);
48
49namespace Platform
50{
51 inline constexpr uint32 Win_x86 = "Win"_fourcc;
52 inline constexpr uint32 Mac_x86 = "OSX"_fourcc;
53
54 TC_SHARED_API bool IsValid(std::string_view platform);
55}
56
58{
59 static constexpr std::size_t Size = 20;
60
62 std::array<uint8, Size> Hash;
63};
64
65struct Info
66{
71 std::array<char, 4> HotfixVersion;
72 std::vector<ExecutableHash> ExecutableHashes;
73};
74
77}
78
79#endif // TRINITYCORE_CLIENT_BUILD_INFO_H
uint8_t uint8
Definition Define.h:135
#define TC_SHARED_API
Definition Define.h:108
uint32_t uint32
Definition Define.h:133
constexpr uint32 Win_x86
TC_SHARED_API bool IsValid(std::string_view platform)
constexpr uint32 Mac_x86
constexpr uint32 ToFourCC(std::string_view text)
Info const * GetBuildInfo(uint32 build)
std::array< char, 5 > ToCharArray(uint32 value)
std::array< uint8, Size > Hash
static constexpr std::size_t Size
std::vector< ExecutableHash > ExecutableHashes
std::array< char, 4 > HotfixVersion