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