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