From c45004b73bb045328a724d1d860df6d1515af6d4 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 23 May 2025 13:51:10 +0200 Subject: lib: split out header files --- lib/include/turnsmm/enum_helpers.hpp | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/include/turnsmm/enum_helpers.hpp (limited to 'lib/include/turnsmm/enum_helpers.hpp') diff --git a/lib/include/turnsmm/enum_helpers.hpp b/lib/include/turnsmm/enum_helpers.hpp new file mode 100644 index 0000000..60b8cd7 --- /dev/null +++ b/lib/include/turnsmm/enum_helpers.hpp @@ -0,0 +1,39 @@ +/* + * SPDX-FileCopyrightText: 2025 Felix Morgner + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#ifndef TURNSMM_ENUM_HELPERS_HPP +#define TURNSMM_ENUM_HELPERS_HPP + +#include + +#include +#include + +#include + +#define TURNS_DECLARE_ENUM_VALUE_SPECIALIZATION(Enum) \ + template<> \ + class Value<::Turns::Enum> : public Glib::Value_Enum<::Turns::Enum> \ + { \ + public: \ + auto static value_type() -> GType; \ + } + +#define TURNS_DEFINE_VALUE_SPECIALIZATION(Enum, TurnsEnumName) \ + auto Value<::Turns::Enum>::value_type() -> GType \ + { \ + return ::turns_##TurnsEnumName##_get_type(); \ + } + +namespace Turns +{ + + template + auto constexpr enum_matches = + static_cast>(Wrapped) == static_cast>(Unwrapped); + +} // namespace Turns + +#endif \ No newline at end of file -- cgit v1.2.3