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", |
| 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 Skeet | eadd4ca | 2015-11-13 20:04:14 +0000 | [diff] [blame^] | 34 | new pbr::GeneratedCodeInfo(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] | 35 | })); |
| 36 | } |
| 37 | #endregion |
| 38 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 39 | } |
| 40 | #region Messages |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 41 | /// <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 Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 48 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 49 | /// Example 1: Compute Duration from two Timestamps in pseudo code. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 50 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 51 | /// Timestamp start = ...; |
| 52 | /// Timestamp end = ...; |
| 53 | /// Duration duration = ...; |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 54 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 55 | /// duration.seconds = end.seconds - start.seconds; |
| 56 | /// duration.nanos = end.nanos - start.nanos; |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 57 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 58 | /// if (duration.seconds < 0 && duration.nanos > 0) { |
| 59 | /// duration.seconds += 1; |
| 60 | /// duration.nanos -= 1000000000; |
| 61 | /// } else if (durations.seconds > 0 && duration.nanos < 0) { |
| 62 | /// duration.seconds -= 1; |
| 63 | /// duration.nanos += 1000000000; |
| 64 | /// } |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 65 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 66 | /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 67 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 68 | /// Timestamp start = ...; |
| 69 | /// Duration duration = ...; |
| 70 | /// Timestamp end = ...; |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 71 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 72 | /// end.seconds = start.seconds + duration.seconds; |
| 73 | /// end.nanos = start.nanos + duration.nanos; |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 74 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 75 | /// if (end.nanos < 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 Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 83 | [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 Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 88 | public static pbr::MessageDescriptor Descriptor { |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 89 | get { return global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes[0]; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 90 | } |
| 91 | |
Jon Skeet | 96cffaa | 2015-07-20 19:25:07 +0100 | [diff] [blame] | 92 | pbr::MessageDescriptor pb::IMessage.Descriptor { |
| 93 | get { return Descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 94 | } |
| 95 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 96 | 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 Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 111 | /// <summary>Field number for the "seconds" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 112 | public const int SecondsFieldNumber = 1; |
| 113 | private long seconds_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 114 | /// <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 Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 118 | public long Seconds { |
| 119 | get { return seconds_; } |
| 120 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 121 | seconds_ = value; |
| 122 | } |
| 123 | } |
| 124 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 125 | /// <summary>Field number for the "nanos" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 126 | public const int NanosFieldNumber = 2; |
| 127 | private int nanos_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 128 | /// <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 Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 136 | public int Nanos { |
| 137 | get { return nanos_; } |
| 138 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 139 | 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 Skeet | 1a57ad8 | 2015-08-05 11:23:52 +0100 | [diff] [blame] | 206 | while ((tag = input.ReadTag()) != 0) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 207 | switch(tag) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 208 | default: |
Jon Skeet | 5bdc572 | 2015-08-06 11:40:43 +0100 | [diff] [blame] | 209 | input.SkipLastField(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 210 | 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 |