Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! |
| 2 | // source: google/protobuf/type.proto |
| 3 | #pragma warning disable 1591, 0612, 3021 |
| 4 | #region Designer generated code |
| 5 | |
| 6 | using pb = global::Google.Protobuf; |
| 7 | using pbc = global::Google.Protobuf.Collections; |
| 8 | using pbr = global::Google.Protobuf.Reflection; |
| 9 | using scg = global::System.Collections.Generic; |
| 10 | namespace Google.Protobuf.WellKnownTypes { |
| 11 | |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 12 | /// <summary>Holder for reflection information generated from google/protobuf/type.proto</summary> |
| 13 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 14 | public static partial class TypeReflection { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 15 | |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 16 | #region Descriptor |
| 17 | /// <summary>File descriptor for google/protobuf/type.proto</summary> |
| 18 | public static pbr::FileDescriptor Descriptor { |
| 19 | get { return descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 20 | } |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 21 | private static pbr::FileDescriptor descriptor; |
| 22 | |
| 23 | static TypeReflection() { |
| 24 | byte[] descriptorData = global::System.Convert.FromBase64String( |
| 25 | string.Concat( |
| 26 | "Chpnb29nbGUvcHJvdG9idWYvdHlwZS5wcm90bxIPZ29vZ2xlLnByb3RvYnVm", |
| 27 | "Ghlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvGiRnb29nbGUvcHJvdG9idWYv", |
| 28 | "c291cmNlX2NvbnRleHQucHJvdG8i1wEKBFR5cGUSDAoEbmFtZRgBIAEoCRIm", |
| 29 | "CgZmaWVsZHMYAiADKAsyFi5nb29nbGUucHJvdG9idWYuRmllbGQSDgoGb25l", |
| 30 | "b2ZzGAMgAygJEigKB29wdGlvbnMYBCADKAsyFy5nb29nbGUucHJvdG9idWYu", |
| 31 | "T3B0aW9uEjYKDnNvdXJjZV9jb250ZXh0GAUgASgLMh4uZ29vZ2xlLnByb3Rv", |
| 32 | "YnVmLlNvdXJjZUNvbnRleHQSJwoGc3ludGF4GAYgASgOMhcuZ29vZ2xlLnBy", |
| 33 | "b3RvYnVmLlN5bnRheCK+BQoFRmllbGQSKQoEa2luZBgBIAEoDjIbLmdvb2ds", |
| 34 | "ZS5wcm90b2J1Zi5GaWVsZC5LaW5kEjcKC2NhcmRpbmFsaXR5GAIgASgOMiIu", |
| 35 | "Z29vZ2xlLnByb3RvYnVmLkZpZWxkLkNhcmRpbmFsaXR5Eg4KBm51bWJlchgD", |
| 36 | "IAEoBRIMCgRuYW1lGAQgASgJEhAKCHR5cGVfdXJsGAYgASgJEhMKC29uZW9m", |
| 37 | "X2luZGV4GAcgASgFEg4KBnBhY2tlZBgIIAEoCBIoCgdvcHRpb25zGAkgAygL", |
| 38 | "MhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhIRCglqc29uX25hbWUYCiABKAki", |
| 39 | "yAIKBEtpbmQSEAoMVFlQRV9VTktOT1dOEAASDwoLVFlQRV9ET1VCTEUQARIO", |
| 40 | "CgpUWVBFX0ZMT0FUEAISDgoKVFlQRV9JTlQ2NBADEg8KC1RZUEVfVUlOVDY0", |
| 41 | "EAQSDgoKVFlQRV9JTlQzMhAFEhAKDFRZUEVfRklYRUQ2NBAGEhAKDFRZUEVf", |
| 42 | "RklYRUQzMhAHEg0KCVRZUEVfQk9PTBAIEg8KC1RZUEVfU1RSSU5HEAkSDgoK", |
| 43 | "VFlQRV9HUk9VUBAKEhAKDFRZUEVfTUVTU0FHRRALEg4KClRZUEVfQllURVMQ", |
| 44 | "DBIPCgtUWVBFX1VJTlQzMhANEg0KCVRZUEVfRU5VTRAOEhEKDVRZUEVfU0ZJ", |
| 45 | "WEVEMzIQDxIRCg1UWVBFX1NGSVhFRDY0EBASDwoLVFlQRV9TSU5UMzIQERIP", |
| 46 | "CgtUWVBFX1NJTlQ2NBASInQKC0NhcmRpbmFsaXR5EhcKE0NBUkRJTkFMSVRZ", |
| 47 | "X1VOS05PV04QABIYChRDQVJESU5BTElUWV9PUFRJT05BTBABEhgKFENBUkRJ", |
| 48 | "TkFMSVRZX1JFUVVJUkVEEAISGAoUQ0FSRElOQUxJVFlfUkVQRUFURUQQAyLO", |
| 49 | "AQoERW51bRIMCgRuYW1lGAEgASgJEi0KCWVudW12YWx1ZRgCIAMoCzIaLmdv", |
| 50 | "b2dsZS5wcm90b2J1Zi5FbnVtVmFsdWUSKAoHb3B0aW9ucxgDIAMoCzIXLmdv", |
| 51 | "b2dsZS5wcm90b2J1Zi5PcHRpb24SNgoOc291cmNlX2NvbnRleHQYBCABKAsy", |
| 52 | "Hi5nb29nbGUucHJvdG9idWYuU291cmNlQ29udGV4dBInCgZzeW50YXgYBSAB", |
| 53 | "KA4yFy5nb29nbGUucHJvdG9idWYuU3ludGF4IlMKCUVudW1WYWx1ZRIMCgRu", |
| 54 | "YW1lGAEgASgJEg4KBm51bWJlchgCIAEoBRIoCgdvcHRpb25zGAMgAygLMhcu", |
| 55 | "Z29vZ2xlLnByb3RvYnVmLk9wdGlvbiI7CgZPcHRpb24SDAoEbmFtZRgBIAEo", |
| 56 | "CRIjCgV2YWx1ZRgCIAEoCzIULmdvb2dsZS5wcm90b2J1Zi5BbnkqLgoGU3lu", |
| 57 | "dGF4EhEKDVNZTlRBWF9QUk9UTzIQABIRCg1TWU5UQVhfUFJPVE8zEAFCTAoT", |
| 58 | "Y29tLmdvb2dsZS5wcm90b2J1ZkIJVHlwZVByb3RvUAGgAQGiAgNHUEKqAh5H", |
| 59 | "b29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); |
| 60 | descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, |
| 61 | new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, }, |
| 62 | new pbr::GeneratedCodeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.Syntax), }, new pbr::GeneratedCodeInfo[] { |
Jon Skeet | eadd4ca | 2015-11-13 20:04:14 +0000 | [diff] [blame^] | 63 | new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Type), global::Google.Protobuf.WellKnownTypes.Type.Parser, new[]{ "Name", "Fields", "Oneofs", "Options", "SourceContext", "Syntax" }, null, null, null), |
| 64 | new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Field), global::Google.Protobuf.WellKnownTypes.Field.Parser, new[]{ "Kind", "Cardinality", "Number", "Name", "TypeUrl", "OneofIndex", "Packed", "Options", "JsonName" }, null, new[]{ typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Kind), typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) }, null), |
| 65 | new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Enum), global::Google.Protobuf.WellKnownTypes.Enum.Parser, new[]{ "Name", "Enumvalue", "Options", "SourceContext", "Syntax" }, null, null, null), |
| 66 | new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.EnumValue), global::Google.Protobuf.WellKnownTypes.EnumValue.Parser, new[]{ "Name", "Number", "Options" }, null, null, null), |
| 67 | new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Option), global::Google.Protobuf.WellKnownTypes.Option.Parser, new[]{ "Name", "Value" }, null, null, null) |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 68 | })); |
| 69 | } |
| 70 | #endregion |
| 71 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 72 | } |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 73 | #region Enums |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 74 | /// <summary> |
| 75 | /// Syntax specifies the syntax in which a service element was defined. |
| 76 | /// </summary> |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 77 | public enum Syntax { |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 78 | /// <summary> |
| 79 | /// Syntax "proto2" |
| 80 | /// </summary> |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 81 | SYNTAX_PROTO2 = 0, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 82 | /// <summary> |
| 83 | /// Syntax "proto3" |
| 84 | /// </summary> |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 85 | SYNTAX_PROTO3 = 1, |
| 86 | } |
| 87 | |
| 88 | #endregion |
| 89 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 90 | #region Messages |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 91 | /// <summary> |
| 92 | /// A light-weight descriptor for a proto message type. |
| 93 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 94 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 95 | public sealed partial class Type : pb::IMessage<Type> { |
| 96 | private static readonly pb::MessageParser<Type> _parser = new pb::MessageParser<Type>(() => new Type()); |
| 97 | public static pb::MessageParser<Type> Parser { get { return _parser; } } |
| 98 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 99 | public static pbr::MessageDescriptor Descriptor { |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 100 | get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[0]; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 101 | } |
| 102 | |
Jon Skeet | 96cffaa | 2015-07-20 19:25:07 +0100 | [diff] [blame] | 103 | pbr::MessageDescriptor pb::IMessage.Descriptor { |
| 104 | get { return Descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 105 | } |
| 106 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 107 | public Type() { |
| 108 | OnConstruction(); |
| 109 | } |
| 110 | |
| 111 | partial void OnConstruction(); |
| 112 | |
| 113 | public Type(Type other) : this() { |
| 114 | name_ = other.name_; |
| 115 | fields_ = other.fields_.Clone(); |
| 116 | oneofs_ = other.oneofs_.Clone(); |
| 117 | options_ = other.options_.Clone(); |
| 118 | SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 119 | syntax_ = other.syntax_; |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | public Type Clone() { |
| 123 | return new Type(this); |
| 124 | } |
| 125 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 126 | /// <summary>Field number for the "name" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 127 | public const int NameFieldNumber = 1; |
| 128 | private string name_ = ""; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 129 | /// <summary> |
| 130 | /// The fully qualified message name. |
| 131 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 132 | public string Name { |
| 133 | get { return name_; } |
| 134 | set { |
Jon Skeet | d18cc08 | 2015-07-30 13:50:02 +0100 | [diff] [blame] | 135 | name_ = pb::Preconditions.CheckNotNull(value, "value"); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 136 | } |
| 137 | } |
| 138 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 139 | /// <summary>Field number for the "fields" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 140 | public const int FieldsFieldNumber = 2; |
| 141 | private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Field> _repeated_fields_codec |
| 142 | = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Field.Parser); |
| 143 | private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Field> fields_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Field>(); |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 144 | /// <summary> |
| 145 | /// The list of fields. |
| 146 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 147 | public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Field> Fields { |
| 148 | get { return fields_; } |
| 149 | } |
| 150 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 151 | /// <summary>Field number for the "oneofs" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 152 | public const int OneofsFieldNumber = 3; |
| 153 | private static readonly pb::FieldCodec<string> _repeated_oneofs_codec |
| 154 | = pb::FieldCodec.ForString(26); |
| 155 | private readonly pbc::RepeatedField<string> oneofs_ = new pbc::RepeatedField<string>(); |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 156 | /// <summary> |
| 157 | /// The list of oneof definitions. |
| 158 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 159 | public pbc::RepeatedField<string> Oneofs { |
| 160 | get { return oneofs_; } |
| 161 | } |
| 162 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 163 | /// <summary>Field number for the "options" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 164 | public const int OptionsFieldNumber = 4; |
| 165 | private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec |
| 166 | = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.WellKnownTypes.Option.Parser); |
| 167 | private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 168 | /// <summary> |
| 169 | /// The proto options. |
| 170 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 171 | public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { |
| 172 | get { return options_; } |
| 173 | } |
| 174 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 175 | /// <summary>Field number for the "source_context" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 176 | public const int SourceContextFieldNumber = 5; |
| 177 | private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 178 | /// <summary> |
| 179 | /// The source context. |
| 180 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 181 | public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { |
| 182 | get { return sourceContext_; } |
| 183 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 184 | sourceContext_ = value; |
| 185 | } |
| 186 | } |
| 187 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 188 | /// <summary>Field number for the "syntax" field.</summary> |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 189 | public const int SyntaxFieldNumber = 6; |
| 190 | private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 191 | /// <summary> |
| 192 | /// The source syntax. |
| 193 | /// </summary> |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 194 | public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { |
| 195 | get { return syntax_; } |
| 196 | set { |
| 197 | syntax_ = value; |
| 198 | } |
| 199 | } |
| 200 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 201 | public override bool Equals(object other) { |
| 202 | return Equals(other as Type); |
| 203 | } |
| 204 | |
| 205 | public bool Equals(Type other) { |
| 206 | if (ReferenceEquals(other, null)) { |
| 207 | return false; |
| 208 | } |
| 209 | if (ReferenceEquals(other, this)) { |
| 210 | return true; |
| 211 | } |
| 212 | if (Name != other.Name) return false; |
| 213 | if(!fields_.Equals(other.fields_)) return false; |
| 214 | if(!oneofs_.Equals(other.oneofs_)) return false; |
| 215 | if(!options_.Equals(other.options_)) return false; |
| 216 | if (!object.Equals(SourceContext, other.SourceContext)) return false; |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 217 | if (Syntax != other.Syntax) return false; |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 218 | return true; |
| 219 | } |
| 220 | |
| 221 | public override int GetHashCode() { |
| 222 | int hash = 1; |
| 223 | if (Name.Length != 0) hash ^= Name.GetHashCode(); |
| 224 | hash ^= fields_.GetHashCode(); |
| 225 | hash ^= oneofs_.GetHashCode(); |
| 226 | hash ^= options_.GetHashCode(); |
| 227 | if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 228 | if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) hash ^= Syntax.GetHashCode(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 229 | return hash; |
| 230 | } |
| 231 | |
| 232 | public override string ToString() { |
| 233 | return pb::JsonFormatter.Default.Format(this); |
| 234 | } |
| 235 | |
| 236 | public void WriteTo(pb::CodedOutputStream output) { |
| 237 | if (Name.Length != 0) { |
| 238 | output.WriteRawTag(10); |
| 239 | output.WriteString(Name); |
| 240 | } |
| 241 | fields_.WriteTo(output, _repeated_fields_codec); |
| 242 | oneofs_.WriteTo(output, _repeated_oneofs_codec); |
| 243 | options_.WriteTo(output, _repeated_options_codec); |
| 244 | if (sourceContext_ != null) { |
| 245 | output.WriteRawTag(42); |
| 246 | output.WriteMessage(SourceContext); |
| 247 | } |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 248 | if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { |
| 249 | output.WriteRawTag(48); |
| 250 | output.WriteEnum((int) Syntax); |
| 251 | } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | public int CalculateSize() { |
| 255 | int size = 0; |
| 256 | if (Name.Length != 0) { |
| 257 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); |
| 258 | } |
| 259 | size += fields_.CalculateSize(_repeated_fields_codec); |
| 260 | size += oneofs_.CalculateSize(_repeated_oneofs_codec); |
| 261 | size += options_.CalculateSize(_repeated_options_codec); |
| 262 | if (sourceContext_ != null) { |
| 263 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext); |
| 264 | } |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 265 | if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { |
| 266 | size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); |
| 267 | } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 268 | return size; |
| 269 | } |
| 270 | |
| 271 | public void MergeFrom(Type other) { |
| 272 | if (other == null) { |
| 273 | return; |
| 274 | } |
| 275 | if (other.Name.Length != 0) { |
| 276 | Name = other.Name; |
| 277 | } |
| 278 | fields_.Add(other.fields_); |
| 279 | oneofs_.Add(other.oneofs_); |
| 280 | options_.Add(other.options_); |
| 281 | if (other.sourceContext_ != null) { |
| 282 | if (sourceContext_ == null) { |
| 283 | sourceContext_ = new global::Google.Protobuf.WellKnownTypes.SourceContext(); |
| 284 | } |
| 285 | SourceContext.MergeFrom(other.SourceContext); |
| 286 | } |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 287 | if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { |
| 288 | Syntax = other.Syntax; |
| 289 | } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | public void MergeFrom(pb::CodedInputStream input) { |
| 293 | uint tag; |
Jon Skeet | 1a57ad8 | 2015-08-05 11:23:52 +0100 | [diff] [blame] | 294 | while ((tag = input.ReadTag()) != 0) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 295 | switch(tag) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 296 | default: |
Jon Skeet | 5bdc572 | 2015-08-06 11:40:43 +0100 | [diff] [blame] | 297 | input.SkipLastField(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 298 | break; |
| 299 | case 10: { |
| 300 | Name = input.ReadString(); |
| 301 | break; |
| 302 | } |
| 303 | case 18: { |
| 304 | fields_.AddEntriesFrom(input, _repeated_fields_codec); |
| 305 | break; |
| 306 | } |
| 307 | case 26: { |
| 308 | oneofs_.AddEntriesFrom(input, _repeated_oneofs_codec); |
| 309 | break; |
| 310 | } |
| 311 | case 34: { |
| 312 | options_.AddEntriesFrom(input, _repeated_options_codec); |
| 313 | break; |
| 314 | } |
| 315 | case 42: { |
| 316 | if (sourceContext_ == null) { |
| 317 | sourceContext_ = new global::Google.Protobuf.WellKnownTypes.SourceContext(); |
| 318 | } |
| 319 | input.ReadMessage(sourceContext_); |
| 320 | break; |
| 321 | } |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 322 | case 48: { |
| 323 | syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); |
| 324 | break; |
| 325 | } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 326 | } |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | } |
| 331 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 332 | /// <summary> |
| 333 | /// Field represents a single field of a message type. |
| 334 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 335 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 336 | public sealed partial class Field : pb::IMessage<Field> { |
| 337 | private static readonly pb::MessageParser<Field> _parser = new pb::MessageParser<Field>(() => new Field()); |
| 338 | public static pb::MessageParser<Field> Parser { get { return _parser; } } |
| 339 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 340 | public static pbr::MessageDescriptor Descriptor { |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 341 | get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[1]; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 342 | } |
| 343 | |
Jon Skeet | 96cffaa | 2015-07-20 19:25:07 +0100 | [diff] [blame] | 344 | pbr::MessageDescriptor pb::IMessage.Descriptor { |
| 345 | get { return Descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 346 | } |
| 347 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 348 | public Field() { |
| 349 | OnConstruction(); |
| 350 | } |
| 351 | |
| 352 | partial void OnConstruction(); |
| 353 | |
| 354 | public Field(Field other) : this() { |
| 355 | kind_ = other.kind_; |
| 356 | cardinality_ = other.cardinality_; |
| 357 | number_ = other.number_; |
| 358 | name_ = other.name_; |
| 359 | typeUrl_ = other.typeUrl_; |
| 360 | oneofIndex_ = other.oneofIndex_; |
| 361 | packed_ = other.packed_; |
| 362 | options_ = other.options_.Clone(); |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 363 | jsonName_ = other.jsonName_; |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | public Field Clone() { |
| 367 | return new Field(this); |
| 368 | } |
| 369 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 370 | /// <summary>Field number for the "kind" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 371 | public const int KindFieldNumber = 1; |
| 372 | private global::Google.Protobuf.WellKnownTypes.Field.Types.Kind kind_ = global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TYPE_UNKNOWN; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 373 | /// <summary> |
| 374 | /// The field kind. |
| 375 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 376 | public global::Google.Protobuf.WellKnownTypes.Field.Types.Kind Kind { |
| 377 | get { return kind_; } |
| 378 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 379 | kind_ = value; |
| 380 | } |
| 381 | } |
| 382 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 383 | /// <summary>Field number for the "cardinality" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 384 | public const int CardinalityFieldNumber = 2; |
| 385 | private global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality cardinality_ = global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.CARDINALITY_UNKNOWN; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 386 | /// <summary> |
| 387 | /// The field cardinality, i.e. optional/required/repeated. |
| 388 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 389 | public global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality Cardinality { |
| 390 | get { return cardinality_; } |
| 391 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 392 | cardinality_ = value; |
| 393 | } |
| 394 | } |
| 395 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 396 | /// <summary>Field number for the "number" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 397 | public const int NumberFieldNumber = 3; |
| 398 | private int number_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 399 | /// <summary> |
| 400 | /// The proto field number. |
| 401 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 402 | public int Number { |
| 403 | get { return number_; } |
| 404 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 405 | number_ = value; |
| 406 | } |
| 407 | } |
| 408 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 409 | /// <summary>Field number for the "name" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 410 | public const int NameFieldNumber = 4; |
| 411 | private string name_ = ""; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 412 | /// <summary> |
| 413 | /// The field name. |
| 414 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 415 | public string Name { |
| 416 | get { return name_; } |
| 417 | set { |
Jon Skeet | d18cc08 | 2015-07-30 13:50:02 +0100 | [diff] [blame] | 418 | name_ = pb::Preconditions.CheckNotNull(value, "value"); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 419 | } |
| 420 | } |
| 421 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 422 | /// <summary>Field number for the "type_url" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 423 | public const int TypeUrlFieldNumber = 6; |
| 424 | private string typeUrl_ = ""; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 425 | /// <summary> |
| 426 | /// The type URL (without the scheme) when the type is MESSAGE or ENUM, |
| 427 | /// such as `type.googleapis.com/google.protobuf.Empty`. |
| 428 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 429 | public string TypeUrl { |
| 430 | get { return typeUrl_; } |
| 431 | set { |
Jon Skeet | d18cc08 | 2015-07-30 13:50:02 +0100 | [diff] [blame] | 432 | typeUrl_ = pb::Preconditions.CheckNotNull(value, "value"); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 433 | } |
| 434 | } |
| 435 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 436 | /// <summary>Field number for the "oneof_index" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 437 | public const int OneofIndexFieldNumber = 7; |
| 438 | private int oneofIndex_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 439 | /// <summary> |
| 440 | /// Index in Type.oneofs. Starts at 1. Zero means no oneof mapping. |
| 441 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 442 | public int OneofIndex { |
| 443 | get { return oneofIndex_; } |
| 444 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 445 | oneofIndex_ = value; |
| 446 | } |
| 447 | } |
| 448 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 449 | /// <summary>Field number for the "packed" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 450 | public const int PackedFieldNumber = 8; |
| 451 | private bool packed_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 452 | /// <summary> |
| 453 | /// Whether to use alternative packed wire representation. |
| 454 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 455 | public bool Packed { |
| 456 | get { return packed_; } |
| 457 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 458 | packed_ = value; |
| 459 | } |
| 460 | } |
| 461 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 462 | /// <summary>Field number for the "options" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 463 | public const int OptionsFieldNumber = 9; |
| 464 | private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec |
| 465 | = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.WellKnownTypes.Option.Parser); |
| 466 | private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 467 | /// <summary> |
| 468 | /// The proto options. |
| 469 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 470 | public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { |
| 471 | get { return options_; } |
| 472 | } |
| 473 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 474 | /// <summary>Field number for the "json_name" field.</summary> |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 475 | public const int JsonNameFieldNumber = 10; |
| 476 | private string jsonName_ = ""; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 477 | /// <summary> |
| 478 | /// The JSON name for this field. |
| 479 | /// </summary> |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 480 | public string JsonName { |
| 481 | get { return jsonName_; } |
| 482 | set { |
| 483 | jsonName_ = pb::Preconditions.CheckNotNull(value, "value"); |
| 484 | } |
| 485 | } |
| 486 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 487 | public override bool Equals(object other) { |
| 488 | return Equals(other as Field); |
| 489 | } |
| 490 | |
| 491 | public bool Equals(Field other) { |
| 492 | if (ReferenceEquals(other, null)) { |
| 493 | return false; |
| 494 | } |
| 495 | if (ReferenceEquals(other, this)) { |
| 496 | return true; |
| 497 | } |
| 498 | if (Kind != other.Kind) return false; |
| 499 | if (Cardinality != other.Cardinality) return false; |
| 500 | if (Number != other.Number) return false; |
| 501 | if (Name != other.Name) return false; |
| 502 | if (TypeUrl != other.TypeUrl) return false; |
| 503 | if (OneofIndex != other.OneofIndex) return false; |
| 504 | if (Packed != other.Packed) return false; |
| 505 | if(!options_.Equals(other.options_)) return false; |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 506 | if (JsonName != other.JsonName) return false; |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 507 | return true; |
| 508 | } |
| 509 | |
| 510 | public override int GetHashCode() { |
| 511 | int hash = 1; |
| 512 | if (Kind != global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TYPE_UNKNOWN) hash ^= Kind.GetHashCode(); |
| 513 | if (Cardinality != global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.CARDINALITY_UNKNOWN) hash ^= Cardinality.GetHashCode(); |
| 514 | if (Number != 0) hash ^= Number.GetHashCode(); |
| 515 | if (Name.Length != 0) hash ^= Name.GetHashCode(); |
| 516 | if (TypeUrl.Length != 0) hash ^= TypeUrl.GetHashCode(); |
| 517 | if (OneofIndex != 0) hash ^= OneofIndex.GetHashCode(); |
| 518 | if (Packed != false) hash ^= Packed.GetHashCode(); |
| 519 | hash ^= options_.GetHashCode(); |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 520 | if (JsonName.Length != 0) hash ^= JsonName.GetHashCode(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 521 | return hash; |
| 522 | } |
| 523 | |
| 524 | public override string ToString() { |
| 525 | return pb::JsonFormatter.Default.Format(this); |
| 526 | } |
| 527 | |
| 528 | public void WriteTo(pb::CodedOutputStream output) { |
| 529 | if (Kind != global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TYPE_UNKNOWN) { |
| 530 | output.WriteRawTag(8); |
| 531 | output.WriteEnum((int) Kind); |
| 532 | } |
| 533 | if (Cardinality != global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.CARDINALITY_UNKNOWN) { |
| 534 | output.WriteRawTag(16); |
| 535 | output.WriteEnum((int) Cardinality); |
| 536 | } |
| 537 | if (Number != 0) { |
| 538 | output.WriteRawTag(24); |
| 539 | output.WriteInt32(Number); |
| 540 | } |
| 541 | if (Name.Length != 0) { |
| 542 | output.WriteRawTag(34); |
| 543 | output.WriteString(Name); |
| 544 | } |
| 545 | if (TypeUrl.Length != 0) { |
| 546 | output.WriteRawTag(50); |
| 547 | output.WriteString(TypeUrl); |
| 548 | } |
| 549 | if (OneofIndex != 0) { |
| 550 | output.WriteRawTag(56); |
| 551 | output.WriteInt32(OneofIndex); |
| 552 | } |
| 553 | if (Packed != false) { |
| 554 | output.WriteRawTag(64); |
| 555 | output.WriteBool(Packed); |
| 556 | } |
| 557 | options_.WriteTo(output, _repeated_options_codec); |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 558 | if (JsonName.Length != 0) { |
| 559 | output.WriteRawTag(82); |
| 560 | output.WriteString(JsonName); |
| 561 | } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 562 | } |
| 563 | |
| 564 | public int CalculateSize() { |
| 565 | int size = 0; |
| 566 | if (Kind != global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TYPE_UNKNOWN) { |
| 567 | size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Kind); |
| 568 | } |
| 569 | if (Cardinality != global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.CARDINALITY_UNKNOWN) { |
| 570 | size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Cardinality); |
| 571 | } |
| 572 | if (Number != 0) { |
| 573 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); |
| 574 | } |
| 575 | if (Name.Length != 0) { |
| 576 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); |
| 577 | } |
| 578 | if (TypeUrl.Length != 0) { |
| 579 | size += 1 + pb::CodedOutputStream.ComputeStringSize(TypeUrl); |
| 580 | } |
| 581 | if (OneofIndex != 0) { |
| 582 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(OneofIndex); |
| 583 | } |
| 584 | if (Packed != false) { |
| 585 | size += 1 + 1; |
| 586 | } |
| 587 | size += options_.CalculateSize(_repeated_options_codec); |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 588 | if (JsonName.Length != 0) { |
| 589 | size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonName); |
| 590 | } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 591 | return size; |
| 592 | } |
| 593 | |
| 594 | public void MergeFrom(Field other) { |
| 595 | if (other == null) { |
| 596 | return; |
| 597 | } |
| 598 | if (other.Kind != global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TYPE_UNKNOWN) { |
| 599 | Kind = other.Kind; |
| 600 | } |
| 601 | if (other.Cardinality != global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.CARDINALITY_UNKNOWN) { |
| 602 | Cardinality = other.Cardinality; |
| 603 | } |
| 604 | if (other.Number != 0) { |
| 605 | Number = other.Number; |
| 606 | } |
| 607 | if (other.Name.Length != 0) { |
| 608 | Name = other.Name; |
| 609 | } |
| 610 | if (other.TypeUrl.Length != 0) { |
| 611 | TypeUrl = other.TypeUrl; |
| 612 | } |
| 613 | if (other.OneofIndex != 0) { |
| 614 | OneofIndex = other.OneofIndex; |
| 615 | } |
| 616 | if (other.Packed != false) { |
| 617 | Packed = other.Packed; |
| 618 | } |
| 619 | options_.Add(other.options_); |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 620 | if (other.JsonName.Length != 0) { |
| 621 | JsonName = other.JsonName; |
| 622 | } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 623 | } |
| 624 | |
| 625 | public void MergeFrom(pb::CodedInputStream input) { |
| 626 | uint tag; |
Jon Skeet | 1a57ad8 | 2015-08-05 11:23:52 +0100 | [diff] [blame] | 627 | while ((tag = input.ReadTag()) != 0) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 628 | switch(tag) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 629 | default: |
Jon Skeet | 5bdc572 | 2015-08-06 11:40:43 +0100 | [diff] [blame] | 630 | input.SkipLastField(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 631 | break; |
| 632 | case 8: { |
| 633 | kind_ = (global::Google.Protobuf.WellKnownTypes.Field.Types.Kind) input.ReadEnum(); |
| 634 | break; |
| 635 | } |
| 636 | case 16: { |
| 637 | cardinality_ = (global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) input.ReadEnum(); |
| 638 | break; |
| 639 | } |
| 640 | case 24: { |
| 641 | Number = input.ReadInt32(); |
| 642 | break; |
| 643 | } |
| 644 | case 34: { |
| 645 | Name = input.ReadString(); |
| 646 | break; |
| 647 | } |
| 648 | case 50: { |
| 649 | TypeUrl = input.ReadString(); |
| 650 | break; |
| 651 | } |
| 652 | case 56: { |
| 653 | OneofIndex = input.ReadInt32(); |
| 654 | break; |
| 655 | } |
| 656 | case 64: { |
| 657 | Packed = input.ReadBool(); |
| 658 | break; |
| 659 | } |
| 660 | case 74: { |
| 661 | options_.AddEntriesFrom(input, _repeated_options_codec); |
| 662 | break; |
| 663 | } |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 664 | case 82: { |
| 665 | JsonName = input.ReadString(); |
| 666 | break; |
| 667 | } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 668 | } |
| 669 | } |
| 670 | } |
| 671 | |
| 672 | #region Nested types |
Jon Skeet | b0888a4 | 2015-09-29 13:37:30 +0100 | [diff] [blame] | 673 | /// <summary>Container for nested types declared in the Field message type.</summary> |
Jon Skeet | e2c8230 | 2015-09-29 14:34:31 +0100 | [diff] [blame] | 674 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 675 | public static partial class Types { |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 676 | /// <summary> |
| 677 | /// Kind represents a basic field type. |
| 678 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 679 | public enum Kind { |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 680 | /// <summary> |
| 681 | /// Field type unknown. |
| 682 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 683 | TYPE_UNKNOWN = 0, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 684 | /// <summary> |
| 685 | /// Field type double. |
| 686 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 687 | TYPE_DOUBLE = 1, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 688 | /// <summary> |
| 689 | /// Field type float. |
| 690 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 691 | TYPE_FLOAT = 2, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 692 | /// <summary> |
| 693 | /// Field type int64. |
| 694 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 695 | TYPE_INT64 = 3, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 696 | /// <summary> |
| 697 | /// Field type uint64. |
| 698 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 699 | TYPE_UINT64 = 4, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 700 | /// <summary> |
| 701 | /// Field type int32. |
| 702 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 703 | TYPE_INT32 = 5, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 704 | /// <summary> |
| 705 | /// Field type fixed64. |
| 706 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 707 | TYPE_FIXED64 = 6, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 708 | /// <summary> |
| 709 | /// Field type fixed32. |
| 710 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 711 | TYPE_FIXED32 = 7, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 712 | /// <summary> |
| 713 | /// Field type bool. |
| 714 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 715 | TYPE_BOOL = 8, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 716 | /// <summary> |
| 717 | /// Field type string. |
| 718 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 719 | TYPE_STRING = 9, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 720 | /// <summary> |
| 721 | /// Field type group (deprecated proto2 type) |
| 722 | /// </summary> |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 723 | TYPE_GROUP = 10, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 724 | /// <summary> |
| 725 | /// Field type message. |
| 726 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 727 | TYPE_MESSAGE = 11, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 728 | /// <summary> |
| 729 | /// Field type bytes. |
| 730 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 731 | TYPE_BYTES = 12, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 732 | /// <summary> |
| 733 | /// Field type uint32. |
| 734 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 735 | TYPE_UINT32 = 13, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 736 | /// <summary> |
| 737 | /// Field type enum. |
| 738 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 739 | TYPE_ENUM = 14, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 740 | /// <summary> |
| 741 | /// Field type sfixed32. |
| 742 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 743 | TYPE_SFIXED32 = 15, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 744 | /// <summary> |
| 745 | /// Field type sfixed64. |
| 746 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 747 | TYPE_SFIXED64 = 16, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 748 | /// <summary> |
| 749 | /// Field type sint32. |
| 750 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 751 | TYPE_SINT32 = 17, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 752 | /// <summary> |
| 753 | /// Field type sint64. |
| 754 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 755 | TYPE_SINT64 = 18, |
| 756 | } |
| 757 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 758 | /// <summary> |
| 759 | /// Cardinality represents whether a field is optional, required, or |
| 760 | /// repeated. |
| 761 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 762 | public enum Cardinality { |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 763 | /// <summary> |
| 764 | /// The field cardinality is unknown. Typically an error condition. |
| 765 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 766 | CARDINALITY_UNKNOWN = 0, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 767 | /// <summary> |
| 768 | /// For optional fields. |
| 769 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 770 | CARDINALITY_OPTIONAL = 1, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 771 | /// <summary> |
| 772 | /// For required fields. Not used for proto3. |
| 773 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 774 | CARDINALITY_REQUIRED = 2, |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 775 | /// <summary> |
| 776 | /// For repeated fields. |
| 777 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 778 | CARDINALITY_REPEATED = 3, |
| 779 | } |
| 780 | |
| 781 | } |
| 782 | #endregion |
| 783 | |
| 784 | } |
| 785 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 786 | /// <summary> |
| 787 | /// Enum type definition. |
| 788 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 789 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 790 | public sealed partial class Enum : pb::IMessage<Enum> { |
| 791 | private static readonly pb::MessageParser<Enum> _parser = new pb::MessageParser<Enum>(() => new Enum()); |
| 792 | public static pb::MessageParser<Enum> Parser { get { return _parser; } } |
| 793 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 794 | public static pbr::MessageDescriptor Descriptor { |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 795 | get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[2]; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 796 | } |
| 797 | |
Jon Skeet | 96cffaa | 2015-07-20 19:25:07 +0100 | [diff] [blame] | 798 | pbr::MessageDescriptor pb::IMessage.Descriptor { |
| 799 | get { return Descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 800 | } |
| 801 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 802 | public Enum() { |
| 803 | OnConstruction(); |
| 804 | } |
| 805 | |
| 806 | partial void OnConstruction(); |
| 807 | |
| 808 | public Enum(Enum other) : this() { |
| 809 | name_ = other.name_; |
| 810 | enumvalue_ = other.enumvalue_.Clone(); |
| 811 | options_ = other.options_.Clone(); |
| 812 | SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 813 | syntax_ = other.syntax_; |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 814 | } |
| 815 | |
| 816 | public Enum Clone() { |
| 817 | return new Enum(this); |
| 818 | } |
| 819 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 820 | /// <summary>Field number for the "name" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 821 | public const int NameFieldNumber = 1; |
| 822 | private string name_ = ""; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 823 | /// <summary> |
| 824 | /// Enum type name. |
| 825 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 826 | public string Name { |
| 827 | get { return name_; } |
| 828 | set { |
Jon Skeet | d18cc08 | 2015-07-30 13:50:02 +0100 | [diff] [blame] | 829 | name_ = pb::Preconditions.CheckNotNull(value, "value"); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 830 | } |
| 831 | } |
| 832 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 833 | /// <summary>Field number for the "enumvalue" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 834 | public const int EnumvalueFieldNumber = 2; |
| 835 | private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.EnumValue> _repeated_enumvalue_codec |
| 836 | = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.EnumValue.Parser); |
| 837 | private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.EnumValue> enumvalue_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.EnumValue>(); |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 838 | /// <summary> |
| 839 | /// Enum value definitions. |
| 840 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 841 | public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.EnumValue> Enumvalue { |
| 842 | get { return enumvalue_; } |
| 843 | } |
| 844 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 845 | /// <summary>Field number for the "options" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 846 | public const int OptionsFieldNumber = 3; |
| 847 | private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec |
| 848 | = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); |
| 849 | private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 850 | /// <summary> |
| 851 | /// Proto options for the enum type. |
| 852 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 853 | public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { |
| 854 | get { return options_; } |
| 855 | } |
| 856 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 857 | /// <summary>Field number for the "source_context" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 858 | public const int SourceContextFieldNumber = 4; |
| 859 | private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 860 | /// <summary> |
| 861 | /// The source context. |
| 862 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 863 | public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { |
| 864 | get { return sourceContext_; } |
| 865 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 866 | sourceContext_ = value; |
| 867 | } |
| 868 | } |
| 869 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 870 | /// <summary>Field number for the "syntax" field.</summary> |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 871 | public const int SyntaxFieldNumber = 5; |
| 872 | private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 873 | /// <summary> |
| 874 | /// The source syntax. |
| 875 | /// </summary> |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 876 | public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { |
| 877 | get { return syntax_; } |
| 878 | set { |
| 879 | syntax_ = value; |
| 880 | } |
| 881 | } |
| 882 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 883 | public override bool Equals(object other) { |
| 884 | return Equals(other as Enum); |
| 885 | } |
| 886 | |
| 887 | public bool Equals(Enum other) { |
| 888 | if (ReferenceEquals(other, null)) { |
| 889 | return false; |
| 890 | } |
| 891 | if (ReferenceEquals(other, this)) { |
| 892 | return true; |
| 893 | } |
| 894 | if (Name != other.Name) return false; |
| 895 | if(!enumvalue_.Equals(other.enumvalue_)) return false; |
| 896 | if(!options_.Equals(other.options_)) return false; |
| 897 | if (!object.Equals(SourceContext, other.SourceContext)) return false; |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 898 | if (Syntax != other.Syntax) return false; |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 899 | return true; |
| 900 | } |
| 901 | |
| 902 | public override int GetHashCode() { |
| 903 | int hash = 1; |
| 904 | if (Name.Length != 0) hash ^= Name.GetHashCode(); |
| 905 | hash ^= enumvalue_.GetHashCode(); |
| 906 | hash ^= options_.GetHashCode(); |
| 907 | if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 908 | if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) hash ^= Syntax.GetHashCode(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 909 | return hash; |
| 910 | } |
| 911 | |
| 912 | public override string ToString() { |
| 913 | return pb::JsonFormatter.Default.Format(this); |
| 914 | } |
| 915 | |
| 916 | public void WriteTo(pb::CodedOutputStream output) { |
| 917 | if (Name.Length != 0) { |
| 918 | output.WriteRawTag(10); |
| 919 | output.WriteString(Name); |
| 920 | } |
| 921 | enumvalue_.WriteTo(output, _repeated_enumvalue_codec); |
| 922 | options_.WriteTo(output, _repeated_options_codec); |
| 923 | if (sourceContext_ != null) { |
| 924 | output.WriteRawTag(34); |
| 925 | output.WriteMessage(SourceContext); |
| 926 | } |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 927 | if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { |
| 928 | output.WriteRawTag(40); |
| 929 | output.WriteEnum((int) Syntax); |
| 930 | } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 931 | } |
| 932 | |
| 933 | public int CalculateSize() { |
| 934 | int size = 0; |
| 935 | if (Name.Length != 0) { |
| 936 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); |
| 937 | } |
| 938 | size += enumvalue_.CalculateSize(_repeated_enumvalue_codec); |
| 939 | size += options_.CalculateSize(_repeated_options_codec); |
| 940 | if (sourceContext_ != null) { |
| 941 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext); |
| 942 | } |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 943 | if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { |
| 944 | size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); |
| 945 | } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 946 | return size; |
| 947 | } |
| 948 | |
| 949 | public void MergeFrom(Enum other) { |
| 950 | if (other == null) { |
| 951 | return; |
| 952 | } |
| 953 | if (other.Name.Length != 0) { |
| 954 | Name = other.Name; |
| 955 | } |
| 956 | enumvalue_.Add(other.enumvalue_); |
| 957 | options_.Add(other.options_); |
| 958 | if (other.sourceContext_ != null) { |
| 959 | if (sourceContext_ == null) { |
| 960 | sourceContext_ = new global::Google.Protobuf.WellKnownTypes.SourceContext(); |
| 961 | } |
| 962 | SourceContext.MergeFrom(other.SourceContext); |
| 963 | } |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 964 | if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.SYNTAX_PROTO2) { |
| 965 | Syntax = other.Syntax; |
| 966 | } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 967 | } |
| 968 | |
| 969 | public void MergeFrom(pb::CodedInputStream input) { |
| 970 | uint tag; |
Jon Skeet | 1a57ad8 | 2015-08-05 11:23:52 +0100 | [diff] [blame] | 971 | while ((tag = input.ReadTag()) != 0) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 972 | switch(tag) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 973 | default: |
Jon Skeet | 5bdc572 | 2015-08-06 11:40:43 +0100 | [diff] [blame] | 974 | input.SkipLastField(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 975 | break; |
| 976 | case 10: { |
| 977 | Name = input.ReadString(); |
| 978 | break; |
| 979 | } |
| 980 | case 18: { |
| 981 | enumvalue_.AddEntriesFrom(input, _repeated_enumvalue_codec); |
| 982 | break; |
| 983 | } |
| 984 | case 26: { |
| 985 | options_.AddEntriesFrom(input, _repeated_options_codec); |
| 986 | break; |
| 987 | } |
| 988 | case 34: { |
| 989 | if (sourceContext_ == null) { |
| 990 | sourceContext_ = new global::Google.Protobuf.WellKnownTypes.SourceContext(); |
| 991 | } |
| 992 | input.ReadMessage(sourceContext_); |
| 993 | break; |
| 994 | } |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 995 | case 40: { |
| 996 | syntax_ = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); |
| 997 | break; |
| 998 | } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 999 | } |
| 1000 | } |
| 1001 | } |
| 1002 | |
| 1003 | } |
| 1004 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 1005 | /// <summary> |
| 1006 | /// Enum value definition. |
| 1007 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1008 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 1009 | public sealed partial class EnumValue : pb::IMessage<EnumValue> { |
| 1010 | private static readonly pb::MessageParser<EnumValue> _parser = new pb::MessageParser<EnumValue>(() => new EnumValue()); |
| 1011 | public static pb::MessageParser<EnumValue> Parser { get { return _parser; } } |
| 1012 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1013 | public static pbr::MessageDescriptor Descriptor { |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 1014 | get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[3]; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1015 | } |
| 1016 | |
Jon Skeet | 96cffaa | 2015-07-20 19:25:07 +0100 | [diff] [blame] | 1017 | pbr::MessageDescriptor pb::IMessage.Descriptor { |
| 1018 | get { return Descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1019 | } |
| 1020 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1021 | public EnumValue() { |
| 1022 | OnConstruction(); |
| 1023 | } |
| 1024 | |
| 1025 | partial void OnConstruction(); |
| 1026 | |
| 1027 | public EnumValue(EnumValue other) : this() { |
| 1028 | name_ = other.name_; |
| 1029 | number_ = other.number_; |
| 1030 | options_ = other.options_.Clone(); |
| 1031 | } |
| 1032 | |
| 1033 | public EnumValue Clone() { |
| 1034 | return new EnumValue(this); |
| 1035 | } |
| 1036 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 1037 | /// <summary>Field number for the "name" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1038 | public const int NameFieldNumber = 1; |
| 1039 | private string name_ = ""; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 1040 | /// <summary> |
| 1041 | /// Enum value name. |
| 1042 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1043 | public string Name { |
| 1044 | get { return name_; } |
| 1045 | set { |
Jon Skeet | d18cc08 | 2015-07-30 13:50:02 +0100 | [diff] [blame] | 1046 | name_ = pb::Preconditions.CheckNotNull(value, "value"); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1047 | } |
| 1048 | } |
| 1049 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 1050 | /// <summary>Field number for the "number" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1051 | public const int NumberFieldNumber = 2; |
| 1052 | private int number_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 1053 | /// <summary> |
| 1054 | /// Enum value number. |
| 1055 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1056 | public int Number { |
| 1057 | get { return number_; } |
| 1058 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1059 | number_ = value; |
| 1060 | } |
| 1061 | } |
| 1062 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 1063 | /// <summary>Field number for the "options" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1064 | public const int OptionsFieldNumber = 3; |
| 1065 | private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Option> _repeated_options_codec |
| 1066 | = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); |
| 1067 | private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> options_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option>(); |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 1068 | /// <summary> |
| 1069 | /// Proto options for the enum value. |
| 1070 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1071 | public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Option> Options { |
| 1072 | get { return options_; } |
| 1073 | } |
| 1074 | |
| 1075 | public override bool Equals(object other) { |
| 1076 | return Equals(other as EnumValue); |
| 1077 | } |
| 1078 | |
| 1079 | public bool Equals(EnumValue other) { |
| 1080 | if (ReferenceEquals(other, null)) { |
| 1081 | return false; |
| 1082 | } |
| 1083 | if (ReferenceEquals(other, this)) { |
| 1084 | return true; |
| 1085 | } |
| 1086 | if (Name != other.Name) return false; |
| 1087 | if (Number != other.Number) return false; |
| 1088 | if(!options_.Equals(other.options_)) return false; |
| 1089 | return true; |
| 1090 | } |
| 1091 | |
| 1092 | public override int GetHashCode() { |
| 1093 | int hash = 1; |
| 1094 | if (Name.Length != 0) hash ^= Name.GetHashCode(); |
| 1095 | if (Number != 0) hash ^= Number.GetHashCode(); |
| 1096 | hash ^= options_.GetHashCode(); |
| 1097 | return hash; |
| 1098 | } |
| 1099 | |
| 1100 | public override string ToString() { |
| 1101 | return pb::JsonFormatter.Default.Format(this); |
| 1102 | } |
| 1103 | |
| 1104 | public void WriteTo(pb::CodedOutputStream output) { |
| 1105 | if (Name.Length != 0) { |
| 1106 | output.WriteRawTag(10); |
| 1107 | output.WriteString(Name); |
| 1108 | } |
| 1109 | if (Number != 0) { |
| 1110 | output.WriteRawTag(16); |
| 1111 | output.WriteInt32(Number); |
| 1112 | } |
| 1113 | options_.WriteTo(output, _repeated_options_codec); |
| 1114 | } |
| 1115 | |
| 1116 | public int CalculateSize() { |
| 1117 | int size = 0; |
| 1118 | if (Name.Length != 0) { |
| 1119 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); |
| 1120 | } |
| 1121 | if (Number != 0) { |
| 1122 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); |
| 1123 | } |
| 1124 | size += options_.CalculateSize(_repeated_options_codec); |
| 1125 | return size; |
| 1126 | } |
| 1127 | |
| 1128 | public void MergeFrom(EnumValue other) { |
| 1129 | if (other == null) { |
| 1130 | return; |
| 1131 | } |
| 1132 | if (other.Name.Length != 0) { |
| 1133 | Name = other.Name; |
| 1134 | } |
| 1135 | if (other.Number != 0) { |
| 1136 | Number = other.Number; |
| 1137 | } |
| 1138 | options_.Add(other.options_); |
| 1139 | } |
| 1140 | |
| 1141 | public void MergeFrom(pb::CodedInputStream input) { |
| 1142 | uint tag; |
Jon Skeet | 1a57ad8 | 2015-08-05 11:23:52 +0100 | [diff] [blame] | 1143 | while ((tag = input.ReadTag()) != 0) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1144 | switch(tag) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1145 | default: |
Jon Skeet | 5bdc572 | 2015-08-06 11:40:43 +0100 | [diff] [blame] | 1146 | input.SkipLastField(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1147 | break; |
| 1148 | case 10: { |
| 1149 | Name = input.ReadString(); |
| 1150 | break; |
| 1151 | } |
| 1152 | case 16: { |
| 1153 | Number = input.ReadInt32(); |
| 1154 | break; |
| 1155 | } |
| 1156 | case 26: { |
| 1157 | options_.AddEntriesFrom(input, _repeated_options_codec); |
| 1158 | break; |
| 1159 | } |
| 1160 | } |
| 1161 | } |
| 1162 | } |
| 1163 | |
| 1164 | } |
| 1165 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 1166 | /// <summary> |
| 1167 | /// Proto option attached to messages/fields/enums etc. |
| 1168 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1169 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 1170 | public sealed partial class Option : pb::IMessage<Option> { |
| 1171 | private static readonly pb::MessageParser<Option> _parser = new pb::MessageParser<Option>(() => new Option()); |
| 1172 | public static pb::MessageParser<Option> Parser { get { return _parser; } } |
| 1173 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1174 | public static pbr::MessageDescriptor Descriptor { |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 1175 | get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[4]; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1176 | } |
| 1177 | |
Jon Skeet | 96cffaa | 2015-07-20 19:25:07 +0100 | [diff] [blame] | 1178 | pbr::MessageDescriptor pb::IMessage.Descriptor { |
| 1179 | get { return Descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1180 | } |
| 1181 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1182 | public Option() { |
| 1183 | OnConstruction(); |
| 1184 | } |
| 1185 | |
| 1186 | partial void OnConstruction(); |
| 1187 | |
| 1188 | public Option(Option other) : this() { |
| 1189 | name_ = other.name_; |
| 1190 | Value = other.value_ != null ? other.Value.Clone() : null; |
| 1191 | } |
| 1192 | |
| 1193 | public Option Clone() { |
| 1194 | return new Option(this); |
| 1195 | } |
| 1196 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 1197 | /// <summary>Field number for the "name" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1198 | public const int NameFieldNumber = 1; |
| 1199 | private string name_ = ""; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 1200 | /// <summary> |
| 1201 | /// Proto option name. |
| 1202 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1203 | public string Name { |
| 1204 | get { return name_; } |
| 1205 | set { |
Jon Skeet | d18cc08 | 2015-07-30 13:50:02 +0100 | [diff] [blame] | 1206 | name_ = pb::Preconditions.CheckNotNull(value, "value"); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1207 | } |
| 1208 | } |
| 1209 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 1210 | /// <summary>Field number for the "value" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1211 | public const int ValueFieldNumber = 2; |
| 1212 | private global::Google.Protobuf.WellKnownTypes.Any value_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 1213 | /// <summary> |
| 1214 | /// Proto option value. |
| 1215 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1216 | public global::Google.Protobuf.WellKnownTypes.Any Value { |
| 1217 | get { return value_; } |
| 1218 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1219 | value_ = value; |
| 1220 | } |
| 1221 | } |
| 1222 | |
| 1223 | public override bool Equals(object other) { |
| 1224 | return Equals(other as Option); |
| 1225 | } |
| 1226 | |
| 1227 | public bool Equals(Option other) { |
| 1228 | if (ReferenceEquals(other, null)) { |
| 1229 | return false; |
| 1230 | } |
| 1231 | if (ReferenceEquals(other, this)) { |
| 1232 | return true; |
| 1233 | } |
| 1234 | if (Name != other.Name) return false; |
| 1235 | if (!object.Equals(Value, other.Value)) return false; |
| 1236 | return true; |
| 1237 | } |
| 1238 | |
| 1239 | public override int GetHashCode() { |
| 1240 | int hash = 1; |
| 1241 | if (Name.Length != 0) hash ^= Name.GetHashCode(); |
| 1242 | if (value_ != null) hash ^= Value.GetHashCode(); |
| 1243 | return hash; |
| 1244 | } |
| 1245 | |
| 1246 | public override string ToString() { |
| 1247 | return pb::JsonFormatter.Default.Format(this); |
| 1248 | } |
| 1249 | |
| 1250 | public void WriteTo(pb::CodedOutputStream output) { |
| 1251 | if (Name.Length != 0) { |
| 1252 | output.WriteRawTag(10); |
| 1253 | output.WriteString(Name); |
| 1254 | } |
| 1255 | if (value_ != null) { |
| 1256 | output.WriteRawTag(18); |
| 1257 | output.WriteMessage(Value); |
| 1258 | } |
| 1259 | } |
| 1260 | |
| 1261 | public int CalculateSize() { |
| 1262 | int size = 0; |
| 1263 | if (Name.Length != 0) { |
| 1264 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); |
| 1265 | } |
| 1266 | if (value_ != null) { |
| 1267 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(Value); |
| 1268 | } |
| 1269 | return size; |
| 1270 | } |
| 1271 | |
| 1272 | public void MergeFrom(Option other) { |
| 1273 | if (other == null) { |
| 1274 | return; |
| 1275 | } |
| 1276 | if (other.Name.Length != 0) { |
| 1277 | Name = other.Name; |
| 1278 | } |
| 1279 | if (other.value_ != null) { |
| 1280 | if (value_ == null) { |
| 1281 | value_ = new global::Google.Protobuf.WellKnownTypes.Any(); |
| 1282 | } |
| 1283 | Value.MergeFrom(other.Value); |
| 1284 | } |
| 1285 | } |
| 1286 | |
| 1287 | public void MergeFrom(pb::CodedInputStream input) { |
| 1288 | uint tag; |
Jon Skeet | 1a57ad8 | 2015-08-05 11:23:52 +0100 | [diff] [blame] | 1289 | while ((tag = input.ReadTag()) != 0) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1290 | switch(tag) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1291 | default: |
Jon Skeet | 5bdc572 | 2015-08-06 11:40:43 +0100 | [diff] [blame] | 1292 | input.SkipLastField(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1293 | break; |
| 1294 | case 10: { |
| 1295 | Name = input.ReadString(); |
| 1296 | break; |
| 1297 | } |
| 1298 | case 18: { |
| 1299 | if (value_ == null) { |
| 1300 | value_ = new global::Google.Protobuf.WellKnownTypes.Any(); |
| 1301 | } |
| 1302 | input.ReadMessage(value_); |
| 1303 | break; |
| 1304 | } |
| 1305 | } |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | } |
| 1310 | |
| 1311 | #endregion |
| 1312 | |
| 1313 | } |
| 1314 | |
| 1315 | #endregion Designer generated code |