Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 1 | // 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 | |
| 6 | using pb = global::Google.Protobuf; |
| 7 | using pbc = global::Google.Protobuf.Collections; |
| 8 | using pbr = global::Google.Protobuf.Reflection; |
| 9 | using scg = global::System.Collections.Generic; |
| 10 | namespace Google.Protobuf.WellKnownTypes { |
| 11 | |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 12 | /// <summary>Holder for reflection information generated from google/protobuf/duration.proto</summary> |
| 13 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 14 | public static partial class DurationReflection { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 15 | |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 16 | #region Descriptor |
| 17 | /// <summary>File descriptor for google/protobuf/duration.proto</summary> |
| 18 | public static pbr::FileDescriptor Descriptor { |
| 19 | get { return descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 20 | } |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 21 | private static pbr::FileDescriptor descriptor; |
| 22 | |
| 23 | static DurationReflection() { |
| 24 | byte[] descriptorData = global::System.Convert.FromBase64String( |
| 25 | string.Concat( |
| 26 | "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90", |
| 27 | "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg", |
Jon Skeet | c588ac4 | 2016-04-20 17:19:42 +0100 | [diff] [blame^] | 28 | "ASgFQnwKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAVoq", |
| 29 | "Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2R1cmF0aW9uoAEB", |
| 30 | "ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90", |
| 31 | "bzM=")); |
Jon Skeet | a2667aa | 2015-11-19 17:14:23 +0000 | [diff] [blame] | 32 | descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 33 | new pbr::FileDescriptor[] { }, |
Jon Skeet | b615996 | 2016-02-04 07:08:55 +0000 | [diff] [blame] | 34 | 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 Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 36 | })); |
| 37 | } |
| 38 | #endregion |
| 39 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 40 | } |
| 41 | #region Messages |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 42 | /// <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 Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 49 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 50 | /// Example 1: Compute Duration from two Timestamps in pseudo code. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 51 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 52 | /// Timestamp start = ...; |
| 53 | /// Timestamp end = ...; |
| 54 | /// Duration duration = ...; |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 55 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 56 | /// duration.seconds = end.seconds - start.seconds; |
| 57 | /// duration.nanos = end.nanos - start.nanos; |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 58 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 59 | /// if (duration.seconds < 0 && duration.nanos > 0) { |
| 60 | /// duration.seconds += 1; |
| 61 | /// duration.nanos -= 1000000000; |
| 62 | /// } else if (durations.seconds > 0 && duration.nanos < 0) { |
| 63 | /// duration.seconds -= 1; |
| 64 | /// duration.nanos += 1000000000; |
| 65 | /// } |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 66 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 67 | /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 68 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 69 | /// Timestamp start = ...; |
| 70 | /// Duration duration = ...; |
| 71 | /// Timestamp end = ...; |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 72 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 73 | /// end.seconds = start.seconds + duration.seconds; |
| 74 | /// end.nanos = start.nanos + duration.nanos; |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 75 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 76 | /// if (end.nanos < 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 Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 84 | [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 Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 89 | public static pbr::MessageDescriptor Descriptor { |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 90 | get { return global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes[0]; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 91 | } |
| 92 | |
Jon Skeet | 96cffaa | 2015-07-20 19:25:07 +0100 | [diff] [blame] | 93 | pbr::MessageDescriptor pb::IMessage.Descriptor { |
| 94 | get { return Descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 95 | } |
| 96 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 97 | 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 Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 112 | /// <summary>Field number for the "seconds" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 113 | public const int SecondsFieldNumber = 1; |
| 114 | private long seconds_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 115 | /// <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 Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 119 | public long Seconds { |
| 120 | get { return seconds_; } |
| 121 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 122 | seconds_ = value; |
| 123 | } |
| 124 | } |
| 125 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 126 | /// <summary>Field number for the "nanos" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 127 | public const int NanosFieldNumber = 2; |
| 128 | private int nanos_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 129 | /// <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 Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 137 | public int Nanos { |
| 138 | get { return nanos_; } |
| 139 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 140 | 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 Skeet | adee6fe | 2015-12-15 09:24:04 +0000 | [diff] [blame] | 168 | return pb::JsonFormatter.ToDiagnosticString(this); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 169 | } |
| 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 Skeet | 1a57ad8 | 2015-08-05 11:23:52 +0100 | [diff] [blame] | 207 | while ((tag = input.ReadTag()) != 0) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 208 | switch(tag) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 209 | default: |
Jon Skeet | 5bdc572 | 2015-08-06 11:40:43 +0100 | [diff] [blame] | 210 | input.SkipLastField(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 211 | 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 |