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