Duration.pbobjc.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. * Example 1: Compute Duration from two Timestamps in pseudo code.
  51. *
  52. * Timestamp start = ...;
  53. * Timestamp end = ...;
  54. * Duration duration = ...;
  55. *
  56. * duration.seconds = end.seconds - start.seconds;
  57. * duration.nanos = end.nanos - start.nanos;
  58. *
  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. * }
  66. *
  67. * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
  68. *
  69. * Timestamp start = ...;
  70. * Duration duration = ...;
  71. * Timestamp end = ...;
  72. *
  73. * end.seconds = start.seconds + duration.seconds;
  74. * end.nanos = start.nanos + duration.nanos;
  75. *
  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. *
  84. * Example 3: Compute Duration from datetime.timedelta in Python.
  85. *
  86. * td = datetime.timedelta(days=3, minutes=10)
  87. * duration = Duration()
  88. * duration.FromTimedelta(td)
  89. **/
  90. @interface GPBDuration : GPBMessage
  91. /**
  92. * Signed seconds of the span of time. Must be from -315,576,000,000
  93. * to +315,576,000,000 inclusive.
  94. **/
  95. @property(nonatomic, readwrite) int64_t seconds;
  96. /**
  97. * Signed fractions of a second at nanosecond resolution of the span
  98. * of time. Durations less than one second are represented with a 0
  99. * `seconds` field and a positive or negative `nanos` field. For durations
  100. * of one second or more, a non-zero value for the `nanos` field must be
  101. * of the same sign as the `seconds` field. Must be from -999,999,999
  102. * to +999,999,999 inclusive.
  103. **/
  104. @property(nonatomic, readwrite) int32_t nanos;
  105. @end
  106. NS_ASSUME_NONNULL_END
  107. CF_EXTERN_C_END
  108. #pragma clang diagnostic pop
  109. // @@protoc_insertion_point(global_scope)