TimeZoneFormatter.d.hpp (11292B)
1 #ifndef icu4x_TimeZoneFormatter_D_HPP 2 #define icu4x_TimeZoneFormatter_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 DataProvider; } 16 class DataProvider; 17 namespace capi { struct Locale; } 18 class Locale; 19 namespace capi { struct TimeZoneFormatter; } 20 class TimeZoneFormatter; 21 namespace capi { struct TimeZoneInfo; } 22 class TimeZoneInfo; 23 class DateTimeFormatterLoadError; 24 class DateTimeWriteError; 25 } 26 27 28 namespace icu4x { 29 namespace capi { 30 struct TimeZoneFormatter; 31 } // namespace capi 32 } // namespace 33 34 namespace icu4x { 35 /** 36 * See the [Rust documentation for `NoCalendarFormatter`](https://docs.rs/icu/latest/icu/datetime/type.NoCalendarFormatter.html) for more information. 37 */ 38 class TimeZoneFormatter { 39 public: 40 41 /** 42 * Creates a zoned formatter based on a non-zoned formatter. 43 * 44 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 45 * or else unexpected behavior may occur! 46 * 47 * See the [Rust documentation for `SpecificLong`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.SpecificLong.html) for more information. 48 */ 49 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_specific_long(const icu4x::Locale& locale); 50 51 /** 52 * Creates a zoned formatter based on a non-zoned formatter. 53 * 54 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 55 * or else unexpected behavior may occur! 56 * 57 * See the [Rust documentation for `SpecificLong`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.SpecificLong.html) for more information. 58 */ 59 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_specific_long_with_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale); 60 61 /** 62 * Creates a zoned formatter based on a non-zoned formatter. 63 * 64 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 65 * or else unexpected behavior may occur! 66 * 67 * See the [Rust documentation for `SpecificShort`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.SpecificShort.html) for more information. 68 */ 69 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_specific_short(const icu4x::Locale& locale); 70 71 /** 72 * Creates a zoned formatter based on a non-zoned formatter. 73 * 74 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 75 * or else unexpected behavior may occur! 76 * 77 * See the [Rust documentation for `SpecificShort`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.SpecificShort.html) for more information. 78 */ 79 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_specific_short_with_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale); 80 81 /** 82 * Creates a zoned formatter based on a non-zoned formatter. 83 * 84 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 85 * or else unexpected behavior may occur! 86 * 87 * See the [Rust documentation for `LocalizedOffsetLong`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.LocalizedOffsetLong.html) for more information. 88 */ 89 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_localized_offset_long(const icu4x::Locale& locale); 90 91 /** 92 * Creates a zoned formatter based on a non-zoned formatter. 93 * 94 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 95 * or else unexpected behavior may occur! 96 * 97 * See the [Rust documentation for `LocalizedOffsetLong`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.LocalizedOffsetLong.html) for more information. 98 */ 99 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_localized_offset_long_with_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale); 100 101 /** 102 * Creates a zoned formatter based on a non-zoned formatter. 103 * 104 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 105 * or else unexpected behavior may occur! 106 * 107 * See the [Rust documentation for `LocalizedOffsetShort`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.LocalizedOffsetShort.html) for more information. 108 */ 109 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_localized_offset_short(const icu4x::Locale& locale); 110 111 /** 112 * Creates a zoned formatter based on a non-zoned formatter. 113 * 114 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 115 * or else unexpected behavior may occur! 116 * 117 * See the [Rust documentation for `LocalizedOffsetShort`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.LocalizedOffsetShort.html) for more information. 118 */ 119 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_localized_offset_short_with_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale); 120 121 /** 122 * Creates a zoned formatter based on a non-zoned formatter. 123 * 124 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 125 * or else unexpected behavior may occur! 126 * 127 * See the [Rust documentation for `GenericLong`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.GenericLong.html) for more information. 128 */ 129 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_generic_long(const icu4x::Locale& locale); 130 131 /** 132 * Creates a zoned formatter based on a non-zoned formatter. 133 * 134 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 135 * or else unexpected behavior may occur! 136 * 137 * See the [Rust documentation for `GenericLong`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.GenericLong.html) for more information. 138 */ 139 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_generic_long_with_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale); 140 141 /** 142 * Creates a zoned formatter based on a non-zoned formatter. 143 * 144 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 145 * or else unexpected behavior may occur! 146 * 147 * See the [Rust documentation for `GenericShort`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.GenericShort.html) for more information. 148 */ 149 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_generic_short(const icu4x::Locale& locale); 150 151 /** 152 * Creates a zoned formatter based on a non-zoned formatter. 153 * 154 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 155 * or else unexpected behavior may occur! 156 * 157 * See the [Rust documentation for `GenericShort`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.GenericShort.html) for more information. 158 */ 159 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_generic_short_with_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale); 160 161 /** 162 * Creates a zoned formatter based on a non-zoned formatter. 163 * 164 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 165 * or else unexpected behavior may occur! 166 * 167 * See the [Rust documentation for `Location`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.Location.html) for more information. 168 */ 169 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_location(const icu4x::Locale& locale); 170 171 /** 172 * Creates a zoned formatter based on a non-zoned formatter. 173 * 174 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 175 * or else unexpected behavior may occur! 176 * 177 * See the [Rust documentation for `Location`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.Location.html) for more information. 178 */ 179 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_location_with_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale); 180 181 /** 182 * Creates a zoned formatter based on a non-zoned formatter. 183 * 184 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 185 * or else unexpected behavior may occur! 186 * 187 * See the [Rust documentation for `ExemplarCity`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.ExemplarCity.html) for more information. 188 */ 189 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_exemplar_city(const icu4x::Locale& locale); 190 191 /** 192 * Creates a zoned formatter based on a non-zoned formatter. 193 * 194 * Caution: The locale provided here must match the locale used to construct the non-zoned formatter, 195 * or else unexpected behavior may occur! 196 * 197 * See the [Rust documentation for `ExemplarCity`](https://docs.rs/icu/latest/icu/datetime/fieldsets/zone/struct.ExemplarCity.html) for more information. 198 */ 199 inline static diplomat::result<std::unique_ptr<icu4x::TimeZoneFormatter>, icu4x::DateTimeFormatterLoadError> create_exemplar_city_with_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale); 200 201 /** 202 * See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.FixedCalendarDateTimeFormatter.html#method.format) for more information. 203 */ 204 inline diplomat::result<std::string, icu4x::DateTimeWriteError> format(const icu4x::TimeZoneInfo& zone) const; 205 206 inline const icu4x::capi::TimeZoneFormatter* AsFFI() const; 207 inline icu4x::capi::TimeZoneFormatter* AsFFI(); 208 inline static const icu4x::TimeZoneFormatter* FromFFI(const icu4x::capi::TimeZoneFormatter* ptr); 209 inline static icu4x::TimeZoneFormatter* FromFFI(icu4x::capi::TimeZoneFormatter* ptr); 210 inline static void operator delete(void* ptr); 211 private: 212 TimeZoneFormatter() = delete; 213 TimeZoneFormatter(const icu4x::TimeZoneFormatter&) = delete; 214 TimeZoneFormatter(icu4x::TimeZoneFormatter&&) noexcept = delete; 215 TimeZoneFormatter operator=(const icu4x::TimeZoneFormatter&) = delete; 216 TimeZoneFormatter operator=(icu4x::TimeZoneFormatter&&) noexcept = delete; 217 static void operator delete[](void*, size_t) = delete; 218 }; 219 220 } // namespace 221 #endif // icu4x_TimeZoneFormatter_D_HPP