// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: phonemetadata.proto

#include "phonemetadata.pb.h"

#include <algorithm>

#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>

PROTOBUF_PRAGMA_INIT_SEG

namespace _pb = ::PROTOBUF_NAMESPACE_ID;
namespace _pbi = _pb::internal;

namespace i18n {
namespace phonenumbers {
PROTOBUF_CONSTEXPR NumberFormat::NumberFormat(
    ::_pbi::ConstantInitialized)
  : leading_digits_pattern_()
  , pattern_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , format_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , national_prefix_formatting_rule_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , domestic_carrier_code_formatting_rule_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , national_prefix_optional_when_formatting_(false){}
struct NumberFormatDefaultTypeInternal {
  PROTOBUF_CONSTEXPR NumberFormatDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~NumberFormatDefaultTypeInternal() {}
  union {
    NumberFormat _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NumberFormatDefaultTypeInternal _NumberFormat_default_instance_;
PROTOBUF_CONSTEXPR PhoneNumberDesc::PhoneNumberDesc(
    ::_pbi::ConstantInitialized)
  : possible_length_()
  , possible_length_local_only_()
  , national_number_pattern_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , example_number_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}){}
struct PhoneNumberDescDefaultTypeInternal {
  PROTOBUF_CONSTEXPR PhoneNumberDescDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~PhoneNumberDescDefaultTypeInternal() {}
  union {
    PhoneNumberDesc _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PhoneNumberDescDefaultTypeInternal _PhoneNumberDesc_default_instance_;
PROTOBUF_CONSTEXPR PhoneMetadata::PhoneMetadata(
    ::_pbi::ConstantInitialized)
  : number_format_()
  , intl_number_format_()
  , id_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , international_prefix_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , national_prefix_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , preferred_extn_prefix_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , national_prefix_for_parsing_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , national_prefix_transform_rule_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , preferred_international_prefix_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , leading_digits_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , general_desc_(nullptr)
  , fixed_line_(nullptr)
  , mobile_(nullptr)
  , toll_free_(nullptr)
  , premium_rate_(nullptr)
  , shared_cost_(nullptr)
  , personal_number_(nullptr)
  , voip_(nullptr)
  , pager_(nullptr)
  , no_international_dialling_(nullptr)
  , uan_(nullptr)
  , emergency_(nullptr)
  , voicemail_(nullptr)
  , short_code_(nullptr)
  , standard_rate_(nullptr)
  , carrier_specific_(nullptr)
  , sms_services_(nullptr)
  , country_code_(0)
  , same_mobile_and_fixed_line_pattern_(false)
  , main_country_for_code_(false)
  , leading_zero_possible_(false)
  , mobile_number_portable_region_(false){}
struct PhoneMetadataDefaultTypeInternal {
  PROTOBUF_CONSTEXPR PhoneMetadataDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~PhoneMetadataDefaultTypeInternal() {}
  union {
    PhoneMetadata _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PhoneMetadataDefaultTypeInternal _PhoneMetadata_default_instance_;
PROTOBUF_CONSTEXPR PhoneMetadataCollection::PhoneMetadataCollection(
    ::_pbi::ConstantInitialized)
  : metadata_(){}
struct PhoneMetadataCollectionDefaultTypeInternal {
  PROTOBUF_CONSTEXPR PhoneMetadataCollectionDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~PhoneMetadataCollectionDefaultTypeInternal() {}
  union {
    PhoneMetadataCollection _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PhoneMetadataCollectionDefaultTypeInternal _PhoneMetadataCollection_default_instance_;
}  // namespace phonenumbers
}  // namespace i18n
namespace i18n {
namespace phonenumbers {

// ===================================================================

class NumberFormat::_Internal {
 public:
  using HasBits = decltype(std::declval<NumberFormat>()._has_bits_);
  static void set_has_pattern(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_format(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_national_prefix_formatting_rule(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_national_prefix_optional_when_formatting(HasBits* has_bits) {
    (*has_bits)[0] |= 16u;
  }
  static void set_has_domestic_carrier_code_formatting_rule(HasBits* has_bits) {
    (*has_bits)[0] |= 8u;
  }
  static bool MissingRequiredFields(const HasBits& has_bits) {
    return ((has_bits[0] & 0x00000003) ^ 0x00000003) != 0;
  }
};

NumberFormat::NumberFormat(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned),
  leading_digits_pattern_(arena) {
  SharedCtor();
  // @@protoc_insertion_point(arena_constructor:i18n.phonenumbers.NumberFormat)
}
NumberFormat::NumberFormat(const NumberFormat& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_),
      leading_digits_pattern_(from.leading_digits_pattern_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  pattern_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    pattern_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_pattern()) {
    pattern_.Set(from._internal_pattern(), 
      GetArenaForAllocation());
  }
  format_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    format_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_format()) {
    format_.Set(from._internal_format(), 
      GetArenaForAllocation());
  }
  national_prefix_formatting_rule_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    national_prefix_formatting_rule_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_national_prefix_formatting_rule()) {
    national_prefix_formatting_rule_.Set(from._internal_national_prefix_formatting_rule(), 
      GetArenaForAllocation());
  }
  domestic_carrier_code_formatting_rule_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    domestic_carrier_code_formatting_rule_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_domestic_carrier_code_formatting_rule()) {
    domestic_carrier_code_formatting_rule_.Set(from._internal_domestic_carrier_code_formatting_rule(), 
      GetArenaForAllocation());
  }
  national_prefix_optional_when_formatting_ = from.national_prefix_optional_when_formatting_;
  // @@protoc_insertion_point(copy_constructor:i18n.phonenumbers.NumberFormat)
}

inline void NumberFormat::SharedCtor() {
pattern_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  pattern_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
format_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  format_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
national_prefix_formatting_rule_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  national_prefix_formatting_rule_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
domestic_carrier_code_formatting_rule_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  domestic_carrier_code_formatting_rule_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
national_prefix_optional_when_formatting_ = false;
}

NumberFormat::~NumberFormat() {
  // @@protoc_insertion_point(destructor:i18n.phonenumbers.NumberFormat)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void NumberFormat::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  pattern_.Destroy();
  format_.Destroy();
  national_prefix_formatting_rule_.Destroy();
  domestic_carrier_code_formatting_rule_.Destroy();
}

void NumberFormat::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void NumberFormat::Clear() {
// @@protoc_insertion_point(message_clear_start:i18n.phonenumbers.NumberFormat)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  leading_digits_pattern_.Clear();
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    if (cached_has_bits & 0x00000001u) {
      pattern_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000002u) {
      format_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000004u) {
      national_prefix_formatting_rule_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000008u) {
      domestic_carrier_code_formatting_rule_.ClearNonDefaultToEmpty();
    }
  }
  national_prefix_optional_when_formatting_ = false;
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* NumberFormat::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // required string pattern = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          auto str = _internal_mutable_pattern();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // required string format = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_format();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // repeated string leading_digits_pattern = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
          ptr -= 1;
          do {
            ptr += 1;
            auto str = _internal_add_leading_digits_pattern();
            ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr));
        } else
          goto handle_unusual;
        continue;
      // optional string national_prefix_formatting_rule = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
          auto str = _internal_mutable_national_prefix_formatting_rule();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional string domestic_carrier_code_formatting_rule = 5;
      case 5:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
          auto str = _internal_mutable_domestic_carrier_code_formatting_rule();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bool national_prefix_optional_when_formatting = 6 [default = false];
      case 6:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 48)) {
          _Internal::set_has_national_prefix_optional_when_formatting(&has_bits);
          national_prefix_optional_when_formatting_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* NumberFormat::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:i18n.phonenumbers.NumberFormat)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // required string pattern = 1;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteStringMaybeAliased(
        1, this->_internal_pattern(), target);
  }

