BidiClass.d.hpp (4194B)
1 #ifndef icu4x_BidiClass_D_HPP 2 #define icu4x_BidiClass_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 BidiClass; 16 } 17 18 19 namespace icu4x { 20 namespace capi { 21 enum BidiClass { 22 BidiClass_LeftToRight = 0, 23 BidiClass_RightToLeft = 1, 24 BidiClass_EuropeanNumber = 2, 25 BidiClass_EuropeanSeparator = 3, 26 BidiClass_EuropeanTerminator = 4, 27 BidiClass_ArabicNumber = 5, 28 BidiClass_CommonSeparator = 6, 29 BidiClass_ParagraphSeparator = 7, 30 BidiClass_SegmentSeparator = 8, 31 BidiClass_WhiteSpace = 9, 32 BidiClass_OtherNeutral = 10, 33 BidiClass_LeftToRightEmbedding = 11, 34 BidiClass_LeftToRightOverride = 12, 35 BidiClass_ArabicLetter = 13, 36 BidiClass_RightToLeftEmbedding = 14, 37 BidiClass_RightToLeftOverride = 15, 38 BidiClass_PopDirectionalFormat = 16, 39 BidiClass_NonspacingMark = 17, 40 BidiClass_BoundaryNeutral = 18, 41 BidiClass_FirstStrongIsolate = 19, 42 BidiClass_LeftToRightIsolate = 20, 43 BidiClass_RightToLeftIsolate = 21, 44 BidiClass_PopDirectionalIsolate = 22, 45 }; 46 47 typedef struct BidiClass_option {union { BidiClass ok; }; bool is_ok; } BidiClass_option; 48 } // namespace capi 49 } // namespace 50 51 namespace icu4x { 52 /** 53 * See the [Rust documentation for `BidiClass`](https://docs.rs/icu/latest/icu/properties/props/struct.BidiClass.html) for more information. 54 */ 55 class BidiClass { 56 public: 57 enum Value { 58 LeftToRight = 0, 59 RightToLeft = 1, 60 EuropeanNumber = 2, 61 EuropeanSeparator = 3, 62 EuropeanTerminator = 4, 63 ArabicNumber = 5, 64 CommonSeparator = 6, 65 ParagraphSeparator = 7, 66 SegmentSeparator = 8, 67 WhiteSpace = 9, 68 OtherNeutral = 10, 69 LeftToRightEmbedding = 11, 70 LeftToRightOverride = 12, 71 ArabicLetter = 13, 72 RightToLeftEmbedding = 14, 73 RightToLeftOverride = 15, 74 PopDirectionalFormat = 16, 75 NonspacingMark = 17, 76 BoundaryNeutral = 18, 77 FirstStrongIsolate = 19, 78 LeftToRightIsolate = 20, 79 RightToLeftIsolate = 21, 80 PopDirectionalIsolate = 22, 81 }; 82 83 BidiClass() = default; 84 // Implicit conversions between enum and ::Value 85 constexpr BidiClass(Value v) : value(v) {} 86 constexpr operator Value() const { return value; } 87 // Prevent usage as boolean value 88 explicit operator bool() const = delete; 89 90 /** 91 * See the [Rust documentation for `for_char`](https://docs.rs/icu/latest/icu/properties/props/trait.EnumeratedProperty.html#tymethod.for_char) for more information. 92 */ 93 inline static icu4x::BidiClass for_char(char32_t ch); 94 95 /** 96 * Get the "long" name of this property value (returns empty if property value is unknown) 97 * 98 * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/struct.PropertyNamesLongBorrowed.html#method.get) for more information. 99 */ 100 inline std::optional<std::string_view> long_name() const; 101 102 /** 103 * Get the "short" name of this property value (returns empty if property value is unknown) 104 * 105 * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/struct.PropertyNamesShortBorrowed.html#method.get) for more information. 106 */ 107 inline std::optional<std::string_view> short_name() const; 108 109 /** 110 * Convert to an integer value usable with ICU4C and CodePointMapData 111 * 112 * See the [Rust documentation for `to_icu4c_value`](https://docs.rs/icu/latest/icu/properties/props/struct.BidiClass.html#method.to_icu4c_value) for more information. 113 */ 114 inline uint8_t to_integer_value() const; 115 116 /** 117 * Convert from an integer value from ICU4C or CodePointMapData 118 * 119 * See the [Rust documentation for `from_icu4c_value`](https://docs.rs/icu/latest/icu/properties/props/struct.BidiClass.html#method.from_icu4c_value) for more information. 120 */ 121 inline static std::optional<icu4x::BidiClass> from_integer_value(uint8_t other); 122 123 inline icu4x::capi::BidiClass AsFFI() const; 124 inline static icu4x::BidiClass FromFFI(icu4x::capi::BidiClass c_enum); 125 private: 126 Value value; 127 }; 128 129 } // namespace 130 #endif // icu4x_BidiClass_D_HPP