diff options
author | Jon Skeet <jonskeet@google.com> | 2015-09-04 12:41:14 +0100 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2015-11-03 19:05:11 +0000 |
commit | fb2488225fbd239f7880e3b493cbfd2f19da755b (patch) | |
tree | e51173d483b91a77708dd3bdbffa1577bf89bbec /csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs | |
parent | aa3675415ec8da317793a3e151e44daaebc21ff8 (diff) | |
download | protobuf-fb2488225fbd239f7880e3b493cbfd2f19da755b.tar.gz protobuf-fb2488225fbd239f7880e3b493cbfd2f19da755b.tar.bz2 protobuf-fb2488225fbd239f7880e3b493cbfd2f19da755b.zip |
Implement JSON parsing in C#.
This includes all the well-known types except Any.
Some aspects are likely to require further work when the details of the JSON parsing expectations are hammered out in more detail. Some of these have "ignored" tests already.
Note that the choice *not* to use Json.NET was made for two reasons:
- Going from 0 dependencies to 1 dependency is a big hit, and there's not much benefit here
- Json.NET parses more leniently than we'd want; accommodating that would be nearly as much work as writing the tokenizer
This only really affects the JsonTokenizer, which could be replaced by Json.NET. The JsonParser code would be about the same length with Json.NET... but I wouldn't be as confident in it.
Diffstat (limited to 'csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs index 18ebefd2..324f48fc 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs @@ -48,6 +48,16 @@ namespace Google.Protobuf.WellKnownTypes public const int NanosecondsPerTick = 100; /// <summary> + /// The maximum permitted number of seconds. + /// </summary> + public const long MaxSeconds = 315576000000L; + + /// <summary> + /// The minimum permitted number of seconds. + /// </summary> + public const long MinSeconds = -315576000000L; + + /// <summary> /// Converts this <see cref="Duration"/> to a <see cref="TimeSpan"/>. /// </summary> /// <remarks>If the duration is not a precise number of ticks, it is truncated towards 0.</remarks> |