1 #ifndef icu4x_Time_D_HPP 2 #define icu4x_Time_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 "../diplomat_runtime.hpp" 12 13 namespace icu4x { 14 namespace capi { struct Time; } 15 class Time; 16 class CalendarError; 17 class CalendarParseError; 18 } 19 20 21 namespace icu4x { 22 namespace capi { 23 struct Time; 24 } // namespace capi 25 } // namespace 26 27 namespace icu4x { 28 class Time { 29 public: 30 31 inline static diplomat::result<std::unique_ptr<icu4x::Time>, icu4x::CalendarError> create(uint8_t hour, uint8_t minute, uint8_t second, uint32_t subsecond); 32 33 inline static diplomat::result<std::unique_ptr<icu4x::Time>, icu4x::CalendarParseError> from_string(std::string_view v); 34 35 inline static diplomat::result<std::unique_ptr<icu4x::Time>, icu4x::CalendarError> midnight(); 36 37 inline uint8_t hour() const; 38 39 inline uint8_t minute() const; 40 41 inline uint8_t second() const; 42 43 inline uint32_t subsecond() const; 44 45 inline const icu4x::capi::Time* AsFFI() const; 46 inline icu4x::capi::Time* AsFFI(); 47 inline static const icu4x::Time* FromFFI(const icu4x::capi::Time* ptr); 48 inline static icu4x::Time* FromFFI(icu4x::capi::Time* ptr); 49 inline static void operator delete(void* ptr); 50 private: 51 Time() = delete; 52 Time(const icu4x::Time&) = delete; 53 Time(icu4x::Time&&) noexcept = delete; 54 Time operator=(const icu4x::Time&) = delete; 55 Time operator=(icu4x::Time&&) noexcept = delete; 56 static void operator delete[](void*, size_t) = delete; 57 }; 58 59 } // namespace 60 #endif // icu4x_Time_D_HPP 61