1 // Generated by the protocol buffer compiler. DO NOT EDIT!
2 // source: phonenumber.proto
3
4 #include "phonenumber.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/io/zero_copy_stream_impl_lite.h>
12 // @@protoc_insertion_point(includes)
13 #include <google/protobuf/port_def.inc>
14 namespace i18n {
15 namespace phonenumbers {
16 class PhoneNumberDefaultTypeInternal {
17 public:
18 ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<PhoneNumber> _instance;
19 } _PhoneNumber_default_instance_;
20 } // namespace phonenumbers
21 } // namespace i18n
InitDefaultsscc_info_PhoneNumber_phonenumber_2eproto()22 static void InitDefaultsscc_info_PhoneNumber_phonenumber_2eproto() {
23 GOOGLE_PROTOBUF_VERIFY_VERSION;
24
25 {
26 void* ptr = &::i18n::phonenumbers::_PhoneNumber_default_instance_;
27 new (ptr) ::i18n::phonenumbers::PhoneNumber();
28 ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
29 }
30 ::i18n::phonenumbers::PhoneNumber::InitAsDefaultInstance();
31 }
32
33 ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_PhoneNumber_phonenumber_2eproto =
34 {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_PhoneNumber_phonenumber_2eproto}, {}};
35
36 namespace i18n {
37 namespace phonenumbers {
PhoneNumber_CountryCodeSource_IsValid(int value)38 bool PhoneNumber_CountryCodeSource_IsValid(int value) {
39 switch (value) {
40 case 0:
41 case 1:
42 case 5:
43 case 10:
44 case 20:
45 return true;
46 default:
47 return false;
48 }
49 }
50
51 static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> PhoneNumber_CountryCodeSource_strings[5] = {};
52
53 static const char PhoneNumber_CountryCodeSource_names[] =
54 "FROM_DEFAULT_COUNTRY"
55 "FROM_NUMBER_WITHOUT_PLUS_SIGN"
56 "FROM_NUMBER_WITH_IDD"
57 "FROM_NUMBER_WITH_PLUS_SIGN"
58 "UNSPECIFIED";
59
60 static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry PhoneNumber_CountryCodeSource_entries[] = {
61 { {PhoneNumber_CountryCodeSource_names + 0, 20}, 20 },
62 { {PhoneNumber_CountryCodeSource_names + 20, 29}, 10 },
63 { {PhoneNumber_CountryCodeSource_names + 49, 20}, 5 },
64 { {PhoneNumber_CountryCodeSource_names + 69, 26}, 1 },
65 { {PhoneNumber_CountryCodeSource_names + 95, 11}, 0 },
66 };
67
68 static const int PhoneNumber_CountryCodeSource_entries_by_number[] = {
69 4, // 0 -> UNSPECIFIED
70 3, // 1 -> FROM_NUMBER_WITH_PLUS_SIGN
71 2, // 5 -> FROM_NUMBER_WITH_IDD
72 1, // 10 -> FROM_NUMBER_WITHOUT_PLUS_SIGN
73 0, // 20 -> FROM_DEFAULT_COUNTRY
74 };
75
PhoneNumber_CountryCodeSource_Name(PhoneNumber_CountryCodeSource value)76 const std::string& PhoneNumber_CountryCodeSource_Name(
77 PhoneNumber_CountryCodeSource value) {
78 static const bool dummy =
79 ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
80 PhoneNumber_CountryCodeSource_entries,
81 PhoneNumber_CountryCodeSource_entries_by_number,
82 5, PhoneNumber_CountryCodeSource_strings);
83 (void) dummy;
84 int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
85 PhoneNumber_CountryCodeSource_entries,
86 PhoneNumber_CountryCodeSource_entries_by_number,
87 5, value);
88 return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
89 PhoneNumber_CountryCodeSource_strings[idx].get();
90 }
PhoneNumber_CountryCodeSource_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name,PhoneNumber_CountryCodeSource * value)91 bool PhoneNumber_CountryCodeSource_Parse(
92 ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, PhoneNumber_CountryCodeSource* value) {
93 int int_value;
94 bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
95 PhoneNumber_CountryCodeSource_entries, 5, name, &int_value);
96 if (success) {
97 *value = static_cast<PhoneNumber_CountryCodeSource>(int_value);
98 }
99 return success;
100 }
101 #if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
102 constexpr PhoneNumber_CountryCodeSource PhoneNumber::UNSPECIFIED;
103 constexpr PhoneNumber_CountryCodeSource PhoneNumber::FROM_NUMBER_WITH_PLUS_SIGN;
104 constexpr PhoneNumber_CountryCodeSource PhoneNumber::FROM_NUMBER_WITH_IDD;
105 constexpr PhoneNumber_CountryCodeSource PhoneNumber::FROM_NUMBER_WITHOUT_PLUS_SIGN;
106 constexpr PhoneNumber_CountryCodeSource PhoneNumber::FROM_DEFAULT_COUNTRY;
107 constexpr PhoneNumber_CountryCodeSource PhoneNumber::CountryCodeSource_MIN;
108 constexpr PhoneNumber_CountryCodeSource PhoneNumber::CountryCodeSource_MAX;
109 constexpr int PhoneNumber::CountryCodeSource_ARRAYSIZE;
110 #endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
111
112 // ===================================================================
113
InitAsDefaultInstance()114 void PhoneNumber::InitAsDefaultInstance() {
115 }
116 class PhoneNumber::_Internal {
117 public:
118 using HasBits = decltype(std::declval<PhoneNumber>()._has_bits_);
set_has_country_code(HasBits * has_bits)119 static void set_has_country_code(HasBits* has_bits) {
120 (*has_bits)[0] |= 16u;
121 }
set_has_national_number(HasBits * has_bits)122 static void set_has_national_number(HasBits* has_bits) {
123 (*has_bits)[0] |= 8u;
124 }
set_has_extension(HasBits * has_bits)125 static void set_has_extension(HasBits* has_bits) {
126 (*has_bits)[0] |= 1u;
127 }
set_has_italian_leading_zero(HasBits * has_bits)128 static void set_has_italian_leading_zero(HasBits* has_bits) {
129 (*has_bits)[0] |= 32u;
130 }
set_has_number_of_leading_zeros(HasBits * has_bits)131 static void set_has_number_of_leading_zeros(HasBits* has_bits) {
132 (*has_bits)[0] |= 128u;
133 }
set_has_raw_input(HasBits * has_bits)134 static void set_has_raw_input(HasBits* has_bits) {
135 (*has_bits)[0] |= 2u;
136 }
set_has_country_code_source(HasBits * has_bits)137 static void set_has_country_code_source(HasBits* has_bits) {
138 (*has_bits)[0] |= 64u;
139 }
set_has_preferred_domestic_carrier_code(HasBits * has_bits)140 static void set_has_preferred_domestic_carrier_code(HasBits* has_bits) {
141 (*has_bits)[0] |= 4u;
142 }
MissingRequiredFields(const HasBits & has_bits)143 static bool MissingRequiredFields(const HasBits& has_bits) {
144 return ((has_bits[0] & 0x00000018) ^ 0x00000018) != 0;
145 }
146 };
147
PhoneNumber(::PROTOBUF_NAMESPACE_ID::Arena * arena)148 PhoneNumber::PhoneNumber(::PROTOBUF_NAMESPACE_ID::Arena* arena)
149 : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena) {
150 SharedCtor();
151 RegisterArenaDtor(arena);
152 // @@protoc_insertion_point(arena_constructor:i18n.phonenumbers.PhoneNumber)
153 }
PhoneNumber(const PhoneNumber & from)154 PhoneNumber::PhoneNumber(const PhoneNumber& from)
155 : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
156 _has_bits_(from._has_bits_) {
157 _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
158 extension_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
159 if (from._internal_has_extension()) {
160 extension_.SetLite(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_extension(),
161 GetArena());
162 }
163 raw_input_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
164 if (from._internal_has_raw_input()) {
165 raw_input_.SetLite(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_raw_input(),
166 GetArena());
167 }
168 preferred_domestic_carrier_code_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
169 if (from._internal_has_preferred_domestic_carrier_code()) {
170 preferred_domestic_carrier_code_.SetLite(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_preferred_domestic_carrier_code(),
171 GetArena());
172 }
173 ::memcpy(&national_number_, &from.national_number_,
174 static_cast<size_t>(reinterpret_cast<char*>(&number_of_leading_zeros_) -
175 reinterpret_cast<char*>(&national_number_)) + sizeof(number_of_leading_zeros_));
176 // @@protoc_insertion_point(copy_constructor:i18n.phonenumbers.PhoneNumber)
177 }
178
SharedCtor()179 void PhoneNumber::SharedCtor() {
180 ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_PhoneNumber_phonenumber_2eproto.base);
181 extension_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
182 raw_input_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
183 preferred_domestic_carrier_code_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
184 ::memset(&national_number_, 0, static_cast<size_t>(
185 reinterpret_cast<char*>(&country_code_source_) -
186 reinterpret_cast<char*>(&national_number_)) + sizeof(country_code_source_));
187 number_of_leading_zeros_ = 1;
188 }
189
~PhoneNumber()190 PhoneNumber::~PhoneNumber() {
191 // @@protoc_insertion_point(destructor:i18n.phonenumbers.PhoneNumber)
192 SharedDtor();
193 _internal_metadata_.Delete<std::string>();
194 }
195
SharedDtor()196 void PhoneNumber::SharedDtor() {
197 GOOGLE_DCHECK(GetArena() == nullptr);
198 extension_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
199 raw_input_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
200 preferred_domestic_carrier_code_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
201 }
202
ArenaDtor(void * object)203 void PhoneNumber::ArenaDtor(void* object) {
204 PhoneNumber* _this = reinterpret_cast< PhoneNumber* >(object);
205 (void)_this;
206 }
RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena *)207 void PhoneNumber::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
208 }
SetCachedSize(int size) const209 void PhoneNumber::SetCachedSize(int size) const {
210 _cached_size_.Set(size);
211 }
default_instance()212 const PhoneNumber& PhoneNumber::default_instance() {
213 ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_PhoneNumber_phonenumber_2eproto.base);
214 return *internal_default_instance();
215 }
216
217
Clear()218 void PhoneNumber::Clear() {
219 // @@protoc_insertion_point(message_clear_start:i18n.phonenumbers.PhoneNumber)
220 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
221 // Prevent compiler warnings about cached_has_bits being unused
222 (void) cached_has_bits;
223
224 cached_has_bits = _has_bits_[0];
225 if (cached_has_bits & 0x00000007u) {
226 if (cached_has_bits & 0x00000001u) {
227 extension_.ClearNonDefaultToEmpty();
228 }
229 if (cached_has_bits & 0x00000002u) {
230 raw_input_.ClearNonDefaultToEmpty();
231 }
232 if (cached_has_bits & 0x00000004u) {
233 preferred_domestic_carrier_code_.ClearNonDefaultToEmpty();
234 }
235 }
236 if (cached_has_bits & 0x000000f8u) {
237 ::memset(&national_number_, 0, static_cast<size_t>(
238 reinterpret_cast<char*>(&country_code_source_) -
239 reinterpret_cast<char*>(&national_number_)) + sizeof(country_code_source_));
240 number_of_leading_zeros_ = 1;
241 }
242 _has_bits_.Clear();
243 _internal_metadata_.Clear<std::string>();
244 }
245
_InternalParse(const char * ptr,::PROTOBUF_NAMESPACE_ID::internal::ParseContext * ctx)246 const char* PhoneNumber::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
247 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
248 _Internal::HasBits has_bits{};
249 ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena;
250 while (!ctx->Done(&ptr)) {
251 ::PROTOBUF_NAMESPACE_ID::uint32 tag;
252 ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
253 CHK_(ptr);
254 switch (tag >> 3) {
255 // required int32 country_code = 1;
256 case 1:
257 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
258 _Internal::set_has_country_code(&has_bits);
259 country_code_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
260 CHK_(ptr);
261 } else goto handle_unusual;
262 continue;
263 // required uint64 national_number = 2;
264 case 2:
265 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
266 _Internal::set_has_national_number(&has_bits);
267 national_number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
268 CHK_(ptr);
269 } else goto handle_unusual;
270 continue;
271 // optional string extension = 3;
272 case 3:
273 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
274 auto str = _internal_mutable_extension();
275 ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
276 CHK_(ptr);
277 } else goto handle_unusual;
278 continue;
279 // optional bool italian_leading_zero = 4;
280 case 4:
281 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
282 _Internal::set_has_italian_leading_zero(&has_bits);
283 italian_leading_zero_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
284 CHK_(ptr);
285 } else goto handle_unusual;
286 continue;
287 // optional string raw_input = 5;
288 case 5:
289 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
290 auto str = _internal_mutable_raw_input();
291 ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
292 CHK_(ptr);
293 } else goto handle_unusual;
294 continue;
295 // optional .i18n.phonenumbers.PhoneNumber.CountryCodeSource country_code_source = 6;
296 case 6:
297 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) {
298 ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
299 CHK_(ptr);
300 if (PROTOBUF_PREDICT_TRUE(::i18n::phonenumbers::PhoneNumber_CountryCodeSource_IsValid(val))) {
301 _internal_set_country_code_source(static_cast<::i18n::phonenumbers::PhoneNumber_CountryCodeSource>(val));
302 } else {
303 ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(6, val, mutable_unknown_fields());
304 }
305 } else goto handle_unusual;
306 continue;
307 // optional string preferred_domestic_carrier_code = 7;
308 case 7:
309 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
310 auto str = _internal_mutable_preferred_domestic_carrier_code();
311 ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
312 CHK_(ptr);
313 } else goto handle_unusual;
314 continue;
315 // optional int32 number_of_leading_zeros = 8 [default = 1];
316 case 8:
317 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 64)) {
318 _Internal::set_has_number_of_leading_zeros(&has_bits);
319 number_of_leading_zeros_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
320 CHK_(ptr);
321 } else goto handle_unusual;
322 continue;
323 default: {
324 handle_unusual:
325 if ((tag & 7) == 4 || tag == 0) {
326 ctx->SetLastTag(tag);
327 goto success;
328 }
329 ptr = UnknownFieldParse(tag,
330 _internal_metadata_.mutable_unknown_fields<std::string>(),
331 ptr, ctx);
332 CHK_(ptr != nullptr);
333 continue;
334 }
335 } // switch
336 } // while
337 success:
338 _has_bits_.Or(has_bits);
339 return ptr;
340 failure:
341 ptr = nullptr;
342 goto success;
343 #undef CHK_
344 }
345
_InternalSerialize(::PROTOBUF_NAMESPACE_ID::uint8 * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const346 ::PROTOBUF_NAMESPACE_ID::uint8* PhoneNumber::_InternalSerialize(
347 ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
348 // @@protoc_insertion_point(serialize_to_array_start:i18n.phonenumbers.PhoneNumber)
349 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
350 (void) cached_has_bits;
351
352 cached_has_bits = _has_bits_[0];
353 // required int32 country_code = 1;
354 if (cached_has_bits & 0x00000010u) {
355 target = stream->EnsureSpace(target);
356 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_country_code(), target);
357 }
358
359 // required uint64 national_number = 2;
360 if (cached_has_bits & 0x00000008u) {
361 target = stream->EnsureSpace(target);
362 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(2, this->_internal_national_number(), target);
363 }
364
365 // optional string extension = 3;
366 if (cached_has_bits & 0x00000001u) {
367 target = stream->WriteStringMaybeAliased(
368 3, this->_internal_extension(), target);
369 }
370
371 // optional bool italian_leading_zero = 4;
372 if (cached_has_bits & 0x00000020u) {
373 target = stream->EnsureSpace(target);
374 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(4, this->_internal_italian_leading_zero(), target);
375 }
376
377 // optional string raw_input = 5;
378 if (cached_has_bits & 0x00000002u) {
379 target = stream->WriteStringMaybeAliased(
380 5, this->_internal_raw_input(), target);
381 }
382
383 // optional .i18n.phonenumbers.PhoneNumber.CountryCodeSource country_code_source = 6;
384 if (cached_has_bits & 0x00000040u) {
385 target = stream->EnsureSpace(target);
386 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray(
387 6, this->_internal_country_code_source(), target);
388 }
389
390 // optional string preferred_domestic_carrier_code = 7;
391 if (cached_has_bits & 0x00000004u) {
392 target = stream->WriteStringMaybeAliased(
393 7, this->_internal_preferred_domestic_carrier_code(), target);
394 }
395
396 // optional int32 number_of_leading_zeros = 8 [default = 1];
397 if (cached_has_bits & 0x00000080u) {
398 target = stream->EnsureSpace(target);
399 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(8, this->_internal_number_of_leading_zeros(), target);
400 }
401
402 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
403 target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
404 static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
405 }
406 // @@protoc_insertion_point(serialize_to_array_end:i18n.phonenumbers.PhoneNumber)
407 return target;
408 }
409
RequiredFieldsByteSizeFallback() const410 size_t PhoneNumber::RequiredFieldsByteSizeFallback() const {
411 // @@protoc_insertion_point(required_fields_byte_size_fallback_start:i18n.phonenumbers.PhoneNumber)
412 size_t total_size = 0;
413
414 if (_internal_has_national_number()) {
415 // required uint64 national_number = 2;
416 total_size += 1 +
417 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
418 this->_internal_national_number());
419 }
420
421 if (_internal_has_country_code()) {
422 // required int32 country_code = 1;
423 total_size += 1 +
424 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
425 this->_internal_country_code());
426 }
427
428 return total_size;
429 }
ByteSizeLong() const430 size_t PhoneNumber::ByteSizeLong() const {
431 // @@protoc_insertion_point(message_byte_size_start:i18n.phonenumbers.PhoneNumber)
432 size_t total_size = 0;
433
434 if (((_has_bits_[0] & 0x00000018) ^ 0x00000018) == 0) { // All required fields are present.
435 // required uint64 national_number = 2;
436 total_size += 1 +
437 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
438 this->_internal_national_number());
439
440 // required int32 country_code = 1;
441 total_size += 1 +
442 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
443 this->_internal_country_code());
444
445 } else {
446 total_size += RequiredFieldsByteSizeFallback();
447 }
448 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
449 // Prevent compiler warnings about cached_has_bits being unused
450 (void) cached_has_bits;
451
452 cached_has_bits = _has_bits_[0];
453 if (cached_has_bits & 0x00000007u) {
454 // optional string extension = 3;
455 if (cached_has_bits & 0x00000001u) {
456 total_size += 1 +
457 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
458 this->_internal_extension());
459 }
460
461 // optional string raw_input = 5;
462 if (cached_has_bits & 0x00000002u) {
463 total_size += 1 +
464 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
465 this->_internal_raw_input());
466 }
467
468 // optional string preferred_domestic_carrier_code = 7;
469 if (cached_has_bits & 0x00000004u) {
470 total_size += 1 +
471 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
472 this->_internal_preferred_domestic_carrier_code());
473 }
474
475 }
476 if (cached_has_bits & 0x000000e0u) {
477 // optional bool italian_leading_zero = 4;
478 if (cached_has_bits & 0x00000020u) {
479 total_size += 1 + 1;
480 }
481
482 // optional .i18n.phonenumbers.PhoneNumber.CountryCodeSource country_code_source = 6;
483 if (cached_has_bits & 0x00000040u) {
484 total_size += 1 +
485 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_country_code_source());
486 }
487
488 // optional int32 number_of_leading_zeros = 8 [default = 1];
489 if (cached_has_bits & 0x00000080u) {
490 total_size += 1 +
491 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
492 this->_internal_number_of_leading_zeros());
493 }
494
495 }
496 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
497 total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
498 }
499 int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
500 SetCachedSize(cached_size);
501 return total_size;
502 }
503
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)504 void PhoneNumber::CheckTypeAndMergeFrom(
505 const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
506 MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const PhoneNumber*>(
507 &from));
508 }
509
MergeFrom(const PhoneNumber & from)510 void PhoneNumber::MergeFrom(const PhoneNumber& from) {
511 // @@protoc_insertion_point(class_specific_merge_from_start:i18n.phonenumbers.PhoneNumber)
512 GOOGLE_DCHECK_NE(&from, this);
513 _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
514 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
515 (void) cached_has_bits;
516
517 cached_has_bits = from._has_bits_[0];
518 if (cached_has_bits & 0x000000ffu) {
519 if (cached_has_bits & 0x00000001u) {
520 _internal_set_extension(from._internal_extension());
521 }
522 if (cached_has_bits & 0x00000002u) {
523 _internal_set_raw_input(from._internal_raw_input());
524 }
525 if (cached_has_bits & 0x00000004u) {
526 _internal_set_preferred_domestic_carrier_code(from._internal_preferred_domestic_carrier_code());
527 }
528 if (cached_has_bits & 0x00000008u) {
529 national_number_ = from.national_number_;
530 }
531 if (cached_has_bits & 0x00000010u) {
532 country_code_ = from.country_code_;
533 }
534 if (cached_has_bits & 0x00000020u) {
535 italian_leading_zero_ = from.italian_leading_zero_;
536 }
537 if (cached_has_bits & 0x00000040u) {
538 country_code_source_ = from.country_code_source_;
539 }
540 if (cached_has_bits & 0x00000080u) {
541 number_of_leading_zeros_ = from.number_of_leading_zeros_;
542 }
543 _has_bits_[0] |= cached_has_bits;
544 }
545 }
546
CopyFrom(const PhoneNumber & from)547 void PhoneNumber::CopyFrom(const PhoneNumber& from) {
548 // @@protoc_insertion_point(class_specific_copy_from_start:i18n.phonenumbers.PhoneNumber)
549 if (&from == this) return;
550 Clear();
551 MergeFrom(from);
552 }
553
IsInitialized() const554 bool PhoneNumber::IsInitialized() const {
555 if (_Internal::MissingRequiredFields(_has_bits_)) return false;
556 return true;
557 }
558
InternalSwap(PhoneNumber * other)559 void PhoneNumber::InternalSwap(PhoneNumber* other) {
560 using std::swap;
561 _internal_metadata_.Swap<std::string>(&other->_internal_metadata_);
562 swap(_has_bits_[0], other->_has_bits_[0]);
563 extension_.Swap(&other->extension_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
564 raw_input_.Swap(&other->raw_input_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
565 preferred_domestic_carrier_code_.Swap(&other->preferred_domestic_carrier_code_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
566 ::PROTOBUF_NAMESPACE_ID::internal::memswap<
567 PROTOBUF_FIELD_OFFSET(PhoneNumber, country_code_source_)
568 + sizeof(PhoneNumber::country_code_source_)
569 - PROTOBUF_FIELD_OFFSET(PhoneNumber, national_number_)>(
570 reinterpret_cast<char*>(&national_number_),
571 reinterpret_cast<char*>(&other->national_number_));
572 swap(number_of_leading_zeros_, other->number_of_leading_zeros_);
573 }
574
GetTypeName() const575 std::string PhoneNumber::GetTypeName() const {
576 return "i18n.phonenumbers.PhoneNumber";
577 }
578
579
580 // @@protoc_insertion_point(namespace_scope)
581 } // namespace phonenumbers
582 } // namespace i18n
583 PROTOBUF_NAMESPACE_OPEN
CreateMaybeMessage(Arena * arena)584 template<> PROTOBUF_NOINLINE ::i18n::phonenumbers::PhoneNumber* Arena::CreateMaybeMessage< ::i18n::phonenumbers::PhoneNumber >(Arena* arena) {
585 return Arena::CreateMessageInternal< ::i18n::phonenumbers::PhoneNumber >(arena);
586 }
587 PROTOBUF_NAMESPACE_CLOSE
588
589 // @@protoc_insertion_point(global_scope)
590 #include <google/protobuf/port_undef.inc>
591