LineBreak.d.hpp (5246B)
1 #ifndef icu4x_LineBreak_D_HPP 2 #define icu4x_LineBreak_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 LineBreak; 16 } 17 18 19 namespace icu4x { 20 namespace capi { 21 enum LineBreak { 22 LineBreak_Unknown = 0, 23 LineBreak_Ambiguous = 1, 24 LineBreak_Alphabetic = 2, 25 LineBreak_BreakBoth = 3, 26 LineBreak_BreakAfter = 4, 27 LineBreak_BreakBefore = 5, 28 LineBreak_MandatoryBreak = 6, 29 LineBreak_ContingentBreak = 7, 30 LineBreak_ClosePunctuation = 8, 31 LineBreak_CombiningMark = 9, 32 LineBreak_CarriageReturn = 10, 33 LineBreak_Exclamation = 11, 34 LineBreak_Glue = 12, 35 LineBreak_Hyphen = 13, 36 LineBreak_Ideographic = 14, 37 LineBreak_Inseparable = 15, 38 LineBreak_InfixNumeric = 16, 39 LineBreak_LineFeed = 17, 40 LineBreak_Nonstarter = 18, 41 LineBreak_Numeric = 19, 42 LineBreak_OpenPunctuation = 20, 43 LineBreak_PostfixNumeric = 21, 44 LineBreak_PrefixNumeric = 22, 45 LineBreak_Quotation = 23, 46 LineBreak_ComplexContext = 24, 47 LineBreak_Surrogate = 25, 48 LineBreak_Space = 26, 49 LineBreak_BreakSymbols = 27, 50 LineBreak_ZWSpace = 28, 51 LineBreak_NextLine = 29, 52 LineBreak_WordJoiner = 30, 53 LineBreak_H2 = 31, 54 LineBreak_H3 = 32, 55 LineBreak_JL = 33, 56 LineBreak_JT = 34, 57 LineBreak_JV = 35, 58 LineBreak_CloseParenthesis = 36, 59 LineBreak_ConditionalJapaneseStarter = 37, 60 LineBreak_HebrewLetter = 38, 61 LineBreak_RegionalIndicator = 39, 62 LineBreak_EBase = 40, 63 LineBreak_EModifier = 41, 64 LineBreak_ZWJ = 42, 65 LineBreak_Aksara = 43, 66 LineBreak_AksaraPrebase = 44, 67 LineBreak_AksaraStart = 45, 68 LineBreak_ViramaFinal = 46, 69 LineBreak_Virama = 47, 70 }; 71 72 typedef struct LineBreak_option {union { LineBreak ok; }; bool is_ok; } LineBreak_option; 73 } // namespace capi 74 } // namespace 75 76 namespace icu4x { 77 /** 78 * See the [Rust documentation for `LineBreak`](https://docs.rs/icu/latest/icu/properties/props/struct.LineBreak.html) for more information. 79 */ 80 class LineBreak { 81 public: 82 enum Value { 83 Unknown = 0, 84 Ambiguous = 1, 85 Alphabetic = 2, 86 BreakBoth = 3, 87 BreakAfter = 4, 88 BreakBefore = 5, 89 MandatoryBreak = 6, 90 ContingentBreak = 7, 91 ClosePunctuation = 8, 92 CombiningMark = 9, 93 CarriageReturn = 10, 94 Exclamation = 11, 95 Glue = 12, 96 Hyphen = 13, 97 Ideographic = 14, 98 Inseparable = 15, 99 InfixNumeric = 16, 100 LineFeed = 17, 101 Nonstarter = 18, 102 Numeric = 19, 103 OpenPunctuation = 20, 104 PostfixNumeric = 21, 105 PrefixNumeric = 22, 106 Quotation = 23, 107 ComplexContext = 24, 108 Surrogate = 25, 109 Space = 26, 110 BreakSymbols = 27, 111 ZWSpace = 28, 112 NextLine = 29, 113 WordJoiner = 30, 114 H2 = 31, 115 H3 = 32, 116 JL = 33, 117 JT = 34, 118 JV = 35, 119 CloseParenthesis = 36, 120 ConditionalJapaneseStarter = 37, 121 HebrewLetter = 38, 122 RegionalIndicator = 39, 123 EBase = 40, 124 EModifier = 41, 125 ZWJ = 42, 126 Aksara = 43, 127 AksaraPrebase = 44, 128 AksaraStart = 45, 129 ViramaFinal = 46, 130 Virama = 47, 131 }; 132 133 LineBreak() = default; 134 // Implicit conversions between enum and ::Value 135 constexpr LineBreak(Value v) : value(v) {} 136 constexpr operator Value() const { return value; } 137 // Prevent usage as boolean value 138 explicit operator bool() const = delete; 139 140 /** 141 * See the [Rust documentation for `for_char`](https://docs.rs/icu/latest/icu/properties/props/trait.EnumeratedProperty.html#tymethod.for_char) for more information. 142 */ 143 inline static icu4x::LineBreak for_char(char32_t ch); 144 145 /** 146 * Get the "long" name of this property value (returns empty if property value is unknown) 147 * 148 * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/struct.PropertyNamesLongBorrowed.html#method.get) for more information. 149 */ 150 inline std::optional<std::string_view> long_name() const; 151 152 /** 153 * Get the "short" name of this property value (returns empty if property value is unknown) 154 * 155 * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/struct.PropertyNamesShortBorrowed.html#method.get) for more information. 156 */ 157 inline std::optional<std::string_view> short_name() const; 158 159 /** 160 * Convert to an integer value usable with ICU4C and CodePointMapData 161 * 162 * See the [Rust documentation for `to_icu4c_value`](https://docs.rs/icu/latest/icu/properties/props/struct.LineBreak.html#method.to_icu4c_value) for more information. 163 */ 164 inline uint8_t to_integer_value() const; 165 166 /** 167 * Convert from an integer value from ICU4C or CodePointMapData 168 * 169 * See the [Rust documentation for `from_icu4c_value`](https://docs.rs/icu/latest/icu/properties/props/struct.LineBreak.html#method.from_icu4c_value) for more information. 170 */ 171 inline static std::optional<icu4x::LineBreak> from_integer_value(uint8_t other); 172 173 inline icu4x::capi::LineBreak AsFFI() const; 174 inline static icu4x::LineBreak FromFFI(icu4x::capi::LineBreak c_enum); 175 private: 176 Value value; 177 }; 178 179 } // namespace 180 #endif // icu4x_LineBreak_D_HPP