TimeFormatter.d.hpp (3717B)
1 #ifndef icu4x_TimeFormatter_D_HPP 2 #define icu4x_TimeFormatter_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 TimeFormatter; } 22 class TimeFormatter; 23 class DateTimeAlignment; 24 class DateTimeFormatterLoadError; 25 class DateTimeLength; 26 class TimePrecision; 27 } 28 29 30 namespace icu4x { 31 namespace capi { 32 struct TimeFormatter; 33 } // namespace capi 34 } // namespace 35 36 namespace icu4x { 37 /** 38 * See the [Rust documentation for `NoCalendarFormatter`](https://docs.rs/icu/latest/icu/datetime/type.NoCalendarFormatter.html) for more information. 39 */ 40 class TimeFormatter { 41 public: 42 43 /** 44 * See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/type.NoCalendarFormatter.html#method.try_new) for more information. 45 * 46 * See the [Rust documentation for `T`](https://docs.rs/icu/latest/icu/datetime/fieldsets/struct.T.html) for more information. 47 * 48 * Additional information: [1](https://docs.rs/icu/latest/icu/datetime/fieldsets/struct.T.html#method.with_time_precision), [2](https://docs.rs/icu/latest/icu/datetime/fieldsets/struct.T.html#method.with_alignment), [3](https://docs.rs/icu/latest/icu/datetime/fieldsets/struct.T.html#method.for_length) 49 */ 50 inline static diplomat::result<std::unique_ptr<icu4x::TimeFormatter>, icu4x::DateTimeFormatterLoadError> create(const icu4x::Locale& locale, std::optional<icu4x::DateTimeLength> length, std::optional<icu4x::TimePrecision> time_precision, std::optional<icu4x::DateTimeAlignment> alignment); 51 52 /** 53 * See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/type.NoCalendarFormatter.html#method.try_new) for more information. 54 * 55 * See the [Rust documentation for `T`](https://docs.rs/icu/latest/icu/datetime/fieldsets/struct.T.html) for more information. 56 * 57 * Additional information: [1](https://docs.rs/icu/latest/icu/datetime/fieldsets/struct.T.html#method.with_time_precision), [2](https://docs.rs/icu/latest/icu/datetime/fieldsets/struct.T.html#method.with_alignment), [3](https://docs.rs/icu/latest/icu/datetime/fieldsets/struct.T.html#method.for_length) 58 */ 59 inline static diplomat::result<std::unique_ptr<icu4x::TimeFormatter>, icu4x::DateTimeFormatterLoadError> create_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); 60 61 /** 62 * See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/type.NoCalendarFormatter.html#method.format) for more information. 63 */ 64 inline std::string format(const icu4x::Time& time) const; 65 66 inline const icu4x::capi::TimeFormatter* AsFFI() const; 67 inline icu4x::capi::TimeFormatter* AsFFI(); 68 inline static const icu4x::TimeFormatter* FromFFI(const icu4x::capi::TimeFormatter* ptr); 69 inline static icu4x::TimeFormatter* FromFFI(icu4x::capi::TimeFormatter* ptr); 70 inline static void operator delete(void* ptr); 71 private: 72 TimeFormatter() = delete; 73 TimeFormatter(const icu4x::TimeFormatter&) = delete; 74 TimeFormatter(icu4x::TimeFormatter&&) noexcept = delete; 75 TimeFormatter operator=(const icu4x::TimeFormatter&) = delete; 76 TimeFormatter operator=(icu4x::TimeFormatter&&) noexcept = delete; 77 static void operator delete[](void*, size_t) = delete; 78 }; 79 80 } // namespace 81 #endif // icu4x_TimeFormatter_D_HPP