IsoDateTime.d.hpp (1543B)
1 #ifndef icu4x_IsoDateTime_D_HPP 2 #define icu4x_IsoDateTime_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 IsoDate; } 16 class IsoDate; 17 namespace capi { struct Time; } 18 class Time; 19 struct IsoDateTime; 20 class Rfc9557ParseError; 21 } 22 23 24 namespace icu4x { 25 namespace capi { 26 struct IsoDateTime { 27 icu4x::capi::IsoDate* date; 28 icu4x::capi::Time* time; 29 }; 30 31 typedef struct IsoDateTime_option {union { IsoDateTime ok; }; bool is_ok; } IsoDateTime_option; 32 } // namespace capi 33 } // namespace 34 35 36 namespace icu4x { 37 /** 38 * An ICU4X DateTime object capable of containing a ISO-8601 date and time. 39 * 40 * See the [Rust documentation for `DateTime`](https://docs.rs/icu/latest/icu/time/struct.DateTime.html) for more information. 41 */ 42 struct IsoDateTime { 43 std::unique_ptr<icu4x::IsoDate> date; 44 std::unique_ptr<icu4x::Time> time; 45 46 /** 47 * Creates a new [`IsoDateTime`] from an IXDTF string. 48 * 49 * See the [Rust documentation for `try_from_str`](https://docs.rs/icu/latest/icu/time/struct.DateTime.html#method.try_from_str) for more information. 50 */ 51 inline static diplomat::result<icu4x::IsoDateTime, icu4x::Rfc9557ParseError> from_string(std::string_view v); 52 53 inline icu4x::capi::IsoDateTime AsFFI() const; 54 inline static icu4x::IsoDateTime FromFFI(icu4x::capi::IsoDateTime c_struct); 55 }; 56 57 } // namespace 58 #endif // icu4x_IsoDateTime_D_HPP