Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions components/properties/src/props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,60 @@ make_enumerated_property! {
ule_ty: u8;
}

/// Property Indic_Conjunct_Break.
/// See UAX #44:
/// <https://www.unicode.org/reports/tr44/#Indic_Conjunct_Break>.
///
/// # Example
///
/// ```
/// use icu::properties::{CodePointMapData, props::IndicConjunctBreak};
///
/// assert_eq!(CodePointMapData::<IndicConjunctBreak>::new().get('a'), IndicConjunctBreak::None);
/// assert_eq!(CodePointMapData::<IndicConjunctBreak>::new().get('\u{094d}'), IndicConjunctBreak::Linker);
/// assert_eq!(CodePointMapData::<IndicConjunctBreak>::new().get('\u{0915}'), IndicConjunctBreak::Consonant);
/// assert_eq!(CodePointMapData::<IndicConjunctBreak>::new().get('\u{0300}'), IndicConjunctBreak::Extend);
/// ```
#[doc(hidden)] // draft API in ICU4C
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "datagen", derive(databake::Bake))]
#[cfg_attr(feature = "datagen", databake(path = icu_properties::props))]
#[allow(clippy::exhaustive_structs)] // newtype
#[repr(transparent)]
pub struct IndicConjunctBreak(pub(crate) u8);

impl IndicConjunctBreak {
/// Returns an ICU4C `UIndicConjunctBreak` value.
pub const fn to_icu4c_value(self) -> u8 {
self.0
}
/// Constructor from an ICU4C `UIndicConjunctBreak` value.
pub const fn from_icu4c_value(value: u8) -> Self {
Self(value)
}
}

create_const_array! {
#[doc(hidden)] // draft API in ICU4C
#[allow(non_upper_case_globals)]
impl IndicConjunctBreak {
pub const None: IndicConjunctBreak = IndicConjunctBreak(0);
pub const Consonant: IndicConjunctBreak = IndicConjunctBreak(1);
pub const Extend: IndicConjunctBreak = IndicConjunctBreak(2);
pub const Linker: IndicConjunctBreak = IndicConjunctBreak(3);
}
}

make_enumerated_property! {
name: "Indic_Conjunct_Break";
short_name: "InCB";
ident: IndicConjunctBreak;
data_marker: crate::provider::PropertyEnumIndicConjunctBreakV1;
singleton: SINGLETON_PROPERTY_ENUM_INDIC_CONJUNCT_BREAK_V1;
ule_ty: u8;
}

