Skip to main content

ferroui_base/media/text_formatting/unicode/
line_break_class.rs

1// Generated by scripts/convert-unicode-enums.py from the upstream file
2// `LineBreakClass.cs`. Do not edit.
3
4/// The Unicode `LineBreakClass` property values, numbered as the generated tries store them.
5#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
6#[repr(i32)]
7pub enum LineBreakClass {
8    /// Property value alias: `OP`
9    #[default]
10    OpenPunctuation = 0,
11    /// Property value alias: `CL`
12    ClosePunctuation = 1,
13    /// Property value alias: `CP`
14    CloseParenthesis = 2,
15    /// Property value alias: `QU`
16    Quotation = 3,
17    /// Property value alias: `GL`
18    Glue = 4,
19    /// Property value alias: `NS`
20    Nonstarter = 5,
21    /// Property value alias: `EX`
22    Exclamation = 6,
23    /// Property value alias: `SY`
24    BreakSymbols = 7,
25    /// Property value alias: `IS`
26    InfixNumeric = 8,
27    /// Property value alias: `PR`
28    PrefixNumeric = 9,
29    /// Property value alias: `PO`
30    PostfixNumeric = 10,
31    /// Property value alias: `NU`
32    Numeric = 11,
33    /// Property value alias: `AL`
34    Alphabetic = 12,
35    /// Property value alias: `HL`
36    HebrewLetter = 13,
37    /// Property value alias: `ID`
38    Ideographic = 14,
39    /// Property value alias: `IN`
40    Inseparable = 15,
41    /// Property value alias: `HY`
42    Hyphen = 16,
43    /// Property value alias: `BA`
44    BreakAfter = 17,
45    /// Property value alias: `BB`
46    BreakBefore = 18,
47    /// Property value alias: `B2`
48    BreakBoth = 19,
49    /// Property value alias: `ZW`
50    ZWSpace = 20,
51    /// Property value alias: `CM`
52    CombiningMark = 21,
53    /// Property value alias: `WJ`
54    WordJoiner = 22,
55    /// Property value alias: `H2`
56    H2 = 23,
57    /// Property value alias: `H3`
58    H3 = 24,
59    /// Property value alias: `JL`
60    JL = 25,
61    /// Property value alias: `JV`
62    JV = 26,
63    /// Property value alias: `JT`
64    JT = 27,
65    /// Property value alias: `RI`
66    RegionalIndicator = 28,
67    /// Property value alias: `EB`
68    EBase = 29,
69    /// Property value alias: `EM`
70    EModifier = 30,
71    /// Property value alias: `ZWJ`
72    ZWJ = 31,
73    /// Property value alias: `CB`
74    ContingentBreak = 32,
75    /// Property value alias: `XX`
76    Unknown = 33,
77    /// Property value alias: `AI`
78    Ambiguous = 34,
79    /// Property value alias: `AK`
80    Aksara = 35,
81    /// Property value alias: `AP`
82    AksaraPrebase = 36,
83    /// Property value alias: `AS`
84    AksaraStart = 37,
85    /// Property value alias: `BK`
86    MandatoryBreak = 38,
87    /// Property value alias: `CJ`
88    ConditionalJapaneseStarter = 39,
89    /// Property value alias: `CR`
90    CarriageReturn = 40,
91    /// Property value alias: `HH`
92    UnambiguousHyphen = 41,
93    /// Property value alias: `LF`
94    LineFeed = 42,
95    /// Property value alias: `NL`
96    NextLine = 43,
97    /// Property value alias: `SA`
98    ComplexContext = 44,
99    /// Property value alias: `SG`
100    Surrogate = 45,
101    /// Property value alias: `SP`
102    Space = 46,
103    /// Property value alias: `VF`
104    ViramaFinal = 47,
105    /// Property value alias: `VI`
106    Virama = 48,
107}
108
109impl LineBreakClass {
110    /// The number of values.
111    pub const COUNT: usize = 49;
112
113    /// Converts the numeric value stored in the generated tries (the cast upstream performs).
114    /// Values outside of the enum map to `OpenPunctuation` (value 0).
115    #[inline]
116    pub const fn from_u32(value: u32) -> Self {
117        match value {
118            1 => Self::ClosePunctuation,
119            2 => Self::CloseParenthesis,
120            3 => Self::Quotation,
121            4 => Self::Glue,
122            5 => Self::Nonstarter,
123            6 => Self::Exclamation,
124            7 => Self::BreakSymbols,
125            8 => Self::InfixNumeric,
126            9 => Self::PrefixNumeric,
127            10 => Self::PostfixNumeric,
128            11 => Self::Numeric,
129            12 => Self::Alphabetic,
130            13 => Self::HebrewLetter,
131            14 => Self::Ideographic,
132            15 => Self::Inseparable,
133            16 => Self::Hyphen,
134            17 => Self::BreakAfter,
135            18 => Self::BreakBefore,
136            19 => Self::BreakBoth,
137            20 => Self::ZWSpace,
138            21 => Self::CombiningMark,
139            22 => Self::WordJoiner,
140            23 => Self::H2,
141            24 => Self::H3,
142            25 => Self::JL,
143            26 => Self::JV,
144            27 => Self::JT,
145            28 => Self::RegionalIndicator,
146            29 => Self::EBase,
147            30 => Self::EModifier,
148            31 => Self::ZWJ,
149            32 => Self::ContingentBreak,
150            33 => Self::Unknown,
151            34 => Self::Ambiguous,
152            35 => Self::Aksara,
153            36 => Self::AksaraPrebase,
154            37 => Self::AksaraStart,
155            38 => Self::MandatoryBreak,
156            39 => Self::ConditionalJapaneseStarter,
157            40 => Self::CarriageReturn,
158            41 => Self::UnambiguousHyphen,
159            42 => Self::LineFeed,
160            43 => Self::NextLine,
161            44 => Self::ComplexContext,
162            45 => Self::Surrogate,
163            46 => Self::Space,
164            47 => Self::ViramaFinal,
165            48 => Self::Virama,
166            _ => Self::OpenPunctuation,
167        }
168    }
169}