  // required string format = 2;
  if (cached_has_bits & 0x00000002u) {
    target = stream->WriteStringMaybeAliased(
        2, this->_internal_format(), target);
  }

  // repeated string leading_digits_pattern = 3;
  for (int i = 0, n = this->_internal_leading_digits_pattern_size(); i < n; i++) {
    const auto& s = this->_internal_leading_digits_pattern(i);
    target = stream->WriteString(3, s, target);
  }

  // optional string national_prefix_formatting_rule = 4;
  if (cached_has_bits & 0x00000004u) {
    target = stream->WriteStringMaybeAliased(
        4, this->_internal_national_prefix_formatting_rule(), target);
  }

  // optional string domestic_carrier_code_formatting_rule = 5;
  if (cached_has_bits & 0x00000008u) {
    target = stream->WriteStringMaybeAliased(
        5, this->_internal_domestic_carrier_code_formatting_rule(), target);
  }

  // optional bool national_prefix_optional_when_formatting = 6 [default = false];
  if (cached_has_bits & 0x00000010u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(6, this->_internal_national_prefix_optional_when_formatting(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:i18n.phonenumbers.NumberFormat)
  return target;
}

size_t NumberFormat::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:i18n.phonenumbers.NumberFormat)
  size_t total_size = 0;

  if (_internal_has_pattern()) {
    // required string pattern = 1;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_pattern());
  }

  if (_internal_has_format()) {
    // required string format = 2;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_format());
  }

  return total_size;
}
size_t NumberFormat::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:i18n.phonenumbers.NumberFormat)
  size_t total_size = 0;

  if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == 0) {  // All required fields are present.
    // required string pattern = 1;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_pattern());

    // required string format = 2;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_format());

  } else {
    total_size += RequiredFieldsByteSizeFallback();
  }
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated string leading_digits_pattern = 3;
  total_size += 1 *
      ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(leading_digits_pattern_.size());
  for (int i = 0, n = leading_digits_pattern_.size(); i < n; i++) {
    total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
      leading_digits_pattern_.Get(i));
  }

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x0000001cu) {
    // optional string national_prefix_formatting_rule = 4;
    if (cached_has_bits & 0x00000004u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_national_prefix_formatting_rule());
    }

    // optional string domestic_carrier_code_formatting_rule = 5;
    if (cached_has_bits & 0x00000008u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_domestic_carrier_code_formatting_rule());
    }

    // optional bool national_prefix_optional_when_formatting = 6 [default = false];
    if (cached_has_bits & 0x00000010u) {
      total_size += 1 + 1;
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void NumberFormat::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const NumberFormat*>(
      &from));
}

void NumberFormat::MergeFrom(const NumberFormat& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:i18n.phonenumbers.NumberFormat)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  leading_digits_pattern_.MergeFrom(from.leading_digits_pattern_);
  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x0000001fu) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_pattern(from._internal_pattern());
    }
    if (cached_has_bits & 0x00000002u) {
      _internal_set_format(from._internal_format());
    }
    if (cached_has_bits & 0x00000004u) {
      _internal_set_national_prefix_formatting_rule(from._internal_national_prefix_formatting_rule());
    }
    if (cached_has_bits & 0x00000008u) {
      _internal_set_domestic_carrier_code_formatting_rule(from._internal_domestic_carrier_code_formatting_rule());
    }
    if (cached_has_bits & 0x00000010u) {
      national_prefix_optional_when_formatting_ = from.national_prefix_optional_when_formatting_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void NumberFormat::CopyFrom(const NumberFormat& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:i18n.phonenumbers.NumberFormat)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool NumberFormat::IsInitialized() const {
  if (_Internal::MissingRequiredFields(_has_bits_)) return false;
  return true;
}

void NumberFormat::InternalSwap(NumberFormat* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  leading_digits_pattern_.InternalSwap(&other->leading_digits_pattern_);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &pattern_, lhs_arena,
      &other->pattern_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &format_, lhs_arena,
      &other->format_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &national_prefix_formatting_rule_, lhs_arena,
      &other->national_prefix_formatting_rule_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &domestic_carrier_code_formatting_rule_, lhs_arena,
      &other->domestic_carrier_code_formatting_rule_, rhs_arena
  );
  swap(national_prefix_optional_when_formatting_, other->national_prefix_optional_when_formatting_);
}

std::string NumberFormat::GetTypeName() const {
  return "i18n.phonenumbers.NumberFormat";
}


// ===================================================================

class PhoneNumberDesc::_Internal {
 public:
  using HasBits = decltype(std::declval<PhoneNumberDesc>()._has_bits_);
  static void set_has_national_number_pattern(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_example_number(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
};

PhoneNumberDesc::PhoneNumberDesc(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned),
  possible_length_(arena),
  possible_length_local_only_(arena) {
  SharedCtor();
  // @@protoc_insertion_point(arena_constructor:i18n.phonenumbers.PhoneNumberDesc)
}
PhoneNumberDesc::PhoneNumberDesc(const PhoneNumberDesc& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_),
      possible_length_(from.possible_length_),
      possible_length_local_only_(from.possible_length_local_only_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  national_number_pattern_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    national_number_pattern_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_national_number_pattern()) {
    national_number_pattern_.Set(from._internal_national_number_pattern(), 
      GetArenaForAllocation());
  }
  example_number_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    example_number_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_example_number()) {
    example_number_.Set(from._internal_example_number(), 
      GetArenaForAllocation());
  }
  // @@protoc_insertion_point(copy_constructor:i18n.phonenumbers.PhoneNumberDesc)
}

inline void PhoneNumberDesc::SharedCtor() {
national_number_pattern_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  national_number_pattern_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
example_number_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  example_number_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}

PhoneNumberDesc::~PhoneNumberDesc() {
  // @@protoc_insertion_point(destructor:i18n.phonenumbers.PhoneNumberDesc)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void PhoneNumberDesc::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  national_number_pattern_.Destroy();
  example_number_.Destroy();
}

