Lugdunum  0.1.0
Enum.cpp
Go to the documentation of this file.
2 
4 
5 namespace lug {
6 namespace Graphics {
7 namespace Vulkan {
8 namespace API {
9 namespace RTTI {
10 
11 #define LUG_ENUM_TO_STR(enum) \
12  case enum: \
13  return #enum;
14 #define LUG_ENUM_TO_STR_FUNCTION(type, macro) \
15  const char* toStr(type enumVal) { \
16  switch (enumVal) { \
17  macro(LUG_ENUM_TO_STR) \
18  default: \
19  LUG_LOG.warn("One value of the enum " #type " is not implemented : {}", enumVal); \
20  return nullptr; \
21  } \
22  }
23 
28 
37 
38 
39 #define LUG_FLAGS_TO_STR_VEC(enum) \
40  if (flag & enum) { \
41  retVal.push_back(#enum); \
42  } \
43  flag &= ~enum;
44 
45 #define LUG_FLAGS_TO_STR_VEC_FUNCTION(type, macro) \
46  std::vector<const char*> type ## ToStrVec(type flag) { \
47  std::vector<const char*> retVal; \
48  \
49  macro(LUG_FLAGS_TO_STR_VEC) \
50  if (flag) { \
51  LUG_LOG.warn("One value of the flag " #type " is not implemented : {}", flag); \
52  } \
53  return retVal; \
54  }
55 
64 
65 #define LUG_FLAGS_TO_STR(enum) \
66  if (flag & enum) { \
67  val += #enum; \
68  if ((flag & ~enum)) \
69  val += " | "; \
70  } \
71  flag &= ~enum;
72 
73 #define LUG_FLAGS_TO_STR_FUNCTION(type, macro) \
74  std::string type ## ToStr(type flag) { \
75  std::string val; \
76  \
77  macro(LUG_FLAGS_TO_STR) \
78  if (flag) { \
79  LUG_LOG.warn("One value of the flag " #type " is not implemented: {}", flag); \
80  } \
81  return val; \
82  }
83 
92 
93 } // RTTI
94 } // API
95 } // Vulkan
96 } // Graphics
97 } // lug
#define LUG_FLAGS_TO_STR_VEC_FUNCTION(type, macro)
Definition: Enum.cpp:45
#define LUG_VULKAN_MEMORY_HEAP_BIT(macro)
Definition: Enum.hpp:256
#define LUG_FLAGS_TO_STR_FUNCTION(type, macro)
Definition: Enum.cpp:73
#define LUG_VULKAN_PHYSICAL_DEVICE_TYPE(macro)
Definition: Enum.hpp:3
#define LUG_VULKAN_SAMPLE_COUNT_BIT(macro)
Definition: Enum.hpp:269
#define LUG_VULKAN_IMAGE_USAGE_BIT(macro)
Definition: Enum.hpp:259
#define LUG_VULKAN_PRESENT_MODE_KHR(macro)
Definition: Enum.hpp:200
#define LUG_VULKAN_FORMAT(macro)
Definition: Enum.hpp:10
#define LUG_VULKAN_QUEUE_BIT(macro)
Definition: Enum.hpp:214
#define LUG_ENUM_TO_STR_FUNCTION(type, macro)
Definition: Enum.cpp:14
#define LUG_VULKAN_COLOR_SPACE_KHR(macro)
Definition: Enum.hpp:197
#define LUG_VULKAN_SURFACE_TRANSFORM_KHR_BIT(macro)
Definition: Enum.hpp:278
#define LUG_VULKAN_FORMAT_FEATURE_BIT(macro)
Definition: Enum.hpp:239
#define LUG_VULKAN_MEMORY_PROPERTY_BIT(macro)
Definition: Enum.hpp:207
#define LUG_VULKAN_COMPOSITE_ALPHA_KHR_BIT(macro)
Definition: Enum.hpp:289