DataError.d.hpp (1637B)
1 #ifndef icu4x_DataError_D_HPP 2 #define icu4x_DataError_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 15 namespace icu4x { 16 namespace capi { 17 enum DataError { 18 DataError_Unknown = 0, 19 DataError_MarkerNotFound = 1, 20 DataError_IdentifierNotFound = 2, 21 DataError_InvalidRequest = 3, 22 DataError_InconsistentData = 4, 23 DataError_Downcast = 5, 24 DataError_Deserialize = 6, 25 DataError_Custom = 7, 26 DataError_Io = 8, 27 }; 28 29 typedef struct DataError_option {union { DataError ok; }; bool is_ok; } DataError_option; 30 } // namespace capi 31 } // namespace 32 33 namespace icu4x { 34 /** 35 * Additional information: [1](https://docs.rs/icu_provider/latest/icu_provider/struct.DataError.html), [2](https://docs.rs/icu_provider/latest/icu_provider/enum.DataErrorKind.html) 36 */ 37 class DataError { 38 public: 39 enum Value { 40 Unknown = 0, 41 MarkerNotFound = 1, 42 IdentifierNotFound = 2, 43 InvalidRequest = 3, 44 InconsistentData = 4, 45 Downcast = 5, 46 Deserialize = 6, 47 Custom = 7, 48 Io = 8, 49 }; 50 51 DataError() = default; 52 // Implicit conversions between enum and ::Value 53 constexpr DataError(Value v) : value(v) {} 54 constexpr operator Value() const { return value; } 55 // Prevent usage as boolean value 56 explicit operator bool() const = delete; 57 58 inline icu4x::capi::DataError AsFFI() const; 59 inline static icu4x::DataError FromFFI(icu4x::capi::DataError c_enum); 60 private: 61 Value value; 62 }; 63 64 } // namespace 65 #endif // icu4x_DataError_D_HPP