void PhoneNumberDesc::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void PhoneNumberDesc::Clear() {
// @@protoc_insertion_point(message_clear_start:i18n.phonenumbers.PhoneNumberDesc)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  possible_length_.Clear();
  possible_length_local_only_.Clear();
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      national_number_pattern_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000002u) {
      example_number_.ClearNonDefaultToEmpty();
    }
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* PhoneNumberDesc::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional string national_number_pattern = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_national_number_pattern();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional string example_number = 6;
      case 6:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
          auto str = _internal_mutable_example_number();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // repeated int32 possible_length = 9;
      case 9:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 72)) {
          ptr -= 1;
          do {
            ptr += 1;
            _internal_add_possible_length(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<72>(ptr));
        } else if (static_cast<uint8_t>(tag) == 74) {
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_possible_length(), ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // repeated int32 possible_length_local_only = 10;
      case 10:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) {
          ptr -= 1;
          do {
            ptr += 1;
            _internal_add_possible_length_local_only(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<80>(ptr));
        } else if (static_cast<uint8_t>(tag) == 82) {
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_possible_length_local_only(), ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* PhoneNumberDesc::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:i18n.phonenumbers.PhoneNumberDesc)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional string national_number_pattern = 2;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteStringMaybeAliased(
        2, this->_internal_national_number_pattern(), target);
  }

  // optional string example_number = 6;
  if (cached_has_bits & 0x00000002u) {
    target = stream->WriteStringMaybeAliased(
        6, this->_internal_example_number(), target);
  }

  // repeated int32 possible_length = 9;
  for (int i = 0, n = this->_internal_possible_length_size(); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteInt32ToArray(9, this->_internal_possible_length(i), target);
  }

  // repeated int32 possible_length_local_only = 10;
  for (int i = 0, n = this->_internal_possible_length_local_only_size(); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteInt32ToArray(10, this->_internal_possible_length_local_only(i), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:i18n.phonenumbers.PhoneNumberDesc)
  return target;
}

size_t PhoneNumberDesc::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:i18n.phonenumbers.PhoneNumberDesc)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated int32 possible_length = 9;
  {
    size_t data_size = ::_pbi::WireFormatLite::
      Int32Size(this->possible_length_);
    total_size += 1 *
                  ::_pbi::FromIntSize(this->_internal_possible_length_size());
    total_size += data_size;
  }

  // repeated int32 possible_length_local_only = 10;
  {
    size_t data_size = ::_pbi::WireFormatLite::
      Int32Size(this->possible_length_local_only_);
    total_size += 1 *
                  ::_pbi::FromIntSize(this->_internal_possible_length_local_only_size());
    total_size += data_size;
  }

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    // optional string national_number_pattern = 2;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_national_number_pattern());
    }

    // optional string example_number = 6;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_example_number());
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void PhoneNumberDesc::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const PhoneNumberDesc*>(
      &from));
}

void PhoneNumberDesc::MergeFrom(const PhoneNumberDesc& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:i18n.phonenumbers.PhoneNumberDesc)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  possible_length_.MergeFrom(from.possible_length_);
  possible_length_local_only_.MergeFrom(from.possible_length_local_only_);
  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_national_number_pattern(from._internal_national_number_pattern());
    }
    if (cached_has_bits & 0x00000002u) {
      _internal_set_example_number(from._internal_example_number());
    }
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void PhoneNumberDesc::CopyFrom(const PhoneNumberDesc& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:i18n.phonenumbers.PhoneNumberDesc)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool PhoneNumberDesc::IsInitialized() const {
  return true;
}

void PhoneNumberDesc::InternalSwap(PhoneNumberDesc* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  possible_length_.InternalSwap(&other->possible_length_);
  possible_length_local_only_.InternalSwap(&other->possible_length_local_only_);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &national_number_pattern_, lhs_arena,
      &other->national_number_pattern_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &example_number_, lhs_arena,
      &other->example_number_, rhs_arena
  );
}

std::string PhoneNumberDesc::GetTypeName() const {
  return "i18n.phonenumbers.PhoneNumberDesc";
}


// ===================================================================

