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