Source

libphonenumber-csharp / csharp / PhoneNumbers / Phonenumber.cs

Full commit
// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48.  DO NOT EDIT!

using scg = global::System.Collections.Generic;
namespace PhoneNumbers {
  
  [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
  [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
  [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
  public static partial class Phonenumber {
  
    
    #region Static variables
    #endregion
    #region Extensions
    internal static readonly object Descriptor;
    static Phonenumber() {
      Descriptor = null;
    }
    #endregion
    
  }
  #region Messages
  [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
  [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
  [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
  public partial class PhoneNumber {
    private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial();
    public static PhoneNumber DefaultInstance {
      get { return defaultInstance; }
    }
    
    public PhoneNumber DefaultInstanceForType {
      get { return defaultInstance; }
    }
    
    protected PhoneNumber ThisMessage {
      get { return this; }
    }
    
    #region Nested types
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
    public static class Types {
      [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
      [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
      public enum CountryCodeSource {
        FROM_NUMBER_WITH_PLUS_SIGN = 1,
        FROM_NUMBER_WITH_IDD = 5,
        FROM_NUMBER_WITHOUT_PLUS_SIGN = 10,
        FROM_DEFAULT_COUNTRY = 20,
      }
      
    }
    #endregion
    
    public const int CountryCodeFieldNumber = 1;
    private bool hasCountryCode;
    private int countryCode_ = 0;
    public bool HasCountryCode {
      get { return hasCountryCode; }
    }
    public int CountryCode {
      get { return countryCode_; }
    }
    
    public const int NationalNumberFieldNumber = 2;
    private bool hasNationalNumber;
    private ulong nationalNumber_ = 0UL;
    public bool HasNationalNumber {
      get { return hasNationalNumber; }
    }
    public ulong NationalNumber {
      get { return nationalNumber_; }
    }
    
    public const int ExtensionFieldNumber = 3;
    private bool hasExtension;
    private string extension_ = "";
    public bool HasExtension {
      get { return hasExtension; }
    }
    public string Extension {
      get { return extension_; }
    }
    
    public const int ItalianLeadingZeroFieldNumber = 4;
    private bool hasItalianLeadingZero;
    private bool italianLeadingZero_ = false;
    public bool HasItalianLeadingZero {
      get { return hasItalianLeadingZero; }
    }
    public bool ItalianLeadingZero {
      get { return italianLeadingZero_; }
    }
    
    public const int RawInputFieldNumber = 5;
    private bool hasRawInput;
    private string rawInput_ = "";
    public bool HasRawInput {
      get { return hasRawInput; }
    }
    public string RawInput {
      get { return rawInput_; }
    }
    
    public const int CountryCodeSourceFieldNumber = 6;
    private bool hasCountryCodeSource;
    private global::PhoneNumbers.PhoneNumber.Types.CountryCodeSource countryCodeSource_ = global::PhoneNumbers.PhoneNumber.Types.CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN;
    public bool HasCountryCodeSource {
      get { return hasCountryCodeSource; }
    }
    public global::PhoneNumbers.PhoneNumber.Types.CountryCodeSource CountryCodeSource {
      get { return countryCodeSource_; }
    }
    
    public const int PreferredDomesticCarrierCodeFieldNumber = 7;
    private bool hasPreferredDomesticCarrierCode;
    private string preferredDomesticCarrierCode_ = "";
    public bool HasPreferredDomesticCarrierCode {
      get { return hasPreferredDomesticCarrierCode; }
    }
    public string PreferredDomesticCarrierCode {
      get { return preferredDomesticCarrierCode_; }
    }
    
    public bool IsInitialized {
      get {
        if (!hasCountryCode) return false;
        if (!hasNationalNumber) return false;
        return true;
      }
    }
    
    
    
    
    #region Lite runtime methods
    public override int GetHashCode() {
      int hash = GetType().GetHashCode();
      if (hasCountryCode) hash ^= countryCode_.GetHashCode();
      if (hasNationalNumber) hash ^= nationalNumber_.GetHashCode();
      if (hasExtension) hash ^= extension_.GetHashCode();
      // Manual fix to behave like the Java version which ignores the hasItalianLeadingZero fields
      hash ^= italianLeadingZero_.GetHashCode();
      if (hasRawInput) hash ^= rawInput_.GetHashCode();
      if (hasCountryCodeSource) hash ^= countryCodeSource_.GetHashCode();
      if (hasPreferredDomesticCarrierCode) hash ^= preferredDomesticCarrierCode_.GetHashCode();
      return hash;
    }
    
    public override bool Equals(object obj) {
      PhoneNumber other = obj as PhoneNumber;
      if (other == null) return false;
      if (hasCountryCode != other.hasCountryCode || (hasCountryCode && !countryCode_.Equals(other.countryCode_))) return false;
      if (hasNationalNumber != other.hasNationalNumber || (hasNationalNumber && !nationalNumber_.Equals(other.nationalNumber_))) return false;
      if (hasExtension != other.hasExtension || (hasExtension && !extension_.Equals(other.extension_))) return false;
      // Manual fix to behave like the Java version which ignores the hasItalianLeadingZero fields
      if (!italianLeadingZero_.Equals(other.italianLeadingZero_)) return false;
      if (hasRawInput != other.hasRawInput || (hasRawInput && !rawInput_.Equals(other.rawInput_))) return false;
      if (hasCountryCodeSource != other.hasCountryCodeSource || (hasCountryCodeSource && !countryCodeSource_.Equals(other.countryCodeSource_))) return false;
      if (hasPreferredDomesticCarrierCode != other.hasPreferredDomesticCarrierCode || (hasPreferredDomesticCarrierCode && !preferredDomesticCarrierCode_.Equals(other.preferredDomesticCarrierCode_))) return false;
      return true;
    }
    
    #endregion
    
    public static Builder CreateBuilder() { return new Builder(); }
    public Builder ToBuilder() { return CreateBuilder(this); }
    public Builder CreateBuilderForType() { return new Builder(); }
    public static Builder CreateBuilder(PhoneNumber prototype) {
      return (Builder) new Builder().MergeFrom(prototype);
    }
    
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
    public partial class Builder {
      protected Builder ThisBuilder {
        get { return this; }
      }
      public Builder() {}
      
      PhoneNumber result = new PhoneNumber();
      
      protected PhoneNumber MessageBeingBuilt {
        get { return result; }
      }
      
      public Builder Clear() {
        result = new PhoneNumber();
        return this;
      }
      
      public Builder Clone() {
        return new Builder().MergeFrom(result);
      }
      
      public PhoneNumber DefaultInstanceForType {
        get { return global::PhoneNumbers.PhoneNumber.DefaultInstance; }
      }
      
      public PhoneNumber Build() { return BuildPartial(); }
      
      public PhoneNumber BuildPartial() {
        if (result == null) {
          throw new global::System.InvalidOperationException("build() has already been called on this Builder");
        }
        PhoneNumber returnMe = result;
        result = null;
        return returnMe;
      }
      
      
      public Builder MergeFrom(PhoneNumber other) {
        if (other == global::PhoneNumbers.PhoneNumber.DefaultInstance) return this;
        if (other.HasCountryCode) {
          CountryCode = other.CountryCode;
        }
        if (other.HasNationalNumber) {
          NationalNumber = other.NationalNumber;
        }
        if (other.HasExtension) {
          Extension = other.Extension;
        }
        if (other.HasItalianLeadingZero) {
          ItalianLeadingZero = other.ItalianLeadingZero;
        }
        if (other.HasRawInput) {
          RawInput = other.RawInput;
        }
        if (other.HasCountryCodeSource) {
          CountryCodeSource = other.CountryCodeSource;
        }
        if (other.HasPreferredDomesticCarrierCode) {
          PreferredDomesticCarrierCode = other.PreferredDomesticCarrierCode;
        }
        return this;
      }
      
      
      
      
      public bool HasCountryCode {
        get { return result.HasCountryCode; }
      }
      public int CountryCode {
        get { return result.CountryCode; }
        set { SetCountryCode(value); }
      }
      public Builder SetCountryCode(int value) {
        result.hasCountryCode = true;
        result.countryCode_ = value;
        return this;
      }
      public Builder ClearCountryCode() {
        result.hasCountryCode = false;
        result.countryCode_ = 0;
        return this;
      }
      
      public bool HasNationalNumber {
        get { return result.HasNationalNumber; }
      }
      public ulong NationalNumber {
        get { return result.NationalNumber; }
        set { SetNationalNumber(value); }
      }
      public Builder SetNationalNumber(ulong value) {
        result.hasNationalNumber = true;
        result.nationalNumber_ = value;
        return this;
      }
      public Builder ClearNationalNumber() {
        result.hasNationalNumber = false;
        result.nationalNumber_ = 0UL;
        return this;
      }
      
      public bool HasExtension {
        get { return result.HasExtension; }
      }
      public string Extension {
        get { return result.Extension; }
        set { SetExtension(value); }
      }
      public Builder SetExtension(string value) {
        if(value == null) throw new global::System.ArgumentNullException("value");
        result.hasExtension = true;
        result.extension_ = value;
        return this;
      }
      public Builder ClearExtension() {
        result.hasExtension = false;
        result.extension_ = "";
        return this;
      }
      
      public bool HasItalianLeadingZero {
        get { return result.HasItalianLeadingZero; }
      }
      public bool ItalianLeadingZero {
        get { return result.ItalianLeadingZero; }
        set { SetItalianLeadingZero(value); }
      }
      public Builder SetItalianLeadingZero(bool value) {
        result.hasItalianLeadingZero = true;
        result.italianLeadingZero_ = value;
        return this;
      }
      public Builder ClearItalianLeadingZero() {
        result.hasItalianLeadingZero = false;
        result.italianLeadingZero_ = false;
        return this;
      }
      
      public bool HasRawInput {
        get { return result.HasRawInput; }
      }
      public string RawInput {
        get { return result.RawInput; }
        set { SetRawInput(value); }
      }
      public Builder SetRawInput(string value) {
        if(value == null) throw new global::System.ArgumentNullException("value");
        result.hasRawInput = true;
        result.rawInput_ = value;
        return this;
      }
      public Builder ClearRawInput() {
        result.hasRawInput = false;
        result.rawInput_ = "";
        return this;
      }
      
      public bool HasCountryCodeSource {
       get { return result.HasCountryCodeSource; }
      }
      public global::PhoneNumbers.PhoneNumber.Types.CountryCodeSource CountryCodeSource {
        get { return result.CountryCodeSource; }
        set { SetCountryCodeSource(value); }
      }
      public Builder SetCountryCodeSource(global::PhoneNumbers.PhoneNumber.Types.CountryCodeSource value) {
        result.hasCountryCodeSource = true;
        result.countryCodeSource_ = value;
        return this;
      }
      public Builder ClearCountryCodeSource() {
        result.hasCountryCodeSource = false;
        result.countryCodeSource_ = global::PhoneNumbers.PhoneNumber.Types.CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN;
        return this;
      }
      
      public bool HasPreferredDomesticCarrierCode {
        get { return result.HasPreferredDomesticCarrierCode; }
      }
      public string PreferredDomesticCarrierCode {
        get { return result.PreferredDomesticCarrierCode; }
        set { SetPreferredDomesticCarrierCode(value); }
      }
      public Builder SetPreferredDomesticCarrierCode(string value) {
        if(value == null) throw new global::System.ArgumentNullException("value");
        result.hasPreferredDomesticCarrierCode = true;
        result.preferredDomesticCarrierCode_ = value;
        return this;
      }
      public Builder ClearPreferredDomesticCarrierCode() {
        result.hasPreferredDomesticCarrierCode = false;
        result.preferredDomesticCarrierCode_ = "";
        return this;
      }
    }
    static PhoneNumber() {
      object.ReferenceEquals(global::PhoneNumbers.Phonenumber.Descriptor, null);
    }
  }
  
  #endregion
  
}