11 #ifndef __HOM_EnumValue_h__
12 #define __HOM_EnumValue_h__
32 myEnumClass = &
typeid(
void);
46 const char *
name,
int id)
47 : myEnumClass(&enum_class), myRepr(repr), myName(name), myId(id)
56 {
return !__eq__(value); }
62 {
return (
int)SYSmultiplicative_inthash(myId); }
71 {
return *myEnumClass == *value.myEnumClass && myId == value.myId; }
75 {
return *myEnumClass != *value.myEnumClass || myId != value.myId; }
79 {
return *myEnumClass; }
87 int v = strcmp(myName, value.myName);
88 return v < 0 || ( v == 0 && myId < value.myId );
92 const std::type_info *myEnumClass;
111 #define HOM_DECLARE_ENUM_MODULE_START(enum_module) \
112 SWIGOUT(%nodefaultctor HOM_ ## enum_module;) \
113 SWIGOUT(%rename(enum_module) HOM_ ## enum_module;) \
114 class HOM_API HOM_ ## enum_module \
117 #define HOM_DECLARE_ENUM_MODULE_END \
121 #include <hboost/preprocessor/cat.hpp>
122 #include <hboost/preprocessor/arithmetic/dec.hpp>
123 #include <hboost/preprocessor/tuple/to_seq.hpp>
124 #include <hboost/preprocessor/tuple/rem.hpp>
125 #include <hboost/preprocessor/seq/transform.hpp>
126 #include <hboost/preprocessor/seq/for_each.hpp>
127 #include <hboost/preprocessor/stringize.hpp>
138 #define HOM_DECLARE_ENUM_VALUE(r, unused_data, elem) \
139 static HOM_EnumValue elem; \
140 static const int HBOOST_PP_CAT(elem, _Id) = HBOOST_PP_DEC(r);
144 #define HOM_DECLARE_ENUM_MODULE_FROM_SEQ(enum_module, values_seq) \
145 HOM_DECLARE_ENUM_MODULE_START(enum_module) \
146 HBOOST_PP_SEQ_FOR_EACH(HOM_DECLARE_ENUM_VALUE, _, values_seq) \
147 HOM_DECLARE_ENUM_MODULE_END
154 #define HOM_DECLARE_ENUM_MODULE(enum_module, num_values, values_tuple) \
155 HOM_DECLARE_ENUM_MODULE_FROM_SEQ(enum_module, \
156 HBOOST_PP_TUPLE_TO_SEQ(num_values, (values_tuple)))
162 #define HOM_DEFINE_ENUM_VALUE(r, enum_module, elem) \
163 HOM_EnumValue HBOOST_PP_CAT(HOM_, enum_module)::elem \
164 (typeid(HBOOST_PP_CAT(HOM_, enum_module)), \
165 HBOOST_PP_STRINGIZE(enum_module) "." HBOOST_PP_STRINGIZE(elem), \
166 HBOOST_PP_STRINGIZE(elem), \
170 #define HOM_DEFINE_ENUM_MODULE_FROM_SEQ(enum_module, values_seq) \
171 HBOOST_PP_SEQ_FOR_EACH(HOM_DEFINE_ENUM_VALUE, enum_module, values_seq)
173 #define HOM_DEFINE_ENUM_MODULE(enum_module, num_values, values_tuple) \
174 HOM_DEFINE_ENUM_MODULE_FROM_SEQ(enum_module, \
175 HBOOST_PP_TUPLE_TO_SEQ(num_values, (values_tuple)))
187 #define HOM_DECLARE_ENUM_VALUE2(enum_module, enum_elem, ienum_elem, ienum_elem_name, enum_value) \
188 static HOM_EnumValue enum_elem; \
189 static const int HBOOST_PP_CAT(enum_elem,_Id) = enum_value;
197 #define HOM_DEFINE_ENUM_VALUE2(enum_module, enum_elem, ienum_elem, ienum_elem_name, enum_value) \
198 HOM_EnumValue HBOOST_PP_CAT(HOM_,enum_module)::enum_elem \
199 ((typeid(HBOOST_PP_CAT(HOM_,enum_module))), \
200 HBOOST_PP_STRINGIZE(enum_module) "." HBOOST_PP_STRINGIZE(enum_elem), \
201 HBOOST_PP_STRINGIZE(enum_elem), \
210 #define HOM_DECLARE_ENUM_MODULE(enum_module, num_values, values_tuple) \
211 HOM_DECLARE_ENUM_MODULE_START(enum_module) \
212 static const HOM_EnumValue values_tuple; \
213 HOM_DECLARE_ENUM_MODULE_END
215 #define HOM_DECLARE_ENUM_VALUE2(enum_module, enum_elem, ienum_elem, ienum_elem_name, enum_value) \
216 static const HOM_EnumValue enum_elem;
bool operator<(const HOM_EnumValue &value) const
GLsizei const GLchar *const * string
bool __eq__(HOM_PtrOrNull< HOM_EnumValue > value)
HOM_EnumValue(const std::type_info &enum_class, const char *repr, const char *name, int id)
void ignore(T const &) VULKAN_HPP_NOEXCEPT
bool __ne__(HOM_PtrOrNull< HOM_EnumValue > value)
GLuint const GLchar * name
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
const std::type_info & enumClass() const
std::string __repr__() const