aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/ProtocolBuffers/WellKnownTypes/Struct.cs
blob: 99f88a96349675b4a81842423dff7da8411ad50a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/protobuf/struct.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code

using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.WellKnownTypes {

  namespace Proto {

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    public static partial class Struct {

      #region Static variables
      internal static pbr::FieldAccessorTable internal__static_google_protobuf_Struct__FieldAccessorTable;
      internal static pbr::FieldAccessorTable internal__static_google_protobuf_Value__FieldAccessorTable;
      internal static pbr::FieldAccessorTable internal__static_google_protobuf_ListValue__FieldAccessorTable;
      #endregion
      #region Descriptor
      public static pbr::FileDescriptor Descriptor {
        get { return descriptor; }
      }
      private static pbr::FileDescriptor descriptor;

      static Struct() {
        byte[] descriptorData = global::System.Convert.FromBase64String(
            string.Concat(
              "Chxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvEg9nb29nbGUucHJvdG9i", 
              "dWYihAEKBlN0cnVjdBIzCgZmaWVsZHMYASADKAsyIy5nb29nbGUucHJvdG9i", 
              "dWYuU3RydWN0LkZpZWxkc0VudHJ5GkUKC0ZpZWxkc0VudHJ5EgsKA2tleRgB", 
              "IAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZToC", 
              "OAEi6gEKBVZhbHVlEjAKCm51bGxfdmFsdWUYASABKA4yGi5nb29nbGUucHJv", 
              "dG9idWYuTnVsbFZhbHVlSAASFgoMbnVtYmVyX3ZhbHVlGAIgASgBSAASFgoM", 
              "c3RyaW5nX3ZhbHVlGAMgASgJSAASFAoKYm9vbF92YWx1ZRgEIAEoCEgAEi8K", 
              "DHN0cnVjdF92YWx1ZRgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RI", 
              "ABIwCgpsaXN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RW", 
              "YWx1ZUgAQgYKBGtpbmQiMwoJTGlzdFZhbHVlEiYKBnZhbHVlcxgBIAMoCzIW", 
              "Lmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9W", 
              "QUxVRRAAQk4KE2NvbS5nb29nbGUucHJvdG9idWZCC1N0cnVjdFByb3RvUAGg", 
              "AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnBy", 
            "b3RvMw=="));
        descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
            new pbr::FileDescriptor[] {
            });
        internal__static_google_protobuf_Struct__FieldAccessorTable = 
            new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.WellKnownTypes.Struct), descriptor.MessageTypes[0],
                new string[] { "Fields", }, new string[] { });
        internal__static_google_protobuf_Value__FieldAccessorTable = 
            new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.WellKnownTypes.Value), descriptor.MessageTypes[1],
                new string[] { "NullValue", "NumberValue", "StringValue", "BoolValue", "StructValue", "ListValue", }, new string[] { "Kind", });
        internal__static_google_protobuf_ListValue__FieldAccessorTable = 
            new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.WellKnownTypes.ListValue), descriptor.MessageTypes[2],
                new string[] { "Values", }, new string[] { });
      }
      #endregion

    }
  }
  #region Enums
  public enum NullValue {
    NULL_VALUE = 0,
  }

  #endregion

  #region Messages
  [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
  public sealed partial class Struct : pb::IMessage<Struct> {
    private static readonly pb::MessageParser<Struct> _parser = new pb::MessageParser<Struct>(() => new Struct());
    public static pb::MessageParser<Struct> Parser { get { return _parser; } }

    private static readonly string[] _fieldNames = new string[] { "fields" };
    private static readonly uint[] _fieldTags = new uint[] { 10 };
    public static pbr::MessageDescriptor Descriptor {
      get { return global::Google.Protobuf.WellKnownTypes.Proto.Struct.Descriptor.MessageTypes[0]; }
    }

    pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
      get { return global::Google.Protobuf.WellKnownTypes.Proto.Struct.internal__static_google_protobuf_Struct__FieldAccessorTable; }
    }

    private bool _frozen = false;
    public bool IsFrozen { get { return _frozen; } }

    public Struct() {
      OnConstruction();
    }

    partial void OnConstruction();

    public Struct(Struct other) : this() {
      fields_ = other.fields_.Clone();
    }

    public Struct Clone() {
      return new Struct(this);
    }

    public void Freeze() {
      if (IsFrozen) {
        return;
      }
      _frozen = true;
      fields_.Freeze();
    }

    public const int FieldsFieldNumber = 1;
    private static readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec _map_fields_codec
        = 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);
    private readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> fields_ = new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>();
    public pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> Fields {
      get { return fields_; }
    }

    public override bool Equals(object other) {
      return Equals(other as Struct);
    }

    public bool Equals(Struct other) {
      if (ReferenceEquals(other, null)) {
        return false;
      }
      if (ReferenceEquals(other, this)) {
        return true;
      }
      if (!Fields.Equals(other.Fields)) return false;
      return true;
    }

    public override int GetHashCode() {
      int hash = 1;
      hash ^= Fields.GetHashCode();
      return hash;
    }

    public override string ToString() {
      return pb::JsonFormatter.Default.Format(this);
    }

    public void WriteTo(pb::CodedOutputStream output) {
      fields_.WriteTo(output, _map_fields_codec);
    }

    public int CalculateSize() {
      int size = 0;
      size += fields_.CalculateSize(_map_fields_codec);
      return size;
    }

    public void MergeFrom(Struct other) {
      if (other == null) {
        return;
      }
      fields_.Add(other.fields_);
    }

    public void MergeFrom(pb::CodedInputStream input) {
      uint tag;
      while (input.ReadTag(out tag)) {
        switch(tag) {
          case 0:
            throw pb::InvalidProtocolBufferException.InvalidTag();
          default:
            if (pb::WireFormat.IsEndGroupTag(tag)) {
              return;
            }
            break;
          case 10: {
            fields_.AddEntriesFrom(input, _map_fields_codec);
            break;
          }
        }
      }
    }

  }

  [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
  public sealed partial class Value : pb::IMessage<Value> {
    private static readonly pb::MessageParser<Value> _parser = new pb::MessageParser<Value>(() => new Value());
    public static pb::MessageParser<Value> Parser { get { return _parser; } }

    private static readonly string[] _fieldNames = new string[] { "bool_value", "list_value", "null_value", "number_value", "string_value", "struct_value" };
    private static readonly uint[] _fieldTags = new uint[] { 32, 50, 8, 17, 26, 42 };
    public static pbr::MessageDescriptor Descriptor {
      get { return global::Google.Protobuf.WellKnownTypes.Proto.Struct.Descriptor.MessageTypes[1]; }
    }

    pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
      get { return global::Google.Protobuf.WellKnownTypes.Proto.Struct.internal__static_google_protobuf_Value__FieldAccessorTable; }
    }

    private bool _frozen = false;
    public bool IsFrozen { get { return _frozen; } }

    public Value() {
      OnConstruction();
    }

    partial void OnConstruction();

    public Value(Value other) : this() {
      switch (other.KindCase) {
        case KindOneofCase.NullValue:
          NullValue = other.NullValue;
          break;
        case KindOneofCase.NumberValue:
          NumberValue = other.NumberValue;
          break;
        case KindOneofCase.StringValue:
          StringValue = other.StringValue;
          break;
        case KindOneofCase.BoolValue:
          BoolValue = other.BoolValue;
          break;
        case KindOneofCase.StructValue:
          StructValue = other.StructValue.Clone();
          break;
        case KindOneofCase.ListValue:
          ListValue = other.ListValue.Clone();
          break;
      }

    }

    public Value Clone() {
      return new Value(this);
    }

    public void Freeze() {
      if (IsFrozen) {
        return;
      }
      _frozen = true;
      if (kind_ is IFreezable) ((IFreezable) kind_).Freeze();
    }

    public const int NullValueFieldNumber = 1;
    public global::Google.Protobuf.WellKnownTypes.NullValue NullValue {
      get { return kindCase_ == KindOneofCase.NullValue ? (global::Google.Protobuf.WellKnownTypes.NullValue) kind_ : global::Google.Protobuf.WellKnownTypes.NullValue.NULL_VALUE; }
      set {
        pb::Freezable.CheckMutable(this);
        kind_ = value;
        kindCase_ = KindOneofCase.NullValue;
      }
    }

    public const int NumberValueFieldNumber = 2;
    public double NumberValue {
      get { return kindCase_ == KindOneofCase.NumberValue ? (double) kind_ : 0D; }
      set {
        pb::Freezable.CheckMutable(this);
        kind_ = value;
        kindCase_ = KindOneofCase.NumberValue;
      }
    }

    public const int StringValueFieldNumber = 3;
    public string StringValue {
      get { return kindCase_ == KindOneofCase.StringValue ? (string) kind_ : ""; }
      set {
        pb::Freezable.CheckMutable(this);
        kind_ = value ?? "";
        kindCase_ = KindOneofCase.StringValue;
      }
    }

    public const int BoolValueFieldNumber = 4;
    public bool BoolValue {
      get { return kindCase_ == KindOneofCase.BoolValue ? (bool) kind_ : false; }
      set {
        pb::Freezable.CheckMutable(this);
        kind_ = value;
        kindCase_ = KindOneofCase.BoolValue;
      }
    }

    public const int StructValueFieldNumber = 5;
    public global::Google.Protobuf.WellKnownTypes.Struct StructValue {
      get { return kindCase_ == KindOneofCase.StructValue ? (global::Google.Protobuf.WellKnownTypes.Struct) kind_ : null; }
      set {
        pb::Freezable.CheckMutable(this);
        kind_ = value;
        kindCase_ = value == null ? KindOneofCase.None : KindOneofCase.StructValue;
      }
    }

    public const int ListValueFieldNumber = 6;
    public global::Google.Protobuf.WellKnownTypes.ListValue ListValue {
      get { return kindCase_ == KindOneofCase.ListValue ? (global::Google.Protobuf.WellKnownTypes.ListValue) kind_ : null; }
      set {
        pb::Freezable.CheckMutable(this);
        kind_ = value;
        kindCase_ = value == null ? KindOneofCase.None : KindOneofCase.ListValue;
      }
    }

    private object kind_;
    public enum KindOneofCase {
      None = 0,
      NullValue = 1,
      NumberValue = 2,
      StringValue = 3,
      BoolValue = 4,
      StructValue = 5,
      ListValue = 6,
    }
    private KindOneofCase kindCase_ = KindOneofCase.None;
    public KindOneofCase KindCase {
      get { return kindCase_; }
    }

    public void ClearKind() {
      pb::Freezable.CheckMutable(this);
      kindCase_ = KindOneofCase.None;
      kind_ = null;
    }

    public override bool Equals(object other) {
      return Equals(other as Value);
    }

    public bool Equals(Value other) {
      if (ReferenceEquals(other, null)) {
        return false;
      }
      if (ReferenceEquals(other, this)) {
        return true;
      }
      if (NullValue != other.NullValue) return false;
      if (NumberValue != other.NumberValue) return false;
      if (StringValue != other.StringValue) return false;
      if (BoolValue != other.BoolValue) return false;
      if (!object.Equals(StructValue, other.StructValue)) return false;
      if (!object.Equals(ListValue, other.ListValue)) return false;
      return true;
    }

    public override int GetHashCode() {
      int hash = 1;
      if (kindCase_ == KindOneofCase.NullValue) hash ^= NullValue.GetHashCode();
      if (kindCase_ == KindOneofCase.NumberValue) hash ^= NumberValue.GetHashCode();
      if (kindCase_ == KindOneofCase.StringValue) hash ^= StringValue.GetHashCode();
      if (kindCase_ == KindOneofCase.BoolValue) hash ^= BoolValue.GetHashCode();
      if (kindCase_ == KindOneofCase.StructValue) hash ^= StructValue.GetHashCode();
      if (kindCase_ == KindOneofCase.ListValue) hash ^= ListValue.GetHashCode();
      return hash;
    }

    public override string ToString() {
      return pb::JsonFormatter.Default.Format(this);
    }

    public void WriteTo(pb::CodedOutputStream output) {
      if (kindCase_ == KindOneofCase.NullValue) {
        output.WriteRawTag(8);
        output.WriteEnum((int) NullValue);
      }
      if (kindCase_ == KindOneofCase.NumberValue) {
        output.WriteRawTag(17);
        output.WriteDouble(NumberValue);
      }
      if (kindCase_ == KindOneofCase.StringValue) {
        output.WriteRawTag(26);
        output.WriteString(StringValue);
      }
      if (kindCase_ == KindOneofCase.BoolValue) {
        output.WriteRawTag(32);
        output.WriteBool(BoolValue);
      }
      if (kindCase_ == KindOneofCase.StructValue) {
        output.WriteRawTag(42);
        output.WriteMessage(StructValue);
      }
      if (kindCase_ == KindOneofCase.ListValue) {
        output.WriteRawTag(50);
        output.WriteMessage(ListValue);
      }
    }

    public int CalculateSize() {
      int size = 0;
      if (kindCase_ == KindOneofCase.NullValue) {
        size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) NullValue);
      }
      if (kindCase_ == KindOneofCase.NumberValue) {
        size += 1 + 8;
      }
      if (kindCase_ == KindOneofCase.StringValue) {
        size += 1 + pb::CodedOutputStream.ComputeStringSize(StringValue);
      }
      if (kindCase_ == KindOneofCase.BoolValue) {
        size += 1 + 1;
      }
      if (kindCase_ == KindOneofCase.StructValue) {
        size += 1 + pb::CodedOutputStream.ComputeMessageSize(StructValue);
      }
      if (kindCase_ == KindOneofCase.ListValue) {
        size += 1 + pb::CodedOutputStream.ComputeMessageSize(ListValue);
      }
      return size;
    }

    public void MergeFrom(Value other) {
      if (other == null) {
        return;
      }
      switch (other.KindCase) {
        case KindOneofCase.NullValue:
          NullValue = other.NullValue;
          break;
        case KindOneofCase.NumberValue:
          NumberValue = other.NumberValue;
          break;
        case KindOneofCase.StringValue:
          StringValue = other.StringValue;
          break;
        case KindOneofCase.BoolValue:
          BoolValue = other.BoolValue;
          break;
        case KindOneofCase.StructValue:
          StructValue = other.StructValue;
          break;
        case KindOneofCase.ListValue:
          ListValue = other.ListValue;
          break;
      }

    }

    public void MergeFrom(pb::CodedInputStream input) {
      uint tag;
      while (input.ReadTag(out tag)) {
        switch(tag) {
          case 0:
            throw pb::InvalidProtocolBufferException.InvalidTag();
          default:
            if (pb::WireFormat.IsEndGroupTag(tag)) {
              return;
            }
            break;
          case 8: {
            kind_ = input.ReadEnum();
            kindCase_ = KindOneofCase.NullValue;
            break;
          }
          case 17: {
            NumberValue = input.ReadDouble();
            break;
          }
          case 26: {
            StringValue = input.ReadString();
            break;
          }
          case 32: {
            BoolValue = input.ReadBool();
            break;
          }
          case 42: {
            global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct();
            if (kindCase_ == KindOneofCase.StructValue) {
              subBuilder.MergeFrom(StructValue);
            }
            input.ReadMessage(subBuilder);
            StructValue = subBuilder;
            break;
          }
          case 50: {
            global::Google.Protobuf.WellKnownTypes.ListValue subBuilder = new global::Google.Protobuf.WellKnownTypes.ListValue();
            if (kindCase_ == KindOneofCase.ListValue) {
              subBuilder.MergeFrom(ListValue);
            }
            input.ReadMessage(subBuilder);
            ListValue = subBuilder;
            break;
          }
        }
      }
    }

  }

  [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
  public sealed partial class ListValue : pb::IMessage<ListValue> {
    private static readonly pb::MessageParser<ListValue> _parser = new pb::MessageParser<ListValue>(() => new ListValue());
    public static pb::MessageParser<ListValue> Parser { get { return _parser; } }

    private static readonly string[] _fieldNames = new string[] { "values" };
    private static readonly uint[] _fieldTags = new uint[] { 10 };
    public static pbr::MessageDescriptor Descriptor {
      get { return global::Google.Protobuf.WellKnownTypes.Proto.Struct.Descriptor.MessageTypes[2]; }
    }

    pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
      get { return global::Google.Protobuf.WellKnownTypes.Proto.Struct.internal__static_google_protobuf_ListValue__FieldAccessorTable; }
    }

    private bool _frozen = false;
    public bool IsFrozen { get { return _frozen; } }

    public ListValue() {
      OnConstruction();
    }

    partial void OnConstruction();

    public ListValue(ListValue other) : this() {
      values_ = other.values_.Clone();
    }

    public ListValue Clone() {
      return new ListValue(this);
    }

    public void Freeze() {
      if (IsFrozen) {
        return;
      }
      _frozen = true;
      values_.Freeze();
    }

    public const int ValuesFieldNumber = 1;
    private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Value> _repeated_values_codec
        = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Value.Parser);
    private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value> values_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value>();
    public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Value> Values {
      get { return values_; }
    }

    public override bool Equals(object other) {
      return Equals(other as ListValue);
    }

    public bool Equals(ListValue other) {
      if (ReferenceEquals(other, null)) {
        return false;
      }
      if (ReferenceEquals(other, this)) {
        return true;
      }
      if(!values_.Equals(other.values_)) return false;
      return true;
    }

    public override int GetHashCode() {
      int hash = 1;
      hash ^= values_.GetHashCode();
      return hash;
    }

    public override string ToString() {
      return pb::JsonFormatter.Default.Format(this);
    }

    public void WriteTo(pb::CodedOutputStream output) {
      values_.WriteTo(output, _repeated_values_codec);
    }

    public int CalculateSize() {
      int size = 0;
      size += values_.CalculateSize(_repeated_values_codec);
      return size;
    }

    public void MergeFrom(ListValue other) {
      if (other == null) {
        return;
      }
      values_.Add(other.values_);
    }

    public void MergeFrom(pb::CodedInputStream input) {
      uint tag;
      while (input.ReadTag(out tag)) {
        switch(tag) {
          case 0:
            throw pb::InvalidProtocolBufferException.InvalidTag();
          default:
            if (pb::WireFormat.IsEndGroupTag(tag)) {
              return;
            }
            break;
          case 10: {
            values_.AddEntriesFrom(input, _repeated_values_codec);
            break;
          }
        }
      }
    }

  }

  #endregion

}

#endregion Designer generated code