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