EastAsianWidth.d.hpp (3106B)
1 #ifndef icu4x_EastAsianWidth_D_HPP 2 #define icu4x_EastAsianWidth_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 class EastAsianWidth; 16 } 17 18 19 namespace icu4x { 20 namespace capi { 21 enum EastAsianWidth { 22 EastAsianWidth_Neutral = 0, 23 EastAsianWidth_Ambiguous = 1, 24 EastAsianWidth_Halfwidth = 2, 25 EastAsianWidth_Fullwidth = 3, 26 EastAsianWidth_Narrow = 4, 27 EastAsianWidth_Wide = 5, 28 }; 29 30 typedef struct EastAsianWidth_option {union { EastAsianWidth ok; }; bool is_ok; } EastAsianWidth_option; 31 } // namespace capi 32 } // namespace 33 34 namespace icu4x { 35 /** 36 * See the [Rust documentation for `EastAsianWidth`](https://docs.rs/icu/latest/icu/properties/props/struct.EastAsianWidth.html) for more information. 37 */ 38 class EastAsianWidth { 39 public: 40 enum Value { 41 Neutral = 0, 42 Ambiguous = 1, 43 Halfwidth = 2, 44 Fullwidth = 3, 45 Narrow = 4, 46 Wide = 5, 47 }; 48 49 EastAsianWidth() = default; 50 // Implicit conversions between enum and ::Value 51 constexpr EastAsianWidth(Value v) : value(v) {} 52 constexpr operator Value() const { return value; } 53 // Prevent usage as boolean value 54 explicit operator bool() const = delete; 55 56 /** 57 * See the [Rust documentation for `for_char`](https://docs.rs/icu/latest/icu/properties/props/trait.EnumeratedProperty.html#tymethod.for_char) for more information. 58 */ 59 inline static icu4x::EastAsianWidth for_char(char32_t ch); 60 61 /** 62 * Get the "long" name of this property value (returns empty if property value is unknown) 63 * 64 * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/struct.PropertyNamesLongBorrowed.html#method.get) for more information. 65 */ 66 inline std::optional<std::string_view> long_name() const; 67 68 /** 69 * Get the "short" name of this property value (returns empty if property value is unknown) 70 * 71 * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/struct.PropertyNamesShortBorrowed.html#method.get) for more information. 72 */ 73 inline std::optional<std::string_view> short_name() const; 74 75 /** 76 * Convert to an integer value usable with ICU4C and CodePointMapData 77 * 78 * See the [Rust documentation for `to_icu4c_value`](https://docs.rs/icu/latest/icu/properties/props/struct.EastAsianWidth.html#method.to_icu4c_value) for more information. 79 */ 80 inline uint8_t to_integer_value() const; 81 82 /** 83 * Convert from an integer value from ICU4C or CodePointMapData 84 * 85 * See the [Rust documentation for `from_icu4c_value`](https://docs.rs/icu/latest/icu/properties/props/struct.EastAsianWidth.html#method.from_icu4c_value) for more information. 86 */ 87 inline static std::optional<icu4x::EastAsianWidth> from_integer_value(uint8_t other); 88 89 inline icu4x::capi::EastAsianWidth AsFFI() const; 90 inline static icu4x::EastAsianWidth FromFFI(icu4x::capi::EastAsianWidth c_enum); 91 private: 92 Value value; 93 }; 94 95 } // namespace 96 #endif // icu4x_EastAsianWidth_D_HPP