duration.pb.dart 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. //
  2. // Generated code. Do not modify.
  3. // source: google/protobuf/duration.proto
  4. //
  5. // @dart = 2.12
  6. // ignore_for_file: annotate_overrides, camel_case_types, comment_references
  7. // ignore_for_file: constant_identifier_names, library_prefixes
  8. // ignore_for_file: non_constant_identifier_names, prefer_final_fields
  9. // ignore_for_file: unnecessary_import, unnecessary_this, unused_import
  10. import 'dart:core' as $core;
  11. import 'package:fixnum/fixnum.dart' as $fixnum;
  12. import 'package:protobuf/protobuf.dart' as $pb;
  13. import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
  14. /// A Duration represents a signed, fixed-length span of time represented
  15. /// as a count of seconds and fractions of seconds at nanosecond
  16. /// resolution. It is independent of any calendar and concepts like "day"
  17. /// or "month". It is related to Timestamp in that the difference between
  18. /// two Timestamp values is a Duration and it can be added or subtracted
  19. /// from a Timestamp. Range is approximately +-10,000 years.
  20. ///
  21. /// # Examples
  22. ///
  23. /// Example 1: Compute Duration from two Timestamps in pseudo code.
  24. ///
  25. /// Timestamp start = ...;
  26. /// Timestamp end = ...;
  27. /// Duration duration = ...;
  28. ///
  29. /// duration.seconds = end.seconds - start.seconds;
  30. /// duration.nanos = end.nanos - start.nanos;
  31. ///
  32. /// if (duration.seconds < 0 && duration.nanos > 0) {
  33. /// duration.seconds += 1;
  34. /// duration.nanos -= 1000000000;
  35. /// } else if (duration.seconds > 0 && duration.nanos < 0) {
  36. /// duration.seconds -= 1;
  37. /// duration.nanos += 1000000000;
  38. /// }
  39. ///
  40. /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
  41. ///
  42. /// Timestamp start = ...;
  43. /// Duration duration = ...;
  44. /// Timestamp end = ...;
  45. ///
  46. /// end.seconds = start.seconds + duration.seconds;
  47. /// end.nanos = start.nanos + duration.nanos;
  48. ///
  49. /// if (end.nanos < 0) {
  50. /// end.seconds -= 1;
  51. /// end.nanos += 1000000000;
  52. /// } else if (end.nanos >= 1000000000) {
  53. /// end.seconds += 1;
  54. /// end.nanos -= 1000000000;
  55. /// }
  56. ///
  57. /// Example 3: Compute Duration from datetime.timedelta in Python.
  58. ///
  59. /// td = datetime.timedelta(days=3, minutes=10)
  60. /// duration = Duration()
  61. /// duration.FromTimedelta(td)
  62. ///
  63. /// # JSON Mapping
  64. ///
  65. /// In JSON format, the Duration type is encoded as a string rather than an
  66. /// object, where the string ends in the suffix "s" (indicating seconds) and
  67. /// is preceded by the number of seconds, with nanoseconds expressed as
  68. /// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
  69. /// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
  70. /// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
  71. /// microsecond should be expressed in JSON format as "3.000001s".
  72. class Duration extends $pb.GeneratedMessage with $mixin.DurationMixin {
  73. factory Duration({
  74. $fixnum.Int64? seconds,
  75. $core.int? nanos,
  76. }) {
  77. final $result = create();
  78. if (seconds != null) {
  79. $result.seconds = seconds;
  80. }
  81. if (nanos != null) {
  82. $result.nanos = nanos;
  83. }
  84. return $result;
  85. }
  86. Duration._() : super();
  87. factory Duration.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
  88. factory Duration.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
  89. static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Duration', package: const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), createEmptyInstance: create, toProto3Json: $mixin.DurationMixin.toProto3JsonHelper, fromProto3Json: $mixin.DurationMixin.fromProto3JsonHelper)
  90. ..aInt64(1, _omitFieldNames ? '' : 'seconds')
  91. ..a<$core.int>(2, _omitFieldNames ? '' : 'nanos', $pb.PbFieldType.O3)
  92. ..hasRequiredFields = false
  93. ;
  94. @$core.Deprecated(
  95. 'Using this can add significant overhead to your binary. '
  96. 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
  97. 'Will be removed in next major version')
  98. Duration clone() => Duration()..mergeFromMessage(this);
  99. @$core.Deprecated(
  100. 'Using this can add significant overhead to your binary. '
  101. 'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
  102. 'Will be removed in next major version')
  103. Duration copyWith(void Function(Duration) updates) => super.copyWith((message) => updates(message as Duration)) as Duration;
  104. $pb.BuilderInfo get info_ => _i;
  105. @$core.pragma('dart2js:noInline')
  106. static Duration create() => Duration._();
  107. Duration createEmptyInstance() => create();
  108. static $pb.PbList<Duration> createRepeated() => $pb.PbList<Duration>();
  109. @$core.pragma('dart2js:noInline')
  110. static Duration getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Duration>(create);
  111. static Duration? _defaultInstance;
  112. /// Signed seconds of the span of time. Must be from -315,576,000,000
  113. /// to +315,576,000,000 inclusive. Note: these bounds are computed from:
  114. /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
  115. @$pb.TagNumber(1)
  116. $fixnum.Int64 get seconds => $_getI64(0);
  117. @$pb.TagNumber(1)
  118. set seconds($fixnum.Int64 v) { $_setInt64(0, v); }
  119. @$pb.TagNumber(1)
  120. $core.bool hasSeconds() => $_has(0);
  121. @$pb.TagNumber(1)
  122. void clearSeconds() => clearField(1);
  123. /// Signed fractions of a second at nanosecond resolution of the span
  124. /// of time. Durations less than one second are represented with a 0
  125. /// `seconds` field and a positive or negative `nanos` field. For durations
  126. /// of one second or more, a non-zero value for the `nanos` field must be
  127. /// of the same sign as the `seconds` field. Must be from -999,999,999
  128. /// to +999,999,999 inclusive.
  129. @$pb.TagNumber(2)
  130. $core.int get nanos => $_getIZ(1);
  131. @$pb.TagNumber(2)
  132. set nanos($core.int v) { $_setSignedInt32(1, v); }
  133. @$pb.TagNumber(2)
  134. $core.bool hasNanos() => $_has(1);
  135. @$pb.TagNumber(2)
  136. void clearNanos() => clearField(2);
  137. }
  138. const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
  139. const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');