Duration.pbobjc.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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_GEN_VERSION != 30001
  14. #error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
  15. #endif
  16. // @@protoc_insertion_point(imports)
  17. #pragma clang diagnostic push
  18. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  19. CF_EXTERN_C_BEGIN
  20. NS_ASSUME_NONNULL_BEGIN
  21. #pragma mark - GPBDurationRoot
  22. /// Exposes the extension registry for this file.
  23. ///
  24. /// The base class provides:
  25. /// @code
  26. /// + (GPBExtensionRegistry *)extensionRegistry;
  27. /// @endcode
  28. /// which is a @c GPBExtensionRegistry that includes all the extensions defined by
  29. /// this file and all files that it depends on.
  30. @interface GPBDurationRoot : GPBRootObject
  31. @end
  32. #pragma mark - GPBDuration
  33. typedef GPB_ENUM(GPBDuration_FieldNumber) {
  34. GPBDuration_FieldNumber_Seconds = 1,
  35. GPBDuration_FieldNumber_Nanos = 2,
  36. };
  37. /// A Duration represents a signed, fixed-length span of time represented
  38. /// as a count of seconds and fractions of seconds at nanosecond
  39. /// resolution. It is independent of any calendar and concepts like "day"
  40. /// or "month". It is related to Timestamp in that the difference between
  41. /// two Timestamp values is a Duration and it can be added or subtracted
  42. /// from a Timestamp. Range is approximately +-10,000 years.
  43. ///
  44. /// Example 1: Compute Duration from two Timestamps in pseudo code.
  45. ///
  46. /// Timestamp start = ...;
  47. /// Timestamp end = ...;
  48. /// Duration duration = ...;
  49. ///
  50. /// duration.seconds = end.seconds - start.seconds;
  51. /// duration.nanos = end.nanos - start.nanos;
  52. ///
  53. /// if (duration.seconds < 0 && duration.nanos > 0) {
  54. /// duration.seconds += 1;
  55. /// duration.nanos -= 1000000000;
  56. /// } else if (durations.seconds > 0 && duration.nanos < 0) {
  57. /// duration.seconds -= 1;
  58. /// duration.nanos += 1000000000;
  59. /// }
  60. ///
  61. /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
  62. ///
  63. /// Timestamp start = ...;
  64. /// Duration duration = ...;
  65. /// Timestamp end = ...;
  66. ///
  67. /// end.seconds = start.seconds + duration.seconds;
  68. /// end.nanos = start.nanos + duration.nanos;
  69. ///
  70. /// if (end.nanos < 0) {
  71. /// end.seconds -= 1;
  72. /// end.nanos += 1000000000;
  73. /// } else if (end.nanos >= 1000000000) {
  74. /// end.seconds += 1;
  75. /// end.nanos -= 1000000000;
  76. /// }
  77. @interface GPBDuration : GPBMessage
  78. /// Signed seconds of the span of time. Must be from -315,576,000,000
  79. /// to +315,576,000,000 inclusive.
  80. @property(nonatomic, readwrite) int64_t seconds;
  81. /// Signed fractions of a second at nanosecond resolution of the span
  82. /// of time. Durations less than one second are represented with a 0
  83. /// `seconds` field and a positive or negative `nanos` field. For durations
  84. /// of one second or more, a non-zero value for the `nanos` field must be
  85. /// of the same sign as the `seconds` field. Must be from -999,999,999
  86. /// to +999,999,999 inclusive.
  87. @property(nonatomic, readwrite) int32_t nanos;
  88. @end
  89. NS_ASSUME_NONNULL_END
  90. CF_EXTERN_C_END
  91. #pragma clang diagnostic pop
  92. // @@protoc_insertion_point(global_scope)