blob: 91d6eb39c69820bb86e305db43c48daeeace9c7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include "turnsmm/enums.hpp"
#include "turns-disposition.h"
#include "turns-enums.h" // IWYU pragma: keep
#include <glib-object.h>
#include <type_traits>
namespace
{
template<auto Wrapped, auto Unwrapped>
auto constexpr matches =
static_cast<std::underlying_type_t<decltype(Wrapped)>>(Wrapped) == static_cast<std::underlying_type_t<decltype(Unwrapped)>>(Unwrapped);
} // namespace
namespace Turns
{
static_assert(matches<Disposition::Neutral, TURNS_DISPOSITION_NEUTRAL>);
static_assert(matches<Disposition::Friendly, TURNS_DISPOSITION_FRIENDLY>);
static_assert(matches<Disposition::Hostile, TURNS_DISPOSITION_HOSTILE>);
static_assert(matches<Disposition::Secret, TURNS_DISPOSITION_SECRET>);
} // namespace Turns
namespace Glib
{
#define VALUE_SPECIALIZATION(Enum, TurnsEnumName) \
auto Value<Turns::Enum>::value_type() -> GType \
{ \
return turns_##TurnsEnumName##_get_type(); \
}
VALUE_SPECIALIZATION(Disposition, disposition)
#undef VALUE_SPECIALIZATION
} // namespace Glib
|