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