summaryrefslogtreecommitdiff
path: root/lib/enumDetails.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-11-26 13:51:33 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-11-26 14:14:13 +0000
commit7fba471728f2216d7e3b7900297fc3b3531e286c (patch)
tree5caef3b2efc23aefccb215ec9005cd8e7d2e91b8 /lib/enumDetails.h
parentFix todo for handling a terrain walk from outside the mesh (diff)
parentModel positions as integers (diff)
downloadilt-7fba471728f2216d7e3b7900297fc3b3531e286c.tar.bz2
ilt-7fba471728f2216d7e3b7900297fc3b3531e286c.tar.xz
ilt-7fba471728f2216d7e3b7900297fc3b3531e286c.zip
Merge branch 'ints' into terrain
Conflicts fix, compiles, some test failures remain. Trees not added, possibility of OM invalid handle assertion failures, normals broken due to integer overflow in Newell's method.
Diffstat (limited to 'lib/enumDetails.h')
-rw-r--r--lib/enumDetails.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/enumDetails.h b/lib/enumDetails.h
index 5966be2..b6ff046 100644
--- a/lib/enumDetails.h
+++ b/lib/enumDetails.h
@@ -26,11 +26,13 @@ template<typename E> struct EnumTypeDetails : EnumDetailsBase {
protected:
#endif
constexpr static std::string_view SEARCH_TYPE {"E = "};
+
constexpr static auto
typeraw()
{
return std::string_view {__PRETTY_FUNCTION__};
};
+
constexpr static auto typeNameStart {typeraw().find(SEARCH_TYPE) + SEARCH_TYPE.length()};
constexpr static auto typeNameEnd {typeraw().find_first_of("];", typeNameStart)};
constexpr static auto typeNameLen {typeNameEnd - typeNameStart};
@@ -47,11 +49,13 @@ template<auto value> struct EnumValueDetails : public EnumTypeDetails<decltype(v
private:
#endif
using T = EnumTypeDetails<decltype(value)>;
+
constexpr static auto
raw()
{
return std::string_view {__PRETTY_FUNCTION__};
};
+
constexpr static auto nameStart {raw().find_last_of(": ") + 1};
constexpr static auto nameEnd {raw().find_first_of("];", nameStart)};
constexpr static auto nameLen {nameEnd - nameStart};
@@ -84,12 +88,14 @@ private:
return std::array {EnumValueDetails<static_cast<E>(n)>::valid...};
#pragma GCC diagnostic pop
}
+
template<auto... n>
constexpr static auto
get_values(std::integer_sequence<int, n...>)
{
return std::array {EnumValueDetails<static_cast<E>(n)>::raw_value...};
}
+
template<auto... n>
constexpr static auto
get_valueNames(std::integer_sequence<int, n...>)