You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
4.5 KiB

6 years ago
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: google/protobuf/duration.proto
  3. // This CPP symbol can be defined to use imports that match up to the framework
  4. // imports needed when using CocoaPods.
  5. #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
  6. #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
  7. #endif
  8. #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
  9. #import <Protobuf/GPBProtocolBuffers.h>
  10. #else
  11. #import "GPBProtocolBuffers.h"
  12. #endif
  13. #if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
  14. #error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
  15. #endif
  16. #if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
  17. #error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
  18. #endif
  19. // @@protoc_insertion_point(imports)
  20. #pragma clang diagnostic push
  21. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  22. CF_EXTERN_C_BEGIN
  23. NS_ASSUME_NONNULL_BEGIN
  24. #pragma mark - GPBDurationRoot
  25. /**
  26. * Exposes the extension registry for this file.
  27. *
  28. * The base class provides:
  29. * @code
  30. * + (GPBExtensionRegistry *)extensionRegistry;
  31. * @endcode
  32. * which is a @c GPBExtensionRegistry that includes all the extensions defined by
  33. * this file and all files that it depends on.
  34. **/
  35. @interface GPBDurationRoot : GPBRootObject
  36. @end
  37. #pragma mark - GPBDuration
  38. typedef GPB_ENUM(GPBDuration_FieldNumber) {
  39. GPBDuration_FieldNumber_Seconds = 1,
  40. GPBDuration_FieldNumber_Nanos = 2,
  41. };
  42. /**
  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.
  49. *
  50. * # Examples
  51. *
  52. * Example 1: Compute Duration from two Timestamps in pseudo code.
  53. *
  54. * Timestamp start = ...;
  55. * Timestamp end = ...;
  56. * Duration duration = ...;
  57. *
  58. * duration.seconds = end.seconds - start.seconds;
  59. * duration.nanos = end.nanos - start.nanos;
  60. *
  61. * if (duration.seconds < 0 && duration.nanos > 0) {
  62. * duration.seconds += 1;
  63. * duration.nanos -= 1000000000;
  64. * } else if (durations.seconds > 0 && duration.nanos < 0) {
  65. * duration.seconds -= 1;
  66. * duration.nanos += 1000000000;
  67. * }
  68. *
  69. * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
  70. *
  71. * Timestamp start = ...;
  72. * Duration duration = ...;
  73. * Timestamp end = ...;
  74. *
  75. * end.seconds = start.seconds + duration.seconds;
  76. * end.nanos = start.nanos + duration.nanos;
  77. *
  78. * if (end.nanos < 0) {
  79. * end.seconds -= 1;
  80. * end.nanos += 1000000000;
  81. * } else if (end.nanos >= 1000000000) {
  82. * end.seconds += 1;
  83. * end.nanos -= 1000000000;
  84. * }
  85. *
  86. * Example 3: Compute Duration from datetime.timedelta in Python.
  87. *
  88. * td = datetime.timedelta(days=3, minutes=10)
  89. * duration = Duration()
  90. * duration.FromTimedelta(td)
  91. *
  92. * # JSON Mapping
  93. *
  94. * In JSON format, the Duration type is encoded as a string rather than an
  95. * object, where the string ends in the suffix "s" (indicating seconds) and
  96. * is preceded by the number of seconds, with nanoseconds expressed as
  97. * fractional seconds. For example, 3 seconds with 0 nanoseconds should be
  98. * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
  99. * be expressed in JSON format as "3.000000001s", and 3 seconds and 1
  100. * microsecond should be expressed in JSON format as "3.000001s".
  101. **/
  102. @interface GPBDuration : GPBMessage
  103. /**
  104. * Signed seconds of the span of time. Must be from -315,576,000,000
  105. * to +315,576,000,000 inclusive. Note: these bounds are computed from:
  106. * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
  107. **/
  108. @property(nonatomic, readwrite) int64_t seconds;
  109. /**
  110. * Signed fractions of a second at nanosecond resolution of the span
  111. * of time. Durations less than one second are represented with a 0
  112. * `seconds` field and a positive or negative `nanos` field. For durations
  113. * of one second or more, a non-zero value for the `nanos` field must be
  114. * of the same sign as the `seconds` field. Must be from -999,999,999
  115. * to +999,999,999 inclusive.
  116. **/
  117. @property(nonatomic, readwrite) int32_t nanos;
  118. @end
  119. NS_ASSUME_NONNULL_END
  120. CF_EXTERN_C_END
  121. #pragma clang diagnostic pop
  122. // @@protoc_insertion_point(global_scope)