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/compiler/test/fixtures/enums/gen-cpp2/module_types.h"
8 #include "thrift/compiler/test/fixtures/enums/gen-cpp2/module_types.tcc"
9 
10 #include <thrift/lib/cpp2/gen/module_types_cpp.h>
11 
12 #include "thrift/compiler/test/fixtures/enums/gen-cpp2/module_data.h"
13 
14 
15 namespace apache { namespace thrift {
16 
17 constexpr std::size_t const TEnumTraits<::cpp2::Metasyntactic>::size;
18 folly::Range<::cpp2::Metasyntactic const*> const TEnumTraits<::cpp2::Metasyntactic>::values = folly::range(TEnumDataStorage<::cpp2::Metasyntactic>::values);
19 folly::Range<folly::StringPiece const*> const TEnumTraits<::cpp2::Metasyntactic>::names = folly::range(TEnumDataStorage<::cpp2::Metasyntactic>::names);
20 
findName(type value)21 char const* TEnumTraits<::cpp2::Metasyntactic>::findName(type value) {
22   using factory = ::cpp2::_Metasyntactic_EnumMapFactory;
23   static folly::Indestructible<factory::ValuesToNamesMapType> const map{
24       factory::makeValuesToNamesMap()};
25   auto found = map->find(value);
26   return found == map->end() ? nullptr : found->second;
27 }
28 
findValue(char const * name,type * out)29 bool TEnumTraits<::cpp2::Metasyntactic>::findValue(char const* name, type* out) {
30   using factory = ::cpp2::_Metasyntactic_EnumMapFactory;
31   static folly::Indestructible<factory::NamesToValuesMapType> const map{
32       factory::makeNamesToValuesMap()};
33   auto found = map->find(name);
34   return found == map->end() ? false : (*out = found->second, true);
35 }
36 
37 }} // apache::thrift
38 
39 namespace cpp2 {
40 FOLLY_PUSH_WARNING
41 FOLLY_GNU_DISABLE_WARNING("-Wdeprecated-declarations")
42 const _Metasyntactic_EnumMapFactory::ValuesToNamesMapType _Metasyntactic_VALUES_TO_NAMES = _Metasyntactic_EnumMapFactory::makeValuesToNamesMap();
43 const _Metasyntactic_EnumMapFactory::NamesToValuesMapType _Metasyntactic_NAMES_TO_VALUES = _Metasyntactic_EnumMapFactory::makeNamesToValuesMap();
44 FOLLY_POP_WARNING
45 
46 } // cpp2
47 
48 namespace apache {
49 namespace thrift {
50 namespace detail {
51 
translateFieldName(folly::StringPiece _fname,int16_t & fid,apache::thrift::protocol::TType & _ftype)52 void TccStructTraits<::cpp2::SomeStruct>::translateFieldName(
53     folly::StringPiece _fname,
54     int16_t& fid,
55     apache::thrift::protocol::TType& _ftype) noexcept {
56   using data = apache::thrift::TStructDataStorage<::cpp2::SomeStruct>;
57   static const st::translate_field_name_table table{
58       data::fields_size,
59       data::fields_names.data(),
60       data::fields_ids.data(),
61       data::fields_types.data()};
62   st::translate_field_name(_fname, fid, _ftype, table);
63 }
64 
65 } // namespace detail
66 } // namespace thrift
67 } // namespace apache
68 
69 namespace cpp2 {
70 
71 SomeStruct::SomeStruct(const SomeStruct&) = default;
72 SomeStruct& SomeStruct::operator=(const SomeStruct&) = default;
SomeStruct(SomeStruct && other)73 SomeStruct::SomeStruct(SomeStruct&& other) noexcept  :
74     __fbthrift_field_reasonable(std::move(other.__fbthrift_field_reasonable)),
75     __fbthrift_field_fine(std::move(other.__fbthrift_field_fine)),
76     __fbthrift_field_questionable(std::move(other.__fbthrift_field_questionable)),
77     __fbthrift_field_tags(std::move(other.__fbthrift_field_tags)),
78     __isset(other.__isset) {
79 }
80 
operator =(FOLLY_MAYBE_UNUSED SomeStruct && other)81 SomeStruct& SomeStruct::operator=(FOLLY_MAYBE_UNUSED SomeStruct&& other) noexcept {
82     this->__fbthrift_field_reasonable = std::move(other.__fbthrift_field_reasonable);
83     this->__fbthrift_field_fine = std::move(other.__fbthrift_field_fine);
84     this->__fbthrift_field_questionable = std::move(other.__fbthrift_field_questionable);
85     this->__fbthrift_field_tags = std::move(other.__fbthrift_field_tags);
86     __isset = other.__isset;
87     return *this;
88 }
89 
90 
SomeStruct(apache::thrift::FragileConstructor,::cpp2::Metasyntactic reasonable__arg,::cpp2::Metasyntactic fine__arg,::cpp2::Metasyntactic questionable__arg,::std::set<::std::int32_t> tags__arg)91 SomeStruct::SomeStruct(apache::thrift::FragileConstructor, ::cpp2::Metasyntactic reasonable__arg, ::cpp2::Metasyntactic fine__arg, ::cpp2::Metasyntactic questionable__arg, ::std::set<::std::int32_t> tags__arg) :
92     __fbthrift_field_reasonable(std::move(reasonable__arg)),
93     __fbthrift_field_fine(std::move(fine__arg)),
94     __fbthrift_field_questionable(std::move(questionable__arg)),
95     __fbthrift_field_tags(std::move(tags__arg)) {
96   __isset.set(folly::index_constant<0>(), true);
97   __isset.set(folly::index_constant<1>(), true);
98   __isset.set(folly::index_constant<2>(), true);
99   __isset.set(folly::index_constant<3>(), true);
100 }
101 
102 
__fbthrift_clear()103 void SomeStruct::__fbthrift_clear() {
104   // clear all fields
105   this->__fbthrift_field_reasonable =  ::cpp2::Metasyntactic::FOO;
106   this->__fbthrift_field_fine =  ::cpp2::Metasyntactic::BAR;
107   this->__fbthrift_field_questionable = static_cast< ::cpp2::Metasyntactic>(-1);
108   this->__fbthrift_field_tags.clear();
109   __isset = {};
110 }
111 
operator ==(const SomeStruct & rhs) const112 bool SomeStruct::operator==(const SomeStruct& rhs) const {
113   (void)rhs;
114   auto& lhs = *this;
115   (void)lhs;
116   if (!(lhs.reasonable_ref() == rhs.reasonable_ref())) {
117     return false;
118   }
119   if (!(lhs.fine_ref() == rhs.fine_ref())) {
120     return false;
121   }
122   if (!(lhs.questionable_ref() == rhs.questionable_ref())) {
123     return false;
124   }
125   if (!(lhs.tags_ref() == rhs.tags_ref())) {
126     return false;
127   }
128   return true;
129 }
130 
operator <(const SomeStruct & rhs) const131 bool SomeStruct::operator<(const SomeStruct& rhs) const {
132   (void)rhs;
133   auto& lhs = *this;
134   (void)lhs;
135   if (!(lhs.reasonable_ref() == rhs.reasonable_ref())) {
136     return lhs.reasonable_ref() < rhs.reasonable_ref();
137   }
138   if (!(lhs.fine_ref() == rhs.fine_ref())) {
139     return lhs.fine_ref() < rhs.fine_ref();
140   }
141   if (!(lhs.questionable_ref() == rhs.questionable_ref())) {
142     return lhs.questionable_ref() < rhs.questionable_ref();
143   }
144   if (!(lhs.tags_ref() == rhs.tags_ref())) {
145     return lhs.tags_ref() < rhs.tags_ref();
146   }
147   return false;
148 }
149 
get_tags() const150 const ::std::set<::std::int32_t>& SomeStruct::get_tags() const& {
151   return __fbthrift_field_tags;
152 }
153 
get_tags()154 ::std::set<::std::int32_t> SomeStruct::get_tags() && {
155   return std::move(__fbthrift_field_tags);
156 }
157 
158 
swap(SomeStruct & a,SomeStruct & b)159 void swap(SomeStruct& a, SomeStruct& b) {
160   using ::std::swap;
161   swap(a.reasonable_ref().value(), b.reasonable_ref().value());
162   swap(a.fine_ref().value(), b.fine_ref().value());
163   swap(a.questionable_ref().value(), b.questionable_ref().value());
164   swap(a.tags_ref().value(), b.tags_ref().value());
165   swap(a.__isset, b.__isset);
166 }
167 
168 template void SomeStruct::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
169 template uint32_t SomeStruct::write<>(apache::thrift::BinaryProtocolWriter*) const;
170 template uint32_t SomeStruct::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
171 template uint32_t SomeStruct::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
172 template void SomeStruct::readNoXfer<>(apache::thrift::CompactProtocolReader*);
173 template uint32_t SomeStruct::write<>(apache::thrift::CompactProtocolWriter*) const;
174 template uint32_t SomeStruct::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
175 template uint32_t SomeStruct::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;
176 
177 
178 
179 } // cpp2
180 
181 namespace cpp2 { namespace {
validateAdapters()182 FOLLY_MAYBE_UNUSED FOLLY_ERASE void validateAdapters() {
183 }
184 }} // cpp2
185