1 /**
2  * Autogenerated by Thrift for src/module.thrift
3  *
4  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5  *  @generated @nocommit
6  */
7 #pragma once
8 
9 #include "thrift/compiler/test/fixtures/types/gen-cpp2/module_types.h"
10 #include "thrift/compiler/test/fixtures/types/gen-cpp2/module_fatal.h"
11 
12 #include <fatal/type/enum.h>
13 
14 #include <type_traits>
15 
16 namespace apache { namespace thrift { namespace fixtures { namespace types {
17 
18 namespace __fbthrift_refl {
19 namespace __fbthrift_refl_impl = ::apache::thrift::detail::reflection_impl;
20 
21 class has_bitwise_ops_enum_traits {
22  public:
23   using type = ::apache::thrift::fixtures::types::has_bitwise_ops;
24 
25  private:
26   struct __fbthrift_value_none {
27     using name = __fbthrift_strings_module::__fbthrift_hash_140bedbf9c3f6d56a9846d2ba7088798683f4da0c248231336e6a05679e4fdfe;
28     using value = std::integral_constant<type, type::none>;
29     using annotations = __fbthrift_refl_impl::no_annotations;
30   };
31 
32   struct __fbthrift_value_zero {
33     using name = __fbthrift_strings_module::__fbthrift_hash_f9194e73f9e9459e3450ea10a179cdf77aafa695beecd3b9344a98d111622243;
34     using value = std::integral_constant<type, type::zero>;
35     using annotations = __fbthrift_refl_impl::no_annotations;
36   };
37 
38   struct __fbthrift_value_one {
39     using name = __fbthrift_strings_module::__fbthrift_hash_7692c3ad3540bb803c020b3aee66cd8887123234ea0c6e7143c0add73ff431ed;
40     using value = std::integral_constant<type, type::one>;
41     using annotations = __fbthrift_refl_impl::no_annotations;
42   };
43 
44   struct __fbthrift_value_two {
45     using name = __fbthrift_strings_module::__fbthrift_hash_3fc4ccfe745870e2c0d99f71f30ff0656c8dedd41cc1d7d3d376b0dbe685e2f3;
46     using value = std::integral_constant<type, type::two>;
47     using annotations = __fbthrift_refl_impl::no_annotations;
48   };
49 
50   struct __fbthrift_value_three {
51     using name = __fbthrift_strings_module::__fbthrift_hash_8b5b9db0c13db24256c829aa364aa90c6d2eba318b9232a4ab9313b954d3555f;
52     using value = std::integral_constant<type, type::three>;
53     using annotations = __fbthrift_refl_impl::no_annotations;
54   };
55 
56   struct __fbthrift_member {
57     using none = __fbthrift_value_none;
58     using zero = __fbthrift_value_zero;
59     using one = __fbthrift_value_one;
60     using two = __fbthrift_value_two;
61     using three = __fbthrift_value_three;
62   };
63 
64  public:
65   using name = __fbthrift_strings_module::has_bitwise_ops;
66   using member = __fbthrift_member;
67   using fields = ::fatal::list<
68       member::none,
69       member::zero,
70       member::one,
71       member::two,
72       member::three
73   >;
74 
75   class annotations {
76     struct __fbthrift_keys {
77       using cpp_declare_bitwise_ops = __fbthrift_strings_module::cpp_declare_bitwise_ops;
78     };
79 
80     struct __fbthrift_values {
81       using cpp_declare_bitwise_ops = ::fatal::sequence<char, '1'>;
82     };
83 
84    public:
85     using keys = __fbthrift_keys;
86     using values = __fbthrift_values;
87     using map = ::fatal::list<
88       ::apache::thrift::annotation<keys::cpp_declare_bitwise_ops, values::cpp_declare_bitwise_ops>
89     >;
90   };
91 
to_string(type e,char const * fallback)92   static char const *to_string(type e, char const *fallback) {
93     switch (e) {
94       case type::none: return "none";
95       case type::zero: return "zero";
96       case type::one: return "one";
97       case type::two: return "two";
98       case type::three: return "three";
99       default: return fallback;
100     }
101   }
102 };
103 
104 class is_unscoped_enum_traits {
105  public:
106   using type = ::apache::thrift::fixtures::types::is_unscoped;
107 
108  private:
109   struct __fbthrift_value_hello {
110     using name = __fbthrift_strings_module::__fbthrift_hash_2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824;
111     using value = std::integral_constant<type, type::hello>;
112     using annotations = __fbthrift_refl_impl::no_annotations;
113   };
114 
115   struct __fbthrift_value_world {
116     using name = __fbthrift_strings_module::__fbthrift_hash_486ea46224d1bb4fb680f34f7c9ad96a8f24ec88be73ea8e5a6c65260e9cb8a7;
117     using value = std::integral_constant<type, type::world>;
118     using annotations = __fbthrift_refl_impl::no_annotations;
119   };
120 
121   struct __fbthrift_member {
122     using hello = __fbthrift_value_hello;
123     using world = __fbthrift_value_world;
124   };
125 
126  public:
127   using name = __fbthrift_strings_module::is_unscoped;
128   using member = __fbthrift_member;
129   using fields = ::fatal::list<
130       member::hello,
131       member::world
132   >;
133 
134   class annotations {
135     struct __fbthrift_keys {
136       using cpp_deprecated_enum_unscoped = __fbthrift_strings_module::cpp_deprecated_enum_unscoped;
137     };
138 
139     struct __fbthrift_values {
140       using cpp_deprecated_enum_unscoped = ::fatal::sequence<char, '1'>;
141     };
142 
143    public:
144     using keys = __fbthrift_keys;
145     using values = __fbthrift_values;
146     using map = ::fatal::list<
147       ::apache::thrift::annotation<keys::cpp_deprecated_enum_unscoped, values::cpp_deprecated_enum_unscoped>
148     >;
149   };
150 
to_string(type e,char const * fallback)151   static char const *to_string(type e, char const *fallback) {
152     switch (e) {
153       case type::hello: return "hello";
154       case type::world: return "world";
155       default: return fallback;
156     }
157   }
158 };
159 
160 class MyForwardRefEnum_enum_traits {
161  public:
162   using type = ::apache::thrift::fixtures::types::MyForwardRefEnum;
163 
164  private:
165   struct __fbthrift_value_ZERO {
166     using name = __fbthrift_strings_module::__fbthrift_hash_2bf193b40158e8c527d83d622099b9e835d4eb8350c9fb51344aef93d5068fb4;
167     using value = std::integral_constant<type, type::ZERO>;
168     using annotations = __fbthrift_refl_impl::no_annotations;
169   };
170 
171   struct __fbthrift_value_NONZERO {
172     using name = __fbthrift_strings_module::__fbthrift_hash_ce341f28cce92dd4aef1789ba556e94d03c552eb381fa789efc112a2a7b95913;
173     using value = std::integral_constant<type, type::NONZERO>;
174     using annotations = __fbthrift_refl_impl::no_annotations;
175   };
176 
177   struct __fbthrift_member {
178     using ZERO = __fbthrift_value_ZERO;
179     using NONZERO = __fbthrift_value_NONZERO;
180   };
181 
182  public:
183   using name = __fbthrift_strings_module::MyForwardRefEnum;
184   using member = __fbthrift_member;
185   using fields = ::fatal::list<
186       member::ZERO,
187       member::NONZERO
188   >;
189 
190   using annotations = __fbthrift_refl_impl::no_annotations;
191 
to_string(type e,char const * fallback)192   static char const *to_string(type e, char const *fallback) {
193     switch (e) {
194       case type::ZERO: return "ZERO";
195       case type::NONZERO: return "NONZERO";
196       default: return fallback;
197     }
198   }
199 };
200 
201 class MyEnumA_enum_traits {
202  public:
203   using type = ::apache::thrift::fixtures::types::MyEnumA;
204 
205  private:
206   struct __fbthrift_value_fieldA {
207     using name = __fbthrift_strings_module::__fbthrift_hash_a003c1938a10c7729197e235918bdad7bc795ec24b19f24c66e4f24374526ad8;
208     using value = std::integral_constant<type, type::fieldA>;
209     using annotations = __fbthrift_refl_impl::no_annotations;
210   };
211 
212   struct __fbthrift_value_fieldB {
213     using name = __fbthrift_strings_module::__fbthrift_hash_c7e10d053d5c1a0a0743c1dfc0a38c439cd181cc30829f18cc684e286d0baf27;
214     using value = std::integral_constant<type, type::fieldB>;
215     using annotations = __fbthrift_refl_impl::no_annotations;
216   };
217 
218   struct __fbthrift_value_fieldC {
219     using name = __fbthrift_strings_module::__fbthrift_hash_7a60aa9f6a5416b61206a441ce84695a835326c0edc0c9b86b92b618f29eb9ed;
220     using value = std::integral_constant<type, type::fieldC>;
221     using annotations = __fbthrift_refl_impl::no_annotations;
222   };
223 
224   struct __fbthrift_member {
225     using fieldA = __fbthrift_value_fieldA;
226     using fieldB = __fbthrift_value_fieldB;
227     using fieldC = __fbthrift_value_fieldC;
228   };
229 
230  public:
231   using name = __fbthrift_strings_module::MyEnumA;
232   using member = __fbthrift_member;
233   using fields = ::fatal::list<
234       member::fieldA,
235       member::fieldB,
236       member::fieldC
237   >;
238 
239   using annotations = __fbthrift_refl_impl::no_annotations;
240 
to_string(type e,char const * fallback)241   static char const *to_string(type e, char const *fallback) {
242     switch (e) {
243       case type::fieldA: return "fieldA";
244       case type::fieldB: return "fieldB";
245       case type::fieldC: return "fieldC";
246       default: return fallback;
247     }
248   }
249 };
250 
251 } // __fbthrift_refl
252 
253 FATAL_REGISTER_ENUM_TRAITS(
254   __fbthrift_refl::has_bitwise_ops_enum_traits,
255   ::apache::thrift::detail::type_common_metadata_impl<
256       module_tags::module,
257       ::apache::thrift::reflected_annotations<__fbthrift_refl::has_bitwise_ops_enum_traits::annotations>,
258       static_cast<::apache::thrift::legacy_type_id_t>(1216557680140306888ull)
259   >
260 );
261 FATAL_REGISTER_ENUM_TRAITS(
262   __fbthrift_refl::is_unscoped_enum_traits,
263   ::apache::thrift::detail::type_common_metadata_impl<
264       module_tags::module,
265       ::apache::thrift::reflected_annotations<__fbthrift_refl::is_unscoped_enum_traits::annotations>,
266       static_cast<::apache::thrift::legacy_type_id_t>(2509072249807621768ull)
267   >
268 );
269 FATAL_REGISTER_ENUM_TRAITS(
270   __fbthrift_refl::MyForwardRefEnum_enum_traits,
271   ::apache::thrift::detail::type_common_metadata_impl<
272       module_tags::module,
273       ::apache::thrift::reflected_annotations<__fbthrift_refl::MyForwardRefEnum_enum_traits::annotations>,
274       static_cast<::apache::thrift::legacy_type_id_t>(11057525912578401640ull)
275   >
276 );
277 FATAL_REGISTER_ENUM_TRAITS(
278   __fbthrift_refl::MyEnumA_enum_traits,
279   ::apache::thrift::detail::type_common_metadata_impl<
280       module_tags::module,
281       ::apache::thrift::reflected_annotations<__fbthrift_refl::MyEnumA_enum_traits::annotations>,
282       static_cast<::apache::thrift::legacy_type_id_t>(12764631319602759848ull)
283   >
284 );
285 }}}} // apache::thrift::fixtures::types
286