Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! |
| 2 | |
| 3 | using pb = global::Google.ProtocolBuffers; |
| 4 | using pbc = global::Google.ProtocolBuffers.Collections; |
| 5 | using pbd = global::Google.ProtocolBuffers.Descriptors; |
| 6 | using scg = global::System.Collections.Generic; |
| 7 | namespace Google.ProtocolBuffers.Examples.AddressBook { |
| 8 | |
| 9 | public static partial class AddressBookProtos { |
| 10 | |
| 11 | #region Descriptor |
| 12 | public static pbd::FileDescriptor Descriptor { |
| 13 | get { return descriptor; } |
| 14 | } |
| 15 | private static readonly pbd::FileDescriptor descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom( |
| 16 | global::System.Convert.FromBase64String( |
| 17 | "Chp0dXRvcmlhbC9hZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwaJGdvb2ds" + |
| 18 | "ZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5wcm90bxogZ29vZ2xlL3Byb3Rv" + |
| 19 | "YnVmL2Rlc2NyaXB0b3IucHJvdG8i2gEKBlBlcnNvbhIMCgRuYW1lGAEgAigJ" + |
| 20 | "EgoKAmlkGAIgAigFEg0KBWVtYWlsGAMgASgJEisKBXBob25lGAQgAygLMhwu" + |
| 21 | "dHV0b3JpYWwuUGVyc29uLlBob25lTnVtYmVyGk0KC1Bob25lTnVtYmVyEg4K" + |
| 22 | "Bm51bWJlchgBIAIoCRIuCgR0eXBlGAIgASgOMhoudHV0b3JpYWwuUGVyc29u" + |
| 23 | "LlBob25lVHlwZToESE9NRSIrCglQaG9uZVR5cGUSCgoGTU9CSUxFEAASCAoE" + |
| 24 | "SE9NRRABEggKBFdPUksQAiIvCgtBZGRyZXNzQm9vaxIgCgZwZXJzb24YASAD" + |
| 25 | "KAsyEC50dXRvcmlhbC5QZXJzb25CRUgBwj5ACitHb29nbGUuUHJvdG9jb2xC" + |
| 26 | "dWZmZXJzLkV4YW1wbGVzLkFkZHJlc3NCb29rEhFBZGRyZXNzQm9va1Byb3Rv" + |
| 27 | "cw=="), |
| 28 | new pbd::FileDescriptor[] { |
| 29 | global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, |
| 30 | global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, |
| 31 | }); |
| 32 | #endregion |
| 33 | |
| 34 | #region Static variables |
| 35 | internal static readonly pbd::MessageDescriptor internal__static_tutorial_Person__Descriptor |
| 36 | = Descriptor.MessageTypes[0]; |
| 37 | internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.Examples.AddressBook.Person, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Builder> internal__static_tutorial_Person__FieldAccessorTable |
| 38 | = new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.Examples.AddressBook.Person, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Builder>(internal__static_tutorial_Person__Descriptor, |
| 39 | new string[] { "Name", "Id", "Email", "Phone", }); |
| 40 | internal static readonly pbd::MessageDescriptor internal__static_tutorial_Person_PhoneNumber__Descriptor |
| 41 | = internal__static_tutorial_Person__Descriptor.NestedTypes[0]; |
| 42 | internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Builder> internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable |
| 43 | = new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Builder>(internal__static_tutorial_Person_PhoneNumber__Descriptor, |
| 44 | new string[] { "Number", "Type", }); |
| 45 | internal static readonly pbd::MessageDescriptor internal__static_tutorial_AddressBook__Descriptor |
| 46 | = Descriptor.MessageTypes[1]; |
| 47 | internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.Examples.AddressBook.AddressBook, global::Google.ProtocolBuffers.Examples.AddressBook.AddressBook.Builder> internal__static_tutorial_AddressBook__FieldAccessorTable |
| 48 | = new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.Examples.AddressBook.AddressBook, global::Google.ProtocolBuffers.Examples.AddressBook.AddressBook.Builder>(internal__static_tutorial_AddressBook__Descriptor, |
| 49 | new string[] { "Person", }); |
| 50 | #endregion |
| 51 | } |
| 52 | #region Messages |
| 53 | public sealed partial class Person : pb::GeneratedMessage<Person, Person.Builder> { |
| 54 | private static readonly Person defaultInstance = new Builder().BuildPartial(); |
| 55 | public static Person DefaultInstance { |
| 56 | get { return defaultInstance; } |
| 57 | } |
| 58 | |
| 59 | public override Person DefaultInstanceForType { |
| 60 | get { return defaultInstance; } |
| 61 | } |
| 62 | |
| 63 | protected override Person ThisMessage { |
| 64 | get { return this; } |
| 65 | } |
| 66 | |
| 67 | public static pbd::MessageDescriptor Descriptor { |
| 68 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_Person__Descriptor; } |
| 69 | } |
| 70 | |
| 71 | protected override pb::FieldAccess.FieldAccessorTable<Person, Person.Builder> InternalFieldAccessors { |
| 72 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_Person__FieldAccessorTable; } |
| 73 | } |
| 74 | |
| 75 | #region Nested types |
| 76 | public static class Types { |
| 77 | public enum PhoneType { |
| 78 | MOBILE = 0, |
| 79 | HOME = 1, |
| 80 | WORK = 2, |
| 81 | } |
| 82 | |
| 83 | public sealed partial class PhoneNumber : pb::GeneratedMessage<PhoneNumber, PhoneNumber.Builder> { |
| 84 | private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); |
| 85 | public static PhoneNumber DefaultInstance { |
| 86 | get { return defaultInstance; } |
| 87 | } |
| 88 | |
| 89 | public override PhoneNumber DefaultInstanceForType { |
| 90 | get { return defaultInstance; } |
| 91 | } |
| 92 | |
| 93 | protected override PhoneNumber ThisMessage { |
| 94 | get { return this; } |
| 95 | } |
| 96 | |
| 97 | public static pbd::MessageDescriptor Descriptor { |
| 98 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_Person_PhoneNumber__Descriptor; } |
| 99 | } |
| 100 | |
| 101 | protected override pb::FieldAccess.FieldAccessorTable<PhoneNumber, PhoneNumber.Builder> InternalFieldAccessors { |
| 102 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; } |
| 103 | } |
| 104 | |
| 105 | private bool hasNumber; |
| 106 | private string number_ = ""; |
| 107 | public bool HasNumber { |
| 108 | get { return hasNumber; } |
| 109 | } |
| 110 | public string Number { |
| 111 | get { return number_; } |
| 112 | } |
| 113 | |
| 114 | private bool hasType; |
| 115 | private global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType type_ = global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME; |
| 116 | public bool HasType { |
| 117 | get { return hasType; } |
| 118 | } |
| 119 | public global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType Type { |
| 120 | get { return type_; } |
| 121 | } |
| 122 | |
| 123 | public override bool IsInitialized { |
| 124 | get { |
| 125 | if (!hasNumber) return false; |
| 126 | return true; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | public override void WriteTo(pb::CodedOutputStream output) { |
| 131 | if (HasNumber) { |
| 132 | output.WriteString(1, Number); |
| 133 | } |
| 134 | if (HasType) { |
| 135 | output.WriteEnum(2, (int) Type); |
| 136 | } |
| 137 | UnknownFields.WriteTo(output); |
| 138 | } |
| 139 | |
| 140 | private int memoizedSerializedSize = -1; |
| 141 | public override int SerializedSize { |
| 142 | get { |
| 143 | int size = memoizedSerializedSize; |
| 144 | if (size != -1) return size; |
| 145 | |
| 146 | size = 0; |
| 147 | if (HasNumber) { |
| 148 | size += pb::CodedOutputStream.ComputeStringSize(1, Number); |
| 149 | } |
| 150 | if (HasType) { |
| 151 | size += pb::CodedOutputStream.ComputeEnumSize(2, (int) Type); |
| 152 | } |
| 153 | size += UnknownFields.SerializedSize; |
| 154 | memoizedSerializedSize = size; |
| 155 | return size; |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | public static PhoneNumber ParseFrom(pb::ByteString data) { |
| 160 | return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
| 161 | } |
| 162 | public static PhoneNumber ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
| 163 | return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
| 164 | } |
| 165 | public static PhoneNumber ParseFrom(byte[] data) { |
| 166 | return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
| 167 | } |
| 168 | public static PhoneNumber ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
| 169 | return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
| 170 | } |
| 171 | public static PhoneNumber ParseFrom(global::System.IO.Stream input) { |
| 172 | return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
| 173 | } |
| 174 | public static PhoneNumber ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
| 175 | return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
| 176 | } |
| 177 | public static PhoneNumber ParseFrom(pb::CodedInputStream input) { |
| 178 | return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
| 179 | } |
| 180 | public static PhoneNumber ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
| 181 | return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
| 182 | } |
| 183 | public static Builder CreateBuilder() { return new Builder(); } |
| 184 | public override Builder CreateBuilderForType() { return new Builder(); } |
| 185 | public static Builder CreateBuilder(PhoneNumber prototype) { |
| 186 | return (Builder) new Builder().MergeFrom(prototype); |
| 187 | } |
| 188 | |
| 189 | public sealed partial class Builder : pb::GeneratedBuilder<PhoneNumber, Builder> { |
| 190 | protected override Builder ThisBuilder { |
| 191 | get { return this; } |
| 192 | } |
| 193 | public Builder() {} |
| 194 | |
| 195 | PhoneNumber result = new PhoneNumber(); |
| 196 | |
| 197 | protected override PhoneNumber MessageBeingBuilt { |
| 198 | get { return result; } |
| 199 | } |
| 200 | |
| 201 | public override Builder Clear() { |
| 202 | result = new PhoneNumber(); |
| 203 | return this; |
| 204 | } |
| 205 | |
| 206 | public override Builder Clone() { |
| 207 | return new Builder().MergeFrom(result); |
| 208 | } |
| 209 | |
| 210 | public override pbd::MessageDescriptor DescriptorForType { |
| 211 | get { return PhoneNumber.Descriptor; } |
| 212 | } |
| 213 | |
| 214 | public override PhoneNumber DefaultInstanceForType { |
| 215 | get { return PhoneNumber.DefaultInstance; } |
| 216 | } |
| 217 | |
| 218 | public override PhoneNumber BuildPartial() { |
| 219 | PhoneNumber returnMe = result; |
| 220 | result = null; |
| 221 | return returnMe; |
| 222 | } |
| 223 | |
| 224 | public override Builder MergeFrom(pb::IMessage other) { |
| 225 | if (other is PhoneNumber) { |
| 226 | return MergeFrom((PhoneNumber) other); |
| 227 | } else { |
| 228 | base.MergeFrom(other); |
| 229 | return this; |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | public override Builder MergeFrom(PhoneNumber other) { |
| 234 | if (other == PhoneNumber.DefaultInstance) return this; |
| 235 | if (other.HasNumber) { |
| 236 | Number = other.Number; |
| 237 | } |
| 238 | if (other.HasType) { |
| 239 | Type = other.Type; |
| 240 | } |
| 241 | this.MergeUnknownFields(other.UnknownFields); |
| 242 | return this; |
| 243 | } |
| 244 | |
| 245 | public override Builder MergeFrom(pb::CodedInputStream input) { |
| 246 | return MergeFrom(input, pb::ExtensionRegistry.Empty); |
| 247 | } |
| 248 | |
| 249 | public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
| 250 | pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); |
| 251 | while (true) { |
| 252 | uint tag = input.ReadTag(); |
| 253 | switch (tag) { |
| 254 | case 0: { |
| 255 | this.UnknownFields = unknownFields.Build(); |
| 256 | return this; |
| 257 | } |
| 258 | default: { |
| 259 | if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { |
| 260 | this.UnknownFields = unknownFields.Build(); |
| 261 | return this; |
| 262 | } |
| 263 | break; |
| 264 | } |
| 265 | case 10: { |
| 266 | Number = input.ReadString(); |
| 267 | break; |
| 268 | } |
| 269 | case 16: { |
| 270 | int rawValue = input.ReadEnum(); |
| 271 | if (!global::System.Enum.IsDefined(typeof(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType), rawValue)) { |
| 272 | unknownFields.MergeVarintField(2, (ulong) rawValue); |
| 273 | } else { |
| 274 | Type = (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType) rawValue; |
| 275 | } |
| 276 | break; |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | |
| 283 | public bool HasNumber { |
| 284 | get { return result.HasNumber; } |
| 285 | } |
| 286 | public string Number { |
| 287 | get { return result.Number; } |
| 288 | set { SetNumber(value); } |
| 289 | } |
| 290 | public Builder SetNumber(string value) { |
| 291 | result.hasNumber = true; |
| 292 | result.number_ = value; |
| 293 | return this; |
| 294 | } |
| 295 | public Builder ClearNumber() { |
| 296 | result.hasNumber = false; |
| 297 | result.number_ = ""; |
| 298 | return this; |
| 299 | } |
| 300 | |
| 301 | public bool HasType { |
| 302 | get { return result.HasType; } |
| 303 | } |
| 304 | public global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType Type { |
| 305 | get { return result.Type; } |
| 306 | set { SetType(value); } |
| 307 | } |
| 308 | public Builder SetType(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType value) { |
| 309 | result.hasType = true; |
| 310 | result.type_ = value; |
| 311 | return this; |
| 312 | } |
| 313 | public Builder ClearType() { |
| 314 | result.hasType = false; |
| 315 | result.type_ = global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME; |
| 316 | return this; |
| 317 | } |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | } |
| 322 | #endregion |
| 323 | |
| 324 | private bool hasName; |
| 325 | private string name_ = ""; |
| 326 | public bool HasName { |
| 327 | get { return hasName; } |
| 328 | } |
| 329 | public string Name { |
| 330 | get { return name_; } |
| 331 | } |
| 332 | |
| 333 | private bool hasId; |
| 334 | private int id_ = 0; |
| 335 | public bool HasId { |
| 336 | get { return hasId; } |
| 337 | } |
| 338 | public int Id { |
| 339 | get { return id_; } |
| 340 | } |
| 341 | |
| 342 | private bool hasEmail; |
| 343 | private string email_ = ""; |
| 344 | public bool HasEmail { |
| 345 | get { return hasEmail; } |
| 346 | } |
| 347 | public string Email { |
| 348 | get { return email_; } |
| 349 | } |
| 350 | |
| 351 | private pbc::PopsicleList<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber> phone_ = new pbc::PopsicleList<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber>(); |
| 352 | public scg::IList<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber> PhoneList { |
| 353 | get { return phone_; } |
| 354 | } |
| 355 | public int PhoneCount { |
| 356 | get { return phone_.Count; } |
| 357 | } |
| 358 | public global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber GetPhone(int index) { |
| 359 | return phone_[index]; |
| 360 | } |
| 361 | |
| 362 | public override bool IsInitialized { |
| 363 | get { |
| 364 | if (!hasName) return false; |
| 365 | if (!hasId) return false; |
| 366 | foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in PhoneList) { |
| 367 | if (!element.IsInitialized) return false; |
| 368 | } |
| 369 | return true; |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | public override void WriteTo(pb::CodedOutputStream output) { |
| 374 | if (HasName) { |
| 375 | output.WriteString(1, Name); |
| 376 | } |
| 377 | if (HasId) { |
| 378 | output.WriteInt32(2, Id); |
| 379 | } |
| 380 | if (HasEmail) { |
| 381 | output.WriteString(3, Email); |
| 382 | } |
| 383 | foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in PhoneList) { |
| 384 | output.WriteMessage(4, element); |
| 385 | } |
| 386 | UnknownFields.WriteTo(output); |
| 387 | } |
| 388 | |
| 389 | private int memoizedSerializedSize = -1; |
| 390 | public override int SerializedSize { |
| 391 | get { |
| 392 | int size = memoizedSerializedSize; |
| 393 | if (size != -1) return size; |
| 394 | |
| 395 | size = 0; |
| 396 | if (HasName) { |
| 397 | size += pb::CodedOutputStream.ComputeStringSize(1, Name); |
| 398 | } |
| 399 | if (HasId) { |
| 400 | size += pb::CodedOutputStream.ComputeInt32Size(2, Id); |
| 401 | } |
| 402 | if (HasEmail) { |
| 403 | size += pb::CodedOutputStream.ComputeStringSize(3, Email); |
| 404 | } |
| 405 | foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in PhoneList) { |
| 406 | size += pb::CodedOutputStream.ComputeMessageSize(4, element); |
| 407 | } |
| 408 | size += UnknownFields.SerializedSize; |
| 409 | memoizedSerializedSize = size; |
| 410 | return size; |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | public static Person ParseFrom(pb::ByteString data) { |
| 415 | return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
| 416 | } |
| 417 | public static Person ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
| 418 | return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
| 419 | } |
| 420 | public static Person ParseFrom(byte[] data) { |
| 421 | return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
| 422 | } |
| 423 | public static Person ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
| 424 | return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
| 425 | } |
| 426 | public static Person ParseFrom(global::System.IO.Stream input) { |
| 427 | return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
| 428 | } |
| 429 | public static Person ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
| 430 | return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
| 431 | } |
| 432 | public static Person ParseFrom(pb::CodedInputStream input) { |
| 433 | return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
| 434 | } |
| 435 | public static Person ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
| 436 | return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
| 437 | } |
| 438 | public static Builder CreateBuilder() { return new Builder(); } |
| 439 | public override Builder CreateBuilderForType() { return new Builder(); } |
| 440 | public static Builder CreateBuilder(Person prototype) { |
| 441 | return (Builder) new Builder().MergeFrom(prototype); |
| 442 | } |
| 443 | |
| 444 | public sealed partial class Builder : pb::GeneratedBuilder<Person, Builder> { |
| 445 | protected override Builder ThisBuilder { |
| 446 | get { return this; } |
| 447 | } |
| 448 | public Builder() {} |
| 449 | |
| 450 | Person result = new Person(); |
| 451 | |
| 452 | protected override Person MessageBeingBuilt { |
| 453 | get { return result; } |
| 454 | } |
| 455 | |
| 456 | public override Builder Clear() { |
| 457 | result = new Person(); |
| 458 | return this; |
| 459 | } |
| 460 | |
| 461 | public override Builder Clone() { |
| 462 | return new Builder().MergeFrom(result); |
| 463 | } |
| 464 | |
| 465 | public override pbd::MessageDescriptor DescriptorForType { |
| 466 | get { return Person.Descriptor; } |
| 467 | } |
| 468 | |
| 469 | public override Person DefaultInstanceForType { |
| 470 | get { return Person.DefaultInstance; } |
| 471 | } |
| 472 | |
| 473 | public override Person BuildPartial() { |
| 474 | result.phone_.MakeReadOnly(); |
| 475 | Person returnMe = result; |
| 476 | result = null; |
| 477 | return returnMe; |
| 478 | } |
| 479 | |
| 480 | public override Builder MergeFrom(pb::IMessage other) { |
| 481 | if (other is Person) { |
| 482 | return MergeFrom((Person) other); |
| 483 | } else { |
| 484 | base.MergeFrom(other); |
| 485 | return this; |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | public override Builder MergeFrom(Person other) { |
| 490 | if (other == Person.DefaultInstance) return this; |
| 491 | if (other.HasName) { |
| 492 | Name = other.Name; |
| 493 | } |
| 494 | if (other.HasId) { |
| 495 | Id = other.Id; |
| 496 | } |
| 497 | if (other.HasEmail) { |
| 498 | Email = other.Email; |
| 499 | } |
| 500 | if (other.phone_.Count != 0) { |
| 501 | base.AddRange(other.phone_, result.phone_); |
| 502 | } |
| 503 | this.MergeUnknownFields(other.UnknownFields); |
| 504 | return this; |
| 505 | } |
| 506 | |
| 507 | public override Builder MergeFrom(pb::CodedInputStream input) { |
| 508 | return MergeFrom(input, pb::ExtensionRegistry.Empty); |
| 509 | } |
| 510 | |
| 511 | public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
| 512 | pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); |
| 513 | while (true) { |
| 514 | uint tag = input.ReadTag(); |
| 515 | switch (tag) { |
| 516 | case 0: { |
| 517 | this.UnknownFields = unknownFields.Build(); |
| 518 | return this; |
| 519 | } |
| 520 | default: { |
| 521 | if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { |
| 522 | this.UnknownFields = unknownFields.Build(); |
| 523 | return this; |
| 524 | } |
| 525 | break; |
| 526 | } |
| 527 | case 10: { |
| 528 | Name = input.ReadString(); |
| 529 | break; |
| 530 | } |
| 531 | case 16: { |
| 532 | Id = input.ReadInt32(); |
| 533 | break; |
| 534 | } |
| 535 | case 26: { |
| 536 | Email = input.ReadString(); |
| 537 | break; |
| 538 | } |
| 539 | case 34: { |
| 540 | global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Builder subBuilder = global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.CreateBuilder(); |
| 541 | input.ReadMessage(subBuilder, extensionRegistry); |
| 542 | AddPhone(subBuilder.BuildPartial()); |
| 543 | break; |
| 544 | } |
| 545 | } |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | |
| 550 | public bool HasName { |
| 551 | get { return result.HasName; } |
| 552 | } |
| 553 | public string Name { |
| 554 | get { return result.Name; } |
| 555 | set { SetName(value); } |
| 556 | } |
| 557 | public Builder SetName(string value) { |
| 558 | result.hasName = true; |
| 559 | result.name_ = value; |
| 560 | return this; |
| 561 | } |
| 562 | public Builder ClearName() { |
| 563 | result.hasName = false; |
| 564 | result.name_ = ""; |
| 565 | return this; |
| 566 | } |
| 567 | |
| 568 | public bool HasId { |
| 569 | get { return result.HasId; } |
| 570 | } |
| 571 | public int Id { |
| 572 | get { return result.Id; } |
| 573 | set { SetId(value); } |
| 574 | } |
| 575 | public Builder SetId(int value) { |
| 576 | result.hasId = true; |
| 577 | result.id_ = value; |
| 578 | return this; |
| 579 | } |
| 580 | public Builder ClearId() { |
| 581 | result.hasId = false; |
| 582 | result.id_ = 0; |
| 583 | return this; |
| 584 | } |
| 585 | |
| 586 | public bool HasEmail { |
| 587 | get { return result.HasEmail; } |
| 588 | } |
| 589 | public string Email { |
| 590 | get { return result.Email; } |
| 591 | set { SetEmail(value); } |
| 592 | } |
| 593 | public Builder SetEmail(string value) { |
| 594 | result.hasEmail = true; |
| 595 | result.email_ = value; |
| 596 | return this; |
| 597 | } |
| 598 | public Builder ClearEmail() { |
| 599 | result.hasEmail = false; |
| 600 | result.email_ = ""; |
| 601 | return this; |
| 602 | } |
| 603 | |
| 604 | public scg::IList<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber> PhoneList { |
| 605 | get { return result.phone_; } |
| 606 | } |
| 607 | public int PhoneCount { |
| 608 | get { return result.PhoneCount; } |
| 609 | } |
| 610 | public global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber GetPhone(int index) { |
| 611 | return result.GetPhone(index); |
| 612 | } |
| 613 | public Builder SetPhone(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber value) { |
| 614 | result.phone_[index] = value; |
| 615 | return this; |
| 616 | } |
| 617 | public Builder SetPhone(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Builder builderForValue) { |
| 618 | result.phone_[index] = builderForValue.Build(); |
| 619 | return this; |
| 620 | } |
| 621 | public Builder AddPhone(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber value) { |
| 622 | result.phone_.Add(value); |
| 623 | return this; |
| 624 | } |
| 625 | public Builder AddPhone(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Builder builderForValue) { |
| 626 | result.phone_.Add(builderForValue.Build()); |
| 627 | return this; |
| 628 | } |
| 629 | public Builder AddRangePhone(scg::IEnumerable<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber> values) { |
| 630 | base.AddRange(values, result.phone_); |
| 631 | return this; |
| 632 | } |
| 633 | public Builder ClearPhone() { |
| 634 | result.phone_.Clear(); |
| 635 | return this; |
| 636 | } |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | public sealed partial class AddressBook : pb::GeneratedMessage<AddressBook, AddressBook.Builder> { |
| 641 | private static readonly AddressBook defaultInstance = new Builder().BuildPartial(); |
| 642 | public static AddressBook DefaultInstance { |
| 643 | get { return defaultInstance; } |
| 644 | } |
| 645 | |
| 646 | public override AddressBook DefaultInstanceForType { |
| 647 | get { return defaultInstance; } |
| 648 | } |
| 649 | |
| 650 | protected override AddressBook ThisMessage { |
| 651 | get { return this; } |
| 652 | } |
| 653 | |
| 654 | public static pbd::MessageDescriptor Descriptor { |
| 655 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_AddressBook__Descriptor; } |
| 656 | } |
| 657 | |
| 658 | protected override pb::FieldAccess.FieldAccessorTable<AddressBook, AddressBook.Builder> InternalFieldAccessors { |
| 659 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_AddressBook__FieldAccessorTable; } |
| 660 | } |
| 661 | |
| 662 | private pbc::PopsicleList<global::Google.ProtocolBuffers.Examples.AddressBook.Person> person_ = new pbc::PopsicleList<global::Google.ProtocolBuffers.Examples.AddressBook.Person>(); |
| 663 | public scg::IList<global::Google.ProtocolBuffers.Examples.AddressBook.Person> PersonList { |
| 664 | get { return person_; } |
| 665 | } |
| 666 | public int PersonCount { |
| 667 | get { return person_.Count; } |
| 668 | } |
| 669 | public global::Google.ProtocolBuffers.Examples.AddressBook.Person GetPerson(int index) { |
| 670 | return person_[index]; |
| 671 | } |
| 672 | |
| 673 | public override bool IsInitialized { |
| 674 | get { |
| 675 | foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in PersonList) { |
| 676 | if (!element.IsInitialized) return false; |
| 677 | } |
| 678 | return true; |
| 679 | } |
| 680 | } |
| 681 | |
| 682 | public override void WriteTo(pb::CodedOutputStream output) { |
| 683 | foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in PersonList) { |
| 684 | output.WriteMessage(1, element); |
| 685 | } |
| 686 | UnknownFields.WriteTo(output); |
| 687 | } |
| 688 | |
| 689 | private int memoizedSerializedSize = -1; |
| 690 | public override int SerializedSize { |
| 691 | get { |
| 692 | int size = memoizedSerializedSize; |
| 693 | if (size != -1) return size; |
| 694 | |
| 695 | size = 0; |
| 696 | foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in PersonList) { |
| 697 | size += pb::CodedOutputStream.ComputeMessageSize(1, element); |
| 698 | } |
| 699 | size += UnknownFields.SerializedSize; |
| 700 | memoizedSerializedSize = size; |
| 701 | return size; |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | public static AddressBook ParseFrom(pb::ByteString data) { |
| 706 | return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
| 707 | } |
| 708 | public static AddressBook ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
| 709 | return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
| 710 | } |
| 711 | public static AddressBook ParseFrom(byte[] data) { |
| 712 | return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
| 713 | } |
| 714 | public static AddressBook ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
| 715 | return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
| 716 | } |
| 717 | public static AddressBook ParseFrom(global::System.IO.Stream input) { |
| 718 | return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
| 719 | } |
| 720 | public static AddressBook ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
| 721 | return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
| 722 | } |
| 723 | public static AddressBook ParseFrom(pb::CodedInputStream input) { |
| 724 | return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
| 725 | } |
| 726 | public static AddressBook ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
| 727 | return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
| 728 | } |
| 729 | public static Builder CreateBuilder() { return new Builder(); } |
| 730 | public override Builder CreateBuilderForType() { return new Builder(); } |
| 731 | public static Builder CreateBuilder(AddressBook prototype) { |
| 732 | return (Builder) new Builder().MergeFrom(prototype); |
| 733 | } |
| 734 | |
| 735 | public sealed partial class Builder : pb::GeneratedBuilder<AddressBook, Builder> { |
| 736 | protected override Builder ThisBuilder { |
| 737 | get { return this; } |
| 738 | } |
| 739 | public Builder() {} |
| 740 | |
| 741 | AddressBook result = new AddressBook(); |
| 742 | |
| 743 | protected override AddressBook MessageBeingBuilt { |
| 744 | get { return result; } |
| 745 | } |
| 746 | |
| 747 | public override Builder Clear() { |
| 748 | result = new AddressBook(); |
| 749 | return this; |
| 750 | } |
| 751 | |
| 752 | public override Builder Clone() { |
| 753 | return new Builder().MergeFrom(result); |
| 754 | } |
| 755 | |
| 756 | public override pbd::MessageDescriptor DescriptorForType { |
| 757 | get { return AddressBook.Descriptor; } |
| 758 | } |
| 759 | |
| 760 | public override AddressBook DefaultInstanceForType { |
| 761 | get { return AddressBook.DefaultInstance; } |
| 762 | } |
| 763 | |
| 764 | public override AddressBook BuildPartial() { |
| 765 | result.person_.MakeReadOnly(); |
| 766 | AddressBook returnMe = result; |
| 767 | result = null; |
| 768 | return returnMe; |
| 769 | } |
| 770 | |
| 771 | public override Builder MergeFrom(pb::IMessage other) { |
| 772 | if (other is AddressBook) { |
| 773 | return MergeFrom((AddressBook) other); |
| 774 | } else { |
| 775 | base.MergeFrom(other); |
| 776 | return this; |
| 777 | } |
| 778 | } |
| 779 | |
| 780 | public override Builder MergeFrom(AddressBook other) { |
| 781 | if (other == AddressBook.DefaultInstance) return this; |
| 782 | if (other.person_.Count != 0) { |
| 783 | base.AddRange(other.person_, result.person_); |
| 784 | } |
| 785 | this.MergeUnknownFields(other.UnknownFields); |
| 786 | return this; |
| 787 | } |
| 788 | |
| 789 | public override Builder MergeFrom(pb::CodedInputStream input) { |
| 790 | return MergeFrom(input, pb::ExtensionRegistry.Empty); |
| 791 | } |
| 792 | |
| 793 | public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
| 794 | pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); |
| 795 | while (true) { |
| 796 | uint tag = input.ReadTag(); |
| 797 | switch (tag) { |
| 798 | case 0: { |
| 799 | this.UnknownFields = unknownFields.Build(); |
| 800 | return this; |
| 801 | } |
| 802 | default: { |
| 803 | if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { |
| 804 | this.UnknownFields = unknownFields.Build(); |
| 805 | return this; |
| 806 | } |
| 807 | break; |
| 808 | } |
| 809 | case 10: { |
| 810 | global::Google.ProtocolBuffers.Examples.AddressBook.Person.Builder subBuilder = global::Google.ProtocolBuffers.Examples.AddressBook.Person.CreateBuilder(); |
| 811 | input.ReadMessage(subBuilder, extensionRegistry); |
| 812 | AddPerson(subBuilder.BuildPartial()); |
| 813 | break; |
| 814 | } |
| 815 | } |
| 816 | } |
| 817 | } |
| 818 | |
| 819 | |
| 820 | public scg::IList<global::Google.ProtocolBuffers.Examples.AddressBook.Person> PersonList { |
| 821 | get { return result.person_; } |
| 822 | } |
| 823 | public int PersonCount { |
| 824 | get { return result.PersonCount; } |
| 825 | } |
| 826 | public global::Google.ProtocolBuffers.Examples.AddressBook.Person GetPerson(int index) { |
| 827 | return result.GetPerson(index); |
| 828 | } |
| 829 | public Builder SetPerson(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person value) { |
| 830 | result.person_[index] = value; |
| 831 | return this; |
| 832 | } |
| 833 | public Builder SetPerson(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Builder builderForValue) { |
| 834 | result.person_[index] = builderForValue.Build(); |
| 835 | return this; |
| 836 | } |
| 837 | public Builder AddPerson(global::Google.ProtocolBuffers.Examples.AddressBook.Person value) { |
| 838 | result.person_.Add(value); |
| 839 | return this; |
| 840 | } |
| 841 | public Builder AddPerson(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Builder builderForValue) { |
| 842 | result.person_.Add(builderForValue.Build()); |
| 843 | return this; |
| 844 | } |
| 845 | public Builder AddRangePerson(scg::IEnumerable<global::Google.ProtocolBuffers.Examples.AddressBook.Person> values) { |
| 846 | base.AddRange(values, result.person_); |
| 847 | return this; |
| 848 | } |
| 849 | public Builder ClearPerson() { |
| 850 | result.person_.Clear(); |
| 851 | return this; |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | |
| 856 | #endregion |
| 857 | |
| 858 | } |