Skip to content

Commit

Permalink
Add prop enums to FFI
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Nov 19, 2024
1 parent 6c763a3 commit 2ac0b71
Show file tree
Hide file tree
Showing 91 changed files with 10,557 additions and 1 deletion.
42 changes: 42 additions & 0 deletions components/properties/src/props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,42 @@ pub(crate) mod gc {

pub use gc::GeneralCategory;

impl GeneralCategory {
/// All possible values of this enum
pub const ALL_VALUES: &'static [GeneralCategory] = &[
GeneralCategory::Unassigned,
GeneralCategory::UppercaseLetter,
GeneralCategory::LowercaseLetter,
GeneralCategory::TitlecaseLetter,
GeneralCategory::ModifierLetter,
GeneralCategory::OtherLetter,
GeneralCategory::NonspacingMark,
GeneralCategory::SpacingMark,
GeneralCategory::EnclosingMark,
GeneralCategory::DecimalNumber,
GeneralCategory::LetterNumber,
GeneralCategory::OtherNumber,
GeneralCategory::SpaceSeparator,
GeneralCategory::LineSeparator,
GeneralCategory::ParagraphSeparator,
GeneralCategory::Control,
GeneralCategory::Format,
GeneralCategory::PrivateUse,
GeneralCategory::Surrogate,
GeneralCategory::DashPunctuation,
GeneralCategory::OpenPunctuation,
GeneralCategory::ClosePunctuation,
GeneralCategory::ConnectorPunctuation,
GeneralCategory::InitialPunctuation,
GeneralCategory::FinalPunctuation,
GeneralCategory::OtherPunctuation,
GeneralCategory::MathSymbol,
GeneralCategory::CurrencySymbol,
GeneralCategory::ModifierSymbol,
GeneralCategory::OtherSymbol,
];
}

#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash, Default)]
/// Error value for `impl TryFrom<u8> for GeneralCategory`.
#[non_exhaustive]
Expand Down Expand Up @@ -628,6 +664,7 @@ impl From<GeneralCategoryGroup> for u32 {
#[repr(transparent)]
pub struct Script(pub u16);

create_const_array! {
#[allow(missing_docs)] // These constants don't need individual documentation.
#[allow(non_upper_case_globals)]
impl Script {
Expand Down Expand Up @@ -797,6 +834,7 @@ impl Script {
pub const Yi: Script = Script(41);
pub const ZanabazarSquare: Script = Script(177);
}
}

make_enumerated_property! {
name: "Script";
Expand Down Expand Up @@ -941,6 +979,7 @@ make_enumerated_property! {
#[repr(transparent)]
pub struct LineBreak(pub u8);

create_const_array! {
#[allow(missing_docs)] // These constants don't need individual documentation.
#[allow(non_upper_case_globals)]
impl LineBreak {
Expand Down Expand Up @@ -995,6 +1034,7 @@ impl LineBreak {
pub const ViramaFinal: LineBreak = LineBreak(46); // name=VF"
pub const Virama: LineBreak = LineBreak(47); // name=VI"
}
}

make_enumerated_property! {
name: "Line_Break";
Expand Down Expand Up @@ -1034,6 +1074,7 @@ make_enumerated_property! {
#[repr(transparent)]
pub struct GraphemeClusterBreak(pub u8);

create_const_array! {
#[allow(missing_docs)] // These constants don't need individual documentation.
#[allow(non_upper_case_globals)]
impl GraphemeClusterBreak {
Expand All @@ -1060,6 +1101,7 @@ impl GraphemeClusterBreak {
pub const GlueAfterZwj: GraphemeClusterBreak = GraphemeClusterBreak(16); // name="GAZ"
pub const ZWJ: GraphemeClusterBreak = GraphemeClusterBreak(17); // name="ZWJ"
}
}

make_enumerated_property! {
name: "Grapheme_Cluster_Break";
Expand Down
44 changes: 44 additions & 0 deletions ffi/capi/bindings/c/BidiClass.d.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions ffi/capi/bindings/c/BidiClass.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions ffi/capi/bindings/c/CanonicalCombiningClass.d.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions ffi/capi/bindings/c/CanonicalCombiningClass.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions ffi/capi/bindings/c/EastAsianWidth.d.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions ffi/capi/bindings/c/EastAsianWidth.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions ffi/capi/bindings/c/GeneralCategory.d.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2ac0b71

Please sign in to comment.