TimeZoneInfo.d.hpp (4347B)
1 #ifndef icu4x_TimeZoneInfo_D_HPP 2 #define icu4x_TimeZoneInfo_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 IsoDate; } 16 class IsoDate; 17 namespace capi { struct Time; } 18 class Time; 19 namespace capi { struct TimeZone; } 20 class TimeZone; 21 namespace capi { struct TimeZoneInfo; } 22 class TimeZoneInfo; 23 namespace capi { struct UtcOffset; } 24 class UtcOffset; 25 namespace capi { struct VariantOffsetsCalculator; } 26 class VariantOffsetsCalculator; 27 struct IsoDateTime; 28 class TimeZoneVariant; 29 } 30 31 32 namespace icu4x { 33 namespace capi { 34 struct TimeZoneInfo; 35 } // namespace capi 36 } // namespace 37 38 namespace icu4x { 39 /** 40 * See the [Rust documentation for `TimeZoneInfo`](https://docs.rs/icu/latest/icu/time/struct.TimeZoneInfo.html) for more information. 41 */ 42 class TimeZoneInfo { 43 public: 44 45 /** 46 * Creates a time zone for UTC (Coordinated Universal Time). 47 * 48 * See the [Rust documentation for `utc`](https://docs.rs/icu/latest/icu/time/struct.TimeZoneInfo.html#method.utc) for more information. 49 */ 50 inline static std::unique_ptr<icu4x::TimeZoneInfo> utc(); 51 52 /** 53 * Creates a time zone info from parts. 54 */ 55 inline static std::unique_ptr<icu4x::TimeZoneInfo> from_parts(const icu4x::TimeZone& id, const icu4x::UtcOffset* offset, std::optional<icu4x::TimeZoneVariant> variant); 56 57 /** 58 * See the [Rust documentation for `id`](https://docs.rs/icu/latest/icu/time/struct.TimeZoneInfo.html#method.id) for more information. 59 */ 60 inline std::unique_ptr<icu4x::TimeZone> id() const; 61 62 /** 63 * Sets the datetime at which to interpret the time zone 64 * for display name lookup. 65 * 66 * Notes: 67 * 68 * - If not set, the formatting datetime is used if possible. 69 * - The constraints are the same as with `ZoneNameTimestamp` in Rust. 70 * - Set to year 1000 or 9999 for a reference far in the past or future. 71 * 72 * See the [Rust documentation for `at_date_time_iso`](https://docs.rs/icu/latest/icu/time/struct.TimeZoneInfo.html#method.at_date_time_iso) for more information. 73 * 74 * Additional information: [1](https://docs.rs/icu/latest/icu/time/zone/struct.ZoneNameTimestamp.html) 75 */ 76 inline std::unique_ptr<icu4x::TimeZoneInfo> at_date_time_iso(const icu4x::IsoDate& date, const icu4x::Time& time) const; 77 78 /** 79 * See the [Rust documentation for `zone_name_timestamp`](https://docs.rs/icu/latest/icu/time/struct.TimeZoneInfo.html#method.zone_name_timestamp) for more information. 80 */ 81 inline std::optional<icu4x::IsoDateTime> zone_name_date_time() const; 82 83 /** 84 * See the [Rust documentation for `with_variant`](https://docs.rs/icu/latest/icu/time/struct.TimeZoneInfo.html#method.with_variant) for more information. 85 */ 86 inline std::unique_ptr<icu4x::TimeZoneInfo> with_variant(icu4x::TimeZoneVariant time_variant) const; 87 88 /** 89 * Infers the zone variant. 90 * 91 * Requires the offset and local time to be set. 92 * 93 * See the [Rust documentation for `infer_variant`](https://docs.rs/icu/latest/icu/time/struct.TimeZoneInfo.html#method.infer_variant) for more information. 94 * 95 * Additional information: [1](https://docs.rs/icu/latest/icu/time/zone/enum.TimeZoneVariant.html) 96 */ 97 inline std::optional<std::monostate> infer_variant(const icu4x::VariantOffsetsCalculator& offset_calculator); 98 99 /** 100 * See the [Rust documentation for `variant`](https://docs.rs/icu/latest/icu/time/struct.TimeZoneInfo.html#method.variant) for more information. 101 */ 102 inline std::optional<icu4x::TimeZoneVariant> variant() const; 103 104 inline const icu4x::capi::TimeZoneInfo* AsFFI() const; 105 inline icu4x::capi::TimeZoneInfo* AsFFI(); 106 inline static const icu4x::TimeZoneInfo* FromFFI(const icu4x::capi::TimeZoneInfo* ptr); 107 inline static icu4x::TimeZoneInfo* FromFFI(icu4x::capi::TimeZoneInfo* ptr); 108 inline static void operator delete(void* ptr); 109 private: 110 TimeZoneInfo() = delete; 111 TimeZoneInfo(const icu4x::TimeZoneInfo&) = delete; 112 TimeZoneInfo(icu4x::TimeZoneInfo&&) noexcept = delete; 113 TimeZoneInfo operator=(const icu4x::TimeZoneInfo&) = delete; 114 TimeZoneInfo operator=(icu4x::TimeZoneInfo&&) noexcept = delete; 115 static void operator delete[](void*, size_t) = delete; 116 }; 117 118 } // namespace 119 #endif // icu4x_TimeZoneInfo_D_HPP