Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! |
| 2 | // source: addressbook.proto |
| 3 | #pragma warning disable 1591, 0612, 3021 |
| 4 | #region Designer generated code |
| 5 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 6 | using pb = global::Google.Protobuf; |
| 7 | using pbc = global::Google.Protobuf.Collections; |
| 8 | using pbd = global::Google.Protobuf.Descriptors; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 9 | using scg = global::System.Collections.Generic; |
| 10 | namespace Google.ProtocolBuffers.Examples.AddressBook { |
| 11 | |
| 12 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 13 | public static partial class Addressbook { |
| 14 | |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 15 | #region Static variables |
| 16 | internal static pbd::MessageDescriptor internal__static_tutorial_Person__Descriptor; |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 17 | internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.Examples.AddressBook.Person> internal__static_tutorial_Person__FieldAccessorTable; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 18 | internal static pbd::MessageDescriptor internal__static_tutorial_Person_PhoneNumber__Descriptor; |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 19 | internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber> internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 20 | internal static pbd::MessageDescriptor internal__static_tutorial_AddressBook__Descriptor; |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 21 | internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.Examples.AddressBook.AddressBook> internal__static_tutorial_AddressBook__FieldAccessorTable; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 22 | #endregion |
| 23 | #region Descriptor |
| 24 | public static pbd::FileDescriptor Descriptor { |
| 25 | get { return descriptor; } |
| 26 | } |
| 27 | private static pbd::FileDescriptor descriptor; |
| 28 | |
| 29 | static Addressbook() { |
| 30 | byte[] descriptorData = global::System.Convert.FromBase64String( |
| 31 | string.Concat( |
| 32 | "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwi2gEKBlBlcnNvbhIMCgRu", |
| 33 | "YW1lGAEgAigJEgoKAmlkGAIgAigFEg0KBWVtYWlsGAMgASgJEisKBXBob25l", |
| 34 | "GAQgAygLMhwudHV0b3JpYWwuUGVyc29uLlBob25lTnVtYmVyGk0KC1Bob25l", |
| 35 | "TnVtYmVyEg4KBm51bWJlchgBIAIoCRIuCgR0eXBlGAIgASgOMhoudHV0b3Jp", |
| 36 | "YWwuUGVyc29uLlBob25lVHlwZToESE9NRSIrCglQaG9uZVR5cGUSCgoGTU9C", |
| 37 | "SUxFEAASCAoESE9NRRABEggKBFdPUksQAiIvCgtBZGRyZXNzQm9vaxIgCgZw", |
| 38 | "ZXJzb24YASADKAsyEC50dXRvcmlhbC5QZXJzb25CVwoUY29tLmV4YW1wbGUu", |
| 39 | "dHV0b3JpYWxCEUFkZHJlc3NCb29rUHJvdG9zqgIrR29vZ2xlLlByb3RvY29s", |
| 40 | "QnVmZmVycy5FeGFtcGxlcy5BZGRyZXNzQm9vaw==")); |
| 41 | pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { |
| 42 | descriptor = root; |
| 43 | internal__static_tutorial_Person__Descriptor = Descriptor.MessageTypes[0]; |
| 44 | internal__static_tutorial_Person__FieldAccessorTable = |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 45 | new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.Examples.AddressBook.Person>(internal__static_tutorial_Person__Descriptor, |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 46 | new string[] { "Name", "Id", "Email", "Phone", }); |
| 47 | internal__static_tutorial_Person_PhoneNumber__Descriptor = internal__static_tutorial_Person__Descriptor.NestedTypes[0]; |
| 48 | internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable = |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 49 | new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber>(internal__static_tutorial_Person_PhoneNumber__Descriptor, |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 50 | new string[] { "Number", "Type", }); |
| 51 | internal__static_tutorial_AddressBook__Descriptor = Descriptor.MessageTypes[1]; |
| 52 | internal__static_tutorial_AddressBook__FieldAccessorTable = |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 53 | new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.Examples.AddressBook.AddressBook>(internal__static_tutorial_AddressBook__Descriptor, |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 54 | new string[] { "Person", }); |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 55 | }; |
| 56 | pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, |
| 57 | new pbd::FileDescriptor[] { |
| 58 | }, assigner); |
| 59 | } |
| 60 | #endregion |
| 61 | |
| 62 | } |
| 63 | #region Messages |
| 64 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 65 | public sealed partial class Person : pb::IMessage<Person>, global::System.IEquatable<Person> { |
| 66 | private static readonly pb::MessageParser<Person> _parser = new pb::MessageParser<Person>(() => new Person()); |
| 67 | public static pb::MessageParser<Person> Parser { get { return _parser; } } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 68 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 69 | private static readonly string[] _fieldNames = new string[] { "email", "id", "name", "phone" }; |
| 70 | private static readonly uint[] _fieldTags = new uint[] { 26, 16, 10, 34 }; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 71 | public static pbd::MessageDescriptor Descriptor { |
| 72 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.Addressbook.internal__static_tutorial_Person__Descriptor; } |
| 73 | } |
| 74 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 75 | public pb::FieldAccess.FieldAccessorTable<Person> Fields { |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 76 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.Addressbook.internal__static_tutorial_Person__FieldAccessorTable; } |
| 77 | } |
| 78 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 79 | public Person() { } |
| 80 | public Person(Person other) { |
| 81 | MergeFrom(other); |
| 82 | } |
| 83 | public const int NameFieldNumber = 1; |
| 84 | private string name_ = ""; |
| 85 | public string Name { |
| 86 | get { return name_; } |
| 87 | set { name_ = value ?? ""; } |
| 88 | } |
| 89 | |
| 90 | |
| 91 | public const int IdFieldNumber = 2; |
| 92 | private int id_; |
| 93 | public int Id { |
| 94 | get { return id_; } |
| 95 | set { id_ = value; } |
| 96 | } |
| 97 | |
| 98 | |
| 99 | public const int EmailFieldNumber = 3; |
| 100 | private string email_ = ""; |
| 101 | public string Email { |
| 102 | get { return email_; } |
| 103 | set { email_ = value ?? ""; } |
| 104 | } |
| 105 | |
| 106 | |
| 107 | public const int PhoneFieldNumber = 4; |
| 108 | private readonly pbc::RepeatedField<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber> phone_ = new pbc::RepeatedField<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber>(); |
| 109 | public pbc::RepeatedField<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber> Phone { |
| 110 | get { return phone_; } |
| 111 | } |
| 112 | |
| 113 | public override bool Equals(object other) { |
| 114 | return Equals(other as Person); |
| 115 | } |
| 116 | |
| 117 | public bool Equals(Person other) { |
| 118 | if (ReferenceEquals(other, null)) { |
| 119 | return false; |
| 120 | } |
| 121 | if (ReferenceEquals(other, this)) { |
| 122 | return true; |
| 123 | } |
| 124 | if (Name != other.Name) return false; |
| 125 | if (Id != other.Id) return false; |
| 126 | if (Email != other.Email) return false; |
| 127 | if(!phone_.Equals(other.phone_)) return false; |
| 128 | return true; |
| 129 | } |
| 130 | |
| 131 | public override int GetHashCode() { |
| 132 | int hash = 0; |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 133 | if (Name.Length != 0) hash ^= Name.GetHashCode(); |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 134 | if (Id != 0) hash ^= Id.GetHashCode(); |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 135 | if (Email.Length != 0) hash ^= Email.GetHashCode(); |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 136 | hash ^= phone_.GetHashCode(); |
| 137 | return hash; |
| 138 | } |
| 139 | |
| 140 | public void WriteTo(pb::CodedOutputStream output) { |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 141 | if (Name.Length != 0) { |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 142 | output.WriteString(1, Name); |
| 143 | } |
| 144 | if (Id != 0) { |
| 145 | output.WriteInt32(2, Id); |
| 146 | } |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 147 | if (Email.Length != 0) { |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 148 | output.WriteString(3, Email); |
| 149 | } |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 150 | if (phone_.Count > 0) { |
| 151 | output.WriteMessageArray(4, phone_); |
| 152 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | public int CalculateSize() { |
| 156 | int size = 0; |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 157 | if (Name.Length != 0) { |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 158 | size += pb::CodedOutputStream.ComputeStringSize(1, Name); |
| 159 | } |
| 160 | if (Id != 0) { |
| 161 | size += pb::CodedOutputStream.ComputeInt32Size(2, Id); |
| 162 | } |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 163 | if (Email.Length != 0) { |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 164 | size += pb::CodedOutputStream.ComputeStringSize(3, Email); |
| 165 | } |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 166 | if (phone_.Count > 0) { |
| 167 | foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in phone_) { |
| 168 | size += pb::CodedOutputStream.ComputeMessageSize(4, element); |
| 169 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 170 | } |
| 171 | return size; |
| 172 | } |
| 173 | public void MergeFrom(Person other) { |
| 174 | if (other == null) { |
| 175 | return; |
| 176 | } |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 177 | if (other.Name.Length != 0) { |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 178 | Name = other.Name; |
| 179 | } |
| 180 | if (other.Id != 0) { |
| 181 | Id = other.Id; |
| 182 | } |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 183 | if (other.Email.Length != 0) { |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 184 | Email = other.Email; |
| 185 | } |
| 186 | phone_.Add(other.phone_); |
| 187 | } |
| 188 | |
| 189 | public void MergeFrom(pb::CodedInputStream input) { |
| 190 | uint tag; |
| 191 | while (input.ReadTag(out tag)) { |
| 192 | switch(tag) { |
| 193 | case 0: |
| 194 | throw pb::InvalidProtocolBufferException.InvalidTag(); |
| 195 | default: |
| 196 | if (pb::WireFormat.IsEndGroupTag(tag)) { |
| 197 | return; |
| 198 | } |
| 199 | break; |
| 200 | case 10: { |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 201 | Name = input.ReadString(); |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 202 | break; |
| 203 | } |
| 204 | case 16: { |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 205 | Id = input.ReadInt32(); |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 206 | break; |
| 207 | } |
| 208 | case 26: { |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 209 | Email = input.ReadString(); |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 210 | break; |
| 211 | } |
| 212 | case 34: { |
| 213 | input.ReadMessageArray(tag, phone_, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Parser); |
| 214 | break; |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 220 | #region Nested types |
| 221 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 222 | public static partial class Types { |
| 223 | public enum PhoneType { |
| 224 | MOBILE = 0, |
| 225 | HOME = 1, |
| 226 | WORK = 2, |
| 227 | } |
| 228 | |
| 229 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 230 | public sealed partial class PhoneNumber : pb::IMessage<PhoneNumber>, global::System.IEquatable<PhoneNumber> { |
| 231 | private static readonly pb::MessageParser<PhoneNumber> _parser = new pb::MessageParser<PhoneNumber>(() => new PhoneNumber()); |
| 232 | public static pb::MessageParser<PhoneNumber> Parser { get { return _parser; } } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 233 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 234 | private static readonly string[] _fieldNames = new string[] { "number", "type" }; |
| 235 | private static readonly uint[] _fieldTags = new uint[] { 10, 16 }; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 236 | public static pbd::MessageDescriptor Descriptor { |
| 237 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.Addressbook.internal__static_tutorial_Person_PhoneNumber__Descriptor; } |
| 238 | } |
| 239 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 240 | public pb::FieldAccess.FieldAccessorTable<PhoneNumber> Fields { |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 241 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.Addressbook.internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; } |
| 242 | } |
| 243 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 244 | public PhoneNumber() { } |
| 245 | public PhoneNumber(PhoneNumber other) { |
| 246 | MergeFrom(other); |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 247 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 248 | public const int NumberFieldNumber = 1; |
| 249 | private string number_ = ""; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 250 | public string Number { |
| 251 | get { return number_; } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 252 | set { number_ = value ?? ""; } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 253 | } |
| 254 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 255 | |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 256 | public const int TypeFieldNumber = 2; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 257 | private global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType type_ = global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 258 | public global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType Type { |
| 259 | get { return type_; } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 260 | set { type_ = value; } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 261 | } |
| 262 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 263 | |
| 264 | public override bool Equals(object other) { |
| 265 | return Equals(other as PhoneNumber); |
| 266 | } |
| 267 | |
| 268 | public bool Equals(PhoneNumber other) { |
| 269 | if (ReferenceEquals(other, null)) { |
| 270 | return false; |
| 271 | } |
| 272 | if (ReferenceEquals(other, this)) { |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 273 | return true; |
| 274 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 275 | if (Number != other.Number) return false; |
| 276 | if (Type != other.Type) return false; |
| 277 | return true; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 278 | } |
| 279 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 280 | public override int GetHashCode() { |
| 281 | int hash = 0; |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 282 | if (Number.Length != 0) hash ^= Number.GetHashCode(); |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 283 | if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) hash ^= Type.GetHashCode(); |
| 284 | return hash; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 285 | } |
| 286 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 287 | public void WriteTo(pb::CodedOutputStream output) { |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 288 | if (Number.Length != 0) { |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 289 | output.WriteString(1, Number); |
| 290 | } |
| 291 | if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) { |
| 292 | output.WriteEnum(2, (int) Type); |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 293 | } |
| 294 | } |
| 295 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 296 | public int CalculateSize() { |
| 297 | int size = 0; |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 298 | if (Number.Length != 0) { |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 299 | size += pb::CodedOutputStream.ComputeStringSize(1, Number); |
| 300 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 301 | if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) { |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 302 | size += pb::CodedOutputStream.ComputeEnumSize(2, (int) Type); |
| 303 | } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 304 | return size; |
| 305 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 306 | public void MergeFrom(PhoneNumber other) { |
| 307 | if (other == null) { |
| 308 | return; |
| 309 | } |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 310 | if (other.Number.Length != 0) { |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 311 | Number = other.Number; |
| 312 | } |
| 313 | if (other.Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) { |
| 314 | Type = other.Type; |
| 315 | } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 316 | } |
| 317 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 318 | public void MergeFrom(pb::CodedInputStream input) { |
| 319 | uint tag; |
| 320 | while (input.ReadTag(out tag)) { |
| 321 | switch(tag) { |
| 322 | case 0: |
| 323 | throw pb::InvalidProtocolBufferException.InvalidTag(); |
| 324 | default: |
| 325 | if (pb::WireFormat.IsEndGroupTag(tag)) { |
| 326 | return; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 327 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 328 | break; |
| 329 | case 10: { |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 330 | Number = input.ReadString(); |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 331 | break; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 332 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 333 | case 16: { |
| 334 | type_ = (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType) input.ReadEnum(); |
| 335 | break; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 336 | } |
| 337 | } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 338 | } |
| 339 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 340 | |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 341 | } |
| 342 | |
| 343 | } |
| 344 | #endregion |
| 345 | |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 349 | public sealed partial class AddressBook : pb::IMessage<AddressBook>, global::System.IEquatable<AddressBook> { |
| 350 | private static readonly pb::MessageParser<AddressBook> _parser = new pb::MessageParser<AddressBook>(() => new AddressBook()); |
| 351 | public static pb::MessageParser<AddressBook> Parser { get { return _parser; } } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 352 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 353 | private static readonly string[] _fieldNames = new string[] { "person" }; |
| 354 | private static readonly uint[] _fieldTags = new uint[] { 10 }; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 355 | public static pbd::MessageDescriptor Descriptor { |
| 356 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.Addressbook.internal__static_tutorial_AddressBook__Descriptor; } |
| 357 | } |
| 358 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 359 | public pb::FieldAccess.FieldAccessorTable<AddressBook> Fields { |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 360 | get { return global::Google.ProtocolBuffers.Examples.AddressBook.Addressbook.internal__static_tutorial_AddressBook__FieldAccessorTable; } |
| 361 | } |
| 362 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 363 | public AddressBook() { } |
| 364 | public AddressBook(AddressBook other) { |
| 365 | MergeFrom(other); |
| 366 | } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 367 | public const int PersonFieldNumber = 1; |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 368 | private readonly pbc::RepeatedField<global::Google.ProtocolBuffers.Examples.AddressBook.Person> person_ = new pbc::RepeatedField<global::Google.ProtocolBuffers.Examples.AddressBook.Person>(); |
| 369 | public pbc::RepeatedField<global::Google.ProtocolBuffers.Examples.AddressBook.Person> Person { |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 370 | get { return person_; } |
| 371 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 372 | |
| 373 | public override bool Equals(object other) { |
| 374 | return Equals(other as AddressBook); |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 375 | } |
| 376 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 377 | public bool Equals(AddressBook other) { |
| 378 | if (ReferenceEquals(other, null)) { |
| 379 | return false; |
| 380 | } |
| 381 | if (ReferenceEquals(other, this)) { |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 382 | return true; |
| 383 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 384 | if(!person_.Equals(other.person_)) return false; |
| 385 | return true; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 386 | } |
| 387 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 388 | public override int GetHashCode() { |
| 389 | int hash = 0; |
| 390 | hash ^= person_.GetHashCode(); |
| 391 | return hash; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 392 | } |
| 393 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 394 | public void WriteTo(pb::CodedOutputStream output) { |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 395 | if (person_.Count > 0) { |
| 396 | output.WriteMessageArray(1, person_); |
| 397 | } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 398 | } |
| 399 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 400 | public int CalculateSize() { |
| 401 | int size = 0; |
Jon Skeet | fb1547b | 2015-06-12 13:11:54 +0100 | [diff] [blame^] | 402 | if (person_.Count > 0) { |
| 403 | foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in person_) { |
| 404 | size += pb::CodedOutputStream.ComputeMessageSize(1, element); |
| 405 | } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 406 | } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 407 | return size; |
| 408 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 409 | public void MergeFrom(AddressBook other) { |
| 410 | if (other == null) { |
| 411 | return; |
| 412 | } |
| 413 | person_.Add(other.person_); |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 414 | } |
| 415 | |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 416 | public void MergeFrom(pb::CodedInputStream input) { |
| 417 | uint tag; |
| 418 | while (input.ReadTag(out tag)) { |
| 419 | switch(tag) { |
| 420 | case 0: |
| 421 | throw pb::InvalidProtocolBufferException.InvalidTag(); |
| 422 | default: |
| 423 | if (pb::WireFormat.IsEndGroupTag(tag)) { |
| 424 | return; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 425 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 426 | break; |
| 427 | case 10: { |
| 428 | input.ReadMessageArray(tag, person_, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Parser); |
| 429 | break; |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 430 | } |
| 431 | } |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 432 | } |
| 433 | } |
Jon Skeet | eb70bd0 | 2015-06-12 09:53:44 +0100 | [diff] [blame] | 434 | |
Jon Skeet | 5e0189a | 2015-04-29 10:10:20 +0100 | [diff] [blame] | 435 | } |
| 436 | |
| 437 | #endregion |
| 438 | |
| 439 | } |
| 440 | |
| 441 | #endregion Designer generated code |