Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TSdlEnum.h
Go to the documentation of this file.
1#pragma once
2
3#include "SDL/sdl_fwd.h"
4
5#include <Common/assertion.h>
6
7#include <string_view>
8#include <type_traits>
9
10namespace ph
11{
12
19template<typename EnumType>
20class TSdlEnum final
21{
22 static_assert(std::is_enum_v<EnumType>,
23 "EnumType must be an enum. Currently it is not.");
24
25public:
28 EnumType operator [] (std::string_view entryName) const;
29
34 std::string_view operator [] (EnumType enumValue) const;
35};
36
37// In-header Implementations:
38
39template<typename EnumType>
40inline EnumType TSdlEnum<EnumType>::operator [] (const std::string_view entryName) const
41{
42 // Please make sure you provide a specialization of `TSdlEnum` for your enum type.
43 PH_ASSERT_UNREACHABLE_SECTION();
44
45 return static_cast<EnumType>(0);
46}
47
48template<typename EnumType>
49inline std::string_view TSdlEnum<EnumType>::operator [] (const EnumType enumValue) const
50{
51 // Please make sure you provide a specialization of `TSdlEnum` for your enum type.
52 PH_ASSERT_UNREACHABLE_SECTION();
53
54 return "";
55}
56
57}// end namespace ph
EnumType operator[](std::string_view entryName) const
Get enum value from its name.
Definition TSdlEnum.h:40
The root for all renderer implementations.
Definition EEngineProject.h:6