1 #ifndef icu4x_DateTimeFormatError_D_HPP 2 #define icu4x_DateTimeFormatError_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 14 namespace icu4x { 15 namespace capi { 16 enum DateTimeFormatError { 17 DateTimeFormatError_Unknown = 0, 18 DateTimeFormatError_MissingInputField = 1, 19 DateTimeFormatError_ZoneInfoMissingFields = 2, 20 DateTimeFormatError_InvalidEra = 3, 21 DateTimeFormatError_InvalidMonthCode = 4, 22 DateTimeFormatError_InvalidCyclicYear = 5, 23 DateTimeFormatError_NamesNotLoaded = 16, 24 DateTimeFormatError_DecimalFormatterNotLoaded = 17, 25 DateTimeFormatError_UnsupportedField = 18, 26 }; 27 28 typedef struct DateTimeFormatError_option {union { DateTimeFormatError ok; }; bool is_ok; } DateTimeFormatError_option; 29 } // namespace capi 30 } // namespace 31 32 namespace icu4x { 33 class DateTimeFormatError { 34 public: 35 enum Value { 36 Unknown = 0, 37 MissingInputField = 1, 38 ZoneInfoMissingFields = 2, 39 InvalidEra = 3, 40 InvalidMonthCode = 4, 41 InvalidCyclicYear = 5, 42 NamesNotLoaded = 16, 43 DecimalFormatterNotLoaded = 17, 44 UnsupportedField = 18, 45 }; 46 47 DateTimeFormatError() = default; 48 // Implicit conversions between enum and ::Value DateTimeFormatError(Value v)49 constexpr DateTimeFormatError(Value v) : value(v) {} operator Value() const50 constexpr operator Value() const { return value; } 51 // Prevent usage as boolean value 52 explicit operator bool() const = delete; 53 54 inline icu4x::capi::DateTimeFormatError AsFFI() const; 55 inline static icu4x::DateTimeFormatError FromFFI(icu4x::capi::DateTimeFormatError c_enum); 56 private: 57 Value value; 58 }; 59 60 } // namespace 61 #endif // icu4x_DateTimeFormatError_D_HPP 62