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(); } |
Jon Skeet | e81a9d7 | 2009-02-24 16:50:56 +0000 | [diff] [blame] | 182 | public override Builder ToBuilder() { return CreateBuilder(this); } |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 183 | public override Builder CreateBuilderForType() { return new Builder(); } |
| 184 | public static Builder CreateBuilder(PhoneNumber prototype) { |
| 185 | return (Builder) new Builder().MergeFrom(prototype); |
| 186 | } |
| 187 | |
| 188 | public sealed partial class Builder : pb::GeneratedBuilder<PhoneNumber, Builder> { |
| 189 | protected override Builder ThisBuilder { |
| 190 | get { return this; } |
| 191 | } |
| 192 | public Builder() {} |
| 193 | |
| 194 | PhoneNumber result = new PhoneNumber(); |
| 195 | |
| 196 | protected override PhoneNumber MessageBeingBuilt { |
| 197 | get { return result; } |
| 198 | } |
| 199 | |
| 200 | public override Builder Clear() { |
| 201 | result = new PhoneNumber(); |
| 202 | return this; |
| 203 | } |
| 204 | |
| 205 | public override Builder Clone() { |
| 206 | return new Builder().MergeFrom(result); |
| 207 | } |
| 208 | |
| 209 | public override pbd::MessageDescriptor DescriptorForType { |
| 210 | get { return PhoneNumber.Descriptor; } |
| 211 | } |
| 212 | |
| 213 | public override PhoneNumber DefaultInstanceForType { |
| 214 | get { return PhoneNumber.DefaultInstance; } |
| 215 | } |
| 216 | |
| 217 | public override PhoneNumber BuildPartial() { |
| 218 | PhoneNumber returnMe = result; |
| 219 | result = null; |
| 220 | return returnMe; |
| 221 | } |
| 222 | |
| 223 | public override Builder MergeFrom(pb::IMessage other) { |
| 224 | if (other is PhoneNumber) { |
| 225 | return MergeFrom((PhoneNumber) other); |
| 226 | } else { |
| 227 | base.MergeFrom(other); |
| 228 | return this; |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | public override Builder MergeFrom(PhoneNumber other) { |
| 233 | if (other == PhoneNumber.DefaultInstance) return this; |
| 234 | if (other.HasNumber) { |
| 235 | Number = other.Number; |
| 236 | } |
| 237 | if (other.HasType) { |
| 238 | Type = other.Type; |
| 239 | } |
| 240 | this.MergeUnknownFields(other.UnknownFields); |
| 241 | return this; |
| 242 | } |
| 243 | |
| 244 | public override Builder MergeFrom(pb::CodedInputStream input) { |
| 245 | return MergeFrom(input, pb::ExtensionRegistry.Empty); |
| 246 | } |
| 247 | |
| 248 | public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
| 249 | pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); |
| 250 | while (true) { |
| 251 | uint tag = input.ReadTag(); |
| 252 | switch (tag) { |
| 253 | case 0: { |
| 254 | this.UnknownFields = unknownFields.Build(); |
| 255 | return this; |
| 256 | } |
| 257 | default: { |
| 258 | if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { |
| 259 | this.UnknownFields = unknownFields.Build(); |
| 260 | return this; |
| 261 | } |
| 262 | break; |
| 263 | } |
| 264 | case 10: { |
| 265 | Number = input.ReadString(); |
| 266 | break; |
| 267 | } |
| 268 | case 16: { |
| 269 | int rawValue = input.ReadEnum(); |
| 270 | if (!global::System.Enum.IsDefined(typeof(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType), rawValue)) { |
| 271 | unknownFields.MergeVarintField(2, (ulong) rawValue); |
| 272 | } else { |
| 273 | Type = (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType) rawValue; |
| 274 | } |
| 275 | break; |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | |
| 282 | public bool HasNumber { |
| 283 | get { return result.HasNumber; } |
| 284 | } |
| 285 | public string Number { |
| 286 | get { return result.Number; } |
| 287 | set { SetNumber(value); } |
| 288 | } |
| 289 | public Builder SetNumber(string value) { |
Jon Skeet | 642a814 | 2009-01-27 12:25:21 +0000 | [diff] [blame] | 290 | pb::ThrowHelper.ThrowIfNull(value, "value"); |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 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(); } |
Jon Skeet | e81a9d7 | 2009-02-24 16:50:56 +0000 | [diff] [blame] | 439 | public override Builder ToBuilder() { return CreateBuilder(this); } |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 440 | public override Builder CreateBuilderForType() { return new Builder(); } |
| 441 | public static Builder CreateBuilder(Person prototype) { |
| 442 | return (Builder) new Builder().MergeFrom(prototype); |
| 443 | } |
| 444 | |
| 445 | public sealed partial class Builder : pb::GeneratedBuilder<Person, Builder> { |
| 446 | protected override Builder ThisBuilder { |
| 447 | get { return this; } |
| 448 | } |
| 449 | public Builder() {} |
| 450 | |
| 451 | Person result = new Person(); |
| 452 | |
| 453 | protected override Person MessageBeingBuilt { |
| 454 | get { return result; } |
| 455 | } |
| 456 | |
| 457 | public override Builder Clear() { |
| 458 | result = new Person(); |
| 459 | return this; |
| 460 | } |
| 461 | |
| 462 | public override Builder Clone() { |
| 463 | return new Builder().MergeFrom(result); |
| 464 | } |
| 465 | |
| 466 | public override pbd::MessageDescriptor DescriptorForType { |
| 467 | get { return Person.Descriptor; } |
| 468 | } |
| 469 | |
| 470 | public override Person DefaultInstanceForType { |
| 471 | get { return Person.DefaultInstance; } |
| 472 | } |
| 473 | |
| 474 | public override Person BuildPartial() { |
| 475 | result.phone_.MakeReadOnly(); |
| 476 | Person returnMe = result; |
| 477 | result = null; |
| 478 | return returnMe; |
| 479 | } |
| 480 | |
| 481 | public override Builder MergeFrom(pb::IMessage other) { |
| 482 | if (other is Person) { |
| 483 | return MergeFrom((Person) other); |
| 484 | } else { |
| 485 | base.MergeFrom(other); |
| 486 | return this; |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | public override Builder MergeFrom(Person other) { |
| 491 | if (other == Person.DefaultInstance) return this; |
| 492 | if (other.HasName) { |
| 493 | Name = other.Name; |
| 494 | } |
| 495 | if (other.HasId) { |
| 496 | Id = other.Id; |
| 497 | } |
| 498 | if (other.HasEmail) { |
| 499 | Email = other.Email; |
| 500 | } |
| 501 | if (other.phone_.Count != 0) { |
| 502 | base.AddRange(other.phone_, result.phone_); |
| 503 | } |
| 504 | this.MergeUnknownFields(other.UnknownFields); |
| 505 | return this; |
| 506 | } |
| 507 | |
| 508 | public override Builder MergeFrom(pb::CodedInputStream input) { |
| 509 | return MergeFrom(input, pb::ExtensionRegistry.Empty); |
| 510 | } |
| 511 | |
| 512 | public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
| 513 | pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); |
| 514 | while (true) { |
| 515 | uint tag = input.ReadTag(); |
| 516 | switch (tag) { |
| 517 | case 0: { |
| 518 | this.UnknownFields = unknownFields.Build(); |
| 519 | return this; |
| 520 | } |
| 521 | default: { |
| 522 | if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { |
| 523 | this.UnknownFields = unknownFields.Build(); |
| 524 | return this; |
| 525 | } |
| 526 | break; |
| 527 | } |
| 528 | case 10: { |
| 529 | Name = input.ReadString(); |
| 530 | break; |
| 531 | } |
| 532 | case 16: { |
| 533 | Id = input.ReadInt32(); |
| 534 | break; |
| 535 | } |
| 536 | case 26: { |
| 537 | Email = input.ReadString(); |
| 538 | break; |
| 539 | } |
| 540 | case 34: { |
| 541 | global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Builder subBuilder = global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.CreateBuilder(); |
| 542 | input.ReadMessage(subBuilder, extensionRegistry); |
| 543 | AddPhone(subBuilder.BuildPartial()); |
| 544 | break; |
| 545 | } |
| 546 | } |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | |
| 551 | public bool HasName { |
| 552 | get { return result.HasName; } |
| 553 | } |
| 554 | public string Name { |
| 555 | get { return result.Name; } |
| 556 | set { SetName(value); } |
| 557 | } |
| 558 | public Builder SetName(string value) { |
Jon Skeet | 642a814 | 2009-01-27 12:25:21 +0000 | [diff] [blame] | 559 | pb::ThrowHelper.ThrowIfNull(value, "value"); |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 560 | result.hasName = true; |
| 561 | result.name_ = value; |
| 562 | return this; |
| 563 | } |
| 564 | public Builder ClearName() { |
| 565 | result.hasName = false; |
| 566 | result.name_ = ""; |
| 567 | return this; |
| 568 | } |
| 569 | |
| 570 | public bool HasId { |
| 571 | get { return result.HasId; } |
| 572 | } |
| 573 | public int Id { |
| 574 | get { return result.Id; } |
| 575 | set { SetId(value); } |
| 576 | } |
| 577 | public Builder SetId(int value) { |
| 578 | result.hasId = true; |
| 579 | result.id_ = value; |
| 580 | return this; |
| 581 | } |
| 582 | public Builder ClearId() { |
| 583 | result.hasId = false; |
| 584 | result.id_ = 0; |
| 585 | return this; |
| 586 | } |
| 587 | |
| 588 | public bool HasEmail { |
| 589 | get { return result.HasEmail; } |
| 590 | } |
| 591 | public string Email { |
| 592 | get { return result.Email; } |
| 593 | set { SetEmail(value); } |
| 594 | } |
| 595 | public Builder SetEmail(string value) { |
Jon Skeet | 642a814 | 2009-01-27 12:25:21 +0000 | [diff] [blame] | 596 | pb::ThrowHelper.ThrowIfNull(value, "value"); |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 597 | result.hasEmail = true; |
| 598 | result.email_ = value; |
| 599 | return this; |
| 600 | } |
| 601 | public Builder ClearEmail() { |
| 602 | result.hasEmail = false; |
| 603 | result.email_ = ""; |
| 604 | return this; |
| 605 | } |
| 606 | |
| 607 | public scg::IList<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber> PhoneList { |
| 608 | get { return result.phone_; } |
| 609 | } |
| 610 | public int PhoneCount { |
| 611 | get { return result.PhoneCount; } |
| 612 | } |
| 613 | public global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber GetPhone(int index) { |
| 614 | return result.GetPhone(index); |
| 615 | } |
| 616 | 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] | 617 | pb::ThrowHelper.ThrowIfNull(value, "value"); |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 618 | result.phone_[index] = value; |
| 619 | return this; |
| 620 | } |
| 621 | 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] | 622 | pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 623 | result.phone_[index] = builderForValue.Build(); |
| 624 | return this; |
| 625 | } |
| 626 | public Builder AddPhone(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber value) { |
Jon Skeet | 642a814 | 2009-01-27 12:25:21 +0000 | [diff] [blame] | 627 | pb::ThrowHelper.ThrowIfNull(value, "value"); |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 628 | result.phone_.Add(value); |
| 629 | return this; |
| 630 | } |
| 631 | 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] | 632 | pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 633 | result.phone_.Add(builderForValue.Build()); |
| 634 | return this; |
| 635 | } |
| 636 | public Builder AddRangePhone(scg::IEnumerable<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber> values) { |
| 637 | base.AddRange(values, result.phone_); |
| 638 | return this; |
| 639 | } |
| 640 | public Builder ClearPhone() { |
| 641 | result.phone_.Clear(); |
| 642 | return this; |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | public sealed partial class AddressBook : pb::GeneratedMessage<AddressBook, AddressBook.Builder> { |
| 648 | private static readonly AddressBook defaultInstance = new Builder().BuildPartial(); |
| 649 | public static AddressBook DefaultInstance { |
| 650 | get { return defaultInstance; } |
| 651 | } |
| 652 | |
| 653 | public override AddressBook DefaultInstanceForType { |
| 654 | get { return defaultInstance; } |
| 655 | } |
| 656 | |
| 657 | protected override AddressBook ThisMessage { |
| 658 | get { return this; } |
| 659 | } |
| 660 | |
| 661 | public static pbd::MessageDescriptor Descriptor { |
| 662 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_AddressBook__Descriptor; } |
| 663 | } |
| 664 | |
| 665 | protected override pb::FieldAccess.FieldAccessorTable<AddressBook, AddressBook.Builder> InternalFieldAccessors { |
| 666 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_AddressBook__FieldAccessorTable; } |
| 667 | } |
| 668 | |
| 669 | private pbc::PopsicleList<global::Google.ProtocolBuffers.Examples.AddressBook.Person> person_ = new pbc::PopsicleList<global::Google.ProtocolBuffers.Examples.AddressBook.Person>(); |
| 670 | public scg::IList<global::Google.ProtocolBuffers.Examples.AddressBook.Person> PersonList { |
| 671 | get { return person_; } |
| 672 | } |
| 673 | public int PersonCount { |
| 674 | get { return person_.Count; } |
| 675 | } |
| 676 | public global::Google.ProtocolBuffers.Examples.AddressBook.Person GetPerson(int index) { |
| 677 | return person_[index]; |
| 678 | } |
| 679 | |
| 680 | public override bool IsInitialized { |
| 681 | get { |
| 682 | foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in PersonList) { |
| 683 | if (!element.IsInitialized) return false; |
| 684 | } |
| 685 | return true; |
| 686 | } |
| 687 | } |
| 688 | |
| 689 | public override void WriteTo(pb::CodedOutputStream output) { |
| 690 | foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in PersonList) { |
| 691 | output.WriteMessage(1, element); |
| 692 | } |
| 693 | UnknownFields.WriteTo(output); |
| 694 | } |
| 695 | |
| 696 | private int memoizedSerializedSize = -1; |
| 697 | public override int SerializedSize { |
| 698 | get { |
| 699 | int size = memoizedSerializedSize; |
| 700 | if (size != -1) return size; |
| 701 | |
| 702 | size = 0; |
| 703 | foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in PersonList) { |
| 704 | size += pb::CodedOutputStream.ComputeMessageSize(1, element); |
| 705 | } |
| 706 | size += UnknownFields.SerializedSize; |
| 707 | memoizedSerializedSize = size; |
| 708 | return size; |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | public static AddressBook ParseFrom(pb::ByteString data) { |
| 713 | return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
| 714 | } |
| 715 | public static AddressBook ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { |
| 716 | return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
| 717 | } |
| 718 | public static AddressBook ParseFrom(byte[] data) { |
| 719 | return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); |
| 720 | } |
| 721 | public static AddressBook ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { |
| 722 | return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); |
| 723 | } |
| 724 | public static AddressBook ParseFrom(global::System.IO.Stream input) { |
| 725 | return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
| 726 | } |
| 727 | public static AddressBook ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { |
| 728 | return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
| 729 | } |
| 730 | public static AddressBook ParseFrom(pb::CodedInputStream input) { |
| 731 | return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); |
| 732 | } |
| 733 | public static AddressBook ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
| 734 | return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); |
| 735 | } |
| 736 | public static Builder CreateBuilder() { return new Builder(); } |
Jon Skeet | e81a9d7 | 2009-02-24 16:50:56 +0000 | [diff] [blame] | 737 | public override Builder ToBuilder() { return CreateBuilder(this); } |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 738 | public override Builder CreateBuilderForType() { return new Builder(); } |
| 739 | public static Builder CreateBuilder(AddressBook prototype) { |
| 740 | return (Builder) new Builder().MergeFrom(prototype); |
| 741 | } |
| 742 | |
| 743 | public sealed partial class Builder : pb::GeneratedBuilder<AddressBook, Builder> { |
| 744 | protected override Builder ThisBuilder { |
| 745 | get { return this; } |
| 746 | } |
| 747 | public Builder() {} |
| 748 | |
| 749 | AddressBook result = new AddressBook(); |
| 750 | |
| 751 | protected override AddressBook MessageBeingBuilt { |
| 752 | get { return result; } |
| 753 | } |
| 754 | |
| 755 | public override Builder Clear() { |
| 756 | result = new AddressBook(); |
| 757 | return this; |
| 758 | } |
| 759 | |
| 760 | public override Builder Clone() { |
| 761 | return new Builder().MergeFrom(result); |
| 762 | } |
| 763 | |
| 764 | public override pbd::MessageDescriptor DescriptorForType { |
| 765 | get { return AddressBook.Descriptor; } |
| 766 | } |
| 767 | |
| 768 | public override AddressBook DefaultInstanceForType { |
| 769 | get { return AddressBook.DefaultInstance; } |
| 770 | } |
| 771 | |
| 772 | public override AddressBook BuildPartial() { |
| 773 | result.person_.MakeReadOnly(); |
| 774 | AddressBook returnMe = result; |
| 775 | result = null; |
| 776 | return returnMe; |
| 777 | } |
| 778 | |
| 779 | public override Builder MergeFrom(pb::IMessage other) { |
| 780 | if (other is AddressBook) { |
| 781 | return MergeFrom((AddressBook) other); |
| 782 | } else { |
| 783 | base.MergeFrom(other); |
| 784 | return this; |
| 785 | } |
| 786 | } |
| 787 | |
| 788 | public override Builder MergeFrom(AddressBook other) { |
| 789 | if (other == AddressBook.DefaultInstance) return this; |
| 790 | if (other.person_.Count != 0) { |
| 791 | base.AddRange(other.person_, result.person_); |
| 792 | } |
| 793 | this.MergeUnknownFields(other.UnknownFields); |
| 794 | return this; |
| 795 | } |
| 796 | |
| 797 | public override Builder MergeFrom(pb::CodedInputStream input) { |
| 798 | return MergeFrom(input, pb::ExtensionRegistry.Empty); |
| 799 | } |
| 800 | |
| 801 | public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { |
| 802 | pb::UnknownFieldSet.Builder unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); |
| 803 | while (true) { |
| 804 | uint tag = input.ReadTag(); |
| 805 | switch (tag) { |
| 806 | case 0: { |
| 807 | this.UnknownFields = unknownFields.Build(); |
| 808 | return this; |
| 809 | } |
| 810 | default: { |
| 811 | if (!ParseUnknownField(input, unknownFields, extensionRegistry, tag)) { |
| 812 | this.UnknownFields = unknownFields.Build(); |
| 813 | return this; |
| 814 | } |
| 815 | break; |
| 816 | } |
| 817 | case 10: { |
| 818 | global::Google.ProtocolBuffers.Examples.AddressBook.Person.Builder subBuilder = global::Google.ProtocolBuffers.Examples.AddressBook.Person.CreateBuilder(); |
| 819 | input.ReadMessage(subBuilder, extensionRegistry); |
| 820 | AddPerson(subBuilder.BuildPartial()); |
| 821 | break; |
| 822 | } |
| 823 | } |
| 824 | } |
| 825 | } |
| 826 | |
| 827 | |
| 828 | public scg::IList<global::Google.ProtocolBuffers.Examples.AddressBook.Person> PersonList { |
| 829 | get { return result.person_; } |
| 830 | } |
| 831 | public int PersonCount { |
| 832 | get { return result.PersonCount; } |
| 833 | } |
| 834 | public global::Google.ProtocolBuffers.Examples.AddressBook.Person GetPerson(int index) { |
| 835 | return result.GetPerson(index); |
| 836 | } |
| 837 | public Builder SetPerson(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person value) { |
Jon Skeet | 642a814 | 2009-01-27 12:25:21 +0000 | [diff] [blame] | 838 | pb::ThrowHelper.ThrowIfNull(value, "value"); |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 839 | result.person_[index] = value; |
| 840 | return this; |
| 841 | } |
| 842 | 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] | 843 | pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 844 | result.person_[index] = builderForValue.Build(); |
| 845 | return this; |
| 846 | } |
| 847 | public Builder AddPerson(global::Google.ProtocolBuffers.Examples.AddressBook.Person value) { |
Jon Skeet | 642a814 | 2009-01-27 12:25:21 +0000 | [diff] [blame] | 848 | pb::ThrowHelper.ThrowIfNull(value, "value"); |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 849 | result.person_.Add(value); |
| 850 | return this; |
| 851 | } |
| 852 | public Builder AddPerson(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Builder builderForValue) { |
Jon Skeet | 642a814 | 2009-01-27 12:25:21 +0000 | [diff] [blame] | 853 | pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); |
Jon Skeet | 3f22511 | 2008-11-24 16:09:39 +0000 | [diff] [blame] | 854 | result.person_.Add(builderForValue.Build()); |
| 855 | return this; |
| 856 | } |
| 857 | public Builder AddRangePerson(scg::IEnumerable<global::Google.ProtocolBuffers.Examples.AddressBook.Person> values) { |
| 858 | base.AddRange(values, result.person_); |
| 859 | return this; |
| 860 | } |
| 861 | public Builder ClearPerson() { |
| 862 | result.person_.Clear(); |
| 863 | return this; |
| 864 | } |
| 865 | } |
| 866 | } |
| 867 | |
| 868 | #endregion |
| 869 | |
| 870 | } |