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/struct.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 | |
| 12 | namespace Proto { |
| 13 | |
Jon Skeet | b0888a4 | 2015-09-29 13:37:30 +0100 | [diff] [blame] | 14 | /// <summary>Holder for reflection information generated from google/protobuf/struct.proto</summary> |
Jon Skeet | e2c8230 | 2015-09-29 14:34:31 +0100 | [diff] [blame] | 15 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 16 | public static partial class Struct { |
| 17 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 18 | #region Descriptor |
Jon Skeet | b0888a4 | 2015-09-29 13:37:30 +0100 | [diff] [blame] | 19 | /// <summary>File descriptor for google/protobuf/struct.proto</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 20 | public static pbr::FileDescriptor Descriptor { |
| 21 | get { return descriptor; } |
| 22 | } |
| 23 | private static pbr::FileDescriptor descriptor; |
| 24 | |
| 25 | static Struct() { |
| 26 | byte[] descriptorData = global::System.Convert.FromBase64String( |
| 27 | string.Concat( |
Jon Skeet | 9489817 | 2015-09-01 15:47:48 +0100 | [diff] [blame] | 28 | "Chxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvEg9nb29nbGUucHJvdG9i", |
| 29 | "dWYihAEKBlN0cnVjdBIzCgZmaWVsZHMYASADKAsyIy5nb29nbGUucHJvdG9i", |
| 30 | "dWYuU3RydWN0LkZpZWxkc0VudHJ5GkUKC0ZpZWxkc0VudHJ5EgsKA2tleRgB", |
| 31 | "IAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZToC", |
| 32 | "OAEi6gEKBVZhbHVlEjAKCm51bGxfdmFsdWUYASABKA4yGi5nb29nbGUucHJv", |
| 33 | "dG9idWYuTnVsbFZhbHVlSAASFgoMbnVtYmVyX3ZhbHVlGAIgASgBSAASFgoM", |
| 34 | "c3RyaW5nX3ZhbHVlGAMgASgJSAASFAoKYm9vbF92YWx1ZRgEIAEoCEgAEi8K", |
| 35 | "DHN0cnVjdF92YWx1ZRgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RI", |
| 36 | "ABIwCgpsaXN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RW", |
| 37 | "YWx1ZUgAQgYKBGtpbmQiMwoJTGlzdFZhbHVlEiYKBnZhbHVlcxgBIAMoCzIW", |
| 38 | "Lmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9W", |
| 39 | "QUxVRRAAQk4KE2NvbS5nb29nbGUucHJvdG9idWZCC1N0cnVjdFByb3RvUAGg", |
| 40 | "AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnBy", |
Jon Skeet | 47bf49b | 2015-07-22 11:39:38 +0100 | [diff] [blame] | 41 | "b3RvMw==")); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 42 | descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, |
Jon Skeet | 96cffaa | 2015-07-20 19:25:07 +0100 | [diff] [blame] | 43 | new pbr::FileDescriptor[] { }, |
Jon Skeet | 47bf49b | 2015-07-22 11:39:38 +0100 | [diff] [blame] | 44 | new pbr::GeneratedCodeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.NullValue), }, new pbr::GeneratedCodeInfo[] { |
| 45 | new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Struct), new[]{ "Fields" }, null, null, new pbr::GeneratedCodeInfo[] { null, }), |
| 46 | new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Value), new[]{ "NullValue", "NumberValue", "StringValue", "BoolValue", "StructValue", "ListValue" }, new[]{ "Kind" }, null, null), |
| 47 | new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.ListValue), new[]{ "Values" }, null, null, null) |
| 48 | })); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 49 | } |
| 50 | #endregion |
| 51 | |
| 52 | } |
| 53 | } |
| 54 | #region Enums |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 55 | /// <summary> |
| 56 | /// `NullValue` is a singleton enumeration to represent the null value for the |
| 57 | /// `Value` type union. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame^] | 58 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 59 | /// The JSON representation for `NullValue` is JSON `null`. |
| 60 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 61 | public enum NullValue { |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 62 | /// <summary> |
| 63 | /// Null value. |
| 64 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 65 | NULL_VALUE = 0, |
| 66 | } |
| 67 | |
| 68 | #endregion |
| 69 | |
| 70 | #region Messages |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 71 | /// <summary> |
| 72 | /// `Struct` represents a structured data value, consisting of fields |
| 73 | /// which map to dynamically typed values. In some languages, `Struct` |
| 74 | /// might be supported by a native representation. For example, in |
| 75 | /// scripting languages like JS a struct is represented as an |
| 76 | /// object. The details of that representation are described together |
| 77 | /// with the proto support for the language. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame^] | 78 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 79 | /// The JSON representation for `Struct` is JSON object. |
| 80 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 81 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 82 | public sealed partial class Struct : pb::IMessage<Struct> { |
| 83 | private static readonly pb::MessageParser<Struct> _parser = new pb::MessageParser<Struct>(() => new Struct()); |
| 84 | public static pb::MessageParser<Struct> Parser { get { return _parser; } } |
| 85 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 86 | public static pbr::MessageDescriptor Descriptor { |
| 87 | get { return global::Google.Protobuf.WellKnownTypes.Proto.Struct.Descriptor.MessageTypes[0]; } |
| 88 | } |
| 89 | |
Jon Skeet | 96cffaa | 2015-07-20 19:25:07 +0100 | [diff] [blame] | 90 | pbr::MessageDescriptor pb::IMessage.Descriptor { |
| 91 | get { return Descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 92 | } |
| 93 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 94 | public Struct() { |
| 95 | OnConstruction(); |
| 96 | } |
| 97 | |
| 98 | partial void OnConstruction(); |
| 99 | |
| 100 | public Struct(Struct other) : this() { |
| 101 | fields_ = other.fields_.Clone(); |
| 102 | } |
| 103 | |
| 104 | public Struct Clone() { |
| 105 | return new Struct(this); |
| 106 | } |
| 107 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 108 | /// <summary>Field number for the "fields" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 109 | public const int FieldsFieldNumber = 1; |
| 110 | private static readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec _map_fields_codec |
| 111 | = new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 10); |
| 112 | private readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> fields_ = new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>(); |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 113 | /// <summary> |
| 114 | /// Map of dynamically typed values. |
| 115 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 116 | public pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> Fields { |
| 117 | get { return fields_; } |
| 118 | } |
| 119 | |
| 120 | public override bool Equals(object other) { |
| 121 | return Equals(other as Struct); |
| 122 | } |
| 123 | |
| 124 | public bool Equals(Struct other) { |
| 125 | if (ReferenceEquals(other, null)) { |
| 126 | return false; |
| 127 | } |
| 128 | if (ReferenceEquals(other, this)) { |
| 129 | return true; |
| 130 | } |
| 131 | if (!Fields.Equals(other.Fields)) return false; |
| 132 | return true; |
| 133 | } |
| 134 | |
| 135 | public override int GetHashCode() { |
| 136 | int hash = 1; |
| 137 | hash ^= Fields.GetHashCode(); |
| 138 | return hash; |
| 139 | } |
| 140 | |
| 141 | public override string ToString() { |
| 142 | return pb::JsonFormatter.Default.Format(this); |
| 143 | } |
| 144 | |
| 145 | public void WriteTo(pb::CodedOutputStream output) { |
| 146 | fields_.WriteTo(output, _map_fields_codec); |
| 147 | } |
| 148 | |
| 149 | public int CalculateSize() { |
| 150 | int size = 0; |
| 151 | size += fields_.CalculateSize(_map_fields_codec); |
| 152 | return size; |
| 153 | } |
| 154 | |
| 155 | public void MergeFrom(Struct other) { |
| 156 | if (other == null) { |
| 157 | return; |
| 158 | } |
| 159 | fields_.Add(other.fields_); |
| 160 | } |
| 161 | |
| 162 | public void MergeFrom(pb::CodedInputStream input) { |
| 163 | uint tag; |
Jon Skeet | 1a57ad8 | 2015-08-05 11:23:52 +0100 | [diff] [blame] | 164 | while ((tag = input.ReadTag()) != 0) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 165 | switch(tag) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 166 | default: |
Jon Skeet | 5bdc572 | 2015-08-06 11:40:43 +0100 | [diff] [blame] | 167 | input.SkipLastField(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 168 | break; |
| 169 | case 10: { |
| 170 | fields_.AddEntriesFrom(input, _map_fields_codec); |
| 171 | break; |
| 172 | } |
| 173 | } |
| 174 | } |
| 175 | } |
| 176 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 177 | } |
| 178 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 179 | /// <summary> |
| 180 | /// `Value` represents a dynamically typed value which can be either |
| 181 | /// null, a number, a string, a boolean, a recursive struct value, or a |
| 182 | /// list of values. A producer of value is expected to set one of that |
| 183 | /// variants, absence of any variant indicates an error. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame^] | 184 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 185 | /// The JSON representation for `Value` is JSON value. |
| 186 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 187 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 188 | public sealed partial class Value : pb::IMessage<Value> { |
| 189 | private static readonly pb::MessageParser<Value> _parser = new pb::MessageParser<Value>(() => new Value()); |
| 190 | public static pb::MessageParser<Value> Parser { get { return _parser; } } |
| 191 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 192 | public static pbr::MessageDescriptor Descriptor { |
| 193 | get { return global::Google.Protobuf.WellKnownTypes.Proto.Struct.Descriptor.MessageTypes[1]; } |
| 194 | } |
| 195 | |
Jon Skeet | 96cffaa | 2015-07-20 19:25:07 +0100 | [diff] [blame] | 196 | pbr::MessageDescriptor pb::IMessage.Descriptor { |
| 197 | get { return Descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 198 | } |
| 199 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 200 | public Value() { |
| 201 | OnConstruction(); |
| 202 | } |
| 203 | |
| 204 | partial void OnConstruction(); |
| 205 | |
| 206 | public Value(Value other) : this() { |
| 207 | switch (other.KindCase) { |
| 208 | case KindOneofCase.NullValue: |
| 209 | NullValue = other.NullValue; |
| 210 | break; |
| 211 | case KindOneofCase.NumberValue: |
| 212 | NumberValue = other.NumberValue; |
| 213 | break; |
| 214 | case KindOneofCase.StringValue: |
| 215 | StringValue = other.StringValue; |
| 216 | break; |
| 217 | case KindOneofCase.BoolValue: |
| 218 | BoolValue = other.BoolValue; |
| 219 | break; |
| 220 | case KindOneofCase.StructValue: |
| 221 | StructValue = other.StructValue.Clone(); |
| 222 | break; |
| 223 | case KindOneofCase.ListValue: |
| 224 | ListValue = other.ListValue.Clone(); |
| 225 | break; |
| 226 | } |
| 227 | |
| 228 | } |
| 229 | |
| 230 | public Value Clone() { |
| 231 | return new Value(this); |
| 232 | } |
| 233 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 234 | /// <summary>Field number for the "null_value" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 235 | public const int NullValueFieldNumber = 1; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 236 | /// <summary> |
| 237 | /// Represents a null value. |
| 238 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 239 | public global::Google.Protobuf.WellKnownTypes.NullValue NullValue { |
| 240 | get { return kindCase_ == KindOneofCase.NullValue ? (global::Google.Protobuf.WellKnownTypes.NullValue) kind_ : global::Google.Protobuf.WellKnownTypes.NullValue.NULL_VALUE; } |
| 241 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 242 | kind_ = value; |
| 243 | kindCase_ = KindOneofCase.NullValue; |
| 244 | } |
| 245 | } |
| 246 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 247 | /// <summary>Field number for the "number_value" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 248 | public const int NumberValueFieldNumber = 2; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 249 | /// <summary> |
| 250 | /// Represents a double value. |
| 251 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 252 | public double NumberValue { |
| 253 | get { return kindCase_ == KindOneofCase.NumberValue ? (double) kind_ : 0D; } |
| 254 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 255 | kind_ = value; |
| 256 | kindCase_ = KindOneofCase.NumberValue; |
| 257 | } |
| 258 | } |
| 259 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 260 | /// <summary>Field number for the "string_value" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 261 | public const int StringValueFieldNumber = 3; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 262 | /// <summary> |
| 263 | /// Represents a string value. |
| 264 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 265 | public string StringValue { |
| 266 | get { return kindCase_ == KindOneofCase.StringValue ? (string) kind_ : ""; } |
| 267 | set { |
Jon Skeet | d18cc08 | 2015-07-30 13:50:02 +0100 | [diff] [blame] | 268 | kind_ = pb::Preconditions.CheckNotNull(value, "value"); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 269 | kindCase_ = KindOneofCase.StringValue; |
| 270 | } |
| 271 | } |
| 272 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 273 | /// <summary>Field number for the "bool_value" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 274 | public const int BoolValueFieldNumber = 4; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 275 | /// <summary> |
| 276 | /// Represents a boolean value. |
| 277 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 278 | public bool BoolValue { |
| 279 | get { return kindCase_ == KindOneofCase.BoolValue ? (bool) kind_ : false; } |
| 280 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 281 | kind_ = value; |
| 282 | kindCase_ = KindOneofCase.BoolValue; |
| 283 | } |
| 284 | } |
| 285 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 286 | /// <summary>Field number for the "struct_value" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 287 | public const int StructValueFieldNumber = 5; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 288 | /// <summary> |
| 289 | /// Represents a structured value. |
| 290 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 291 | public global::Google.Protobuf.WellKnownTypes.Struct StructValue { |
| 292 | get { return kindCase_ == KindOneofCase.StructValue ? (global::Google.Protobuf.WellKnownTypes.Struct) kind_ : null; } |
| 293 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 294 | kind_ = value; |
| 295 | kindCase_ = value == null ? KindOneofCase.None : KindOneofCase.StructValue; |
| 296 | } |
| 297 | } |
| 298 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 299 | /// <summary>Field number for the "list_value" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 300 | public const int ListValueFieldNumber = 6; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 301 | /// <summary> |
| 302 | /// Represents a repeated `Value`. |
| 303 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 304 | public global::Google.Protobuf.WellKnownTypes.ListValue ListValue { |
| 305 | get { return kindCase_ == KindOneofCase.ListValue ? (global::Google.Protobuf.WellKnownTypes.ListValue) kind_ : null; } |
| 306 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 307 | kind_ = value; |
| 308 | kindCase_ = value == null ? KindOneofCase.None : KindOneofCase.ListValue; |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | private object kind_; |
Jon Skeet | 6bbbdfa | 2015-09-30 06:59:38 +0100 | [diff] [blame] | 313 | /// <summary>Enum of possible cases for the "kind" oneof.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 314 | public enum KindOneofCase { |
| 315 | None = 0, |
| 316 | NullValue = 1, |
| 317 | NumberValue = 2, |
| 318 | StringValue = 3, |
| 319 | BoolValue = 4, |
| 320 | StructValue = 5, |
| 321 | ListValue = 6, |
| 322 | } |
| 323 | private KindOneofCase kindCase_ = KindOneofCase.None; |
| 324 | public KindOneofCase KindCase { |
| 325 | get { return kindCase_; } |
| 326 | } |
| 327 | |
| 328 | public void ClearKind() { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 329 | kindCase_ = KindOneofCase.None; |
| 330 | kind_ = null; |
| 331 | } |
| 332 | |
| 333 | public override bool Equals(object other) { |
| 334 | return Equals(other as Value); |
| 335 | } |
| 336 | |
| 337 | public bool Equals(Value other) { |
| 338 | if (ReferenceEquals(other, null)) { |
| 339 | return false; |
| 340 | } |
| 341 | if (ReferenceEquals(other, this)) { |
| 342 | return true; |
| 343 | } |
| 344 | if (NullValue != other.NullValue) return false; |
| 345 | if (NumberValue != other.NumberValue) return false; |
| 346 | if (StringValue != other.StringValue) return false; |
| 347 | if (BoolValue != other.BoolValue) return false; |
| 348 | if (!object.Equals(StructValue, other.StructValue)) return false; |
| 349 | if (!object.Equals(ListValue, other.ListValue)) return false; |
Jon Skeet | 55313c9 | 2015-10-24 06:46:02 +0100 | [diff] [blame] | 350 | if (KindCase != other.KindCase) return false; |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 351 | return true; |
| 352 | } |
| 353 | |
| 354 | public override int GetHashCode() { |
| 355 | int hash = 1; |
| 356 | if (kindCase_ == KindOneofCase.NullValue) hash ^= NullValue.GetHashCode(); |
| 357 | if (kindCase_ == KindOneofCase.NumberValue) hash ^= NumberValue.GetHashCode(); |
| 358 | if (kindCase_ == KindOneofCase.StringValue) hash ^= StringValue.GetHashCode(); |
| 359 | if (kindCase_ == KindOneofCase.BoolValue) hash ^= BoolValue.GetHashCode(); |
| 360 | if (kindCase_ == KindOneofCase.StructValue) hash ^= StructValue.GetHashCode(); |
| 361 | if (kindCase_ == KindOneofCase.ListValue) hash ^= ListValue.GetHashCode(); |
Jon Skeet | 55313c9 | 2015-10-24 06:46:02 +0100 | [diff] [blame] | 362 | hash ^= (int) kindCase_; |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 363 | return hash; |
| 364 | } |
| 365 | |
| 366 | public override string ToString() { |
| 367 | return pb::JsonFormatter.Default.Format(this); |
| 368 | } |
| 369 | |
| 370 | public void WriteTo(pb::CodedOutputStream output) { |
| 371 | if (kindCase_ == KindOneofCase.NullValue) { |
| 372 | output.WriteRawTag(8); |
| 373 | output.WriteEnum((int) NullValue); |
| 374 | } |
| 375 | if (kindCase_ == KindOneofCase.NumberValue) { |
| 376 | output.WriteRawTag(17); |
| 377 | output.WriteDouble(NumberValue); |
| 378 | } |
| 379 | if (kindCase_ == KindOneofCase.StringValue) { |
| 380 | output.WriteRawTag(26); |
| 381 | output.WriteString(StringValue); |
| 382 | } |
| 383 | if (kindCase_ == KindOneofCase.BoolValue) { |
| 384 | output.WriteRawTag(32); |
| 385 | output.WriteBool(BoolValue); |
| 386 | } |
| 387 | if (kindCase_ == KindOneofCase.StructValue) { |
| 388 | output.WriteRawTag(42); |
| 389 | output.WriteMessage(StructValue); |
| 390 | } |
| 391 | if (kindCase_ == KindOneofCase.ListValue) { |
| 392 | output.WriteRawTag(50); |
| 393 | output.WriteMessage(ListValue); |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | public int CalculateSize() { |
| 398 | int size = 0; |
| 399 | if (kindCase_ == KindOneofCase.NullValue) { |
| 400 | size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) NullValue); |
| 401 | } |
| 402 | if (kindCase_ == KindOneofCase.NumberValue) { |
| 403 | size += 1 + 8; |
| 404 | } |
| 405 | if (kindCase_ == KindOneofCase.StringValue) { |
| 406 | size += 1 + pb::CodedOutputStream.ComputeStringSize(StringValue); |
| 407 | } |
| 408 | if (kindCase_ == KindOneofCase.BoolValue) { |
| 409 | size += 1 + 1; |
| 410 | } |
| 411 | if (kindCase_ == KindOneofCase.StructValue) { |
| 412 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(StructValue); |
| 413 | } |
| 414 | if (kindCase_ == KindOneofCase.ListValue) { |
| 415 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(ListValue); |
| 416 | } |
| 417 | return size; |
| 418 | } |
| 419 | |
| 420 | public void MergeFrom(Value other) { |
| 421 | if (other == null) { |
| 422 | return; |
| 423 | } |
| 424 | switch (other.KindCase) { |
| 425 | case KindOneofCase.NullValue: |
| 426 | NullValue = other.NullValue; |
| 427 | break; |
| 428 | case KindOneofCase.NumberValue: |
| 429 | NumberValue = other.NumberValue; |
| 430 | break; |
| 431 | case KindOneofCase.StringValue: |
| 432 | StringValue = other.StringValue; |
| 433 | break; |
| 434 | case KindOneofCase.BoolValue: |
| 435 | BoolValue = other.BoolValue; |
| 436 | break; |
| 437 | case KindOneofCase.StructValue: |
| 438 | StructValue = other.StructValue; |
| 439 | break; |
| 440 | case KindOneofCase.ListValue: |
| 441 | ListValue = other.ListValue; |
| 442 | break; |
| 443 | } |
| 444 | |
| 445 | } |
| 446 | |
| 447 | public void MergeFrom(pb::CodedInputStream input) { |
| 448 | uint tag; |
Jon Skeet | 1a57ad8 | 2015-08-05 11:23:52 +0100 | [diff] [blame] | 449 | while ((tag = input.ReadTag()) != 0) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 450 | switch(tag) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 451 | default: |
Jon Skeet | 5bdc572 | 2015-08-06 11:40:43 +0100 | [diff] [blame] | 452 | input.SkipLastField(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 453 | break; |
| 454 | case 8: { |
| 455 | kind_ = input.ReadEnum(); |
| 456 | kindCase_ = KindOneofCase.NullValue; |
| 457 | break; |
| 458 | } |
| 459 | case 17: { |
| 460 | NumberValue = input.ReadDouble(); |
| 461 | break; |
| 462 | } |
| 463 | case 26: { |
| 464 | StringValue = input.ReadString(); |
| 465 | break; |
| 466 | } |
| 467 | case 32: { |
| 468 | BoolValue = input.ReadBool(); |
| 469 | break; |
| 470 | } |
| 471 | case 42: { |
| 472 | global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct(); |
| 473 | if (kindCase_ == KindOneofCase.StructValue) { |
| 474 | subBuilder.MergeFrom(StructValue); |
| 475 | } |
| 476 | input.ReadMessage(subBuilder); |
| 477 | StructValue = subBuilder; |
| 478 | break; |
| 479 | } |
| 480 | case 50: { |
| 481 | global::Google.Protobuf.WellKnownTypes.ListValue subBuilder = new global::Google.Protobuf.WellKnownTypes.ListValue(); |
| 482 | if (kindCase_ == KindOneofCase.ListValue) { |
| 483 | subBuilder.MergeFrom(ListValue); |
| 484 | } |
| 485 | input.ReadMessage(subBuilder); |
| 486 | ListValue = subBuilder; |
| 487 | break; |
| 488 | } |
| 489 | } |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | } |
| 494 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 495 | /// <summary> |
| 496 | /// `ListValue` is a wrapper around a repeated field of values. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame^] | 497 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 498 | /// The JSON representation for `ListValue` is JSON array. |
| 499 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 500 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 501 | public sealed partial class ListValue : pb::IMessage<ListValue> { |
| 502 | private static readonly pb::MessageParser<ListValue> _parser = new pb::MessageParser<ListValue>(() => new ListValue()); |
| 503 | public static pb::MessageParser<ListValue> Parser { get { return _parser; } } |
| 504 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 505 | public static pbr::MessageDescriptor Descriptor { |
| 506 | get { return global::Google.Protobuf.WellKnownTypes.Proto.Struct.Descriptor.MessageTypes[2]; } |
| 507 | } |
| 508 | |
Jon Skeet | 96cffaa | 2015-07-20 19:25:07 +0100 | [diff] [blame] | 509 | pbr::MessageDescriptor pb::IMessage.Descriptor { |
| 510 | get { return Descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 511 | } |
| 512 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 513 | public ListValue() { |
| 514 | OnConstruction(); |
| 515 | } |
| 516 | |
| 517 | partial void OnConstruction(); |
| 518 | |
| 519 | public ListValue(ListValue other) : this() { |
| 520 | values_ = other.values_.Clone(); |
| 521 | } |
| 522 | |
| 523 | public ListValue Clone() { |
| 524 | return new ListValue(this); |
| 525 | } |
| 526 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 527 | /// <summary>Field number for the "values" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 528 | public const int ValuesFieldNumber = 1; |
| 529 | private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Value> _repeated_values_codec |
| 530 | = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Value.Parser); |
| 531 | private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value> values_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value>(); |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 532 | /// <summary> |
| 533 | /// Repeated field of dynamically typed values. |
| 534 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 535 | public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value> Values { |
| 536 | get { return values_; } |
| 537 | } |
| 538 | |
| 539 | public override bool Equals(object other) { |
| 540 | return Equals(other as ListValue); |
| 541 | } |
| 542 | |
| 543 | public bool Equals(ListValue other) { |
| 544 | if (ReferenceEquals(other, null)) { |
| 545 | return false; |
| 546 | } |
| 547 | if (ReferenceEquals(other, this)) { |
| 548 | return true; |
| 549 | } |
| 550 | if(!values_.Equals(other.values_)) return false; |
| 551 | return true; |
| 552 | } |
| 553 | |
| 554 | public override int GetHashCode() { |
| 555 | int hash = 1; |
| 556 | hash ^= values_.GetHashCode(); |
| 557 | return hash; |
| 558 | } |
| 559 | |
| 560 | public override string ToString() { |
| 561 | return pb::JsonFormatter.Default.Format(this); |
| 562 | } |
| 563 | |
| 564 | public void WriteTo(pb::CodedOutputStream output) { |
| 565 | values_.WriteTo(output, _repeated_values_codec); |
| 566 | } |
| 567 | |
| 568 | public int CalculateSize() { |
| 569 | int size = 0; |
| 570 | size += values_.CalculateSize(_repeated_values_codec); |
| 571 | return size; |
| 572 | } |
| 573 | |
| 574 | public void MergeFrom(ListValue other) { |
| 575 | if (other == null) { |
| 576 | return; |
| 577 | } |
| 578 | values_.Add(other.values_); |
| 579 | } |
| 580 | |
| 581 | public void MergeFrom(pb::CodedInputStream input) { |
| 582 | uint tag; |
Jon Skeet | 1a57ad8 | 2015-08-05 11:23:52 +0100 | [diff] [blame] | 583 | while ((tag = input.ReadTag()) != 0) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 584 | switch(tag) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 585 | default: |
Jon Skeet | 5bdc572 | 2015-08-06 11:40:43 +0100 | [diff] [blame] | 586 | input.SkipLastField(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 587 | break; |
| 588 | case 10: { |
| 589 | values_.AddEntriesFrom(input, _repeated_values_codec); |
| 590 | break; |
| 591 | } |
| 592 | } |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | } |
| 597 | |
| 598 | #endregion |
| 599 | |
| 600 | } |
| 601 | |
| 602 | #endregion Designer generated code |