/src/brpc/build/test/addressbook.pb.cc
Line | Count | Source |
1 | | // Generated by the protocol buffer compiler. DO NOT EDIT! |
2 | | // source: addressbook.proto |
3 | | |
4 | | #include "addressbook.pb.h" |
5 | | |
6 | | #include <algorithm> |
7 | | |
8 | | #include <google/protobuf/io/coded_stream.h> |
9 | | #include <google/protobuf/extension_set.h> |
10 | | #include <google/protobuf/wire_format_lite.h> |
11 | | #include <google/protobuf/descriptor.h> |
12 | | #include <google/protobuf/generated_message_reflection.h> |
13 | | #include <google/protobuf/reflection_ops.h> |
14 | | #include <google/protobuf/wire_format.h> |
15 | | // @@protoc_insertion_point(includes) |
16 | | #include <google/protobuf/port_def.inc> |
17 | | |
18 | | PROTOBUF_PRAGMA_INIT_SEG |
19 | | |
20 | | namespace _pb = ::PROTOBUF_NAMESPACE_ID; |
21 | | namespace _pbi = _pb::internal; |
22 | | |
23 | | namespace addressbook { |
24 | | PROTOBUF_CONSTEXPR Person_PhoneNumber::Person_PhoneNumber( |
25 | | ::_pbi::ConstantInitialized): _impl_{ |
26 | | /*decltype(_impl_._has_bits_)*/{} |
27 | | , /*decltype(_impl_._cached_size_)*/{} |
28 | | , /*decltype(_impl_.number_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} |
29 | | , /*decltype(_impl_.type_)*/1} {} |
30 | | struct Person_PhoneNumberDefaultTypeInternal { |
31 | | PROTOBUF_CONSTEXPR Person_PhoneNumberDefaultTypeInternal() |
32 | 0 | : _instance(::_pbi::ConstantInitialized{}) {} |
33 | 0 | ~Person_PhoneNumberDefaultTypeInternal() {} |
34 | | union { |
35 | | Person_PhoneNumber _instance; |
36 | | }; |
37 | | }; |
38 | | PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 Person_PhoneNumberDefaultTypeInternal _Person_PhoneNumber_default_instance_; |
39 | | PROTOBUF_CONSTEXPR Person::Person( |
40 | | ::_pbi::ConstantInitialized): _impl_{ |
41 | | /*decltype(_impl_._extensions_)*/{} |
42 | | , /*decltype(_impl_._has_bits_)*/{} |
43 | | , /*decltype(_impl_._cached_size_)*/{} |
44 | | , /*decltype(_impl_.phone_)*/{} |
45 | | , /*decltype(_impl_.name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} |
46 | | , /*decltype(_impl_.email_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} |
47 | | , /*decltype(_impl_.databyte_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} |
48 | | , /*decltype(_impl_.id_)*/0 |
49 | | , /*decltype(_impl_.data32_)*/0 |
50 | | , /*decltype(_impl_.data_)*/int64_t{0} |
51 | | , /*decltype(_impl_.data64_)*/int64_t{0} |
52 | | , /*decltype(_impl_.datadouble_)*/0 |
53 | | , /*decltype(_impl_.datafloat_)*/0 |
54 | | , /*decltype(_impl_.datau32_)*/0u |
55 | | , /*decltype(_impl_.datau64_)*/uint64_t{0u} |
56 | | , /*decltype(_impl_.databool_)*/false |
57 | | , /*decltype(_impl_.datafix32_)*/0u |
58 | | , /*decltype(_impl_.datafix64_)*/uint64_t{0u} |
59 | | , /*decltype(_impl_.datasfix64_)*/int64_t{0} |
60 | | , /*decltype(_impl_.datasfix32_)*/0 |
61 | | , /*decltype(_impl_.datafloat_scientific_)*/0 |
62 | | , /*decltype(_impl_.datadouble_scientific_)*/0} {} |
63 | | struct PersonDefaultTypeInternal { |
64 | | PROTOBUF_CONSTEXPR PersonDefaultTypeInternal() |
65 | 0 | : _instance(::_pbi::ConstantInitialized{}) {} |
66 | 0 | ~PersonDefaultTypeInternal() {} |
67 | | union { |
68 | | Person _instance; |
69 | | }; |
70 | | }; |
71 | | PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PersonDefaultTypeInternal _Person_default_instance_; |
72 | | PROTOBUF_CONSTEXPR AddressBook::AddressBook( |
73 | | ::_pbi::ConstantInitialized): _impl_{ |
74 | | /*decltype(_impl_.person_)*/{} |
75 | | , /*decltype(_impl_._cached_size_)*/{}} {} |
76 | | struct AddressBookDefaultTypeInternal { |
77 | | PROTOBUF_CONSTEXPR AddressBookDefaultTypeInternal() |
78 | 0 | : _instance(::_pbi::ConstantInitialized{}) {} |
79 | 0 | ~AddressBookDefaultTypeInternal() {} |
80 | | union { |
81 | | AddressBook _instance; |
82 | | }; |
83 | | }; |
84 | | PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 AddressBookDefaultTypeInternal _AddressBook_default_instance_; |
85 | | } // namespace addressbook |
86 | | static ::_pb::Metadata file_level_metadata_addressbook_2eproto[3]; |
87 | | static const ::_pb::EnumDescriptor* file_level_enum_descriptors_addressbook_2eproto[1]; |
88 | | static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_addressbook_2eproto = nullptr; |
89 | | |
90 | | const uint32_t TableStruct_addressbook_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { |
91 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person_PhoneNumber, _impl_._has_bits_), |
92 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person_PhoneNumber, _internal_metadata_), |
93 | | ~0u, // no _extensions_ |
94 | | ~0u, // no _oneof_case_ |
95 | | ~0u, // no _weak_field_map_ |
96 | | ~0u, // no _inlined_string_donated_ |
97 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person_PhoneNumber, _impl_.number_), |
98 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person_PhoneNumber, _impl_.type_), |
99 | | 0, |
100 | | 1, |
101 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_._has_bits_), |
102 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _internal_metadata_), |
103 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_._extensions_), |
104 | | ~0u, // no _oneof_case_ |
105 | | ~0u, // no _weak_field_map_ |
106 | | ~0u, // no _inlined_string_donated_ |
107 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.name_), |
108 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.id_), |
109 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.email_), |
110 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.phone_), |
111 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.data_), |
112 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.data32_), |
113 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.data64_), |
114 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.datadouble_), |
115 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.datafloat_), |
116 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.datau32_), |
117 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.datau64_), |
118 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.databool_), |
119 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.databyte_), |
120 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.datafix32_), |
121 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.datafix64_), |
122 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.datasfix32_), |
123 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.datasfix64_), |
124 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.datafloat_scientific_), |
125 | | PROTOBUF_FIELD_OFFSET(::addressbook::Person, _impl_.datadouble_scientific_), |
126 | | 0, |
127 | | 3, |
128 | | 1, |
129 | | ~0u, |
130 | | 5, |
131 | | 4, |
132 | | 6, |
133 | | 7, |
134 | | 8, |
135 | | 9, |
136 | | 10, |
137 | | 11, |
138 | | 2, |
139 | | 12, |
140 | | 13, |
141 | | 15, |
142 | | 14, |
143 | | 16, |
144 | | 17, |
145 | | ~0u, // no _has_bits_ |
146 | | PROTOBUF_FIELD_OFFSET(::addressbook::AddressBook, _internal_metadata_), |
147 | | ~0u, // no _extensions_ |
148 | | ~0u, // no _oneof_case_ |
149 | | ~0u, // no _weak_field_map_ |
150 | | ~0u, // no _inlined_string_donated_ |
151 | | PROTOBUF_FIELD_OFFSET(::addressbook::AddressBook, _impl_.person_), |
152 | | }; |
153 | | static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { |
154 | | { 0, 8, -1, sizeof(::addressbook::Person_PhoneNumber)}, |
155 | | { 10, 35, -1, sizeof(::addressbook::Person)}, |
156 | | { 54, -1, -1, sizeof(::addressbook::AddressBook)}, |
157 | | }; |
158 | | |
159 | | static const ::_pb::Message* const file_default_instances[] = { |
160 | | &::addressbook::_Person_PhoneNumber_default_instance_._instance, |
161 | | &::addressbook::_Person_default_instance_._instance, |
162 | | &::addressbook::_AddressBook_default_instance_._instance, |
163 | | }; |
164 | | |
165 | | const char descriptor_table_protodef_addressbook_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = |
166 | | "\n\021addressbook.proto\022\013addressbook\"\215\004\n\006Per" |
167 | | "son\022\014\n\004name\030\001 \002(\t\022\n\n\002id\030\002 \002(\005\022\r\n\005email\030\003" |
168 | | " \001(\t\022.\n\005phone\030\004 \003(\0132\037.addressbook.Person" |
169 | | ".PhoneNumber\022\014\n\004data\030\005 \001(\003\022\016\n\006data32\030\006 \001" |
170 | | "(\021\022\016\n\006data64\030\007 \001(\022\022\022\n\ndatadouble\030\010 \002(\001\022\021" |
171 | | "\n\tdatafloat\030\t \001(\002\022\017\n\007datau32\030\n \001(\r\022\017\n\007da" |
172 | | "tau64\030\013 \001(\004\022\020\n\010databool\030\014 \001(\010\022\020\n\010databyt" |
173 | | "e\030\r \001(\014\022\021\n\tdatafix32\030\016 \001(\007\022\021\n\tdatafix64\030" |
174 | | "\017 \001(\006\022\022\n\ndatasfix32\030\020 \001(\017\022\022\n\ndatasfix64\030" |
175 | | "\021 \001(\020\022\034\n\024datafloat_scientific\030\022 \001(\002\022\035\n\025d" |
176 | | "atadouble_scientific\030\023 \001(\001\032P\n\013PhoneNumbe" |
177 | | "r\022\016\n\006number\030\001 \002(\t\0221\n\004type\030\002 \001(\0162\035.addres" |
178 | | "sbook.Person.PhoneType:\004HOME\"+\n\tPhoneTyp" |
179 | | "e\022\n\n\006MOBILE\020\000\022\010\n\004HOME\020\001\022\010\n\004WORK\020\002*\005\010d\020\311\001" |
180 | | "\"2\n\013AddressBook\022#\n\006person\030\001 \003(\0132\023.addres" |
181 | | "sbook.Person:\"\n\005hobby\022\023.addressbook.Pers" |
182 | | "on\030d \001(\t" |
183 | | ; |
184 | | static ::_pbi::once_flag descriptor_table_addressbook_2eproto_once; |
185 | | const ::_pbi::DescriptorTable descriptor_table_addressbook_2eproto = { |
186 | | false, false, 648, descriptor_table_protodef_addressbook_2eproto, |
187 | | "addressbook.proto", |
188 | | &descriptor_table_addressbook_2eproto_once, nullptr, 0, 3, |
189 | | schemas, file_default_instances, TableStruct_addressbook_2eproto::offsets, |
190 | | file_level_metadata_addressbook_2eproto, file_level_enum_descriptors_addressbook_2eproto, |
191 | | file_level_service_descriptors_addressbook_2eproto, |
192 | | }; |
193 | 0 | PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_addressbook_2eproto_getter() { |
194 | 0 | return &descriptor_table_addressbook_2eproto; |
195 | 0 | } |
196 | | |
197 | | // Force running AddDescriptors() at dynamic initialization time. |
198 | | PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_addressbook_2eproto(&descriptor_table_addressbook_2eproto); |
199 | | namespace addressbook { |
200 | 0 | const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Person_PhoneType_descriptor() { |
201 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_addressbook_2eproto); |
202 | 0 | return file_level_enum_descriptors_addressbook_2eproto[0]; |
203 | 0 | } |
204 | 0 | bool Person_PhoneType_IsValid(int value) { |
205 | 0 | switch (value) { |
206 | 0 | case 0: |
207 | 0 | case 1: |
208 | 0 | case 2: |
209 | 0 | return true; |
210 | 0 | default: |
211 | 0 | return false; |
212 | 0 | } |
213 | 0 | } |
214 | | |
215 | | #if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) |
216 | | constexpr Person_PhoneType Person::MOBILE; |
217 | | constexpr Person_PhoneType Person::HOME; |
218 | | constexpr Person_PhoneType Person::WORK; |
219 | | constexpr Person_PhoneType Person::PhoneType_MIN; |
220 | | constexpr Person_PhoneType Person::PhoneType_MAX; |
221 | | constexpr int Person::PhoneType_ARRAYSIZE; |
222 | | #endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) |
223 | | |
224 | | // =================================================================== |
225 | | |
226 | | class Person_PhoneNumber::_Internal { |
227 | | public: |
228 | | using HasBits = decltype(std::declval<Person_PhoneNumber>()._impl_._has_bits_); |
229 | 0 | static void set_has_number(HasBits* has_bits) { |
230 | 0 | (*has_bits)[0] |= 1u; |
231 | 0 | } |
232 | 0 | static void set_has_type(HasBits* has_bits) { |
233 | 0 | (*has_bits)[0] |= 2u; |
234 | 0 | } |
235 | 0 | static bool MissingRequiredFields(const HasBits& has_bits) { |
236 | 0 | return ((has_bits[0] & 0x00000001) ^ 0x00000001) != 0; |
237 | 0 | } |
238 | | }; |
239 | | |
240 | | Person_PhoneNumber::Person_PhoneNumber(::PROTOBUF_NAMESPACE_ID::Arena* arena, |
241 | | bool is_message_owned) |
242 | 0 | : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { |
243 | 0 | SharedCtor(arena, is_message_owned); |
244 | | // @@protoc_insertion_point(arena_constructor:addressbook.Person.PhoneNumber) |
245 | 0 | } |
246 | | Person_PhoneNumber::Person_PhoneNumber(const Person_PhoneNumber& from) |
247 | 0 | : ::PROTOBUF_NAMESPACE_ID::Message() { |
248 | 0 | Person_PhoneNumber* const _this = this; (void)_this; |
249 | 0 | new (&_impl_) Impl_{ |
250 | 0 | decltype(_impl_._has_bits_){from._impl_._has_bits_} |
251 | 0 | , /*decltype(_impl_._cached_size_)*/{} |
252 | 0 | , decltype(_impl_.number_){} |
253 | 0 | , decltype(_impl_.type_){}}; |
254 | |
|
255 | 0 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
256 | 0 | _impl_.number_.InitDefault(); |
257 | | #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING |
258 | | _impl_.number_.Set("", GetArenaForAllocation()); |
259 | | #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING |
260 | 0 | if (from._internal_has_number()) { |
261 | 0 | _this->_impl_.number_.Set(from._internal_number(), |
262 | 0 | _this->GetArenaForAllocation()); |
263 | 0 | } |
264 | 0 | _this->_impl_.type_ = from._impl_.type_; |
265 | | // @@protoc_insertion_point(copy_constructor:addressbook.Person.PhoneNumber) |
266 | 0 | } |
267 | | |
268 | | inline void Person_PhoneNumber::SharedCtor( |
269 | 0 | ::_pb::Arena* arena, bool is_message_owned) { |
270 | 0 | (void)arena; |
271 | 0 | (void)is_message_owned; |
272 | 0 | new (&_impl_) Impl_{ |
273 | 0 | decltype(_impl_._has_bits_){} |
274 | 0 | , /*decltype(_impl_._cached_size_)*/{} |
275 | 0 | , decltype(_impl_.number_){} |
276 | 0 | , decltype(_impl_.type_){1} |
277 | 0 | }; |
278 | 0 | _impl_.number_.InitDefault(); |
279 | | #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING |
280 | | _impl_.number_.Set("", GetArenaForAllocation()); |
281 | | #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING |
282 | 0 | } |
283 | | |
284 | 0 | Person_PhoneNumber::~Person_PhoneNumber() { |
285 | | // @@protoc_insertion_point(destructor:addressbook.Person.PhoneNumber) |
286 | 0 | if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { |
287 | 0 | (void)arena; |
288 | 0 | return; |
289 | 0 | } |
290 | 0 | SharedDtor(); |
291 | 0 | } |
292 | | |
293 | 0 | inline void Person_PhoneNumber::SharedDtor() { |
294 | 0 | GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); |
295 | 0 | _impl_.number_.Destroy(); |
296 | 0 | } |
297 | | |
298 | 0 | void Person_PhoneNumber::SetCachedSize(int size) const { |
299 | 0 | _impl_._cached_size_.Set(size); |
300 | 0 | } |
301 | | |
302 | 0 | void Person_PhoneNumber::Clear() { |
303 | | // @@protoc_insertion_point(message_clear_start:addressbook.Person.PhoneNumber) |
304 | 0 | uint32_t cached_has_bits = 0; |
305 | | // Prevent compiler warnings about cached_has_bits being unused |
306 | 0 | (void) cached_has_bits; |
307 | |
|
308 | 0 | cached_has_bits = _impl_._has_bits_[0]; |
309 | 0 | if (cached_has_bits & 0x00000003u) { |
310 | 0 | if (cached_has_bits & 0x00000001u) { |
311 | 0 | _impl_.number_.ClearNonDefaultToEmpty(); |
312 | 0 | } |
313 | 0 | _impl_.type_ = 1; |
314 | 0 | } |
315 | 0 | _impl_._has_bits_.Clear(); |
316 | 0 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
317 | 0 | } |
318 | | |
319 | 0 | const char* Person_PhoneNumber::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { |
320 | 0 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
321 | 0 | _Internal::HasBits has_bits{}; |
322 | 0 | while (!ctx->Done(&ptr)) { |
323 | 0 | uint32_t tag; |
324 | 0 | ptr = ::_pbi::ReadTag(ptr, &tag); |
325 | 0 | switch (tag >> 3) { |
326 | | // required string number = 1; |
327 | 0 | case 1: |
328 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { |
329 | 0 | auto str = _internal_mutable_number(); |
330 | 0 | ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); |
331 | 0 | CHK_(ptr); |
332 | 0 | #ifndef NDEBUG |
333 | 0 | ::_pbi::VerifyUTF8(str, "addressbook.Person.PhoneNumber.number"); |
334 | 0 | #endif // !NDEBUG |
335 | 0 | } else |
336 | 0 | goto handle_unusual; |
337 | 0 | continue; |
338 | | // optional .addressbook.Person.PhoneType type = 2 [default = HOME]; |
339 | 0 | case 2: |
340 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { |
341 | 0 | uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
342 | 0 | CHK_(ptr); |
343 | 0 | if (PROTOBUF_PREDICT_TRUE(::addressbook::Person_PhoneType_IsValid(val))) { |
344 | 0 | _internal_set_type(static_cast<::addressbook::Person_PhoneType>(val)); |
345 | 0 | } else { |
346 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); |
347 | 0 | } |
348 | 0 | } else |
349 | 0 | goto handle_unusual; |
350 | 0 | continue; |
351 | 0 | default: |
352 | 0 | goto handle_unusual; |
353 | 0 | } // switch |
354 | 0 | handle_unusual: |
355 | 0 | if ((tag == 0) || ((tag & 7) == 4)) { |
356 | 0 | CHK_(ptr); |
357 | 0 | ctx->SetLastTag(tag); |
358 | 0 | goto message_done; |
359 | 0 | } |
360 | 0 | ptr = UnknownFieldParse( |
361 | 0 | tag, |
362 | 0 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
363 | 0 | ptr, ctx); |
364 | 0 | CHK_(ptr != nullptr); |
365 | 0 | } // while |
366 | 0 | message_done: |
367 | 0 | _impl_._has_bits_.Or(has_bits); |
368 | 0 | return ptr; |
369 | 0 | failure: |
370 | 0 | ptr = nullptr; |
371 | 0 | goto message_done; |
372 | 0 | #undef CHK_ |
373 | 0 | } |
374 | | |
375 | | uint8_t* Person_PhoneNumber::_InternalSerialize( |
376 | 0 | uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
377 | | // @@protoc_insertion_point(serialize_to_array_start:addressbook.Person.PhoneNumber) |
378 | 0 | uint32_t cached_has_bits = 0; |
379 | 0 | (void) cached_has_bits; |
380 | |
|
381 | 0 | cached_has_bits = _impl_._has_bits_[0]; |
382 | | // required string number = 1; |
383 | 0 | if (cached_has_bits & 0x00000001u) { |
384 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
385 | 0 | this->_internal_number().data(), static_cast<int>(this->_internal_number().length()), |
386 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
387 | 0 | "addressbook.Person.PhoneNumber.number"); |
388 | 0 | target = stream->WriteStringMaybeAliased( |
389 | 0 | 1, this->_internal_number(), target); |
390 | 0 | } |
391 | | |
392 | | // optional .addressbook.Person.PhoneType type = 2 [default = HOME]; |
393 | 0 | if (cached_has_bits & 0x00000002u) { |
394 | 0 | target = stream->EnsureSpace(target); |
395 | 0 | target = ::_pbi::WireFormatLite::WriteEnumToArray( |
396 | 0 | 2, this->_internal_type(), target); |
397 | 0 | } |
398 | |
|
399 | 0 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
400 | 0 | target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( |
401 | 0 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
402 | 0 | } |
403 | | // @@protoc_insertion_point(serialize_to_array_end:addressbook.Person.PhoneNumber) |
404 | 0 | return target; |
405 | 0 | } |
406 | | |
407 | 0 | size_t Person_PhoneNumber::ByteSizeLong() const { |
408 | | // @@protoc_insertion_point(message_byte_size_start:addressbook.Person.PhoneNumber) |
409 | 0 | size_t total_size = 0; |
410 | | |
411 | | // required string number = 1; |
412 | 0 | if (_internal_has_number()) { |
413 | 0 | total_size += 1 + |
414 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
415 | 0 | this->_internal_number()); |
416 | 0 | } |
417 | 0 | uint32_t cached_has_bits = 0; |
418 | | // Prevent compiler warnings about cached_has_bits being unused |
419 | 0 | (void) cached_has_bits; |
420 | | |
421 | | // optional .addressbook.Person.PhoneType type = 2 [default = HOME]; |
422 | 0 | cached_has_bits = _impl_._has_bits_[0]; |
423 | 0 | if (cached_has_bits & 0x00000002u) { |
424 | 0 | total_size += 1 + |
425 | 0 | ::_pbi::WireFormatLite::EnumSize(this->_internal_type()); |
426 | 0 | } |
427 | |
|
428 | 0 | return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); |
429 | 0 | } |
430 | | |
431 | | const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Person_PhoneNumber::_class_data_ = { |
432 | | ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, |
433 | | Person_PhoneNumber::MergeImpl |
434 | | }; |
435 | 0 | const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Person_PhoneNumber::GetClassData() const { return &_class_data_; } |
436 | | |
437 | | |
438 | 0 | void Person_PhoneNumber::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { |
439 | 0 | auto* const _this = static_cast<Person_PhoneNumber*>(&to_msg); |
440 | 0 | auto& from = static_cast<const Person_PhoneNumber&>(from_msg); |
441 | | // @@protoc_insertion_point(class_specific_merge_from_start:addressbook.Person.PhoneNumber) |
442 | 0 | GOOGLE_DCHECK_NE(&from, _this); |
443 | 0 | uint32_t cached_has_bits = 0; |
444 | 0 | (void) cached_has_bits; |
445 | |
|
446 | 0 | cached_has_bits = from._impl_._has_bits_[0]; |
447 | 0 | if (cached_has_bits & 0x00000003u) { |
448 | 0 | if (cached_has_bits & 0x00000001u) { |
449 | 0 | _this->_internal_set_number(from._internal_number()); |
450 | 0 | } |
451 | 0 | if (cached_has_bits & 0x00000002u) { |
452 | 0 | _this->_impl_.type_ = from._impl_.type_; |
453 | 0 | } |
454 | 0 | _this->_impl_._has_bits_[0] |= cached_has_bits; |
455 | 0 | } |
456 | 0 | _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
457 | 0 | } |
458 | | |
459 | 0 | void Person_PhoneNumber::CopyFrom(const Person_PhoneNumber& from) { |
460 | | // @@protoc_insertion_point(class_specific_copy_from_start:addressbook.Person.PhoneNumber) |
461 | 0 | if (&from == this) return; |
462 | 0 | Clear(); |
463 | 0 | MergeFrom(from); |
464 | 0 | } |
465 | | |
466 | 0 | bool Person_PhoneNumber::IsInitialized() const { |
467 | 0 | if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false; |
468 | 0 | return true; |
469 | 0 | } |
470 | | |
471 | 0 | void Person_PhoneNumber::InternalSwap(Person_PhoneNumber* other) { |
472 | 0 | using std::swap; |
473 | 0 | auto* lhs_arena = GetArenaForAllocation(); |
474 | 0 | auto* rhs_arena = other->GetArenaForAllocation(); |
475 | 0 | _internal_metadata_.InternalSwap(&other->_internal_metadata_); |
476 | 0 | swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); |
477 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( |
478 | 0 | &_impl_.number_, lhs_arena, |
479 | 0 | &other->_impl_.number_, rhs_arena |
480 | 0 | ); |
481 | 0 | swap(_impl_.type_, other->_impl_.type_); |
482 | 0 | } |
483 | | |
484 | 0 | ::PROTOBUF_NAMESPACE_ID::Metadata Person_PhoneNumber::GetMetadata() const { |
485 | 0 | return ::_pbi::AssignDescriptors( |
486 | 0 | &descriptor_table_addressbook_2eproto_getter, &descriptor_table_addressbook_2eproto_once, |
487 | 0 | file_level_metadata_addressbook_2eproto[0]); |
488 | 0 | } |
489 | | |
490 | | // =================================================================== |
491 | | |
492 | | class Person::_Internal { |
493 | | public: |
494 | | using HasBits = decltype(std::declval<Person>()._impl_._has_bits_); |
495 | 0 | static void set_has_name(HasBits* has_bits) { |
496 | 0 | (*has_bits)[0] |= 1u; |
497 | 0 | } |
498 | 0 | static void set_has_id(HasBits* has_bits) { |
499 | 0 | (*has_bits)[0] |= 8u; |
500 | 0 | } |
501 | 0 | static void set_has_email(HasBits* has_bits) { |
502 | 0 | (*has_bits)[0] |= 2u; |
503 | 0 | } |
504 | 0 | static void set_has_data(HasBits* has_bits) { |
505 | 0 | (*has_bits)[0] |= 32u; |
506 | 0 | } |
507 | 0 | static void set_has_data32(HasBits* has_bits) { |
508 | 0 | (*has_bits)[0] |= 16u; |
509 | 0 | } |
510 | 0 | static void set_has_data64(HasBits* has_bits) { |
511 | 0 | (*has_bits)[0] |= 64u; |
512 | 0 | } |
513 | 0 | static void set_has_datadouble(HasBits* has_bits) { |
514 | 0 | (*has_bits)[0] |= 128u; |
515 | 0 | } |
516 | 0 | static void set_has_datafloat(HasBits* has_bits) { |
517 | 0 | (*has_bits)[0] |= 256u; |
518 | 0 | } |
519 | 0 | static void set_has_datau32(HasBits* has_bits) { |
520 | 0 | (*has_bits)[0] |= 512u; |
521 | 0 | } |
522 | 0 | static void set_has_datau64(HasBits* has_bits) { |
523 | 0 | (*has_bits)[0] |= 1024u; |
524 | 0 | } |
525 | 0 | static void set_has_databool(HasBits* has_bits) { |
526 | 0 | (*has_bits)[0] |= 2048u; |
527 | 0 | } |
528 | 0 | static void set_has_databyte(HasBits* has_bits) { |
529 | 0 | (*has_bits)[0] |= 4u; |
530 | 0 | } |
531 | 0 | static void set_has_datafix32(HasBits* has_bits) { |
532 | 0 | (*has_bits)[0] |= 4096u; |
533 | 0 | } |
534 | 0 | static void set_has_datafix64(HasBits* has_bits) { |
535 | 0 | (*has_bits)[0] |= 8192u; |
536 | 0 | } |
537 | 0 | static void set_has_datasfix32(HasBits* has_bits) { |
538 | 0 | (*has_bits)[0] |= 32768u; |
539 | 0 | } |
540 | 0 | static void set_has_datasfix64(HasBits* has_bits) { |
541 | 0 | (*has_bits)[0] |= 16384u; |
542 | 0 | } |
543 | 0 | static void set_has_datafloat_scientific(HasBits* has_bits) { |
544 | 0 | (*has_bits)[0] |= 65536u; |
545 | 0 | } |
546 | 0 | static void set_has_datadouble_scientific(HasBits* has_bits) { |
547 | 0 | (*has_bits)[0] |= 131072u; |
548 | 0 | } |
549 | 0 | static bool MissingRequiredFields(const HasBits& has_bits) { |
550 | 0 | return ((has_bits[0] & 0x00000089) ^ 0x00000089) != 0; |
551 | 0 | } |
552 | | }; |
553 | | |
554 | | Person::Person(::PROTOBUF_NAMESPACE_ID::Arena* arena, |
555 | | bool is_message_owned) |
556 | 0 | : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { |
557 | 0 | SharedCtor(arena, is_message_owned); |
558 | | // @@protoc_insertion_point(arena_constructor:addressbook.Person) |
559 | 0 | } |
560 | | Person::Person(const Person& from) |
561 | 0 | : ::PROTOBUF_NAMESPACE_ID::Message() { |
562 | 0 | Person* const _this = this; (void)_this; |
563 | 0 | new (&_impl_) Impl_{ |
564 | 0 | /*decltype(_impl_._extensions_)*/{} |
565 | 0 | , decltype(_impl_._has_bits_){from._impl_._has_bits_} |
566 | 0 | , /*decltype(_impl_._cached_size_)*/{} |
567 | 0 | , decltype(_impl_.phone_){from._impl_.phone_} |
568 | 0 | , decltype(_impl_.name_){} |
569 | 0 | , decltype(_impl_.email_){} |
570 | 0 | , decltype(_impl_.databyte_){} |
571 | 0 | , decltype(_impl_.id_){} |
572 | 0 | , decltype(_impl_.data32_){} |
573 | 0 | , decltype(_impl_.data_){} |
574 | 0 | , decltype(_impl_.data64_){} |
575 | 0 | , decltype(_impl_.datadouble_){} |
576 | 0 | , decltype(_impl_.datafloat_){} |
577 | 0 | , decltype(_impl_.datau32_){} |
578 | 0 | , decltype(_impl_.datau64_){} |
579 | 0 | , decltype(_impl_.databool_){} |
580 | 0 | , decltype(_impl_.datafix32_){} |
581 | 0 | , decltype(_impl_.datafix64_){} |
582 | 0 | , decltype(_impl_.datasfix64_){} |
583 | 0 | , decltype(_impl_.datasfix32_){} |
584 | 0 | , decltype(_impl_.datafloat_scientific_){} |
585 | 0 | , decltype(_impl_.datadouble_scientific_){}}; |
586 | |
|
587 | 0 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
588 | 0 | _impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); |
589 | 0 | _impl_.name_.InitDefault(); |
590 | | #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING |
591 | | _impl_.name_.Set("", GetArenaForAllocation()); |
592 | | #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING |
593 | 0 | if (from._internal_has_name()) { |
594 | 0 | _this->_impl_.name_.Set(from._internal_name(), |
595 | 0 | _this->GetArenaForAllocation()); |
596 | 0 | } |
597 | 0 | _impl_.email_.InitDefault(); |
598 | | #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING |
599 | | _impl_.email_.Set("", GetArenaForAllocation()); |
600 | | #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING |
601 | 0 | if (from._internal_has_email()) { |
602 | 0 | _this->_impl_.email_.Set(from._internal_email(), |
603 | 0 | _this->GetArenaForAllocation()); |
604 | 0 | } |
605 | 0 | _impl_.databyte_.InitDefault(); |
606 | | #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING |
607 | | _impl_.databyte_.Set("", GetArenaForAllocation()); |
608 | | #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING |
609 | 0 | if (from._internal_has_databyte()) { |
610 | 0 | _this->_impl_.databyte_.Set(from._internal_databyte(), |
611 | 0 | _this->GetArenaForAllocation()); |
612 | 0 | } |
613 | 0 | ::memcpy(&_impl_.id_, &from._impl_.id_, |
614 | 0 | static_cast<size_t>(reinterpret_cast<char*>(&_impl_.datadouble_scientific_) - |
615 | 0 | reinterpret_cast<char*>(&_impl_.id_)) + sizeof(_impl_.datadouble_scientific_)); |
616 | | // @@protoc_insertion_point(copy_constructor:addressbook.Person) |
617 | 0 | } |
618 | | |
619 | | inline void Person::SharedCtor( |
620 | 0 | ::_pb::Arena* arena, bool is_message_owned) { |
621 | 0 | (void)arena; |
622 | 0 | (void)is_message_owned; |
623 | 0 | new (&_impl_) Impl_{ |
624 | 0 | /*decltype(_impl_._extensions_)*/{::_pbi::ArenaInitialized(), arena} |
625 | 0 | , decltype(_impl_._has_bits_){} |
626 | 0 | , /*decltype(_impl_._cached_size_)*/{} |
627 | 0 | , decltype(_impl_.phone_){arena} |
628 | 0 | , decltype(_impl_.name_){} |
629 | 0 | , decltype(_impl_.email_){} |
630 | 0 | , decltype(_impl_.databyte_){} |
631 | 0 | , decltype(_impl_.id_){0} |
632 | 0 | , decltype(_impl_.data32_){0} |
633 | 0 | , decltype(_impl_.data_){int64_t{0}} |
634 | 0 | , decltype(_impl_.data64_){int64_t{0}} |
635 | 0 | , decltype(_impl_.datadouble_){0} |
636 | 0 | , decltype(_impl_.datafloat_){0} |
637 | 0 | , decltype(_impl_.datau32_){0u} |
638 | 0 | , decltype(_impl_.datau64_){uint64_t{0u}} |
639 | 0 | , decltype(_impl_.databool_){false} |
640 | 0 | , decltype(_impl_.datafix32_){0u} |
641 | 0 | , decltype(_impl_.datafix64_){uint64_t{0u}} |
642 | 0 | , decltype(_impl_.datasfix64_){int64_t{0}} |
643 | 0 | , decltype(_impl_.datasfix32_){0} |
644 | 0 | , decltype(_impl_.datafloat_scientific_){0} |
645 | 0 | , decltype(_impl_.datadouble_scientific_){0} |
646 | 0 | }; |
647 | 0 | _impl_.name_.InitDefault(); |
648 | | #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING |
649 | | _impl_.name_.Set("", GetArenaForAllocation()); |
650 | | #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING |
651 | 0 | _impl_.email_.InitDefault(); |
652 | | #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING |
653 | | _impl_.email_.Set("", GetArenaForAllocation()); |
654 | | #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING |
655 | 0 | _impl_.databyte_.InitDefault(); |
656 | | #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING |
657 | | _impl_.databyte_.Set("", GetArenaForAllocation()); |
658 | | #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING |
659 | 0 | } |
660 | | |
661 | 0 | Person::~Person() { |
662 | | // @@protoc_insertion_point(destructor:addressbook.Person) |
663 | 0 | if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { |
664 | 0 | (void)arena; |
665 | 0 | return; |
666 | 0 | } |
667 | 0 | SharedDtor(); |
668 | 0 | } |
669 | | |
670 | 0 | inline void Person::SharedDtor() { |
671 | 0 | GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); |
672 | 0 | _impl_._extensions_.~ExtensionSet(); |
673 | 0 | _impl_.phone_.~RepeatedPtrField(); |
674 | 0 | _impl_.name_.Destroy(); |
675 | 0 | _impl_.email_.Destroy(); |
676 | 0 | _impl_.databyte_.Destroy(); |
677 | 0 | } |
678 | | |
679 | 0 | void Person::SetCachedSize(int size) const { |
680 | 0 | _impl_._cached_size_.Set(size); |
681 | 0 | } |
682 | | |
683 | 0 | void Person::Clear() { |
684 | | // @@protoc_insertion_point(message_clear_start:addressbook.Person) |
685 | 0 | uint32_t cached_has_bits = 0; |
686 | | // Prevent compiler warnings about cached_has_bits being unused |
687 | 0 | (void) cached_has_bits; |
688 | |
|
689 | 0 | _impl_._extensions_.Clear(); |
690 | 0 | _impl_.phone_.Clear(); |
691 | 0 | cached_has_bits = _impl_._has_bits_[0]; |
692 | 0 | if (cached_has_bits & 0x00000007u) { |
693 | 0 | if (cached_has_bits & 0x00000001u) { |
694 | 0 | _impl_.name_.ClearNonDefaultToEmpty(); |
695 | 0 | } |
696 | 0 | if (cached_has_bits & 0x00000002u) { |
697 | 0 | _impl_.email_.ClearNonDefaultToEmpty(); |
698 | 0 | } |
699 | 0 | if (cached_has_bits & 0x00000004u) { |
700 | 0 | _impl_.databyte_.ClearNonDefaultToEmpty(); |
701 | 0 | } |
702 | 0 | } |
703 | 0 | if (cached_has_bits & 0x000000f8u) { |
704 | 0 | ::memset(&_impl_.id_, 0, static_cast<size_t>( |
705 | 0 | reinterpret_cast<char*>(&_impl_.datadouble_) - |
706 | 0 | reinterpret_cast<char*>(&_impl_.id_)) + sizeof(_impl_.datadouble_)); |
707 | 0 | } |
708 | 0 | if (cached_has_bits & 0x0000ff00u) { |
709 | 0 | ::memset(&_impl_.datafloat_, 0, static_cast<size_t>( |
710 | 0 | reinterpret_cast<char*>(&_impl_.datasfix32_) - |
711 | 0 | reinterpret_cast<char*>(&_impl_.datafloat_)) + sizeof(_impl_.datasfix32_)); |
712 | 0 | } |
713 | 0 | if (cached_has_bits & 0x00030000u) { |
714 | 0 | ::memset(&_impl_.datafloat_scientific_, 0, static_cast<size_t>( |
715 | 0 | reinterpret_cast<char*>(&_impl_.datadouble_scientific_) - |
716 | 0 | reinterpret_cast<char*>(&_impl_.datafloat_scientific_)) + sizeof(_impl_.datadouble_scientific_)); |
717 | 0 | } |
718 | 0 | _impl_._has_bits_.Clear(); |
719 | 0 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
720 | 0 | } |
721 | | |
722 | 0 | const char* Person::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { |
723 | 0 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
724 | 0 | _Internal::HasBits has_bits{}; |
725 | 0 | while (!ctx->Done(&ptr)) { |
726 | 0 | uint32_t tag; |
727 | 0 | ptr = ::_pbi::ReadTag(ptr, &tag); |
728 | 0 | switch (tag >> 3) { |
729 | | // required string name = 1; |
730 | 0 | case 1: |
731 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { |
732 | 0 | auto str = _internal_mutable_name(); |
733 | 0 | ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); |
734 | 0 | CHK_(ptr); |
735 | 0 | #ifndef NDEBUG |
736 | 0 | ::_pbi::VerifyUTF8(str, "addressbook.Person.name"); |
737 | 0 | #endif // !NDEBUG |
738 | 0 | } else |
739 | 0 | goto handle_unusual; |
740 | 0 | continue; |
741 | | // required int32 id = 2; |
742 | 0 | case 2: |
743 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { |
744 | 0 | _Internal::set_has_id(&has_bits); |
745 | 0 | _impl_.id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); |
746 | 0 | CHK_(ptr); |
747 | 0 | } else |
748 | 0 | goto handle_unusual; |
749 | 0 | continue; |
750 | | // optional string email = 3; |
751 | 0 | case 3: |
752 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { |
753 | 0 | auto str = _internal_mutable_email(); |
754 | 0 | ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); |
755 | 0 | CHK_(ptr); |
756 | 0 | #ifndef NDEBUG |
757 | 0 | ::_pbi::VerifyUTF8(str, "addressbook.Person.email"); |
758 | 0 | #endif // !NDEBUG |
759 | 0 | } else |
760 | 0 | goto handle_unusual; |
761 | 0 | continue; |
762 | | // repeated .addressbook.Person.PhoneNumber phone = 4; |
763 | 0 | case 4: |
764 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { |
765 | 0 | ptr -= 1; |
766 | 0 | do { |
767 | 0 | ptr += 1; |
768 | 0 | ptr = ctx->ParseMessage(_internal_add_phone(), ptr); |
769 | 0 | CHK_(ptr); |
770 | 0 | if (!ctx->DataAvailable(ptr)) break; |
771 | 0 | } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr)); |
772 | 0 | } else |
773 | 0 | goto handle_unusual; |
774 | 0 | continue; |
775 | | // optional int64 data = 5; |
776 | 0 | case 5: |
777 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) { |
778 | 0 | _Internal::set_has_data(&has_bits); |
779 | 0 | _impl_.data_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
780 | 0 | CHK_(ptr); |
781 | 0 | } else |
782 | 0 | goto handle_unusual; |
783 | 0 | continue; |
784 | | // optional sint32 data32 = 6; |
785 | 0 | case 6: |
786 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 48)) { |
787 | 0 | _Internal::set_has_data32(&has_bits); |
788 | 0 | _impl_.data32_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarintZigZag32(&ptr); |
789 | 0 | CHK_(ptr); |
790 | 0 | } else |
791 | 0 | goto handle_unusual; |
792 | 0 | continue; |
793 | | // optional sint64 data64 = 7; |
794 | 0 | case 7: |
795 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) { |
796 | 0 | _Internal::set_has_data64(&has_bits); |
797 | 0 | _impl_.data64_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarintZigZag64(&ptr); |
798 | 0 | CHK_(ptr); |
799 | 0 | } else |
800 | 0 | goto handle_unusual; |
801 | 0 | continue; |
802 | | // required double datadouble = 8; |
803 | 0 | case 8: |
804 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 65)) { |
805 | 0 | _Internal::set_has_datadouble(&has_bits); |
806 | 0 | _impl_.datadouble_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr); |
807 | 0 | ptr += sizeof(double); |
808 | 0 | } else |
809 | 0 | goto handle_unusual; |
810 | 0 | continue; |
811 | | // optional float datafloat = 9; |
812 | 0 | case 9: |
813 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 77)) { |
814 | 0 | _Internal::set_has_datafloat(&has_bits); |
815 | 0 | _impl_.datafloat_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr); |
816 | 0 | ptr += sizeof(float); |
817 | 0 | } else |
818 | 0 | goto handle_unusual; |
819 | 0 | continue; |
820 | | // optional uint32 datau32 = 10; |
821 | 0 | case 10: |
822 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) { |
823 | 0 | _Internal::set_has_datau32(&has_bits); |
824 | 0 | _impl_.datau32_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); |
825 | 0 | CHK_(ptr); |
826 | 0 | } else |
827 | 0 | goto handle_unusual; |
828 | 0 | continue; |
829 | | // optional uint64 datau64 = 11; |
830 | 0 | case 11: |
831 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 88)) { |
832 | 0 | _Internal::set_has_datau64(&has_bits); |
833 | 0 | _impl_.datau64_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
834 | 0 | CHK_(ptr); |
835 | 0 | } else |
836 | 0 | goto handle_unusual; |
837 | 0 | continue; |
838 | | // optional bool databool = 12; |
839 | 0 | case 12: |
840 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 96)) { |
841 | 0 | _Internal::set_has_databool(&has_bits); |
842 | 0 | _impl_.databool_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
843 | 0 | CHK_(ptr); |
844 | 0 | } else |
845 | 0 | goto handle_unusual; |
846 | 0 | continue; |
847 | | // optional bytes databyte = 13; |
848 | 0 | case 13: |
849 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 106)) { |
850 | 0 | auto str = _internal_mutable_databyte(); |
851 | 0 | ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); |
852 | 0 | CHK_(ptr); |
853 | 0 | } else |
854 | 0 | goto handle_unusual; |
855 | 0 | continue; |
856 | | // optional fixed32 datafix32 = 14; |
857 | 0 | case 14: |
858 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 117)) { |
859 | 0 | _Internal::set_has_datafix32(&has_bits); |
860 | 0 | _impl_.datafix32_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<uint32_t>(ptr); |
861 | 0 | ptr += sizeof(uint32_t); |
862 | 0 | } else |
863 | 0 | goto handle_unusual; |
864 | 0 | continue; |
865 | | // optional fixed64 datafix64 = 15; |
866 | 0 | case 15: |
867 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 121)) { |
868 | 0 | _Internal::set_has_datafix64(&has_bits); |
869 | 0 | _impl_.datafix64_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<uint64_t>(ptr); |
870 | 0 | ptr += sizeof(uint64_t); |
871 | 0 | } else |
872 | 0 | goto handle_unusual; |
873 | 0 | continue; |
874 | | // optional sfixed32 datasfix32 = 16; |
875 | 0 | case 16: |
876 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 133)) { |
877 | 0 | _Internal::set_has_datasfix32(&has_bits); |
878 | 0 | _impl_.datasfix32_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<int32_t>(ptr); |
879 | 0 | ptr += sizeof(int32_t); |
880 | 0 | } else |
881 | 0 | goto handle_unusual; |
882 | 0 | continue; |
883 | | // optional sfixed64 datasfix64 = 17; |
884 | 0 | case 17: |
885 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 137)) { |
886 | 0 | _Internal::set_has_datasfix64(&has_bits); |
887 | 0 | _impl_.datasfix64_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<int64_t>(ptr); |
888 | 0 | ptr += sizeof(int64_t); |
889 | 0 | } else |
890 | 0 | goto handle_unusual; |
891 | 0 | continue; |
892 | | // optional float datafloat_scientific = 18; |
893 | 0 | case 18: |
894 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 149)) { |
895 | 0 | _Internal::set_has_datafloat_scientific(&has_bits); |
896 | 0 | _impl_.datafloat_scientific_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr); |
897 | 0 | ptr += sizeof(float); |
898 | 0 | } else |
899 | 0 | goto handle_unusual; |
900 | 0 | continue; |
901 | | // optional double datadouble_scientific = 19; |
902 | 0 | case 19: |
903 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 153)) { |
904 | 0 | _Internal::set_has_datadouble_scientific(&has_bits); |
905 | 0 | _impl_.datadouble_scientific_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr); |
906 | 0 | ptr += sizeof(double); |
907 | 0 | } else |
908 | 0 | goto handle_unusual; |
909 | 0 | continue; |
910 | 0 | default: |
911 | 0 | goto handle_unusual; |
912 | 0 | } // switch |
913 | 0 | handle_unusual: |
914 | 0 | if ((tag == 0) || ((tag & 7) == 4)) { |
915 | 0 | CHK_(ptr); |
916 | 0 | ctx->SetLastTag(tag); |
917 | 0 | goto message_done; |
918 | 0 | } |
919 | 0 | if ((800u <= tag && tag < 1608u)) { |
920 | 0 | ptr = _impl_._extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); |
921 | 0 | CHK_(ptr != nullptr); |
922 | 0 | continue; |
923 | 0 | } |
924 | 0 | ptr = UnknownFieldParse( |
925 | 0 | tag, |
926 | 0 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
927 | 0 | ptr, ctx); |
928 | 0 | CHK_(ptr != nullptr); |
929 | 0 | } // while |
930 | 0 | message_done: |
931 | 0 | _impl_._has_bits_.Or(has_bits); |
932 | 0 | return ptr; |
933 | 0 | failure: |
934 | 0 | ptr = nullptr; |
935 | 0 | goto message_done; |
936 | 0 | #undef CHK_ |
937 | 0 | } |
938 | | |
939 | | uint8_t* Person::_InternalSerialize( |
940 | 0 | uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
941 | | // @@protoc_insertion_point(serialize_to_array_start:addressbook.Person) |
942 | 0 | uint32_t cached_has_bits = 0; |
943 | 0 | (void) cached_has_bits; |
944 | |
|
945 | 0 | cached_has_bits = _impl_._has_bits_[0]; |
946 | | // required string name = 1; |
947 | 0 | if (cached_has_bits & 0x00000001u) { |
948 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
949 | 0 | this->_internal_name().data(), static_cast<int>(this->_internal_name().length()), |
950 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
951 | 0 | "addressbook.Person.name"); |
952 | 0 | target = stream->WriteStringMaybeAliased( |
953 | 0 | 1, this->_internal_name(), target); |
954 | 0 | } |
955 | | |
956 | | // required int32 id = 2; |
957 | 0 | if (cached_has_bits & 0x00000008u) { |
958 | 0 | target = stream->EnsureSpace(target); |
959 | 0 | target = ::_pbi::WireFormatLite::WriteInt32ToArray(2, this->_internal_id(), target); |
960 | 0 | } |
961 | | |
962 | | // optional string email = 3; |
963 | 0 | if (cached_has_bits & 0x00000002u) { |
964 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
965 | 0 | this->_internal_email().data(), static_cast<int>(this->_internal_email().length()), |
966 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
967 | 0 | "addressbook.Person.email"); |
968 | 0 | target = stream->WriteStringMaybeAliased( |
969 | 0 | 3, this->_internal_email(), target); |
970 | 0 | } |
971 | | |
972 | | // repeated .addressbook.Person.PhoneNumber phone = 4; |
973 | 0 | for (unsigned i = 0, |
974 | 0 | n = static_cast<unsigned>(this->_internal_phone_size()); i < n; i++) { |
975 | 0 | const auto& repfield = this->_internal_phone(i); |
976 | 0 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
977 | 0 | InternalWriteMessage(4, repfield, repfield.GetCachedSize(), target, stream); |
978 | 0 | } |
979 | | |
980 | | // optional int64 data = 5; |
981 | 0 | if (cached_has_bits & 0x00000020u) { |
982 | 0 | target = stream->EnsureSpace(target); |
983 | 0 | target = ::_pbi::WireFormatLite::WriteInt64ToArray(5, this->_internal_data(), target); |
984 | 0 | } |
985 | | |
986 | | // optional sint32 data32 = 6; |
987 | 0 | if (cached_has_bits & 0x00000010u) { |
988 | 0 | target = stream->EnsureSpace(target); |
989 | 0 | target = ::_pbi::WireFormatLite::WriteSInt32ToArray(6, this->_internal_data32(), target); |
990 | 0 | } |
991 | | |
992 | | // optional sint64 data64 = 7; |
993 | 0 | if (cached_has_bits & 0x00000040u) { |
994 | 0 | target = stream->EnsureSpace(target); |
995 | 0 | target = ::_pbi::WireFormatLite::WriteSInt64ToArray(7, this->_internal_data64(), target); |
996 | 0 | } |
997 | | |
998 | | // required double datadouble = 8; |
999 | 0 | if (cached_has_bits & 0x00000080u) { |
1000 | 0 | target = stream->EnsureSpace(target); |
1001 | 0 | target = ::_pbi::WireFormatLite::WriteDoubleToArray(8, this->_internal_datadouble(), target); |
1002 | 0 | } |
1003 | | |
1004 | | // optional float datafloat = 9; |
1005 | 0 | if (cached_has_bits & 0x00000100u) { |
1006 | 0 | target = stream->EnsureSpace(target); |
1007 | 0 | target = ::_pbi::WireFormatLite::WriteFloatToArray(9, this->_internal_datafloat(), target); |
1008 | 0 | } |
1009 | | |
1010 | | // optional uint32 datau32 = 10; |
1011 | 0 | if (cached_has_bits & 0x00000200u) { |
1012 | 0 | target = stream->EnsureSpace(target); |
1013 | 0 | target = ::_pbi::WireFormatLite::WriteUInt32ToArray(10, this->_internal_datau32(), target); |
1014 | 0 | } |
1015 | | |
1016 | | // optional uint64 datau64 = 11; |
1017 | 0 | if (cached_has_bits & 0x00000400u) { |
1018 | 0 | target = stream->EnsureSpace(target); |
1019 | 0 | target = ::_pbi::WireFormatLite::WriteUInt64ToArray(11, this->_internal_datau64(), target); |
1020 | 0 | } |
1021 | | |
1022 | | // optional bool databool = 12; |
1023 | 0 | if (cached_has_bits & 0x00000800u) { |
1024 | 0 | target = stream->EnsureSpace(target); |
1025 | 0 | target = ::_pbi::WireFormatLite::WriteBoolToArray(12, this->_internal_databool(), target); |
1026 | 0 | } |
1027 | | |
1028 | | // optional bytes databyte = 13; |
1029 | 0 | if (cached_has_bits & 0x00000004u) { |
1030 | 0 | target = stream->WriteBytesMaybeAliased( |
1031 | 0 | 13, this->_internal_databyte(), target); |
1032 | 0 | } |
1033 | | |
1034 | | // optional fixed32 datafix32 = 14; |
1035 | 0 | if (cached_has_bits & 0x00001000u) { |
1036 | 0 | target = stream->EnsureSpace(target); |
1037 | 0 | target = ::_pbi::WireFormatLite::WriteFixed32ToArray(14, this->_internal_datafix32(), target); |
1038 | 0 | } |
1039 | | |
1040 | | // optional fixed64 datafix64 = 15; |
1041 | 0 | if (cached_has_bits & 0x00002000u) { |
1042 | 0 | target = stream->EnsureSpace(target); |
1043 | 0 | target = ::_pbi::WireFormatLite::WriteFixed64ToArray(15, this->_internal_datafix64(), target); |
1044 | 0 | } |
1045 | | |
1046 | | // optional sfixed32 datasfix32 = 16; |
1047 | 0 | if (cached_has_bits & 0x00008000u) { |
1048 | 0 | target = stream->EnsureSpace(target); |
1049 | 0 | target = ::_pbi::WireFormatLite::WriteSFixed32ToArray(16, this->_internal_datasfix32(), target); |
1050 | 0 | } |
1051 | | |
1052 | | // optional sfixed64 datasfix64 = 17; |
1053 | 0 | if (cached_has_bits & 0x00004000u) { |
1054 | 0 | target = stream->EnsureSpace(target); |
1055 | 0 | target = ::_pbi::WireFormatLite::WriteSFixed64ToArray(17, this->_internal_datasfix64(), target); |
1056 | 0 | } |
1057 | | |
1058 | | // optional float datafloat_scientific = 18; |
1059 | 0 | if (cached_has_bits & 0x00010000u) { |
1060 | 0 | target = stream->EnsureSpace(target); |
1061 | 0 | target = ::_pbi::WireFormatLite::WriteFloatToArray(18, this->_internal_datafloat_scientific(), target); |
1062 | 0 | } |
1063 | | |
1064 | | // optional double datadouble_scientific = 19; |
1065 | 0 | if (cached_has_bits & 0x00020000u) { |
1066 | 0 | target = stream->EnsureSpace(target); |
1067 | 0 | target = ::_pbi::WireFormatLite::WriteDoubleToArray(19, this->_internal_datadouble_scientific(), target); |
1068 | 0 | } |
1069 | | |
1070 | | // Extension range [100, 201) |
1071 | 0 | target = _impl_._extensions_._InternalSerialize( |
1072 | 0 | internal_default_instance(), 100, 201, target, stream); |
1073 | |
|
1074 | 0 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
1075 | 0 | target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( |
1076 | 0 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
1077 | 0 | } |
1078 | | // @@protoc_insertion_point(serialize_to_array_end:addressbook.Person) |
1079 | 0 | return target; |
1080 | 0 | } |
1081 | | |
1082 | 0 | size_t Person::RequiredFieldsByteSizeFallback() const { |
1083 | | // @@protoc_insertion_point(required_fields_byte_size_fallback_start:addressbook.Person) |
1084 | 0 | size_t total_size = 0; |
1085 | |
|
1086 | 0 | if (_internal_has_name()) { |
1087 | | // required string name = 1; |
1088 | 0 | total_size += 1 + |
1089 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
1090 | 0 | this->_internal_name()); |
1091 | 0 | } |
1092 | |
|
1093 | 0 | if (_internal_has_id()) { |
1094 | | // required int32 id = 2; |
1095 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_id()); |
1096 | 0 | } |
1097 | |
|
1098 | 0 | if (_internal_has_datadouble()) { |
1099 | | // required double datadouble = 8; |
1100 | 0 | total_size += 1 + 8; |
1101 | 0 | } |
1102 | |
|
1103 | 0 | return total_size; |
1104 | 0 | } |
1105 | 0 | size_t Person::ByteSizeLong() const { |
1106 | | // @@protoc_insertion_point(message_byte_size_start:addressbook.Person) |
1107 | 0 | size_t total_size = 0; |
1108 | |
|
1109 | 0 | total_size += _impl_._extensions_.ByteSize(); |
1110 | |
|
1111 | 0 | if (((_impl_._has_bits_[0] & 0x00000089) ^ 0x00000089) == 0) { // All required fields are present. |
1112 | | // required string name = 1; |
1113 | 0 | total_size += 1 + |
1114 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
1115 | 0 | this->_internal_name()); |
1116 | | |
1117 | | // required int32 id = 2; |
1118 | 0 | total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_id()); |
1119 | | |
1120 | | // required double datadouble = 8; |
1121 | 0 | total_size += 1 + 8; |
1122 | |
|
1123 | 0 | } else { |
1124 | 0 | total_size += RequiredFieldsByteSizeFallback(); |
1125 | 0 | } |
1126 | 0 | uint32_t cached_has_bits = 0; |
1127 | | // Prevent compiler warnings about cached_has_bits being unused |
1128 | 0 | (void) cached_has_bits; |
1129 | | |
1130 | | // repeated .addressbook.Person.PhoneNumber phone = 4; |
1131 | 0 | total_size += 1UL * this->_internal_phone_size(); |
1132 | 0 | for (const auto& msg : this->_impl_.phone_) { |
1133 | 0 | total_size += |
1134 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); |
1135 | 0 | } |
1136 | |
|
1137 | 0 | cached_has_bits = _impl_._has_bits_[0]; |
1138 | 0 | if (cached_has_bits & 0x00000006u) { |
1139 | | // optional string email = 3; |
1140 | 0 | if (cached_has_bits & 0x00000002u) { |
1141 | 0 | total_size += 1 + |
1142 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
1143 | 0 | this->_internal_email()); |
1144 | 0 | } |
1145 | | |
1146 | | // optional bytes databyte = 13; |
1147 | 0 | if (cached_has_bits & 0x00000004u) { |
1148 | 0 | total_size += 1 + |
1149 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( |
1150 | 0 | this->_internal_databyte()); |
1151 | 0 | } |
1152 | |
|
1153 | 0 | } |
1154 | 0 | if (cached_has_bits & 0x00000070u) { |
1155 | | // optional sint32 data32 = 6; |
1156 | 0 | if (cached_has_bits & 0x00000010u) { |
1157 | 0 | total_size += ::_pbi::WireFormatLite::SInt32SizePlusOne(this->_internal_data32()); |
1158 | 0 | } |
1159 | | |
1160 | | // optional int64 data = 5; |
1161 | 0 | if (cached_has_bits & 0x00000020u) { |
1162 | 0 | total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_data()); |
1163 | 0 | } |
1164 | | |
1165 | | // optional sint64 data64 = 7; |
1166 | 0 | if (cached_has_bits & 0x00000040u) { |
1167 | 0 | total_size += ::_pbi::WireFormatLite::SInt64SizePlusOne(this->_internal_data64()); |
1168 | 0 | } |
1169 | |
|
1170 | 0 | } |
1171 | 0 | if (cached_has_bits & 0x0000ff00u) { |
1172 | | // optional float datafloat = 9; |
1173 | 0 | if (cached_has_bits & 0x00000100u) { |
1174 | 0 | total_size += 1 + 4; |
1175 | 0 | } |
1176 | | |
1177 | | // optional uint32 datau32 = 10; |
1178 | 0 | if (cached_has_bits & 0x00000200u) { |
1179 | 0 | total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_datau32()); |
1180 | 0 | } |
1181 | | |
1182 | | // optional uint64 datau64 = 11; |
1183 | 0 | if (cached_has_bits & 0x00000400u) { |
1184 | 0 | total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_datau64()); |
1185 | 0 | } |
1186 | | |
1187 | | // optional bool databool = 12; |
1188 | 0 | if (cached_has_bits & 0x00000800u) { |
1189 | 0 | total_size += 1 + 1; |
1190 | 0 | } |
1191 | | |
1192 | | // optional fixed32 datafix32 = 14; |
1193 | 0 | if (cached_has_bits & 0x00001000u) { |
1194 | 0 | total_size += 1 + 4; |
1195 | 0 | } |
1196 | | |
1197 | | // optional fixed64 datafix64 = 15; |
1198 | 0 | if (cached_has_bits & 0x00002000u) { |
1199 | 0 | total_size += 1 + 8; |
1200 | 0 | } |
1201 | | |
1202 | | // optional sfixed64 datasfix64 = 17; |
1203 | 0 | if (cached_has_bits & 0x00004000u) { |
1204 | 0 | total_size += 2 + 8; |
1205 | 0 | } |
1206 | | |
1207 | | // optional sfixed32 datasfix32 = 16; |
1208 | 0 | if (cached_has_bits & 0x00008000u) { |
1209 | 0 | total_size += 2 + 4; |
1210 | 0 | } |
1211 | |
|
1212 | 0 | } |
1213 | 0 | if (cached_has_bits & 0x00030000u) { |
1214 | | // optional float datafloat_scientific = 18; |
1215 | 0 | if (cached_has_bits & 0x00010000u) { |
1216 | 0 | total_size += 2 + 4; |
1217 | 0 | } |
1218 | | |
1219 | | // optional double datadouble_scientific = 19; |
1220 | 0 | if (cached_has_bits & 0x00020000u) { |
1221 | 0 | total_size += 2 + 8; |
1222 | 0 | } |
1223 | |
|
1224 | 0 | } |
1225 | 0 | return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); |
1226 | 0 | } |
1227 | | |
1228 | | const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Person::_class_data_ = { |
1229 | | ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, |
1230 | | Person::MergeImpl |
1231 | | }; |
1232 | 0 | const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Person::GetClassData() const { return &_class_data_; } |
1233 | | |
1234 | | |
1235 | 0 | void Person::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { |
1236 | 0 | auto* const _this = static_cast<Person*>(&to_msg); |
1237 | 0 | auto& from = static_cast<const Person&>(from_msg); |
1238 | | // @@protoc_insertion_point(class_specific_merge_from_start:addressbook.Person) |
1239 | 0 | GOOGLE_DCHECK_NE(&from, _this); |
1240 | 0 | uint32_t cached_has_bits = 0; |
1241 | 0 | (void) cached_has_bits; |
1242 | |
|
1243 | 0 | _this->_impl_.phone_.MergeFrom(from._impl_.phone_); |
1244 | 0 | cached_has_bits = from._impl_._has_bits_[0]; |
1245 | 0 | if (cached_has_bits & 0x000000ffu) { |
1246 | 0 | if (cached_has_bits & 0x00000001u) { |
1247 | 0 | _this->_internal_set_name(from._internal_name()); |
1248 | 0 | } |
1249 | 0 | if (cached_has_bits & 0x00000002u) { |
1250 | 0 | _this->_internal_set_email(from._internal_email()); |
1251 | 0 | } |
1252 | 0 | if (cached_has_bits & 0x00000004u) { |
1253 | 0 | _this->_internal_set_databyte(from._internal_databyte()); |
1254 | 0 | } |
1255 | 0 | if (cached_has_bits & 0x00000008u) { |
1256 | 0 | _this->_impl_.id_ = from._impl_.id_; |
1257 | 0 | } |
1258 | 0 | if (cached_has_bits & 0x00000010u) { |
1259 | 0 | _this->_impl_.data32_ = from._impl_.data32_; |
1260 | 0 | } |
1261 | 0 | if (cached_has_bits & 0x00000020u) { |
1262 | 0 | _this->_impl_.data_ = from._impl_.data_; |
1263 | 0 | } |
1264 | 0 | if (cached_has_bits & 0x00000040u) { |
1265 | 0 | _this->_impl_.data64_ = from._impl_.data64_; |
1266 | 0 | } |
1267 | 0 | if (cached_has_bits & 0x00000080u) { |
1268 | 0 | _this->_impl_.datadouble_ = from._impl_.datadouble_; |
1269 | 0 | } |
1270 | 0 | _this->_impl_._has_bits_[0] |= cached_has_bits; |
1271 | 0 | } |
1272 | 0 | if (cached_has_bits & 0x0000ff00u) { |
1273 | 0 | if (cached_has_bits & 0x00000100u) { |
1274 | 0 | _this->_impl_.datafloat_ = from._impl_.datafloat_; |
1275 | 0 | } |
1276 | 0 | if (cached_has_bits & 0x00000200u) { |
1277 | 0 | _this->_impl_.datau32_ = from._impl_.datau32_; |
1278 | 0 | } |
1279 | 0 | if (cached_has_bits & 0x00000400u) { |
1280 | 0 | _this->_impl_.datau64_ = from._impl_.datau64_; |
1281 | 0 | } |
1282 | 0 | if (cached_has_bits & 0x00000800u) { |
1283 | 0 | _this->_impl_.databool_ = from._impl_.databool_; |
1284 | 0 | } |
1285 | 0 | if (cached_has_bits & 0x00001000u) { |
1286 | 0 | _this->_impl_.datafix32_ = from._impl_.datafix32_; |
1287 | 0 | } |
1288 | 0 | if (cached_has_bits & 0x00002000u) { |
1289 | 0 | _this->_impl_.datafix64_ = from._impl_.datafix64_; |
1290 | 0 | } |
1291 | 0 | if (cached_has_bits & 0x00004000u) { |
1292 | 0 | _this->_impl_.datasfix64_ = from._impl_.datasfix64_; |
1293 | 0 | } |
1294 | 0 | if (cached_has_bits & 0x00008000u) { |
1295 | 0 | _this->_impl_.datasfix32_ = from._impl_.datasfix32_; |
1296 | 0 | } |
1297 | 0 | _this->_impl_._has_bits_[0] |= cached_has_bits; |
1298 | 0 | } |
1299 | 0 | if (cached_has_bits & 0x00030000u) { |
1300 | 0 | if (cached_has_bits & 0x00010000u) { |
1301 | 0 | _this->_impl_.datafloat_scientific_ = from._impl_.datafloat_scientific_; |
1302 | 0 | } |
1303 | 0 | if (cached_has_bits & 0x00020000u) { |
1304 | 0 | _this->_impl_.datadouble_scientific_ = from._impl_.datadouble_scientific_; |
1305 | 0 | } |
1306 | 0 | _this->_impl_._has_bits_[0] |= cached_has_bits; |
1307 | 0 | } |
1308 | 0 | _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); |
1309 | 0 | _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
1310 | 0 | } |
1311 | | |
1312 | 0 | void Person::CopyFrom(const Person& from) { |
1313 | | // @@protoc_insertion_point(class_specific_copy_from_start:addressbook.Person) |
1314 | 0 | if (&from == this) return; |
1315 | 0 | Clear(); |
1316 | 0 | MergeFrom(from); |
1317 | 0 | } |
1318 | | |
1319 | 0 | bool Person::IsInitialized() const { |
1320 | 0 | if (!_impl_._extensions_.IsInitialized()) { |
1321 | 0 | return false; |
1322 | 0 | } |
1323 | | |
1324 | 0 | if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false; |
1325 | 0 | if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_impl_.phone_)) |
1326 | 0 | return false; |
1327 | 0 | return true; |
1328 | 0 | } |
1329 | | |
1330 | 0 | void Person::InternalSwap(Person* other) { |
1331 | 0 | using std::swap; |
1332 | 0 | _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); |
1333 | 0 | auto* lhs_arena = GetArenaForAllocation(); |
1334 | 0 | auto* rhs_arena = other->GetArenaForAllocation(); |
1335 | 0 | _internal_metadata_.InternalSwap(&other->_internal_metadata_); |
1336 | 0 | swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); |
1337 | 0 | _impl_.phone_.InternalSwap(&other->_impl_.phone_); |
1338 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( |
1339 | 0 | &_impl_.name_, lhs_arena, |
1340 | 0 | &other->_impl_.name_, rhs_arena |
1341 | 0 | ); |
1342 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( |
1343 | 0 | &_impl_.email_, lhs_arena, |
1344 | 0 | &other->_impl_.email_, rhs_arena |
1345 | 0 | ); |
1346 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( |
1347 | 0 | &_impl_.databyte_, lhs_arena, |
1348 | 0 | &other->_impl_.databyte_, rhs_arena |
1349 | 0 | ); |
1350 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::memswap< |
1351 | 0 | PROTOBUF_FIELD_OFFSET(Person, _impl_.datadouble_scientific_) |
1352 | 0 | + sizeof(Person::_impl_.datadouble_scientific_) |
1353 | 0 | - PROTOBUF_FIELD_OFFSET(Person, _impl_.id_)>( |
1354 | 0 | reinterpret_cast<char*>(&_impl_.id_), |
1355 | 0 | reinterpret_cast<char*>(&other->_impl_.id_)); |
1356 | 0 | } |
1357 | | |
1358 | 0 | ::PROTOBUF_NAMESPACE_ID::Metadata Person::GetMetadata() const { |
1359 | 0 | return ::_pbi::AssignDescriptors( |
1360 | 0 | &descriptor_table_addressbook_2eproto_getter, &descriptor_table_addressbook_2eproto_once, |
1361 | 0 | file_level_metadata_addressbook_2eproto[1]); |
1362 | 0 | } |
1363 | | |
1364 | | // =================================================================== |
1365 | | |
1366 | | class AddressBook::_Internal { |
1367 | | public: |
1368 | | }; |
1369 | | |
1370 | | AddressBook::AddressBook(::PROTOBUF_NAMESPACE_ID::Arena* arena, |
1371 | | bool is_message_owned) |
1372 | 0 | : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { |
1373 | 0 | SharedCtor(arena, is_message_owned); |
1374 | | // @@protoc_insertion_point(arena_constructor:addressbook.AddressBook) |
1375 | 0 | } |
1376 | | AddressBook::AddressBook(const AddressBook& from) |
1377 | 0 | : ::PROTOBUF_NAMESPACE_ID::Message() { |
1378 | 0 | AddressBook* const _this = this; (void)_this; |
1379 | 0 | new (&_impl_) Impl_{ |
1380 | 0 | decltype(_impl_.person_){from._impl_.person_} |
1381 | 0 | , /*decltype(_impl_._cached_size_)*/{}}; |
1382 | |
|
1383 | 0 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
1384 | | // @@protoc_insertion_point(copy_constructor:addressbook.AddressBook) |
1385 | 0 | } |
1386 | | |
1387 | | inline void AddressBook::SharedCtor( |
1388 | 0 | ::_pb::Arena* arena, bool is_message_owned) { |
1389 | 0 | (void)arena; |
1390 | 0 | (void)is_message_owned; |
1391 | 0 | new (&_impl_) Impl_{ |
1392 | 0 | decltype(_impl_.person_){arena} |
1393 | 0 | , /*decltype(_impl_._cached_size_)*/{} |
1394 | 0 | }; |
1395 | 0 | } |
1396 | | |
1397 | 0 | AddressBook::~AddressBook() { |
1398 | | // @@protoc_insertion_point(destructor:addressbook.AddressBook) |
1399 | 0 | if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { |
1400 | 0 | (void)arena; |
1401 | 0 | return; |
1402 | 0 | } |
1403 | 0 | SharedDtor(); |
1404 | 0 | } |
1405 | | |
1406 | 0 | inline void AddressBook::SharedDtor() { |
1407 | 0 | GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); |
1408 | 0 | _impl_.person_.~RepeatedPtrField(); |
1409 | 0 | } |
1410 | | |
1411 | 0 | void AddressBook::SetCachedSize(int size) const { |
1412 | 0 | _impl_._cached_size_.Set(size); |
1413 | 0 | } |
1414 | | |
1415 | 0 | void AddressBook::Clear() { |
1416 | | // @@protoc_insertion_point(message_clear_start:addressbook.AddressBook) |
1417 | 0 | uint32_t cached_has_bits = 0; |
1418 | | // Prevent compiler warnings about cached_has_bits being unused |
1419 | 0 | (void) cached_has_bits; |
1420 | |
|
1421 | 0 | _impl_.person_.Clear(); |
1422 | 0 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
1423 | 0 | } |
1424 | | |
1425 | 0 | const char* AddressBook::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { |
1426 | 0 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
1427 | 0 | while (!ctx->Done(&ptr)) { |
1428 | 0 | uint32_t tag; |
1429 | 0 | ptr = ::_pbi::ReadTag(ptr, &tag); |
1430 | 0 | switch (tag >> 3) { |
1431 | | // repeated .addressbook.Person person = 1; |
1432 | 0 | case 1: |
1433 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { |
1434 | 0 | ptr -= 1; |
1435 | 0 | do { |
1436 | 0 | ptr += 1; |
1437 | 0 | ptr = ctx->ParseMessage(_internal_add_person(), ptr); |
1438 | 0 | CHK_(ptr); |
1439 | 0 | if (!ctx->DataAvailable(ptr)) break; |
1440 | 0 | } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); |
1441 | 0 | } else |
1442 | 0 | goto handle_unusual; |
1443 | 0 | continue; |
1444 | 0 | default: |
1445 | 0 | goto handle_unusual; |
1446 | 0 | } // switch |
1447 | 0 | handle_unusual: |
1448 | 0 | if ((tag == 0) || ((tag & 7) == 4)) { |
1449 | 0 | CHK_(ptr); |
1450 | 0 | ctx->SetLastTag(tag); |
1451 | 0 | goto message_done; |
1452 | 0 | } |
1453 | 0 | ptr = UnknownFieldParse( |
1454 | 0 | tag, |
1455 | 0 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
1456 | 0 | ptr, ctx); |
1457 | 0 | CHK_(ptr != nullptr); |
1458 | 0 | } // while |
1459 | 0 | message_done: |
1460 | 0 | return ptr; |
1461 | 0 | failure: |
1462 | 0 | ptr = nullptr; |
1463 | 0 | goto message_done; |
1464 | 0 | #undef CHK_ |
1465 | 0 | } |
1466 | | |
1467 | | uint8_t* AddressBook::_InternalSerialize( |
1468 | 0 | uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
1469 | | // @@protoc_insertion_point(serialize_to_array_start:addressbook.AddressBook) |
1470 | 0 | uint32_t cached_has_bits = 0; |
1471 | 0 | (void) cached_has_bits; |
1472 | | |
1473 | | // repeated .addressbook.Person person = 1; |
1474 | 0 | for (unsigned i = 0, |
1475 | 0 | n = static_cast<unsigned>(this->_internal_person_size()); i < n; i++) { |
1476 | 0 | const auto& repfield = this->_internal_person(i); |
1477 | 0 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
1478 | 0 | InternalWriteMessage(1, repfield, repfield.GetCachedSize(), target, stream); |
1479 | 0 | } |
1480 | |
|
1481 | 0 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
1482 | 0 | target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( |
1483 | 0 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
1484 | 0 | } |
1485 | | // @@protoc_insertion_point(serialize_to_array_end:addressbook.AddressBook) |
1486 | 0 | return target; |
1487 | 0 | } |
1488 | | |
1489 | 0 | size_t AddressBook::ByteSizeLong() const { |
1490 | | // @@protoc_insertion_point(message_byte_size_start:addressbook.AddressBook) |
1491 | 0 | size_t total_size = 0; |
1492 | |
|
1493 | 0 | uint32_t cached_has_bits = 0; |
1494 | | // Prevent compiler warnings about cached_has_bits being unused |
1495 | 0 | (void) cached_has_bits; |
1496 | | |
1497 | | // repeated .addressbook.Person person = 1; |
1498 | 0 | total_size += 1UL * this->_internal_person_size(); |
1499 | 0 | for (const auto& msg : this->_impl_.person_) { |
1500 | 0 | total_size += |
1501 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); |
1502 | 0 | } |
1503 | |
|
1504 | 0 | return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); |
1505 | 0 | } |
1506 | | |
1507 | | const ::PROTOBUF_NAMESPACE_ID::Message::ClassData AddressBook::_class_data_ = { |
1508 | | ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, |
1509 | | AddressBook::MergeImpl |
1510 | | }; |
1511 | 0 | const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*AddressBook::GetClassData() const { return &_class_data_; } |
1512 | | |
1513 | | |
1514 | 0 | void AddressBook::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { |
1515 | 0 | auto* const _this = static_cast<AddressBook*>(&to_msg); |
1516 | 0 | auto& from = static_cast<const AddressBook&>(from_msg); |
1517 | | // @@protoc_insertion_point(class_specific_merge_from_start:addressbook.AddressBook) |
1518 | 0 | GOOGLE_DCHECK_NE(&from, _this); |
1519 | 0 | uint32_t cached_has_bits = 0; |
1520 | 0 | (void) cached_has_bits; |
1521 | |
|
1522 | 0 | _this->_impl_.person_.MergeFrom(from._impl_.person_); |
1523 | 0 | _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
1524 | 0 | } |
1525 | | |
1526 | 0 | void AddressBook::CopyFrom(const AddressBook& from) { |
1527 | | // @@protoc_insertion_point(class_specific_copy_from_start:addressbook.AddressBook) |
1528 | 0 | if (&from == this) return; |
1529 | 0 | Clear(); |
1530 | 0 | MergeFrom(from); |
1531 | 0 | } |
1532 | | |
1533 | 0 | bool AddressBook::IsInitialized() const { |
1534 | 0 | if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_impl_.person_)) |
1535 | 0 | return false; |
1536 | 0 | return true; |
1537 | 0 | } |
1538 | | |
1539 | 0 | void AddressBook::InternalSwap(AddressBook* other) { |
1540 | 0 | using std::swap; |
1541 | 0 | _internal_metadata_.InternalSwap(&other->_internal_metadata_); |
1542 | 0 | _impl_.person_.InternalSwap(&other->_impl_.person_); |
1543 | 0 | } |
1544 | | |
1545 | 0 | ::PROTOBUF_NAMESPACE_ID::Metadata AddressBook::GetMetadata() const { |
1546 | 0 | return ::_pbi::AssignDescriptors( |
1547 | 0 | &descriptor_table_addressbook_2eproto_getter, &descriptor_table_addressbook_2eproto_once, |
1548 | 0 | file_level_metadata_addressbook_2eproto[2]); |
1549 | 0 | } |
1550 | | const std::string hobby_default(""); |
1551 | | PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::addressbook::Person, |
1552 | | ::PROTOBUF_NAMESPACE_ID::internal::StringTypeTraits, 9, false> |
1553 | | hobby(kHobbyFieldNumber, hobby_default, nullptr); |
1554 | | |
1555 | | // @@protoc_insertion_point(namespace_scope) |
1556 | | } // namespace addressbook |
1557 | | PROTOBUF_NAMESPACE_OPEN |
1558 | | template<> PROTOBUF_NOINLINE ::addressbook::Person_PhoneNumber* |
1559 | 0 | Arena::CreateMaybeMessage< ::addressbook::Person_PhoneNumber >(Arena* arena) { |
1560 | 0 | return Arena::CreateMessageInternal< ::addressbook::Person_PhoneNumber >(arena); |
1561 | 0 | } |
1562 | | template<> PROTOBUF_NOINLINE ::addressbook::Person* |
1563 | 0 | Arena::CreateMaybeMessage< ::addressbook::Person >(Arena* arena) { |
1564 | 0 | return Arena::CreateMessageInternal< ::addressbook::Person >(arena); |
1565 | 0 | } |
1566 | | template<> PROTOBUF_NOINLINE ::addressbook::AddressBook* |
1567 | 0 | Arena::CreateMaybeMessage< ::addressbook::AddressBook >(Arena* arena) { |
1568 | 0 | return Arena::CreateMessageInternal< ::addressbook::AddressBook >(arena); |
1569 | 0 | } |
1570 | | PROTOBUF_NAMESPACE_CLOSE |
1571 | | |
1572 | | // @@protoc_insertion_point(global_scope) |
1573 | | #include <google/protobuf/port_undef.inc> |