/// Property Indic_Syllabic_Category.
/// See UAX #44:
/// <https://www.unicode.org/reports/tr44/#Indic_Syllabic_Category>.
Expand Down
8 changes: 8 additions & 0 deletions components/properties/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ const _: () = {
impl_property_enum_general_category_v1!(Baked);
impl_property_enum_grapheme_cluster_break_v1!(Baked);
impl_property_enum_hangul_syllable_type_v1!(Baked);
impl_property_enum_indic_conjunct_break_v1!(Baked);
impl_property_enum_indic_syllabic_category_v1!(Baked);
impl_property_enum_joining_type_v1!(Baked);
impl_property_enum_line_break_v1!(Baked);
Expand Down Expand Up @@ -619,6 +620,12 @@ icu_provider::data_marker!(
PropertyCodePointMap<'static, crate::props::HangulSyllableType>,
is_singleton = true,
);
icu_provider::data_marker!(
/// Data marker for the 'IndicConjunctBreak' Unicode property
PropertyEnumIndicConjunctBreakV1,
PropertyCodePointMap<'static, crate::props::IndicConjunctBreak>,
is_singleton = true,
);
icu_provider::data_marker!(
/// Data marker for the 'IndicSyllabicCategory' Unicode property
PropertyEnumIndicSyllabicCategoryV1,
Expand Down Expand Up @@ -793,6 +800,7 @@ pub const MARKERS: &[DataMarkerInfo] = &[
PropertyEnumGeneralCategoryV1::INFO,
PropertyEnumGraphemeClusterBreakV1::INFO,
PropertyEnumHangulSyllableTypeV1::INFO,
PropertyEnumIndicConjunctBreakV1::INFO,
PropertyEnumIndicSyllabicCategoryV1::INFO,
PropertyEnumJoiningTypeV1::INFO,
PropertyEnumLineBreakV1::INFO,
Expand Down
1 change: 1 addition & 0 deletions components/properties/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ enum EnumeratedProperty {
GeneralCategory = 0x1005,
GraphemeClusterBreak = 0x1012,
HangulSyllableType = 0x100B,
IndicConjunctBreak = 0x101A,
IndicPositionalCategory = 0x1016,
IndicSyllabicCategory = 0x1017,
JoiningGroup = 0x1006,
Expand Down
16 changes: 14 additions & 2 deletions components/properties/src/trievalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use crate::bidi::BidiMirroringGlyph;
use crate::props::{
BidiClass, CanonicalCombiningClass, EastAsianWidth, GeneralCategory, GeneralCategoryGroup,
GraphemeClusterBreak, HangulSyllableType, IndicSyllabicCategory, JoiningType, LineBreak,
Script, SentenceBreak, VerticalOrientation, WordBreak,
GraphemeClusterBreak, HangulSyllableType, IndicConjunctBreak, IndicSyllabicCategory,
JoiningType, LineBreak, Script, SentenceBreak, VerticalOrientation, WordBreak,
};
use crate::script::ScriptWithExt;
use core::convert::TryInto;
Expand Down Expand Up @@ -151,6 +151,18 @@ impl TrieValue for SentenceBreak {
}
}

impl TrieValue for IndicConjunctBreak {
type TryFromU32Error = TryFromIntError;

fn try_from_u32(i: u32) -> Result<Self, Self::TryFromU32Error> {
u8::try_from(i).map(Self)
}

fn to_u32(self) -> u32 {
u32::from(self.0)
}
}

impl TrieValue for IndicSyllabicCategory {
type TryFromU32Error = TryFromIntError;

Expand Down
2 changes: 2 additions & 0 deletions provider/data/properties/data/mod.rs

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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions provider/data/properties/fingerprints.csv
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ property/enum/east/asian/width/v1, <singleton>, 5028B, 4971B, cbe33fdd284572e5
property/enum/general/category/v1, <singleton>, 17572B, 17516B, fa8858c0d81ead14
property/enum/grapheme/cluster/break/v1, <singleton>, 7840B, 7783B, bd0d2d3da35038da
property/enum/hangul/syllable/type/v1, <singleton>, 888B, 829B, 67c6d3aaab48ff19
property/enum/indic/conjunct/break/v1, <singleton>, 6724B, 6667B, 855285c232bd1220
property/enum/indic/syllabic/category/v1, <singleton>, 6248B, 6189B, c10d1f8e12ae80ea
property/enum/joining/type/v1, <singleton>, 7072B, 7015B, dff64b1d9027a0e6
property/enum/line/break/v1, <singleton>, 15284B, 15228B, ec2f73fe17e5fb1c
Expand Down
2 changes: 2 additions & 0 deletions provider/data/properties/stubdata/mod.rs

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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions provider/registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ macro_rules! registry(
icu::properties::provider::PropertyEnumGeneralCategoryV1: PropertyEnumGeneralCategoryV1,
icu::properties::provider::PropertyEnumGraphemeClusterBreakV1: PropertyEnumGraphemeClusterBreakV1,
icu::properties::provider::PropertyEnumHangulSyllableTypeV1: PropertyEnumHangulSyllableTypeV1,
icu::properties::provider::PropertyEnumIndicConjunctBreakV1: PropertyEnumIndicConjunctBreakV1,
icu::properties::provider::PropertyEnumIndicSyllabicCategoryV1: PropertyEnumIndicSyllabicCategoryV1,
icu::properties::provider::PropertyEnumJoiningTypeV1: PropertyEnumJoiningTypeV1,
icu::properties::provider::PropertyEnumLineBreakV1: PropertyEnumLineBreakV1,
Expand Down
Loading