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/deprecated-public-fields-for-cpp-ref/gen-cpp2/module_types.h"
8 #include "thrift/compiler/test/fixtures/deprecated-public-fields-for-cpp-ref/gen-cpp2/module_types.tcc"
9 
10 #include <thrift/lib/cpp2/gen/module_types_cpp.h>
11 
12 #include "thrift/compiler/test/fixtures/deprecated-public-fields-for-cpp-ref/gen-cpp2/module_data.h"
13 
14 
15 namespace apache {
16 namespace thrift {
17 namespace detail {
18 
translateFieldName(folly::StringPiece _fname,int16_t & fid,apache::thrift::protocol::TType & _ftype)19 void TccStructTraits<::cpp2::Foo>::translateFieldName(
20     folly::StringPiece _fname,
21     int16_t& fid,
22     apache::thrift::protocol::TType& _ftype) noexcept {
23   using data = apache::thrift::TStructDataStorage<::cpp2::Foo>;
24   static const st::translate_field_name_table table{
25       data::fields_size,
26       data::fields_names.data(),
27       data::fields_ids.data(),
28       data::fields_types.data()};
29   st::translate_field_name(_fname, fid, _ftype, table);
30 }
31 
32 } // namespace detail
33 } // namespace thrift
34 } // namespace apache
35 
36 namespace cpp2 {
37 
Foo(const Foo & srcObj)38 Foo::Foo(const Foo& srcObj) {
39   __fbthrift_field_foo = ::apache::thrift::detail::st::copy_field<
40         ::apache::thrift::type_class::structure>(srcObj.__fbthrift_field_foo);
41   __fbthrift_field_bar = srcObj.__fbthrift_field_bar;
42 }
43 
operator =(const Foo & src)44 Foo& Foo::operator=(const Foo& src) {
45   Foo tmp(src);
46   swap(*this, tmp);
47   return *this;
48 }
49 
Foo(Foo && other)50 Foo::Foo(Foo&& other) noexcept  :
51     __fbthrift_field_foo(std::move(other.__fbthrift_field_foo)),
52     __fbthrift_field_bar(std::move(other.__fbthrift_field_bar)) {
53 }
54 
operator =(FOLLY_MAYBE_UNUSED Foo && other)55 Foo& Foo::operator=(FOLLY_MAYBE_UNUSED Foo&& other) noexcept {
56     this->__fbthrift_field_foo = std::move(other.__fbthrift_field_foo);
57     this->__fbthrift_field_bar = std::move(other.__fbthrift_field_bar);
58     return *this;
59 }
60 
61 
Foo(apache::thrift::FragileConstructor,::std::unique_ptr<::cpp2::Foo> foo__arg,::std::shared_ptr<::cpp2::Foo> bar__arg)62 Foo::Foo(apache::thrift::FragileConstructor, ::std::unique_ptr<::cpp2::Foo> foo__arg, ::std::shared_ptr<::cpp2::Foo> bar__arg) :
63     __fbthrift_field_foo(std::move(foo__arg)),
64     __fbthrift_field_bar(std::move(bar__arg)) {
65 }
66 
67 
__fbthrift_clear()68 void Foo::__fbthrift_clear() {
69   // clear all fields
70   this->__fbthrift_field_foo.reset();
71   this->__fbthrift_field_bar.reset();
72 }
73 
operator ==(const Foo & rhs) const74 bool Foo::operator==(const Foo& rhs) const {
75   (void)rhs;
76   auto& lhs = *this;
77   (void)lhs;
78   if ((!::apache::thrift::detail::pointer_equal(lhs.foo_ref(), rhs.foo_ref()))) {
79     return false;
80   }
81   if ((!::apache::thrift::detail::pointer_equal(lhs.bar_ref(), rhs.bar_ref()))) {
82     return false;
83   }
84   return true;
85 }
86 
operator <(const Foo & rhs) const87 bool Foo::operator<(const Foo& rhs) const {
88   (void)rhs;
89   auto& lhs = *this;
90   (void)lhs;
91   if ((!::apache::thrift::detail::pointer_equal(lhs.foo_ref(), rhs.foo_ref()))) {
92     return ::apache::thrift::detail::pointer_less(lhs.foo_ref(), rhs.foo_ref());
93   }
94   if ((!::apache::thrift::detail::pointer_equal(lhs.bar_ref(), rhs.bar_ref()))) {
95     return ::apache::thrift::detail::pointer_less(lhs.bar_ref(), rhs.bar_ref());
96   }
97   return false;
98 }
99 
100 
swap(Foo & a,Foo & b)101 void swap(Foo& a, Foo& b) {
102   using ::std::swap;
103   swap(a.__fbthrift_field_foo, b.__fbthrift_field_foo);
104   swap(a.__fbthrift_field_bar, b.__fbthrift_field_bar);
105 }
106 
107 template void Foo::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
108 template uint32_t Foo::write<>(apache::thrift::BinaryProtocolWriter*) const;
109 template uint32_t Foo::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
110 template uint32_t Foo::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
111 template void Foo::readNoXfer<>(apache::thrift::CompactProtocolReader*);
112 template uint32_t Foo::write<>(apache::thrift::CompactProtocolWriter*) const;
113 template uint32_t Foo::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
114 template uint32_t Foo::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;
115 
116 static_assert(
117     ::apache::thrift::detail::st::gen_check_json<
118         Foo,
119         ::apache::thrift::type_class::structure,
120         ::cpp2::Foo>,
121     "inconsistent use of json option");
122 static_assert(
123     ::apache::thrift::detail::st::gen_check_json<
124         Foo,
125         ::apache::thrift::type_class::structure,
126         ::cpp2::Foo>,
127     "inconsistent use of json option");
128 
129 static_assert(
130     ::apache::thrift::detail::st::gen_check_nimble<
131         Foo,
132         ::apache::thrift::type_class::structure,
133         ::cpp2::Foo>,
134     "inconsistent use of nimble option");
135 static_assert(
136     ::apache::thrift::detail::st::gen_check_nimble<
137         Foo,
138         ::apache::thrift::type_class::structure,
139         ::cpp2::Foo>,
140     "inconsistent use of nimble option");
141 
142 } // cpp2
143 
144 namespace cpp2 { namespace {
validateAdapters()145 FOLLY_MAYBE_UNUSED FOLLY_ERASE void validateAdapters() {
146 }
147 }} // cpp2
148