TimeZone.d.hpp (2687B)
1 #ifndef icu4x_TimeZone_D_HPP 2 #define icu4x_TimeZone_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 TimeZone; } 16 class TimeZone; 17 namespace capi { struct TimeZoneInfo; } 18 class TimeZoneInfo; 19 namespace capi { struct UtcOffset; } 20 class UtcOffset; 21 } 22 23 24 namespace icu4x { 25 namespace capi { 26 struct TimeZone; 27 } // namespace capi 28 } // namespace 29 30 namespace icu4x { 31 /** 32 * See the [Rust documentation for `TimeZone`](https://docs.rs/icu/latest/icu/time/struct.TimeZone.html) for more information. 33 */ 34 class TimeZone { 35 public: 36 37 /** 38 * The unknown time zone. 39 * 40 * See the [Rust documentation for `unknown`](https://docs.rs/icu/latest/icu/time/struct.TimeZoneInfo.html#method.unknown) for more information. 41 */ 42 inline static std::unique_ptr<icu4x::TimeZone> unknown(); 43 44 /** 45 * Whether the time zone is the unknown zone. 46 * 47 * See the [Rust documentation for `is_unknown`](https://docs.rs/icu/latest/icu/time/struct.TimeZone.html#method.is_unknown) for more information. 48 */ 49 inline bool is_unknown() const; 50 51 /** 52 * Creates a time zone from a BCP-47 string. 53 * 54 * Returns the unknown time zone if the string is not a valid BCP-47 subtag. 55 * 56 * Additional information: [1](https://docs.rs/icu/latest/icu/time/struct.TimeZone.html) 57 */ 58 inline static std::unique_ptr<icu4x::TimeZone> create_from_bcp47(std::string_view id); 59 60 /** 61 * See the [Rust documentation for `with_offset`](https://docs.rs/icu/latest/icu/time/struct.TimeZone.html#method.with_offset) for more information. 62 */ 63 inline std::unique_ptr<icu4x::TimeZoneInfo> with_offset(const icu4x::UtcOffset& offset) const; 64 65 /** 66 * See the [Rust documentation for `without_offset`](https://docs.rs/icu/latest/icu/time/struct.TimeZone.html#method.without_offset) for more information. 67 */ 68 inline std::unique_ptr<icu4x::TimeZoneInfo> without_offset() const; 69 70 inline const icu4x::capi::TimeZone* AsFFI() const; 71 inline icu4x::capi::TimeZone* AsFFI(); 72 inline static const icu4x::TimeZone* FromFFI(const icu4x::capi::TimeZone* ptr); 73 inline static icu4x::TimeZone* FromFFI(icu4x::capi::TimeZone* ptr); 74 inline static void operator delete(void* ptr); 75 private: 76 TimeZone() = delete; 77 TimeZone(const icu4x::TimeZone&) = delete; 78 TimeZone(icu4x::TimeZone&&) noexcept = delete; 79 TimeZone operator=(const icu4x::TimeZone&) = delete; 80 TimeZone operator=(icu4x::TimeZone&&) noexcept = delete; 81 static void operator delete[](void*, size_t) = delete; 82 }; 83 84 } // namespace 85 #endif // icu4x_TimeZone_D_HPP