blob: 7b3767a209420c0fe67512d80125606cdd681b98 [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",
28 "ASgFQlAKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAaAB",
29 "AaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJv",
30 "dG8z"));
31 descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
32 new pbr::FileDescriptor[] { },
33 new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
Jon Skeeteadd4ca2015-11-13 20:04:14 +000034 new pbr::GeneratedCodeInfo(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 +000035 }));
36 }
37 #endregion
38
Jon Skeet62a4aa52015-07-14 14:26:49 +010039 }
40 #region Messages
Jon Skeet18e0a2e2015-10-01 10:38:01 +010041 /// <summary>
42 /// A Duration represents a signed, fixed-length span of time represented
43 /// as a count of seconds and fractions of seconds at nanosecond
44 /// resolution. It is independent of any calendar and concepts like "day"
45 /// or "month". It is related to Timestamp in that the difference between
46 /// two Timestamp values is a Duration and it can be added or subtracted
47 /// from a Timestamp. Range is approximately +-10,000 years.
Jon Skeetcff900e2015-11-06 18:38:31 +000048 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010049 /// Example 1: Compute Duration from two Timestamps in pseudo code.
Jon Skeetcff900e2015-11-06 18:38:31 +000050 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010051 /// Timestamp start = ...;
52 /// Timestamp end = ...;
53 /// Duration duration = ...;
Jon Skeetcff900e2015-11-06 18:38:31 +000054 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010055 /// duration.seconds = end.seconds - start.seconds;
56 /// duration.nanos = end.nanos - start.nanos;
Jon Skeetcff900e2015-11-06 18:38:31 +000057 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010058 /// if (duration.seconds &lt; 0 &amp;&amp; duration.nanos > 0) {
59 /// duration.seconds += 1;
60 /// duration.nanos -= 1000000000;
61 /// } else if (durations.seconds > 0 &amp;&amp; duration.nanos &lt; 0) {
62 /// duration.seconds -= 1;
63 /// duration.nanos += 1000000000;
64 /// }
Jon Skeetcff900e2015-11-06 18:38:31 +000065 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010066 /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
Jon Skeetcff900e2015-11-06 18:38:31 +000067 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010068 /// Timestamp start = ...;
69 /// Duration duration = ...;
70 /// Timestamp end = ...;
Jon Skeetcff900e2015-11-06 18:38:31 +000071 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010072 /// end.seconds = start.seconds + duration.seconds;
73 /// end.nanos = start.nanos + duration.nanos;
Jon Skeetcff900e2015-11-06 18:38:31 +000074 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010075 /// if (end.nanos &lt; 0) {
76 /// end.seconds -= 1;
77 /// end.nanos += 1000000000;
78 /// } else if (end.nanos >= 1000000000) {
79 /// end.seconds += 1;
80 /// end.nanos -= 1000000000;
81 /// }
82 /// </summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +010083 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
84 public sealed partial class Duration : pb::IMessage<Duration> {
85 private static readonly pb::MessageParser<Duration> _parser = new pb::MessageParser<Duration>(() => new Duration());
86 public static pb::MessageParser<Duration> Parser { get { return _parser; } }
87
Jon Skeet62a4aa52015-07-14 14:26:49 +010088 public static pbr::MessageDescriptor Descriptor {
Jon Skeet284bb452015-11-05 09:13:53 +000089 get { return global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes[0]; }
Jon Skeet62a4aa52015-07-14 14:26:49 +010090 }
91
Jon Skeet96cffaa2015-07-20 19:25:07 +010092 pbr::MessageDescriptor pb::IMessage.Descriptor {
93 get { return Descriptor; }
Jon Skeet62a4aa52015-07-14 14:26:49 +010094 }
95
Jon Skeet62a4aa52015-07-14 14:26:49 +010096 public Duration() {
97 OnConstruction();
98 }
99
100 partial void OnConstruction();
101
102 public Duration(Duration other) : this() {
103 seconds_ = other.seconds_;
104 nanos_ = other.nanos_;
105 }
106
107 public Duration Clone() {
108 return new Duration(this);
109 }
110
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100111 /// <summary>Field number for the "seconds" field.</summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +0100112 public const int SecondsFieldNumber = 1;
113 private long seconds_;
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100114 /// <summary>
115 /// Signed seconds of the span of time. Must be from -315,576,000,000
116 /// to +315,576,000,000 inclusive.
117 /// </summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +0100118 public long Seconds {
119 get { return seconds_; }
120 set {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100121 seconds_ = value;
122 }
123 }
124
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100125 /// <summary>Field number for the "nanos" field.</summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +0100126 public const int NanosFieldNumber = 2;
127 private int nanos_;
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100128 /// <summary>
129 /// Signed fractions of a second at nanosecond resolution of the span
130 /// of time. Durations less than one second are represented with a 0
131 /// `seconds` field and a positive or negative `nanos` field. For durations
132 /// of one second or more, a non-zero value for the `nanos` field must be
133 /// of the same sign as the `seconds` field. Must be from -999,999,999
134 /// to +999,999,999 inclusive.
135 /// </summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +0100136 public int Nanos {
137 get { return nanos_; }
138 set {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100139 nanos_ = value;
140 }
141 }
142
143 public override bool Equals(object other) {
144 return Equals(other as Duration);
145 }
146
147 public bool Equals(Duration other) {
148 if (ReferenceEquals(other, null)) {
149 return false;
150 }
151 if (ReferenceEquals(other, this)) {
152 return true;
153 }
154 if (Seconds != other.Seconds) return false;
155 if (Nanos != other.Nanos) return false;
156 return true;
157 }
158
159 public override int GetHashCode() {
160 int hash = 1;
161 if (Seconds != 0L) hash ^= Seconds.GetHashCode();
162 if (Nanos != 0) hash ^= Nanos.GetHashCode();
163 return hash;
164 }
165
166 public override string ToString() {
167 return pb::JsonFormatter.Default.Format(this);
168 }
169
170 public void WriteTo(pb::CodedOutputStream output) {
171 if (Seconds != 0L) {
172 output.WriteRawTag(8);
173 output.WriteInt64(Seconds);
174 }
175 if (Nanos != 0) {
176 output.WriteRawTag(16);
177 output.WriteInt32(Nanos);
178 }
179 }
180
181 public int CalculateSize() {
182 int size = 0;
183 if (Seconds != 0L) {
184 size += 1 + pb::CodedOutputStream.ComputeInt64Size(Seconds);
185 }
186 if (Nanos != 0) {
187 size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos);
188 }
189 return size;
190 }
191
192 public void MergeFrom(Duration other) {
193 if (other == null) {
194 return;
195 }
196 if (other.Seconds != 0L) {
197 Seconds = other.Seconds;
198 }
199 if (other.Nanos != 0) {
200 Nanos = other.Nanos;
201 }
202 }
203
204 public void MergeFrom(pb::CodedInputStream input) {
205 uint tag;
Jon Skeet1a57ad82015-08-05 11:23:52 +0100206 while ((tag = input.ReadTag()) != 0) {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100207 switch(tag) {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100208 default:
Jon Skeet5bdc5722015-08-06 11:40:43 +0100209 input.SkipLastField();
Jon Skeet62a4aa52015-07-14 14:26:49 +0100210 break;
211 case 8: {
212 Seconds = input.ReadInt64();
213 break;
214 }
215 case 16: {
216 Nanos = input.ReadInt32();
217 break;
218 }
219 }
220 }
221 }
222
223 }
224
225 #endregion
226
227}
228
229#endregion Designer generated code