1 #ifndef icu4x_JoiningType_D_HPP 2 #define icu4x_JoiningType_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 class JoiningType; 15 } 16 17 18 namespace icu4x { 19 namespace capi { 20 enum JoiningType { 21 JoiningType_NonJoining = 0, 22 JoiningType_JoinCausing = 1, 23 JoiningType_DualJoining = 2, 24 JoiningType_LeftJoining = 3, 25 JoiningType_RightJoining = 4, 26 JoiningType_Transparent = 5, 27 }; 28 29 typedef struct JoiningType_option {union { JoiningType ok; }; bool is_ok; } JoiningType_option; 30 } // namespace capi 31 } // namespace 32 33 namespace icu4x { 34 class JoiningType { 35 public: 36 enum Value { 37 NonJoining = 0, 38 JoinCausing = 1, 39 DualJoining = 2, 40 LeftJoining = 3, 41 RightJoining = 4, 42 Transparent = 5, 43 }; 44 45 JoiningType() = default; 46 // Implicit conversions between enum and ::Value JoiningType(Value v)47 constexpr JoiningType(Value v) : value(v) {} operator Value() const48 constexpr operator Value() const { return value; } 49 // Prevent usage as boolean value 50 explicit operator bool() const = delete; 51 52 inline static icu4x::JoiningType for_char(char32_t ch); 53 54 inline std::optional<std::string_view> long_name(); 55 56 inline std::optional<std::string_view> short_name(); 57 58 inline uint8_t to_integer_value(); 59 60 inline static std::optional<icu4x::JoiningType> from_integer_value(uint8_t other); 61 62 inline icu4x::capi::JoiningType AsFFI() const; 63 inline static icu4x::JoiningType FromFFI(icu4x::capi::JoiningType c_enum); 64 private: 65 Value value; 66 }; 67 68 } // namespace 69 #endif // icu4x_JoiningType_D_HPP 70