UtcOffset.d.hpp (4470B)
1 #ifndef icu4x_UtcOffset_D_HPP 2 #define icu4x_UtcOffset_D_HPP 3 4 #include <stdio.h> 5 #include <stdint.h> 6 #include <stddef.h> 7 #include <stdbool.h> 8 #include <memory> 9 #include <functional> 10 #include <optional> 11 #include <cstdlib> 12 #include "../diplomat_runtime.hpp" 13 14 namespace icu4x { 15 namespace capi { struct UtcOffset; } 16 class UtcOffset; 17 struct TimeZoneInvalidOffsetError; 18 } 19 20 21 namespace icu4x { 22 namespace capi { 23 struct UtcOffset; 24 } // namespace capi 25 } // namespace 26 27 namespace icu4x { 28 /** 29 * See the [Rust documentation for `UtcOffset`](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html) for more information. 30 */ 31 class UtcOffset { 32 public: 33 34 /** 35 * Creates an offset from seconds. 36 * 37 * Errors if the offset seconds are out of range. 38 * 39 * See the [Rust documentation for `try_from_seconds`](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html#method.try_from_seconds) for more information. 40 */ 41 inline static diplomat::result<std::unique_ptr<icu4x::UtcOffset>, icu4x::TimeZoneInvalidOffsetError> from_seconds(int32_t seconds); 42 43 /** 44 * Creates an offset from a string. 45 * 46 * See the [Rust documentation for `try_from_str`](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html#method.try_from_str) for more information. 47 * 48 * Additional information: [1](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html) 49 */ 50 inline static diplomat::result<std::unique_ptr<icu4x::UtcOffset>, icu4x::TimeZoneInvalidOffsetError> from_string(std::string_view offset); 51 52 /** 53 * Returns the value as offset seconds. 54 * 55 * See the [Rust documentation for `offset`](https://docs.rs/icu/latest/icu/time/struct.TimeZoneInfo.html#method.offset) for more information. 56 * 57 * See the [Rust documentation for `to_seconds`](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html#method.to_seconds) for more information. 58 * 59 * Additional information: [1](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html) 60 */ 61 inline int32_t seconds() const; 62 63 /** 64 * Returns whether the offset is positive. 65 * 66 * See the [Rust documentation for `is_non_negative`](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html#method.is_non_negative) for more information. 67 * 68 * Additional information: [1](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html) 69 */ 70 inline bool is_non_negative() const; 71 72 /** 73 * Returns whether the offset is zero. 74 * 75 * See the [Rust documentation for `is_zero`](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html#method.is_zero) for more information. 76 * 77 * Additional information: [1](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html) 78 */ 79 inline bool is_zero() const; 80 81 /** 82 * Returns the hours part of the offset. 83 * 84 * See the [Rust documentation for `hours_part`](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html#method.hours_part) for more information. 85 * 86 * Additional information: [1](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html) 87 */ 88 inline int32_t hours_part() const; 89 90 /** 91 * Returns the minutes part of the offset. 92 * 93 * See the [Rust documentation for `minutes_part`](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html#method.minutes_part) for more information. 94 * 95 * Additional information: [1](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html) 96 */ 97 inline uint32_t minutes_part() const; 98 99 /** 100 * Returns the seconds part of the offset. 101 * 102 * See the [Rust documentation for `seconds_part`](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html#method.seconds_part) for more information. 103 * 104 * Additional information: [1](https://docs.rs/icu/latest/icu/time/zone/struct.UtcOffset.html) 105 */ 106 inline uint32_t seconds_part() const; 107 108 inline const icu4x::capi::UtcOffset* AsFFI() const; 109 inline icu4x::capi::UtcOffset* AsFFI(); 110 inline static const icu4x::UtcOffset* FromFFI(const icu4x::capi::UtcOffset* ptr); 111 inline static icu4x::UtcOffset* FromFFI(icu4x::capi::UtcOffset* ptr); 112 inline static void operator delete(void* ptr); 113 private: 114 UtcOffset() = delete; 115 UtcOffset(const icu4x::UtcOffset&) = delete; 116 UtcOffset(icu4x::UtcOffset&&) noexcept = delete; 117 UtcOffset operator=(const icu4x::UtcOffset&) = delete; 118 UtcOffset operator=(icu4x::UtcOffset&&) noexcept = delete; 119 static void operator delete[](void*, size_t) = delete; 120 }; 121 122 } // namespace 123 #endif // icu4x_UtcOffset_D_HPP