wowlib
0.0.0
Read & write World of Warcraft client files — a C++26 core
Toggle main menu visibility
Loading...
Searching...
No Matches
expansion.hpp
Go to the documentation of this file.
1
#pragma once
2
7
8
#include <array>
9
#include <meta>
10
#include <optional>
11
12
#include <welder/vocabulary.hpp>
13
14
#include <
wowlib/core/client_version.hpp
>
15
16
namespace
wowlib
{
17
enum class
[[
18
=welder::weld,
19
=welder::doc(R
"(
20
The expansion a client belongs to, in release order. The enumerable
21
counterpart of a full ClientVersion: versioned format classes and
22
factories are keyed on it (each enumerator maps to the
23
last-minor-of-major release in the versions namespace).)")
24
]]
Expansion
{
25
Vanilla
,
26
Tbc
,
27
Wotlk
,
28
Cata
,
29
Mop
,
30
Wod
,
31
Legion
,
32
Bfa
,
33
Shadowlands
,
34
Dragonflight
,
35
TheWarWithin
36
};
37
38
namespace
detail
{
41
inline
constexpr
std::array
ExpansionVersions
{
42
versions::Vanilla
,
43
versions::Tbc
,
44
versions::Wotlk
,
45
versions::Cata
,
46
versions::Mop
,
47
versions::Wod
,
48
versions::Legion
,
49
versions::Bfa
,
50
versions::Shadowlands
,
51
versions::Dragonflight
,
52
versions::Tww
53
};
54
55
static_assert
(
ExpansionVersions
.size() == std::meta::enumerators_of(^^
Expansion
).size(),
56
"expansion_versions must cover every Expansion enumerator"
);
57
}
58
59
[[=welder::weld,
60
=welder::doc(
61
"The last-minor-of-major client version wowlib targets for this "
62
"expansion (the versions constant)."
),
63
=welder::returns(
"the matching versions constant"
)]]
64
constexpr
ClientVersion
toClientVersion
(
Expansion
expansion [[=welder::doc(
"the expansion"
)]]) {
65
return
detail::ExpansionVersions
[
static_cast<
std::size_t
>
(expansion)];
66
}
67
68
[[=welder::weld,
69
=welder::doc(
70
"The expansion whose targeted release is exactly this version. "
71
"Never matches a Classic constant — Classic clients are not "
72
"expansion releases; pass version.format_lineage to ask which "
73
"expansion's FORMATS one uses."
),
74
=welder::returns(
"the expansion, or None if the version is not one of the "
75
"versions constants"
)]]
76
constexpr
std::optional<Expansion>
toExpansion
(
ClientVersion
version [[=welder::doc(
"a full client version"
)]]) {
77
for
(std::size_t i = 0; i <
detail::ExpansionVersions
.size(); ++i)
78
if
(
detail::ExpansionVersions
[i] == version)
return
static_cast<
Expansion
>
(i);
79
return
std::nullopt;
80
}
81
82
[[=welder::weld,
83
=welder::doc(R
"(
84
The expansion a client version belongs to, by major version — works for
85
any build, not just the targeted releases.
86
87
This is the CONTENT axis: Cataclysm Classic 4.4.2 reports Cata, because
88
that is the game it is. It is NOT the format axis — that same client
89
writes War Within-era files. For formats, ask
90
to_expansion(version.format_lineage) instead.)"),
91
=welder::returns(
"the expansion, or None for unknown majors"
)]]
92
constexpr
std::optional<Expansion>
expansionOf
(ClientVersion version [[=welder::doc(
"a full client version"
)]]) {
93
for
(std::size_t i = 0; i <
detail::ExpansionVersions
.size(); ++i)
94
if
(
detail::ExpansionVersions
[i].major == version.major)
return
static_cast<
Expansion
>
(i);
95
return
std::nullopt;
96
}
97
}
client_version.hpp
Client version identity, the flavor axis that separates a client's CONTENT version from the engine ge...
wowlib::detail
Definition
client_version.hpp:226
wowlib::detail::ExpansionVersions
constexpr std::array ExpansionVersions
The targeted ClientVersion of each Expansion, indexed by enumerator value.
Definition
expansion.hpp:34
wowlib::versions::Shadowlands
constexpr ClientVersion Shadowlands
Definition
client_version.hpp:142
wowlib::versions::Tww
constexpr ClientVersion Tww
Definition
client_version.hpp:150
wowlib::versions::Bfa
constexpr ClientVersion Bfa
Definition
client_version.hpp:138
wowlib::versions::Mop
constexpr ClientVersion Mop
Definition
client_version.hpp:126
wowlib::versions::Wod
constexpr ClientVersion Wod
Definition
client_version.hpp:130
wowlib::versions::Tbc
constexpr ClientVersion Tbc
Definition
client_version.hpp:114
wowlib::versions::Vanilla
constexpr ClientVersion Vanilla
Definition
client_version.hpp:110
wowlib::versions::Legion
constexpr ClientVersion Legion
Definition
client_version.hpp:134
wowlib::versions::Dragonflight
constexpr ClientVersion Dragonflight
Definition
client_version.hpp:146
wowlib::versions::Cata
constexpr ClientVersion Cata
Definition
client_version.hpp:122
wowlib::versions::Wotlk
constexpr ClientVersion Wotlk
Definition
client_version.hpp:118
wowlib
Definition
detail.hpp:29
wowlib::expansionOf
constexpr std::optional< Expansion > expansionOf(ClientVersion version)
Definition
expansion.hpp:71
wowlib::Expansion
Expansion
Definition
expansion.hpp:17
wowlib::Expansion::Legion
@ Legion
Definition
expansion.hpp:24
wowlib::Expansion::Cata
@ Cata
Definition
expansion.hpp:21
wowlib::Expansion::TheWarWithin
@ TheWarWithin
Definition
expansion.hpp:28
wowlib::Expansion::Tbc
@ Tbc
Definition
expansion.hpp:19
wowlib::Expansion::Vanilla
@ Vanilla
Definition
expansion.hpp:18
wowlib::Expansion::Mop
@ Mop
Definition
expansion.hpp:22
wowlib::Expansion::Dragonflight
@ Dragonflight
Definition
expansion.hpp:27
wowlib::Expansion::Shadowlands
@ Shadowlands
Definition
expansion.hpp:26
wowlib::Expansion::Bfa
@ Bfa
Definition
expansion.hpp:25
wowlib::Expansion::Wotlk
@ Wotlk
Definition
expansion.hpp:20
wowlib::Expansion::Wod
@ Wod
Definition
expansion.hpp:23
wowlib::toExpansion
constexpr std::optional< Expansion > toExpansion(ClientVersion version)
The expansion whose targeted release is exactly this version.
Definition
expansion.hpp:64
wowlib::toClientVersion
constexpr ClientVersion toClientVersion(Expansion expansion)
The last-minor-of-major client version wowlib targets for this expansion (the versions constant).
Definition
expansion.hpp:56
wowlib::ClientVersion
Definition
client_version.hpp:33
wowlib::ClientVersion::major
std::uint16_t major
Expansion number, e.g.
Definition
client_version.hpp:35
src
wowlib
core
expansion.hpp
Generated by
1.17.0