Home | History | Annotate | Download | only in AddressBook
      1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
      2 // source: addressbook.proto
      3 #pragma warning disable 1591, 0612, 3021
      4 #region Designer generated code
      5 
      6 using pb = global::Google.Protobuf;
      7 using pbc = global::Google.Protobuf.Collections;
      8 using pbr = global::Google.Protobuf.Reflection;
      9 using scg = global::System.Collections.Generic;
     10 namespace Google.Protobuf.Examples.AddressBook {
     11 
     12   /// <summary>Holder for reflection information generated from addressbook.proto</summary>
     13   [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     14   public static partial class AddressbookReflection {
     15 
     16     #region Descriptor
     17     /// <summary>File descriptor for addressbook.proto</summary>
     18     public static pbr::FileDescriptor Descriptor {
     19       get { return descriptor; }
     20     }
     21     private static pbr::FileDescriptor descriptor;
     22 
     23     static AddressbookReflection() {
     24       byte[] descriptorData = global::System.Convert.FromBase64String(
     25           string.Concat(
     26             "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwi1QEKBlBlcnNvbhIMCgRu",
     27             "YW1lGAEgASgJEgoKAmlkGAIgASgFEg0KBWVtYWlsGAMgASgJEiwKBnBob25l",
     28             "cxgEIAMoCzIcLnR1dG9yaWFsLlBlcnNvbi5QaG9uZU51bWJlchpHCgtQaG9u",
     29             "ZU51bWJlchIOCgZudW1iZXIYASABKAkSKAoEdHlwZRgCIAEoDjIaLnR1dG9y",
     30             "aWFsLlBlcnNvbi5QaG9uZVR5cGUiKwoJUGhvbmVUeXBlEgoKBk1PQklMRRAA",
     31             "EggKBEhPTUUQARIICgRXT1JLEAIiLwoLQWRkcmVzc0Jvb2sSIAoGcGVvcGxl",
     32             "GAEgAygLMhAudHV0b3JpYWwuUGVyc29uQlAKFGNvbS5leGFtcGxlLnR1dG9y",
     33             "aWFsQhFBZGRyZXNzQm9va1Byb3Rvc6oCJEdvb2dsZS5Qcm90b2J1Zi5FeGFt",
     34             "cGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z"));
     35       descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
     36           new pbr::FileDescriptor[] { },
     37           new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
     38             new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null)}),
     39             new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), global::Google.Protobuf.Examples.AddressBook.AddressBook.Parser, new[]{ "People" }, null, null, null)
     40           }));
     41     }
     42     #endregion
     43 
     44   }
     45   #region Messages
     46   /// <summary>
     47   ///  [START messages]
     48   /// </summary>
     49   [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     50   public sealed partial class Person : pb::IMessage<Person> {
     51     private static readonly pb::MessageParser<Person> _parser = new pb::MessageParser<Person>(() => new Person());
     52     public static pb::MessageParser<Person> Parser { get { return _parser; } }
     53 
     54     public static pbr::MessageDescriptor Descriptor {
     55       get { return global::Google.Protobuf.Examples.AddressBook.AddressbookReflection.Descriptor.MessageTypes[0]; }
     56     }
     57 
     58     pbr::MessageDescriptor pb::IMessage.Descriptor {
     59       get { return Descriptor; }
     60     }
     61 
     62     public Person() {
     63       OnConstruction();
     64     }
     65 
     66     partial void OnConstruction();
     67 
     68     public Person(Person other) : this() {
     69       name_ = other.name_;
     70       id_ = other.id_;
     71       email_ = other.email_;
     72       phones_ = other.phones_.Clone();
     73     }
     74 
     75     public Person Clone() {
     76       return new Person(this);
     77     }
     78 
     79     /// <summary>Field number for the "name" field.</summary>
     80     public const int NameFieldNumber = 1;
     81     private string name_ = "";
     82     public string Name {
     83       get { return name_; }
     84       set {
     85         name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
     86       }
     87     }
     88 
     89     /// <summary>Field number for the "id" field.</summary>
     90     public const int IdFieldNumber = 2;
     91     private int id_;
     92     /// <summary>
     93     ///  Unique ID number for this person.
     94     /// </summary>
     95     public int Id {
     96       get { return id_; }
     97       set {
     98         id_ = value;
     99       }
    100     }
    101 
    102     /// <summary>Field number for the "email" field.</summary>
    103     public const int EmailFieldNumber = 3;
    104     private string email_ = "";
    105     public string Email {
    106       get { return email_; }
    107       set {
    108         email_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
    109       }
    110     }
    111 
    112     /// <summary>Field number for the "phones" field.</summary>
    113     public const int PhonesFieldNumber = 4;
    114     private static readonly pb::FieldCodec<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber> _repeated_phones_codec
    115         = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser);
    116     private readonly pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber> phones_ = new pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber>();
    117     public pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber> Phones {
    118       get { return phones_; }
    119     }
    120 
    121     public override bool Equals(object other) {
    122       return Equals(other as Person);
    123     }
    124 
    125     public bool Equals(Person other) {
    126       if (ReferenceEquals(other, null)) {
    127         return false;
    128       }
    129       if (ReferenceEquals(other, this)) {
    130         return true;
    131       }
    132       if (Name != other.Name) return false;
    133       if (Id != other.Id) return false;
    134       if (Email != other.Email) return false;
    135       if(!phones_.Equals(other.phones_)) return false;
    136       return true;
    137     }
    138 
    139     public override int GetHashCode() {
    140       int hash = 1;
    141       if (Name.Length != 0) hash ^= Name.GetHashCode();
    142       if (Id != 0) hash ^= Id.GetHashCode();
    143       if (Email.Length != 0) hash ^= Email.GetHashCode();
    144       hash ^= phones_.GetHashCode();
    145       return hash;
    146     }
    147 
    148     public override string ToString() {
    149       return pb::JsonFormatter.ToDiagnosticString(this);
    150     }
    151 
    152     public void WriteTo(pb::CodedOutputStream output) {
    153       if (Name.Length != 0) {
    154         output.WriteRawTag(10);
    155         output.WriteString(Name);
    156       }
    157       if (Id != 0) {
    158         output.WriteRawTag(16);
    159         output.WriteInt32(Id);
    160       }
    161       if (Email.Length != 0) {
    162         output.WriteRawTag(26);
    163         output.WriteString(Email);
    164       }
    165       phones_.WriteTo(output, _repeated_phones_codec);
    166     }
    167 
    168     public int CalculateSize() {
    169       int size = 0;
    170       if (Name.Length != 0) {
    171         size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
    172       }
    173       if (Id != 0) {
    174         size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id);
    175       }
    176       if (Email.Length != 0) {
    177         size += 1 + pb::CodedOutputStream.ComputeStringSize(Email);
    178       }
    179       size += phones_.CalculateSize(_repeated_phones_codec);
    180       return size;
    181     }
    182 
    183     public void MergeFrom(Person other) {
    184       if (other == null) {
    185         return;
    186       }
    187       if (other.Name.Length != 0) {
    188         Name = other.Name;
    189       }
    190       if (other.Id != 0) {
    191         Id = other.Id;
    192       }
    193       if (other.Email.Length != 0) {
    194         Email = other.Email;
    195       }
    196       phones_.Add(other.phones_);
    197     }
    198 
    199     public void MergeFrom(pb::CodedInputStream input) {
    200       uint tag;
    201       while ((tag = input.ReadTag()) != 0) {
    202         switch(tag) {
    203           default:
    204             input.SkipLastField();
    205             break;
    206           case 10: {
    207             Name = input.ReadString();
    208             break;
    209           }
    210           case 16: {
    211             Id = input.ReadInt32();
    212             break;
    213           }
    214           case 26: {
    215             Email = input.ReadString();
    216             break;
    217           }
    218           case 34: {
    219             phones_.AddEntriesFrom(input, _repeated_phones_codec);
    220             break;
    221           }
    222         }
    223       }
    224     }
    225 
    226     #region Nested types
    227     /// <summary>Container for nested types declared in the Person message type.</summary>
    228     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    229     public static partial class Types {
    230       public enum PhoneType {
    231         [pbr::OriginalName("MOBILE")] Mobile = 0,
    232         [pbr::OriginalName("HOME")] Home = 1,
    233         [pbr::OriginalName("WORK")] Work = 2,
    234       }
    235 
    236       [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    237       public sealed partial class PhoneNumber : pb::IMessage<PhoneNumber> {
    238         private static readonly pb::MessageParser<PhoneNumber> _parser = new pb::MessageParser<PhoneNumber>(() => new PhoneNumber());
    239         public static pb::MessageParser<PhoneNumber> Parser { get { return _parser; } }
    240 
    241         public static pbr::MessageDescriptor Descriptor {
    242           get { return global::Google.Protobuf.Examples.AddressBook.Person.Descriptor.NestedTypes[0]; }
    243         }
    244 
    245         pbr::MessageDescriptor pb::IMessage.Descriptor {
    246           get { return Descriptor; }
    247         }
    248 
    249         public PhoneNumber() {
    250           OnConstruction();
    251         }
    252 
    253         partial void OnConstruction();
    254 
    255         public PhoneNumber(PhoneNumber other) : this() {
    256           number_ = other.number_;
    257           type_ = other.type_;
    258         }
    259 
    260         public PhoneNumber Clone() {
    261           return new PhoneNumber(this);
    262         }
    263 
    264         /// <summary>Field number for the "number" field.</summary>
    265         public const int NumberFieldNumber = 1;
    266         private string number_ = "";
    267         public string Number {
    268           get { return number_; }
    269           set {
    270             number_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
    271           }
    272         }
    273 
    274         /// <summary>Field number for the "type" field.</summary>
    275         public const int TypeFieldNumber = 2;
    276         private global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType type_ = 0;
    277         public global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType Type {
    278           get { return type_; }
    279           set {
    280             type_ = value;
    281           }
    282         }
    283 
    284         public override bool Equals(object other) {
    285           return Equals(other as PhoneNumber);
    286         }
    287 
    288         public bool Equals(PhoneNumber other) {
    289           if (ReferenceEquals(other, null)) {
    290             return false;
    291           }
    292           if (ReferenceEquals(other, this)) {
    293             return true;
    294           }
    295           if (Number != other.Number) return false;
    296           if (Type != other.Type) return false;
    297           return true;
    298         }
    299 
    300         public override int GetHashCode() {
    301           int hash = 1;
    302           if (Number.Length != 0) hash ^= Number.GetHashCode();
    303           if (Type != 0) hash ^= Type.GetHashCode();
    304           return hash;
    305         }
    306 
    307         public override string ToString() {
    308           return pb::JsonFormatter.ToDiagnosticString(this);
    309         }
    310 
    311         public void WriteTo(pb::CodedOutputStream output) {
    312           if (Number.Length != 0) {
    313             output.WriteRawTag(10);
    314             output.WriteString(Number);
    315           }
    316           if (Type != 0) {
    317             output.WriteRawTag(16);
    318             output.WriteEnum((int) Type);
    319           }
    320         }
    321 
    322         public int CalculateSize() {
    323           int size = 0;
    324           if (Number.Length != 0) {
    325             size += 1 + pb::CodedOutputStream.ComputeStringSize(Number);
    326           }
    327           if (Type != 0) {
    328             size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type);
    329           }
    330           return size;
    331         }
    332 
    333         public void MergeFrom(PhoneNumber other) {
    334           if (other == null) {
    335             return;
    336           }
    337           if (other.Number.Length != 0) {
    338             Number = other.Number;
    339           }
    340           if (other.Type != 0) {
    341             Type = other.Type;
    342           }
    343         }
    344 
    345         public void MergeFrom(pb::CodedInputStream input) {
    346           uint tag;
    347           while ((tag = input.ReadTag()) != 0) {
    348             switch(tag) {
    349               default:
    350                 input.SkipLastField();
    351                 break;
    352               case 10: {
    353                 Number = input.ReadString();
    354                 break;
    355               }
    356               case 16: {
    357                 type_ = (global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) input.ReadEnum();
    358                 break;
    359               }
    360             }
    361           }
    362         }
    363 
    364       }
    365 
    366     }
    367     #endregion
    368 
    369   }
    370 
    371   /// <summary>
    372   ///  Our address book file is just one of these.
    373   /// </summary>
    374   [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    375   public sealed partial class AddressBook : pb::IMessage<AddressBook> {
    376     private static readonly pb::MessageParser<AddressBook> _parser = new pb::MessageParser<AddressBook>(() => new AddressBook());
    377     public static pb::MessageParser<AddressBook> Parser { get { return _parser; } }
    378 
    379     public static pbr::MessageDescriptor Descriptor {
    380       get { return global::Google.Protobuf.Examples.AddressBook.AddressbookReflection.Descriptor.MessageTypes[1]; }
    381     }
    382 
    383     pbr::MessageDescriptor pb::IMessage.Descriptor {
    384       get { return Descriptor; }
    385     }
    386 
    387     public AddressBook() {
    388       OnConstruction();
    389     }
    390 
    391     partial void OnConstruction();
    392 
    393     public AddressBook(AddressBook other) : this() {
    394       people_ = other.people_.Clone();
    395     }
    396 
    397     public AddressBook Clone() {
    398       return new AddressBook(this);
    399     }
    400 
    401     /// <summary>Field number for the "people" field.</summary>
    402     public const int PeopleFieldNumber = 1;
    403     private static readonly pb::FieldCodec<global::Google.Protobuf.Examples.AddressBook.Person> _repeated_people_codec
    404         = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Examples.AddressBook.Person.Parser);
    405     private readonly pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person> people_ = new pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person>();
    406     public pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person> People {
    407       get { return people_; }
    408     }
    409 
    410     public override bool Equals(object other) {
    411       return Equals(other as AddressBook);
    412     }
    413 
    414     public bool Equals(AddressBook other) {
    415       if (ReferenceEquals(other, null)) {
    416         return false;
    417       }
    418       if (ReferenceEquals(other, this)) {
    419         return true;
    420       }
    421       if(!people_.Equals(other.people_)) return false;
    422       return true;
    423     }
    424 
    425     public override int GetHashCode() {
    426       int hash = 1;
    427       hash ^= people_.GetHashCode();
    428       return hash;
    429     }
    430 
    431     public override string ToString() {
    432       return pb::JsonFormatter.ToDiagnosticString(this);
    433     }
    434 
    435     public void WriteTo(pb::CodedOutputStream output) {
    436       people_.WriteTo(output, _repeated_people_codec);
    437     }
    438 
    439     public int CalculateSize() {
    440       int size = 0;
    441       size += people_.CalculateSize(_repeated_people_codec);
    442       return size;
    443     }
    444 
    445     public void MergeFrom(AddressBook other) {
    446       if (other == null) {
    447         return;
    448       }
    449       people_.Add(other.people_);
    450     }
    451 
    452     public void MergeFrom(pb::CodedInputStream input) {
    453       uint tag;
    454       while ((tag = input.ReadTag()) != 0) {
    455         switch(tag) {
    456           default:
    457             input.SkipLastField();
    458             break;
    459           case 10: {
    460             people_.AddEntriesFrom(input, _repeated_people_codec);
    461             break;
    462           }
    463         }
    464       }
    465     }
    466 
    467   }
    468 
    469   #endregion
    470 
    471 }
    472 
    473 #endregion Designer generated code
    474