ZonedDateTime.d.hpp (3480B)
1 #ifndef icu4x_ZonedDateTime_D_HPP 2 #define icu4x_ZonedDateTime_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 Calendar; } 16 class Calendar; 17 namespace capi { struct Date; } 18 class Date; 19 namespace capi { struct IanaParser; } 20 class IanaParser; 21 namespace capi { struct Time; } 22 class Time; 23 namespace capi { struct TimeZoneInfo; } 24 class TimeZoneInfo; 25 namespace capi { struct VariantOffsetsCalculator; } 26 class VariantOffsetsCalculator; 27 struct ZonedDateTime; 28 class Rfc9557ParseError; 29 } 30 31 32 namespace icu4x { 33 namespace capi { 34 struct ZonedDateTime { 35 icu4x::capi::Date* date; 36 icu4x::capi::Time* time; 37 icu4x::capi::TimeZoneInfo* zone; 38 }; 39 40 typedef struct ZonedDateTime_option {union { ZonedDateTime ok; }; bool is_ok; } ZonedDateTime_option; 41 } // namespace capi 42 } // namespace 43 44 45 namespace icu4x { 46 /** 47 * An ICU4X DateTime object capable of containing a date, time, and zone for any calendar. 48 * 49 * See the [Rust documentation for `ZonedDateTime`](https://docs.rs/icu/latest/icu/time/struct.ZonedDateTime.html) for more information. 50 */ 51 struct ZonedDateTime { 52 std::unique_ptr<icu4x::Date> date; 53 std::unique_ptr<icu4x::Time> time; 54 std::unique_ptr<icu4x::TimeZoneInfo> zone; 55 56 /** 57 * Creates a new [`ZonedDateTime`] from an IXDTF string. 58 * 59 * See the [Rust documentation for `try_full_from_str`](https://docs.rs/icu/latest/icu/time/struct.ZonedDateTime.html#method.try_full_from_str) for more information. 60 */ 61 inline static diplomat::result<icu4x::ZonedDateTime, icu4x::Rfc9557ParseError> full_from_string(std::string_view v, const icu4x::Calendar& calendar, const icu4x::IanaParser& iana_parser, const icu4x::VariantOffsetsCalculator& offset_calculator); 62 63 /** 64 * Creates a new [`ZonedDateTime`] from a location-only IXDTF string. 65 * 66 * See the [Rust documentation for `try_location_only_from_str`](https://docs.rs/icu/latest/icu/time/struct.ZonedDateTime.html#method.try_location_only_from_str) for more information. 67 */ 68 inline static diplomat::result<icu4x::ZonedDateTime, icu4x::Rfc9557ParseError> location_only_from_string(std::string_view v, const icu4x::Calendar& calendar, const icu4x::IanaParser& iana_parser); 69 70 /** 71 * Creates a new [`ZonedDateTime`] from an offset-only IXDTF string. 72 * 73 * See the [Rust documentation for `try_offset_only_from_str`](https://docs.rs/icu/latest/icu/time/struct.ZonedDateTime.html#method.try_offset_only_from_str) for more information. 74 */ 75 inline static diplomat::result<icu4x::ZonedDateTime, icu4x::Rfc9557ParseError> offset_only_from_string(std::string_view v, const icu4x::Calendar& calendar); 76 77 /** 78 * Creates a new [`ZonedDateTime`] from an IXDTF string, without requiring the offset or calculating the zone variant. 79 * 80 * See the [Rust documentation for `try_lenient_from_str`](https://docs.rs/icu/latest/icu/time/struct.ZonedDateTime.html#method.try_lenient_from_str) for more information. 81 */ 82 inline static diplomat::result<icu4x::ZonedDateTime, icu4x::Rfc9557ParseError> lenient_from_string(std::string_view v, const icu4x::Calendar& calendar, const icu4x::IanaParser& iana_parser); 83 84 inline icu4x::capi::ZonedDateTime AsFFI() const; 85 inline static icu4x::ZonedDateTime FromFFI(icu4x::capi::ZonedDateTime c_struct); 86 }; 87 88 } // namespace 89 #endif // icu4x_ZonedDateTime_D_HPP