blob: f17358f4b383bb39de23c135c56f143e55142c05 [file] [log] [blame]
Jon Skeet62a4aa52015-07-14 14:26:49 +01001// Generated by the protocol buffer compiler. DO NOT EDIT!
2// source: google/protobuf/duration.proto
3#pragma warning disable 1591, 0612, 3021
4#region Designer generated code
5
6using pb = global::Google.Protobuf;
7using pbc = global::Google.Protobuf.Collections;
8using pbr = global::Google.Protobuf.Reflection;
9using scg = global::System.Collections.Generic;
10namespace Google.Protobuf.WellKnownTypes {
11
Jon Skeet284bb452015-11-05 09:13:53 +000012 /// <summary>Holder for reflection information generated from google/protobuf/duration.proto</summary>
13 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
14 public static partial class DurationReflection {
Jon Skeet62a4aa52015-07-14 14:26:49 +010015
Jon Skeet284bb452015-11-05 09:13:53 +000016 #region Descriptor
17 /// <summary>File descriptor for google/protobuf/duration.proto</summary>
18 public static pbr::FileDescriptor Descriptor {
19 get { return descriptor; }
Jon Skeet62a4aa52015-07-14 14:26:49 +010020 }
Jon Skeet284bb452015-11-05 09:13:53 +000021 private static pbr::FileDescriptor descriptor;
22
23 static DurationReflection() {
24 byte[] descriptorData = global::System.Convert.FromBase64String(
25 string.Concat(
26 "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90",
27 "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg",
Jon Skeetc588ac42016-04-20 17:19:42 +010028 "ASgFQnwKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAVoq",
29 "Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2R1cmF0aW9uoAEB",
30 "ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90",
31 "bzM="));
Jon Skeeta2667aa2015-11-19 17:14:23 +000032 descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
Jon Skeet284bb452015-11-05 09:13:53 +000033 new pbr::FileDescriptor[] { },
Jon Skeetb6159962016-02-04 07:08:55 +000034 new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
35 new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Duration), global::Google.Protobuf.WellKnownTypes.Duration.Parser, new[]{ "Seconds", "Nanos" }, null, null, null)
Jon Skeet284bb452015-11-05 09:13:53 +000036 }));
37 }
38 #endregion
39
Jon Skeet62a4aa52015-07-14 14:26:49 +010040 }
41 #region Messages
Jon Skeet18e0a2e2015-10-01 10:38:01 +010042 /// <summary>
43 /// A Duration represents a signed, fixed-length span of time represented
44 /// as a count of seconds and fractions of seconds at nanosecond
45 /// resolution. It is independent of any calendar and concepts like "day"
46 /// or "month". It is related to Timestamp in that the difference between
47 /// two Timestamp values is a Duration and it can be added or subtracted
48 /// from a Timestamp. Range is approximately +-10,000 years.
Jon Skeetcff900e2015-11-06 18:38:31 +000049 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010050 /// Example 1: Compute Duration from two Timestamps in pseudo code.
Jon Skeetcff900e2015-11-06 18:38:31 +000051 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010052 /// Timestamp start = ...;
53 /// Timestamp end = ...;
54 /// Duration duration = ...;
Jon Skeetcff900e2015-11-06 18:38:31 +000055 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010056 /// duration.seconds = end.seconds - start.seconds;
57 /// duration.nanos = end.nanos - start.nanos;
Jon Skeetcff900e2015-11-06 18:38:31 +000058 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010059 /// if (duration.seconds &lt; 0 &amp;&amp; duration.nanos > 0) {
60 /// duration.seconds += 1;
61 /// duration.nanos -= 1000000000;
62 /// } else if (durations.seconds > 0 &amp;&amp; duration.nanos &lt; 0) {
63 /// duration.seconds -= 1;
64 /// duration.nanos += 1000000000;
65 /// }
Jon Skeetcff900e2015-11-06 18:38:31 +000066 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010067 /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
Jon Skeetcff900e2015-11-06 18:38:31 +000068 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010069 /// Timestamp start = ...;
70 /// Duration duration = ...;
71 /// Timestamp end = ...;
Jon Skeetcff900e2015-11-06 18:38:31 +000072 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010073 /// end.seconds = start.seconds + duration.seconds;
74 /// end.nanos = start.nanos + duration.nanos;
Jon Skeetcff900e2015-11-06 18:38:31 +000075 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010076 /// if (end.nanos &lt; 0) {
77 /// end.seconds -= 1;
78 /// end.nanos += 1000000000;
79 /// } else if (end.nanos >= 1000000000) {
80 /// end.seconds += 1;
81 /// end.nanos -= 1000000000;
82 /// }
83 /// </summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +010084 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
85 public sealed partial class Duration : pb::IMessage<Duration> {
86 private static readonly pb::MessageParser<Duration> _parser = new pb::MessageParser<Duration>(() => new Duration());
87 public static pb::MessageParser<Duration> Parser { get { return _parser; } }
88
Jon Skeet62a4aa52015-07-14 14:26:49 +010089 public static pbr::MessageDescriptor Descriptor {
Jon Skeet284bb452015-11-05 09:13:53 +000090 get { return global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes[0]; }
Jon Skeet62a4aa52015-07-14 14:26:49 +010091 }
92
Jon Skeet96cffaa2015-07-20 19:25:07 +010093 pbr::MessageDescriptor pb::IMessage.Descriptor {
94 get { return Descriptor; }
Jon Skeet62a4aa52015-07-14 14:26:49 +010095 }
96
Jon Skeet62a4aa52015-07-14 14:26:49 +010097 public Duration() {
98 OnConstruction();
99 }
100
101 partial void OnConstruction();
102
103 public Duration(Duration other) : this() {
104 seconds_ = other.seconds_;
105 nanos_ = other.nanos_;
106 }
107
108 public Duration Clone() {
109 return new Duration(this);
110 }
111
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100112 /// <summary>Field number for the "seconds" field.</summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +0100113 public const int SecondsFieldNumber = 1;
114 private long seconds_;
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100115 /// <summary>
116 /// Signed seconds of the span of time. Must be from -315,576,000,000
117 /// to +315,576,000,000 inclusive.
118 /// </summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +0100119 public long Seconds {
120 get { return seconds_; }
121 set {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100122 seconds_ = value;
123 }
124 }
125
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100126 /// <summary>Field number for the "nanos" field.</summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +0100127 public const int NanosFieldNumber = 2;
128 private int nanos_;
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100129 /// <summary>
130 /// Signed fractions of a second at nanosecond resolution of the span
131 /// of time. Durations less than one second are represented with a 0
132 /// `seconds` field and a positive or negative `nanos` field. For durations
133 /// of one second or more, a non-zero value for the `nanos` field must be
134 /// of the same sign as the `seconds` field. Must be from -999,999,999
135 /// to +999,999,999 inclusive.
136 /// </summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +0100137 public int Nanos {
138 get { return nanos_; }
139 set {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100140 nanos_ = value;
141 }
142 }
143
144 public override bool Equals(object other) {
145 return Equals(other as Duration);
146 }
147
148 public bool Equals(Duration other) {
149 if (ReferenceEquals(other, null)) {
150 return false;
151 }
152 if (ReferenceEquals(other, this)) {
153 return true;
154 }
155 if (Seconds != other.Seconds) return false;
156 if (Nanos != other.Nanos) return false;
157 return true;
158 }
159
160 public override int GetHashCode() {
161 int hash = 1;
162 if (Seconds != 0L) hash ^= Seconds.GetHashCode();
163 if (Nanos != 0) hash ^= Nanos.GetHashCode();
164 return hash;
165 }
166
167 public override string ToString() {
Jon Skeetadee6fe2015-12-15 09:24:04 +0000168 return pb::JsonFormatter.ToDiagnosticString(this);
Jon Skeet62a4aa52015-07-14 14:26:49 +0100169 }
170
171 public void WriteTo(pb::CodedOutputStream output) {
172 if (Seconds != 0L) {
173 output.WriteRawTag(8);
174 output.WriteInt64(Seconds);
175 }
176 if (Nanos != 0) {
177 output.WriteRawTag(16);
178 output.WriteInt32(Nanos);
179 }
180 }
181
182 public int CalculateSize() {
183 int size = 0;
184 if (Seconds != 0L) {
185 size += 1 + pb::CodedOutputStream.ComputeInt64Size(Seconds);
186 }
187 if (Nanos != 0) {
188 size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos);
189 }
190 return size;
191 }
192
193 public void MergeFrom(Duration other) {
194 if (other == null) {
195 return;
196 }
197 if (other.Seconds != 0L) {
198 Seconds = other.Seconds;
199 }
200 if (other.Nanos != 0) {
201 Nanos = other.Nanos;
202 }
203 }
204
205 public void MergeFrom(pb::CodedInputStream input) {
206 uint tag;
Jon Skeet1a57ad82015-08-05 11:23:52 +0100207 while ((tag = input.ReadTag()) != 0) {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100208 switch(tag) {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100209 default:
Jon Skeet5bdc5722015-08-06 11:40:43 +0100210 input.SkipLastField();
Jon Skeet62a4aa52015-07-14 14:26:49 +0100211 break;
212 case 8: {
213 Seconds = input.ReadInt64();
214 break;
215 }
216 case 16: {
217 Nanos = input.ReadInt32();
218 break;
219 }
220 }
221 }
222 }
223
224 }
225
226 #endregion
227
228}
229
230#endregion Designer generated code