• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // <auto-generated>
2 //     Generated by the protocol buffer compiler.  DO NOT EDIT!
3 //     source: google/protobuf/duration.proto
4 // </auto-generated>
5 #pragma warning disable 1591, 0612, 3021
6 #region Designer generated code
7 
8 using pb = global::Google.Protobuf;
9 using pbc = global::Google.Protobuf.Collections;
10 using pbr = global::Google.Protobuf.Reflection;
11 using scg = global::System.Collections.Generic;
12 namespace Google.Protobuf.WellKnownTypes {
13 
14   /// <summary>Holder for reflection information generated from google/protobuf/duration.proto</summary>
15   public static partial class DurationReflection {
16 
17     #region Descriptor
18     /// <summary>File descriptor for google/protobuf/duration.proto</summary>
19     public static pbr::FileDescriptor Descriptor {
20       get { return descriptor; }
21     }
22     private static pbr::FileDescriptor descriptor;
23 
DurationReflection()24     static DurationReflection() {
25       byte[] descriptorData = global::System.Convert.FromBase64String(
26           string.Concat(
27             "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90",
28             "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg",
29             "ASgFQnwKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAVoq",
30             "Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2R1cmF0aW9u+AEB",
31             "ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90",
32             "bzM="));
33       descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
34           new pbr::FileDescriptor[] { },
35           new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
36             new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Duration), global::Google.Protobuf.WellKnownTypes.Duration.Parser, new[]{ "Seconds", "Nanos" }, null, null, null, null)
37           }));
38     }
39     #endregion
40 
41   }
42   #region Messages
43   /// <summary>
44   /// A Duration represents a signed, fixed-length span of time represented
45   /// as a count of seconds and fractions of seconds at nanosecond
46   /// resolution. It is independent of any calendar and concepts like "day"
47   /// or "month". It is related to Timestamp in that the difference between
48   /// two Timestamp values is a Duration and it can be added or subtracted
49   /// from a Timestamp. Range is approximately +-10,000 years.
50   ///
51   /// # Examples
52   ///
53   /// Example 1: Compute Duration from two Timestamps in pseudo code.
54   ///
55   ///     Timestamp start = ...;
56   ///     Timestamp end = ...;
57   ///     Duration duration = ...;
58   ///
59   ///     duration.seconds = end.seconds - start.seconds;
60   ///     duration.nanos = end.nanos - start.nanos;
61   ///
62   ///     if (duration.seconds &lt; 0 &amp;&amp; duration.nanos > 0) {
63   ///       duration.seconds += 1;
64   ///       duration.nanos -= 1000000000;
65   ///     } else if (durations.seconds > 0 &amp;&amp; duration.nanos &lt; 0) {
66   ///       duration.seconds -= 1;
67   ///       duration.nanos += 1000000000;
68   ///     }
69   ///
70   /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
71   ///
72   ///     Timestamp start = ...;
73   ///     Duration duration = ...;
74   ///     Timestamp end = ...;
75   ///
76   ///     end.seconds = start.seconds + duration.seconds;
77   ///     end.nanos = start.nanos + duration.nanos;
78   ///
79   ///     if (end.nanos &lt; 0) {
80   ///       end.seconds -= 1;
81   ///       end.nanos += 1000000000;
82   ///     } else if (end.nanos >= 1000000000) {
83   ///       end.seconds += 1;
84   ///       end.nanos -= 1000000000;
85   ///     }
86   ///
87   /// Example 3: Compute Duration from datetime.timedelta in Python.
88   ///
89   ///     td = datetime.timedelta(days=3, minutes=10)
90   ///     duration = Duration()
91   ///     duration.FromTimedelta(td)
92   ///
93   /// # JSON Mapping
94   ///
95   /// In JSON format, the Duration type is encoded as a string rather than an
96   /// object, where the string ends in the suffix "s" (indicating seconds) and
97   /// is preceded by the number of seconds, with nanoseconds expressed as
98   /// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
99   /// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
100   /// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
101   /// microsecond should be expressed in JSON format as "3.000001s".
102   /// </summary>
103   public sealed partial class Duration : pb::IMessage<Duration> {
104     private static readonly pb::MessageParser<Duration> _parser = new pb::MessageParser<Duration>(() => new Duration());
105     private pb::UnknownFieldSet _unknownFields;
106     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
107     public static pb::MessageParser<Duration> Parser { get { return _parser; } }
108 
109     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
110     public static pbr::MessageDescriptor Descriptor {
111       get { return global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes[0]; }
112     }
113 
114     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
115     pbr::MessageDescriptor pb::IMessage.Descriptor {
116       get { return Descriptor; }
117     }
118 
119     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
Duration()120     public Duration() {
121       OnConstruction();
122     }
123 
OnConstruction()124     partial void OnConstruction();
125 
126     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
Duration(Duration other)127     public Duration(Duration other) : this() {
128       seconds_ = other.seconds_;
129       nanos_ = other.nanos_;
130       _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
131     }
132 
133     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
Clone()134     public Duration Clone() {
135       return new Duration(this);
136     }
137 
138     /// <summary>Field number for the "seconds" field.</summary>
139     public const int SecondsFieldNumber = 1;
140     private long seconds_;
141     /// <summary>
142     /// Signed seconds of the span of time. Must be from -315,576,000,000
143     /// to +315,576,000,000 inclusive. Note: these bounds are computed from:
144     /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
145     /// </summary>
146     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
147     public long Seconds {
148       get { return seconds_; }
149       set {
150         seconds_ = value;
151       }
152     }
153 
154     /// <summary>Field number for the "nanos" field.</summary>
155     public const int NanosFieldNumber = 2;
156     private int nanos_;
157     /// <summary>
158     /// Signed fractions of a second at nanosecond resolution of the span
159     /// of time. Durations less than one second are represented with a 0
160     /// `seconds` field and a positive or negative `nanos` field. For durations
161     /// of one second or more, a non-zero value for the `nanos` field must be
162     /// of the same sign as the `seconds` field. Must be from -999,999,999
163     /// to +999,999,999 inclusive.
164     /// </summary>
165     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
166     public int Nanos {
167       get { return nanos_; }
168       set {
169         nanos_ = value;
170       }
171     }
172 
173     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
Equals(object other)174     public override bool Equals(object other) {
175       return Equals(other as Duration);
176     }
177 
178     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
Equals(Duration other)179     public bool Equals(Duration other) {
180       if (ReferenceEquals(other, null)) {
181         return false;
182       }
183       if (ReferenceEquals(other, this)) {
184         return true;
185       }
186       if (Seconds != other.Seconds) return false;
187       if (Nanos != other.Nanos) return false;
188       return Equals(_unknownFields, other._unknownFields);
189     }
190 
191     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
GetHashCode()192     public override int GetHashCode() {
193       int hash = 1;
194       if (Seconds != 0L) hash ^= Seconds.GetHashCode();
195       if (Nanos != 0) hash ^= Nanos.GetHashCode();
196       if (_unknownFields != null) {
197         hash ^= _unknownFields.GetHashCode();
198       }
199       return hash;
200     }
201 
202     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
ToString()203     public override string ToString() {
204       return pb::JsonFormatter.ToDiagnosticString(this);
205     }
206 
207     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
WriteTo(pb::CodedOutputStream output)208     public void WriteTo(pb::CodedOutputStream output) {
209       if (Seconds != 0L) {
210         output.WriteRawTag(8);
211         output.WriteInt64(Seconds);
212       }
213       if (Nanos != 0) {
214         output.WriteRawTag(16);
215         output.WriteInt32(Nanos);
216       }
217       if (_unknownFields != null) {
218         _unknownFields.WriteTo(output);
219       }
220     }
221 
222     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
CalculateSize()223     public int CalculateSize() {
224       int size = 0;
225       if (Seconds != 0L) {
226         size += 1 + pb::CodedOutputStream.ComputeInt64Size(Seconds);
227       }
228       if (Nanos != 0) {
229         size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos);
230       }
231       if (_unknownFields != null) {
232         size += _unknownFields.CalculateSize();
233       }
234       return size;
235     }
236 
237     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
MergeFrom(Duration other)238     public void MergeFrom(Duration other) {
239       if (other == null) {
240         return;
241       }
242       if (other.Seconds != 0L) {
243         Seconds = other.Seconds;
244       }
245       if (other.Nanos != 0) {
246         Nanos = other.Nanos;
247       }
248       _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
249     }
250 
251     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
MergeFrom(pb::CodedInputStream input)252     public void MergeFrom(pb::CodedInputStream input) {
253       uint tag;
254       while ((tag = input.ReadTag()) != 0) {
255         switch(tag) {
256           default:
257             _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
258             break;
259           case 8: {
260             Seconds = input.ReadInt64();
261             break;
262           }
263           case 16: {
264             Nanos = input.ReadInt32();
265             break;
266           }
267         }
268       }
269     }
270 
271   }
272 
273   #endregion
274 
275 }
276 
277 #endregion Designer generated code
278