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 #include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
8 #include "thrift/compiler/test/fixtures/deprecated-public-fields-for-cpp-ref/gen-cpp2/module_metadata.h"
9 
10 namespace apache {
11 namespace thrift {
12 namespace detail {
13 namespace md {
14 using ThriftMetadata = ::apache::thrift::metadata::ThriftMetadata;
15 using ThriftPrimitiveType = ::apache::thrift::metadata::ThriftPrimitiveType;
16 using ThriftType = ::apache::thrift::metadata::ThriftType;
17 using ThriftService = ::apache::thrift::metadata::ThriftService;
18 using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext;
19 using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&);
20 
21 
22 const ::apache::thrift::metadata::ThriftStruct&
gen(ThriftMetadata & metadata)23 StructMetadata<::cpp2::Foo>::gen(ThriftMetadata& metadata) {
24   auto res = metadata.structs_ref()->emplace("module.Foo", ::apache::thrift::metadata::ThriftStruct{});
25   if (!res.second) {
26     return res.first->second;
27   }
28   ::apache::thrift::metadata::ThriftStruct& module_Foo = res.first->second;
29   module_Foo.name_ref() = "module.Foo";
30   module_Foo.is_union_ref() = false;
31   static const EncodedThriftField
32   module_Foo_fields[] = {
33     {1, "foo", true, std::make_unique<Typedef>("module.Foo", std::make_unique<Struct< ::cpp2::Foo>>("module.Foo"), std::vector<ThriftConstStruct>{}), std::vector<ThriftConstStruct>{}},
34     {2, "bar", true, std::make_unique<Typedef>("module.Foo", std::make_unique<Struct< ::cpp2::Foo>>("module.Foo"), std::vector<ThriftConstStruct>{}), std::vector<ThriftConstStruct>{}},
35   };
36   for (const auto& f : module_Foo_fields) {
37     ::apache::thrift::metadata::ThriftField field;
38     field.id_ref() = f.id;
39     field.name_ref() = f.name;
40     field.is_optional_ref() = f.is_optional;
41     f.metadata_type_interface->writeAndGenType(*field.type_ref(), metadata);
42     field.structured_annotations_ref() = f.structured_annotations;
43     module_Foo.fields_ref()->push_back(std::move(field));
44   }
45   return res.first->second;
46 }
47 
48 } // namespace md
49 } // namespace detail
50 } // namespace thrift
51 } // namespace apache
52