class PhoneMetadata::_Internal {
 public:
  using HasBits = decltype(std::declval<PhoneMetadata>()._has_bits_);
  static const ::i18n::phonenumbers::PhoneNumberDesc& general_desc(const PhoneMetadata* msg);
  static void set_has_general_desc(HasBits* has_bits) {
    (*has_bits)[0] |= 256u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& fixed_line(const PhoneMetadata* msg);
  static void set_has_fixed_line(HasBits* has_bits) {
    (*has_bits)[0] |= 512u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& mobile(const PhoneMetadata* msg);
  static void set_has_mobile(HasBits* has_bits) {
    (*has_bits)[0] |= 1024u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& toll_free(const PhoneMetadata* msg);
  static void set_has_toll_free(HasBits* has_bits) {
    (*has_bits)[0] |= 2048u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& premium_rate(const PhoneMetadata* msg);
  static void set_has_premium_rate(HasBits* has_bits) {
    (*has_bits)[0] |= 4096u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& shared_cost(const PhoneMetadata* msg);
  static void set_has_shared_cost(HasBits* has_bits) {
    (*has_bits)[0] |= 8192u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& personal_number(const PhoneMetadata* msg);
  static void set_has_personal_number(HasBits* has_bits) {
    (*has_bits)[0] |= 16384u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& voip(const PhoneMetadata* msg);
  static void set_has_voip(HasBits* has_bits) {
    (*has_bits)[0] |= 32768u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& pager(const PhoneMetadata* msg);
  static void set_has_pager(HasBits* has_bits) {
    (*has_bits)[0] |= 65536u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& uan(const PhoneMetadata* msg);
  static void set_has_uan(HasBits* has_bits) {
    (*has_bits)[0] |= 262144u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& emergency(const PhoneMetadata* msg);
  static void set_has_emergency(HasBits* has_bits) {
    (*has_bits)[0] |= 524288u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& voicemail(const PhoneMetadata* msg);
  static void set_has_voicemail(HasBits* has_bits) {
    (*has_bits)[0] |= 1048576u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& short_code(const PhoneMetadata* msg);
  static void set_has_short_code(HasBits* has_bits) {
    (*has_bits)[0] |= 2097152u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& standard_rate(const PhoneMetadata* msg);
  static void set_has_standard_rate(HasBits* has_bits) {
    (*has_bits)[0] |= 4194304u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& carrier_specific(const PhoneMetadata* msg);
  static void set_has_carrier_specific(HasBits* has_bits) {
    (*has_bits)[0] |= 8388608u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& sms_services(const PhoneMetadata* msg);
  static void set_has_sms_services(HasBits* has_bits) {
    (*has_bits)[0] |= 16777216u;
  }
  static const ::i18n::phonenumbers::PhoneNumberDesc& no_international_dialling(const PhoneMetadata* msg);
  static void set_has_no_international_dialling(HasBits* has_bits) {
    (*has_bits)[0] |= 131072u;
  }
  static void set_has_id(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_country_code(HasBits* has_bits) {
    (*has_bits)[0] |= 33554432u;
  }
  static void set_has_international_prefix(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_preferred_international_prefix(HasBits* has_bits) {
    (*has_bits)[0] |= 64u;
  }
  static void set_has_national_prefix(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_preferred_extn_prefix(HasBits* has_bits) {
    (*has_bits)[0] |= 8u;
  }
  static void set_has_national_prefix_for_parsing(HasBits* has_bits) {
    (*has_bits)[0] |= 16u;
  }
  static void set_has_national_prefix_transform_rule(HasBits* has_bits) {
    (*has_bits)[0] |= 32u;
  }
  static void set_has_same_mobile_and_fixed_line_pattern(HasBits* has_bits) {
    (*has_bits)[0] |= 67108864u;
  }
  static void set_has_main_country_for_code(HasBits* has_bits) {
    (*has_bits)[0] |= 134217728u;
  }
  static void set_has_leading_digits(HasBits* has_bits) {
    (*has_bits)[0] |= 128u;
  }
  static void set_has_leading_zero_possible(HasBits* has_bits) {
    (*has_bits)[0] |= 268435456u;
  }
  static void set_has_mobile_number_portable_region(HasBits* has_bits) {
    (*has_bits)[0] |= 536870912u;
  }
  static bool MissingRequiredFields(const HasBits& has_bits) {
    return ((has_bits[0] & 0x00000001) ^ 0x00000001) != 0;
  }
};

const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::general_desc(const PhoneMetadata* msg) {
  return *msg->general_desc_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::fixed_line(const PhoneMetadata* msg) {
  return *msg->fixed_line_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::mobile(const PhoneMetadata* msg) {
  return *msg->mobile_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::toll_free(const PhoneMetadata* msg) {
  return *msg->toll_free_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::premium_rate(const PhoneMetadata* msg) {
  return *msg->premium_rate_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::shared_cost(const PhoneMetadata* msg) {
  return *msg->shared_cost_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::personal_number(const PhoneMetadata* msg) {
  return *msg->personal_number_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::voip(const PhoneMetadata* msg) {
  return *msg->voip_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::pager(const PhoneMetadata* msg) {
  return *msg->pager_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::uan(const PhoneMetadata* msg) {
  return *msg->uan_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::emergency(const PhoneMetadata* msg) {
  return *msg->emergency_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::voicemail(const PhoneMetadata* msg) {
  return *msg->voicemail_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::short_code(const PhoneMetadata* msg) {
  return *msg->short_code_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::standard_rate(const PhoneMetadata* msg) {
  return *msg->standard_rate_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::carrier_specific(const PhoneMetadata* msg) {
  return *msg->carrier_specific_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::sms_services(const PhoneMetadata* msg) {
  return *msg->sms_services_;
}
const ::i18n::phonenumbers::PhoneNumberDesc&
PhoneMetadata::_Internal::no_international_dialling(const PhoneMetadata* msg) {
  return *msg->no_international_dialling_;
}
PhoneMetadata::PhoneMetadata(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned),
  number_format_(arena),
  intl_number_format_(arena) {
  SharedCtor();
  // @@protoc_insertion_point(arena_constructor:i18n.phonenumbers.PhoneMetadata)
}
PhoneMetadata::PhoneMetadata(const PhoneMetadata& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_),
      number_format_(from.number_format_),
      intl_number_format_(from.intl_number_format_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  id_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    id_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_id()) {
    id_.Set(from._internal_id(), 
      GetArenaForAllocation());
  }
  international_prefix_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    international_prefix_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_international_prefix()) {
    international_prefix_.Set(from._internal_international_prefix(), 
      GetArenaForAllocation());
  }
  national_prefix_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    national_prefix_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_national_prefix()) {
    national_prefix_.Set(from._internal_national_prefix(), 
      GetArenaForAllocation());
  }
  preferred_extn_prefix_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    preferred_extn_prefix_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_preferred_extn_prefix()) {
    preferred_extn_prefix_.Set(from._internal_preferred_extn_prefix(), 
      GetArenaForAllocation());
  }
  national_prefix_for_parsing_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    national_prefix_for_parsing_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_national_prefix_for_parsing()) {
    national_prefix_for_parsing_.Set(from._internal_national_prefix_for_parsing(), 
      GetArenaForAllocation());
  }
  national_prefix_transform_rule_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    national_prefix_transform_rule_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_national_prefix_transform_rule()) {
    national_prefix_transform_rule_.Set(from._internal_national_prefix_transform_rule(), 
      GetArenaForAllocation());
  }
  preferred_international_prefix_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    preferred_international_prefix_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_preferred_international_prefix()) {
    preferred_international_prefix_.Set(from._internal_preferred_international_prefix(), 
      GetArenaForAllocation());
  }
  leading_digits_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    leading_digits_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_leading_digits()) {
    leading_digits_.Set(from._internal_leading_digits(), 
      GetArenaForAllocation());
  }
  if (from._internal_has_general_desc()) {
    general_desc_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.general_desc_);
  } else {
    general_desc_ = nullptr;
  }
  if (from._internal_has_fixed_line()) {
    fixed_line_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.fixed_line_);
  } else {
    fixed_line_ = nullptr;
  }
  if (from._internal_has_mobile()) {
    mobile_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.mobile_);
  } else {
    mobile_ = nullptr;
  }
  if (from._internal_has_toll_free()) {
    toll_free_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.toll_free_);
  } else {
    toll_free_ = nullptr;
  }
  if (from._internal_has_premium_rate()) {
    premium_rate_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.premium_rate_);
  } else {
    premium_rate_ = nullptr;
  }
  if (from._internal_has_shared_cost()) {
    shared_cost_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.shared_cost_);
  } else {
    shared_cost_ = nullptr;
  }
  if (from._internal_has_personal_number()) {
    personal_number_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.personal_number_);
  } else {
    personal_number_ = nullptr;
  }
  if (from._internal_has_voip()) {
    voip_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.voip_);
  } else {
    voip_ = nullptr;
  }
  if (from._internal_has_pager()) {
    pager_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.pager_);
  } else {
    pager_ = nullptr;
  }
  if (from._internal_has_no_international_dialling()) {
    no_international_dialling_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.no_international_dialling_);
  } else {
    no_international_dialling_ = nullptr;
  }
  if (from._internal_has_uan()) {
    uan_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.uan_);
  } else {
    uan_ = nullptr;
  }
  if (from._internal_has_emergency()) {
    emergency_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.emergency_);
  } else {
    emergency_ = nullptr;
  }
  if (from._internal_has_voicemail()) {
    voicemail_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.voicemail_);
  } else {
    voicemail_ = nullptr;
  }
  if (from._internal_has_short_code()) {
    short_code_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.short_code_);
  } else {
    short_code_ = nullptr;
  }
  if (from._internal_has_standard_rate()) {
    standard_rate_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.standard_rate_);
  } else {
    standard_rate_ = nullptr;
  }
  if (from._internal_has_carrier_specific()) {
    carrier_specific_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.carrier_specific_);
  } else {
    carrier_specific_ = nullptr;
  }
  if (from._internal_has_sms_services()) {
    sms_services_ = new ::i18n::phonenumbers::PhoneNumberDesc(*from.sms_services_);
  } else {
    sms_services_ = nullptr;
  }
  ::memcpy(&country_code_, &from.country_code_,
    static_cast<size_t>(reinterpret_cast<char*>(&mobile_number_portable_region_) -
    reinterpret_cast<char*>(&country_code_)) + sizeof(mobile_number_portable_region_));
  // @@protoc_insertion_point(copy_constructor:i18n.phonenumbers.PhoneMetadata)
}

inline void PhoneMetadata::SharedCtor() {
id_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  id_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
international_prefix_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  international_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
national_prefix_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  national_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
preferred_extn_prefix_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  preferred_extn_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
national_prefix_for_parsing_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  national_prefix_for_parsing_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
national_prefix_transform_rule_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  national_prefix_transform_rule_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
preferred_international_prefix_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  preferred_international_prefix_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
leading_digits_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  leading_digits_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&general_desc_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&mobile_number_portable_region_) -
    reinterpret_cast<char*>(&general_desc_)) + sizeof(mobile_number_portable_region_));
}

PhoneMetadata::~PhoneMetadata() {
  // @@protoc_insertion_point(destructor:i18n.phonenumbers.PhoneMetadata)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void PhoneMetadata::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  id_.Destroy();
  international_prefix_.Destroy();
  national_prefix_.Destroy();
  preferred_extn_prefix_.Destroy();
  national_prefix_for_parsing_.Destroy();
  national_prefix_transform_rule_.Destroy();
  preferred_international_prefix_.Destroy();
  leading_digits_.Destroy();
  if (this != internal_default_instance()) delete general_desc_;
  if (this != internal_default_instance()) delete fixed_line_;
  if (this != internal_default_instance()) delete mobile_;
  if (this != internal_default_instance()) delete toll_free_;
  if (this != internal_default_instance()) delete premium_rate_;
  if (this != internal_default_instance()) delete shared_cost_;
  if (this != internal_default_instance()) delete personal_number_;
  if (this != internal_default_instance()) delete voip_;
  if (this != internal_default_instance()) delete pager_;
  if (this != internal_default_instance()) delete no_international_dialling_;
  if (this != internal_default_instance()) delete uan_;
  if (this != internal_default_instance()) delete emergency_;
  if (this != internal_default_instance()) delete voicemail_;
  if (this != internal_default_instance()) delete short_code_;
  if (this != internal_default_instance()) delete standard_rate_;
  if (this != internal_default_instance()) delete carrier_specific_;
  if (this != internal_default_instance()) delete sms_services_;
}

void PhoneMetadata::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void PhoneMetadata::Clear() {
// @@protoc_insertion_point(message_clear_start:i18n.phonenumbers.PhoneMetadata)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  number_format_.Clear();
  intl_number_format_.Clear();
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x000000ffu) {
    if (cached_has_bits & 0x00000001u) {
      id_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000002u) {
      international_prefix_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000004u) {
      national_prefix_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000008u) {
      preferred_extn_prefix_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000010u) {
      national_prefix_for_parsing_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000020u) {
      national_prefix_transform_rule_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000040u) {
      preferred_international_prefix_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000080u) {
      leading_digits_.ClearNonDefaultToEmpty();
    }
  }
  if (cached_has_bits & 0x0000ff00u) {
    if (cached_has_bits & 0x00000100u) {
      GOOGLE_DCHECK(general_desc_ != nullptr);
      general_desc_->Clear();
    }
    if (cached_has_bits & 0x00000200u) {
      GOOGLE_DCHECK(fixed_line_ != nullptr);
      fixed_line_->Clear();
    }
    if (cached_has_bits & 0x00000400u) {
      GOOGLE_DCHECK(mobile_ != nullptr);
      mobile_->Clear();
    }
    if (cached_has_bits & 0x00000800u) {
      GOOGLE_DCHECK(toll_free_ != nullptr);
      toll_free_->Clear();
    }
    if (cached_has_bits & 0x00001000u) {
      GOOGLE_DCHECK(premium_rate_ != nullptr);
      premium_rate_->Clear();
    }
    if (cached_has_bits & 0x00002000u) {
      GOOGLE_DCHECK(shared_cost_ != nullptr);
      shared_cost_->Clear();
    }
    if (cached_has_bits & 0x00004000u) {
      GOOGLE_DCHECK(personal_number_ != nullptr);
      personal_number_->Clear();
    }
    if (cached_has_bits & 0x00008000u) {
      GOOGLE_DCHECK(voip_ != nullptr);
      voip_->Clear();
    }
  }
  if (cached_has_bits & 0x00ff0000u) {
    if (cached_has_bits & 0x00010000u) {
      GOOGLE_DCHECK(pager_ != nullptr);
      pager_->Clear();
    }
    if (cached_has_bits & 0x00020000u) {
      GOOGLE_DCHECK(no_international_dialling_ != nullptr);
      no_international_dialling_->Clear();
    }
    if (cached_has_bits & 0x00040000u) {
      GOOGLE_DCHECK(uan_ != nullptr);
      uan_->Clear();
    }
    if (cached_has_bits & 0x00080000u) {
      GOOGLE_DCHECK(emergency_ != nullptr);
      emergency_->Clear();
    }
    if (cached_has_bits & 0x00100000u) {
      GOOGLE_DCHECK(voicemail_ != nullptr);
      voicemail_->Clear();
    }
    if (cached_has_bits & 0x00200000u) {
      GOOGLE_DCHECK(short_code_ != nullptr);
      short_code_->Clear();
    }
    if (cached_has_bits & 0x00400000u) {
      GOOGLE_DCHECK(standard_rate_ != nullptr);
      standard_rate_->Clear();
    }
    if (cached_has_bits & 0x00800000u) {
      GOOGLE_DCHECK(carrier_specific_ != nullptr);
      carrier_specific_->Clear();
    }
  }
  if (cached_has_bits & 0x01000000u) {
    GOOGLE_DCHECK(sms_services_ != nullptr);
    sms_services_->Clear();
  }
  if (cached_has_bits & 0x3e000000u) {
    ::memset(&country_code_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&mobile_number_portable_region_) -
        reinterpret_cast<char*>(&country_code_)) + sizeof(mobile_number_portable_region_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* PhoneMetadata::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional .i18n.phonenumbers.PhoneNumberDesc general_desc = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_general_desc(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc fixed_line = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_fixed_line(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc mobile = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
          ptr = ctx->ParseMessage(_internal_mutable_mobile(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc toll_free = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
          ptr = ctx->ParseMessage(_internal_mutable_toll_free(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc premium_rate = 5;
      case 5:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
          ptr = ctx->ParseMessage(_internal_mutable_premium_rate(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc shared_cost = 6;
      case 6:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
          ptr = ctx->ParseMessage(_internal_mutable_shared_cost(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc personal_number = 7;
      case 7:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
          ptr = ctx->ParseMessage(_internal_mutable_personal_number(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc voip = 8;
      case 8:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) {
          ptr = ctx->ParseMessage(_internal_mutable_voip(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // required string id = 9;
      case 9:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 74)) {
          auto str = _internal_mutable_id();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional int32 country_code = 10;
      case 10:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) {
          _Internal::set_has_country_code(&has_bits);
          country_code_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional string international_prefix = 11;
      case 11:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 90)) {
          auto str = _internal_mutable_international_prefix();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional string national_prefix = 12;
      case 12:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 98)) {
          auto str = _internal_mutable_national_prefix();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional string preferred_extn_prefix = 13;
      case 13:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 106)) {
          auto str = _internal_mutable_preferred_extn_prefix();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional string national_prefix_for_parsing = 15;
      case 15:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 122)) {
          auto str = _internal_mutable_national_prefix_for_parsing();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional string national_prefix_transform_rule = 16;
      case 16:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 130)) {
          auto str = _internal_mutable_national_prefix_transform_rule();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional string preferred_international_prefix = 17;
      case 17:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 138)) {
          auto str = _internal_mutable_preferred_international_prefix();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bool same_mobile_and_fixed_line_pattern = 18 [default = false];
      case 18:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 144)) {
          _Internal::set_has_same_mobile_and_fixed_line_pattern(&has_bits);
          same_mobile_and_fixed_line_pattern_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // repeated .i18n.phonenumbers.NumberFormat number_format = 19;
      case 19:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 154)) {
          ptr -= 2;
          do {
            ptr += 2;
            ptr = ctx->ParseMessage(_internal_add_number_format(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<154>(ptr));
        } else
          goto handle_unusual;
        continue;
      // repeated .i18n.phonenumbers.NumberFormat intl_number_format = 20;
      case 20:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 162)) {
          ptr -= 2;
          do {
            ptr += 2;
            ptr = ctx->ParseMessage(_internal_add_intl_number_format(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<162>(ptr));
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc pager = 21;
      case 21:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 170)) {
          ptr = ctx->ParseMessage(_internal_mutable_pager(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bool main_country_for_code = 22 [default = false];
      case 22:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 176)) {
          _Internal::set_has_main_country_for_code(&has_bits);
          main_country_for_code_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional string leading_digits = 23;
      case 23:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 186)) {
          auto str = _internal_mutable_leading_digits();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc no_international_dialling = 24;
      case 24:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 194)) {
          ptr = ctx->ParseMessage(_internal_mutable_no_international_dialling(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc uan = 25;
      case 25:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 202)) {
          ptr = ctx->ParseMessage(_internal_mutable_uan(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bool leading_zero_possible = 26 [default = false];
      case 26:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 208)) {
          _Internal::set_has_leading_zero_possible(&has_bits);
          leading_zero_possible_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc emergency = 27;
      case 27:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 218)) {
          ptr = ctx->ParseMessage(_internal_mutable_emergency(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc voicemail = 28;
      case 28:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 226)) {
          ptr = ctx->ParseMessage(_internal_mutable_voicemail(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc short_code = 29;
      case 29:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 234)) {
          ptr = ctx->ParseMessage(_internal_mutable_short_code(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc standard_rate = 30;
      case 30:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 242)) {
          ptr = ctx->ParseMessage(_internal_mutable_standard_rate(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc carrier_specific = 31;
      case 31:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 250)) {
          ptr = ctx->ParseMessage(_internal_mutable_carrier_specific(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bool mobile_number_portable_region = 32 [default = false];
      case 32:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 0)) {
          _Internal::set_has_mobile_number_portable_region(&has_bits);
          mobile_number_portable_region_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .i18n.phonenumbers.PhoneNumberDesc sms_services = 33;
      case 33:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_sms_services(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* PhoneMetadata::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:i18n.phonenumbers.PhoneMetadata)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional .i18n.phonenumbers.PhoneNumberDesc general_desc = 1;
  if (cached_has_bits & 0x00000100u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(1, _Internal::general_desc(this),
        _Internal::general_desc(this).GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc fixed_line = 2;
  if (cached_has_bits & 0x00000200u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(2, _Internal::fixed_line(this),
        _Internal::fixed_line(this).GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc mobile = 3;
  if (cached_has_bits & 0x00000400u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(3, _Internal::mobile(this),
        _Internal::mobile(this).GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc toll_free = 4;
  if (cached_has_bits & 0x00000800u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(4, _Internal::toll_free(this),
        _Internal::toll_free(this).GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc premium_rate = 5;
  if (cached_has_bits & 0x00001000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(5, _Internal::premium_rate(this),
        _Internal::premium_rate(this).GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc shared_cost = 6;
  if (cached_has_bits & 0x00002000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(6, _Internal::shared_cost(this),
        _Internal::shared_cost(this).GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc personal_number = 7;
  if (cached_has_bits & 0x00004000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(7, _Internal::personal_number(this),
        _Internal::personal_number(this).GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc voip = 8;
  if (cached_has_bits & 0x00008000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(8, _Internal::voip(this),
        _Internal::voip(this).GetCachedSize(), target, stream);
  }

  // required string id = 9;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteStringMaybeAliased(
        9, this->_internal_id(), target);
  }

  // optional int32 country_code = 10;
  if (cached_has_bits & 0x02000000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteInt32ToArray(10, this->_internal_country_code(), target);
  }

  // optional string international_prefix = 11;
  if (cached_has_bits & 0x00000002u) {
    target = stream->WriteStringMaybeAliased(
        11, this->_internal_international_prefix(), target);
  }

  // optional string national_prefix = 12;
  if (cached_has_bits & 0x00000004u) {
    target = stream->WriteStringMaybeAliased(
        12, this->_internal_national_prefix(), target);
  }

  // optional string preferred_extn_prefix = 13;
  if (cached_has_bits & 0x00000008u) {
    target = stream->WriteStringMaybeAliased(
        13, this->_internal_preferred_extn_prefix(), target);
  }

  // optional string national_prefix_for_parsing = 15;
  if (cached_has_bits & 0x00000010u) {
    target = stream->WriteStringMaybeAliased(
        15, this->_internal_national_prefix_for_parsing(), target);
  }

  // optional string national_prefix_transform_rule = 16;
  if (cached_has_bits & 0x00000020u) {
    target = stream->WriteStringMaybeAliased(
        16, this->_internal_national_prefix_transform_rule(), target);
  }

  // optional string preferred_international_prefix = 17;
  if (cached_has_bits & 0x00000040u) {
    target = stream->WriteStringMaybeAliased(
        17, this->_internal_preferred_international_prefix(), target);
  }

  // optional bool same_mobile_and_fixed_line_pattern = 18 [default = false];
  if (cached_has_bits & 0x04000000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(18, this->_internal_same_mobile_and_fixed_line_pattern(), target);
  }

  // repeated .i18n.phonenumbers.NumberFormat number_format = 19;
  for (unsigned i = 0,
      n = static_cast<unsigned>(this->_internal_number_format_size()); i < n; i++) {
    const auto& repfield = this->_internal_number_format(i);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
        InternalWriteMessage(19, repfield, repfield.GetCachedSize(), target, stream);
  }

  // repeated .i18n.phonenumbers.NumberFormat intl_number_format = 20;
  for (unsigned i = 0,
      n = static_cast<unsigned>(this->_internal_intl_number_format_size()); i < n; i++) {
    const auto& repfield = this->_internal_intl_number_format(i);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
        InternalWriteMessage(20, repfield, repfield.GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc pager = 21;
  if (cached_has_bits & 0x00010000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(21, _Internal::pager(this),
        _Internal::pager(this).GetCachedSize(), target, stream);
  }

  // optional bool main_country_for_code = 22 [default = false];
  if (cached_has_bits & 0x08000000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(22, this->_internal_main_country_for_code(), target);
  }

  // optional string leading_digits = 23;
  if (cached_has_bits & 0x00000080u) {
    target = stream->WriteStringMaybeAliased(
        23, this->_internal_leading_digits(), target);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc no_international_dialling = 24;
  if (cached_has_bits & 0x00020000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(24, _Internal::no_international_dialling(this),
        _Internal::no_international_dialling(this).GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc uan = 25;
  if (cached_has_bits & 0x00040000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(25, _Internal::uan(this),
        _Internal::uan(this).GetCachedSize(), target, stream);
  }

  // optional bool leading_zero_possible = 26 [default = false];
  if (cached_has_bits & 0x10000000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(26, this->_internal_leading_zero_possible(), target);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc emergency = 27;
  if (cached_has_bits & 0x00080000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(27, _Internal::emergency(this),
        _Internal::emergency(this).GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc voicemail = 28;
  if (cached_has_bits & 0x00100000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(28, _Internal::voicemail(this),
        _Internal::voicemail(this).GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc short_code = 29;
  if (cached_has_bits & 0x00200000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(29, _Internal::short_code(this),
        _Internal::short_code(this).GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc standard_rate = 30;
  if (cached_has_bits & 0x00400000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(30, _Internal::standard_rate(this),
        _Internal::standard_rate(this).GetCachedSize(), target, stream);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc carrier_specific = 31;
  if (cached_has_bits & 0x00800000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(31, _Internal::carrier_specific(this),
        _Internal::carrier_specific(this).GetCachedSize(), target, stream);
  }

  // optional bool mobile_number_portable_region = 32 [default = false];
  if (cached_has_bits & 0x20000000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(32, this->_internal_mobile_number_portable_region(), target);
  }

  // optional .i18n.phonenumbers.PhoneNumberDesc sms_services = 33;
  if (cached_has_bits & 0x01000000u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(33, _Internal::sms_services(this),
        _Internal::sms_services(this).GetCachedSize(), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:i18n.phonenumbers.PhoneMetadata)
  return target;
}

size_t PhoneMetadata::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:i18n.phonenumbers.PhoneMetadata)
  size_t total_size = 0;

  // required string id = 9;
  if (_internal_has_id()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_id());
  }
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated .i18n.phonenumbers.NumberFormat number_format = 19;
  total_size += 2UL * this->_internal_number_format_size();
  for (const auto& msg : this->number_format_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  // repeated .i18n.phonenumbers.NumberFormat intl_number_format = 20;
  total_size += 2UL * this->_internal_intl_number_format_size();
  for (const auto& msg : this->intl_number_format_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x000000feu) {
    // optional string international_prefix = 11;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_international_prefix());
    }

    // optional string national_prefix = 12;
    if (cached_has_bits & 0x00000004u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_national_prefix());
    }

    // optional string preferred_extn_prefix = 13;
    if (cached_has_bits & 0x00000008u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_preferred_extn_prefix());
    }

    // optional string national_prefix_for_parsing = 15;
    if (cached_has_bits & 0x00000010u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_national_prefix_for_parsing());
    }

    // optional string national_prefix_transform_rule = 16;
    if (cached_has_bits & 0x00000020u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_national_prefix_transform_rule());
    }

    // optional string preferred_international_prefix = 17;
    if (cached_has_bits & 0x00000040u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_preferred_international_prefix());
    }

    // optional string leading_digits = 23;
    if (cached_has_bits & 0x00000080u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_leading_digits());
    }

  }
  if (cached_has_bits & 0x0000ff00u) {
    // optional .i18n.phonenumbers.PhoneNumberDesc general_desc = 1;
    if (cached_has_bits & 0x00000100u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *general_desc_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc fixed_line = 2;
    if (cached_has_bits & 0x00000200u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *fixed_line_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc mobile = 3;
    if (cached_has_bits & 0x00000400u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *mobile_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc toll_free = 4;
    if (cached_has_bits & 0x00000800u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *toll_free_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc premium_rate = 5;
    if (cached_has_bits & 0x00001000u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *premium_rate_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc shared_cost = 6;
    if (cached_has_bits & 0x00002000u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *shared_cost_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc personal_number = 7;
    if (cached_has_bits & 0x00004000u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *personal_number_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc voip = 8;
    if (cached_has_bits & 0x00008000u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *voip_);
    }

  }
  if (cached_has_bits & 0x00ff0000u) {
    // optional .i18n.phonenumbers.PhoneNumberDesc pager = 21;
    if (cached_has_bits & 0x00010000u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *pager_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc no_international_dialling = 24;
    if (cached_has_bits & 0x00020000u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *no_international_dialling_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc uan = 25;
    if (cached_has_bits & 0x00040000u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *uan_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc emergency = 27;
    if (cached_has_bits & 0x00080000u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *emergency_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc voicemail = 28;
    if (cached_has_bits & 0x00100000u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *voicemail_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc short_code = 29;
    if (cached_has_bits & 0x00200000u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *short_code_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc standard_rate = 30;
    if (cached_has_bits & 0x00400000u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *standard_rate_);
    }

    // optional .i18n.phonenumbers.PhoneNumberDesc carrier_specific = 31;
    if (cached_has_bits & 0x00800000u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *carrier_specific_);
    }

  }
  if (cached_has_bits & 0x3f000000u) {
    // optional .i18n.phonenumbers.PhoneNumberDesc sms_services = 33;
    if (cached_has_bits & 0x01000000u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *sms_services_);
    }

    // optional int32 country_code = 10;
    if (cached_has_bits & 0x02000000u) {
      total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_country_code());
    }

    // optional bool same_mobile_and_fixed_line_pattern = 18 [default = false];
    if (cached_has_bits & 0x04000000u) {
      total_size += 2 + 1;
    }

    // optional bool main_country_for_code = 22 [default = false];
    if (cached_has_bits & 0x08000000u) {
      total_size += 2 + 1;
    }

    // optional bool leading_zero_possible = 26 [default = false];
    if (cached_has_bits & 0x10000000u) {
      total_size += 2 + 1;
    }

    // optional bool mobile_number_portable_region = 32 [default = false];
    if (cached_has_bits & 0x20000000u) {
      total_size += 2 + 1;
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void PhoneMetadata::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const PhoneMetadata*>(
      &from));
}

void PhoneMetadata::MergeFrom(const PhoneMetadata& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:i18n.phonenumbers.PhoneMetadata)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  number_format_.MergeFrom(from.number_format_);
  intl_number_format_.MergeFrom(from.intl_number_format_);
  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x000000ffu) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_id(from._internal_id());
    }
    if (cached_has_bits & 0x00000002u) {
      _internal_set_international_prefix(from._internal_international_prefix());
    }
    if (cached_has_bits & 0x00000004u) {
      _internal_set_national_prefix(from._internal_national_prefix());
    }
    if (cached_has_bits & 0x00000008u) {
      _internal_set_preferred_extn_prefix(from._internal_preferred_extn_prefix());
    }
    if (cached_has_bits & 0x00000010u) {
      _internal_set_national_prefix_for_parsing(from._internal_national_prefix_for_parsing());
    }
    if (cached_has_bits & 0x00000020u) {
      _internal_set_national_prefix_transform_rule(from._internal_national_prefix_transform_rule());
    }
    if (cached_has_bits & 0x00000040u) {
      _internal_set_preferred_international_prefix(from._internal_preferred_international_prefix());
    }
    if (cached_has_bits & 0x00000080u) {
      _internal_set_leading_digits(from._internal_leading_digits());
    }
  }
  if (cached_has_bits & 0x0000ff00u) {
    if (cached_has_bits & 0x00000100u) {
      _internal_mutable_general_desc()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_general_desc());
    }
    if (cached_has_bits & 0x00000200u) {
      _internal_mutable_fixed_line()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_fixed_line());
    }
    if (cached_has_bits & 0x00000400u) {
      _internal_mutable_mobile()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_mobile());
    }
    if (cached_has_bits & 0x00000800u) {
      _internal_mutable_toll_free()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_toll_free());
    }
    if (cached_has_bits & 0x00001000u) {
      _internal_mutable_premium_rate()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_premium_rate());
    }
    if (cached_has_bits & 0x00002000u) {
      _internal_mutable_shared_cost()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_shared_cost());
    }
    if (cached_has_bits & 0x00004000u) {
      _internal_mutable_personal_number()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_personal_number());
    }
    if (cached_has_bits & 0x00008000u) {
      _internal_mutable_voip()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_voip());
    }
  }
  if (cached_has_bits & 0x00ff0000u) {
    if (cached_has_bits & 0x00010000u) {
      _internal_mutable_pager()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_pager());
    }
    if (cached_has_bits & 0x00020000u) {
      _internal_mutable_no_international_dialling()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_no_international_dialling());
    }
    if (cached_has_bits & 0x00040000u) {
      _internal_mutable_uan()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_uan());
    }
    if (cached_has_bits & 0x00080000u) {
      _internal_mutable_emergency()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_emergency());
    }
    if (cached_has_bits & 0x00100000u) {
      _internal_mutable_voicemail()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_voicemail());
    }
    if (cached_has_bits & 0x00200000u) {
      _internal_mutable_short_code()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_short_code());
    }
    if (cached_has_bits & 0x00400000u) {
      _internal_mutable_standard_rate()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_standard_rate());
    }
    if (cached_has_bits & 0x00800000u) {
      _internal_mutable_carrier_specific()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_carrier_specific());
    }
  }
  if (cached_has_bits & 0x3f000000u) {
    if (cached_has_bits & 0x01000000u) {
      _internal_mutable_sms_services()->::i18n::phonenumbers::PhoneNumberDesc::MergeFrom(from._internal_sms_services());
    }
    if (cached_has_bits & 0x02000000u) {
      country_code_ = from.country_code_;
    }
    if (cached_has_bits & 0x04000000u) {
      same_mobile_and_fixed_line_pattern_ = from.same_mobile_and_fixed_line_pattern_;
    }
    if (cached_has_bits & 0x08000000u) {
      main_country_for_code_ = from.main_country_for_code_;
    }
    if (cached_has_bits & 0x10000000u) {
      leading_zero_possible_ = from.leading_zero_possible_;
    }
    if (cached_has_bits & 0x20000000u) {
      mobile_number_portable_region_ = from.mobile_number_portable_region_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void PhoneMetadata::CopyFrom(const PhoneMetadata& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:i18n.phonenumbers.PhoneMetadata)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool PhoneMetadata::IsInitialized() const {
  if (_Internal::MissingRequiredFields(_has_bits_)) return false;
  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(number_format_))
    return false;
  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(intl_number_format_))
    return false;
  return true;
}

void PhoneMetadata::InternalSwap(PhoneMetadata* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  number_format_.InternalSwap(&other->number_format_);
  intl_number_format_.InternalSwap(&other->intl_number_format_);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &id_, lhs_arena,
      &other->id_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &international_prefix_, lhs_arena,
      &other->international_prefix_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &national_prefix_, lhs_arena,
      &other->national_prefix_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &preferred_extn_prefix_, lhs_arena,
      &other->preferred_extn_prefix_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &national_prefix_for_parsing_, lhs_arena,
      &other->national_prefix_for_parsing_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &national_prefix_transform_rule_, lhs_arena,
      &other->national_prefix_transform_rule_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &preferred_international_prefix_, lhs_arena,
      &other->preferred_international_prefix_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &leading_digits_, lhs_arena,
      &other->leading_digits_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(PhoneMetadata, mobile_number_portable_region_)
      + sizeof(PhoneMetadata::mobile_number_portable_region_)
      - PROTOBUF_FIELD_OFFSET(PhoneMetadata, general_desc_)>(
          reinterpret_cast<char*>(&general_desc_),
          reinterpret_cast<char*>(&other->general_desc_));
}

std::string PhoneMetadata::GetTypeName() const {
  return "i18n.phonenumbers.PhoneMetadata";
}


// ===================================================================

class PhoneMetadataCollection::_Internal {
 public:
};

PhoneMetadataCollection::PhoneMetadataCollection(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned),
  metadata_(arena) {
  SharedCtor();
  // @@protoc_insertion_point(arena_constructor:i18n.phonenumbers.PhoneMetadataCollection)
}
PhoneMetadataCollection::PhoneMetadataCollection(const PhoneMetadataCollection& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      metadata_(from.metadata_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:i18n.phonenumbers.PhoneMetadataCollection)
}

inline void PhoneMetadataCollection::SharedCtor() {
}

PhoneMetadataCollection::~PhoneMetadataCollection() {
  // @@protoc_insertion_point(destructor:i18n.phonenumbers.PhoneMetadataCollection)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void PhoneMetadataCollection::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void PhoneMetadataCollection::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void PhoneMetadataCollection::Clear() {
// @@protoc_insertion_point(message_clear_start:i18n.phonenumbers.PhoneMetadataCollection)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  metadata_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* PhoneMetadataCollection::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // repeated .i18n.phonenumbers.PhoneMetadata metadata = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr -= 1;
          do {
            ptr += 1;
            ptr = ctx->ParseMessage(_internal_add_metadata(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* PhoneMetadataCollection::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:i18n.phonenumbers.PhoneMetadataCollection)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated .i18n.phonenumbers.PhoneMetadata metadata = 1;
  for (unsigned i = 0,
      n = static_cast<unsigned>(this->_internal_metadata_size()); i < n; i++) {
    const auto& repfield = this->_internal_metadata(i);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
        InternalWriteMessage(1, repfield, repfield.GetCachedSize(), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:i18n.phonenumbers.PhoneMetadataCollection)
  return target;
}

size_t PhoneMetadataCollection::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:i18n.phonenumbers.PhoneMetadataCollection)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated .i18n.phonenumbers.PhoneMetadata metadata = 1;
  total_size += 1UL * this->_internal_metadata_size();
  for (const auto& msg : this->metadata_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void PhoneMetadataCollection::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const PhoneMetadataCollection*>(
      &from));
}

void PhoneMetadataCollection::MergeFrom(const PhoneMetadataCollection& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:i18n.phonenumbers.PhoneMetadataCollection)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  metadata_.MergeFrom(from.metadata_);
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void PhoneMetadataCollection::CopyFrom(const PhoneMetadataCollection& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:i18n.phonenumbers.PhoneMetadataCollection)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool PhoneMetadataCollection::IsInitialized() const {
  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(metadata_))
    return false;
  return true;
}

void PhoneMetadataCollection::InternalSwap(PhoneMetadataCollection* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  metadata_.InternalSwap(&other->metadata_);
}

std::string PhoneMetadataCollection::GetTypeName() const {
  return "i18n.phonenumbers.PhoneMetadataCollection";
}


// @@protoc_insertion_point(namespace_scope)
}  // namespace phonenumbers
}  // namespace i18n
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::i18n::phonenumbers::NumberFormat*
Arena::CreateMaybeMessage< ::i18n::phonenumbers::NumberFormat >(Arena* arena) {
  return Arena::CreateMessageInternal< ::i18n::phonenumbers::NumberFormat >(arena);
}
template<> PROTOBUF_NOINLINE ::i18n::phonenumbers::PhoneNumberDesc*
Arena::CreateMaybeMessage< ::i18n::phonenumbers::PhoneNumberDesc >(Arena* arena) {
  return Arena::CreateMessageInternal< ::i18n::phonenumbers::PhoneNumberDesc >(arena);
}
template<> PROTOBUF_NOINLINE ::i18n::phonenumbers::PhoneMetadata*
Arena::CreateMaybeMessage< ::i18n::phonenumbers::PhoneMetadata >(Arena* arena) {
  return Arena::CreateMessageInternal< ::i18n::phonenumbers::PhoneMetadata >(arena);
}
template<> PROTOBUF_NOINLINE ::i18n::phonenumbers::PhoneMetadataCollection*
Arena::CreateMaybeMessage< ::i18n::phonenumbers::PhoneMetadataCollection >(Arena* arena) {
  return Arena::CreateMessageInternal< ::i18n::phonenumbers::PhoneMetadataCollection >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
