From fb2dda82e9c8e19659edac343fc38e91a6d0d280 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Fri, 15 Sep 2023 13:28:53 +0300 Subject: [PATCH 1/7] Provide a getter for the resolved options for the collator Fixes #3880 --- components/collator/src/comparison.rs | 6 + components/collator/src/options.rs | 38 +++++++ components/collator/tests/tests.rs | 155 +++++++++++++++++++++++++- 3 files changed, 196 insertions(+), 3 deletions(-) diff --git a/components/collator/src/comparison.rs b/components/collator/src/comparison.rs index 5b41f6dd4a2..fe57dc23fff 100644 --- a/components/collator/src/comparison.rs +++ b/components/collator/src/comparison.rs @@ -247,6 +247,12 @@ impl Collator { }) } + /// The resolved options showing how the default options, the requested options, + /// and the options from locale data were combined. + pub fn resolved_options(&self) -> CollatorOptions { + self.options.into() + } + /// Compare potentially ill-formed UTF-16 slices. Unpaired surrogates /// are compared as if each one was a REPLACEMENT CHARACTER. pub fn compare_utf16(&self, left: &[u16], right: &[u16]) -> Ordering { diff --git a/components/collator/src/options.rs b/components/collator/src/options.rs index 30301ee3b71..95defcb50d2 100644 --- a/components/collator/src/options.rs +++ b/components/collator/src/options.rs @@ -359,6 +359,32 @@ impl CollatorOptions { } } +impl From for CollatorOptions { + fn from(options: CollatorOptionsBitField) -> CollatorOptions { + Self { + strength: Some(options.strength()), + alternate_handling: Some(options.alternate_handling()), + case_first: Some(options.case_first()), + max_variable: Some(options.max_variable()), + case_level: Some(if options.case_level() { + CaseLevel::On + } else { + CaseLevel::Off + }), + numeric: Some(if options.numeric() { + Numeric::On + } else { + Numeric::Off + }), + backward_second_level: Some(if options.backward_second_level() { + BackwardSecondLevel::On + } else { + BackwardSecondLevel::Off + }), + } + } +} + #[derive(Copy, Clone, Debug)] pub(crate) struct CollatorOptionsBitField(u32); @@ -521,6 +547,18 @@ impl CollatorOptionsBitField { } } + fn case_first(&self) -> CaseFirst { + if (self.0 & CollatorOptionsBitField::CASE_FIRST_MASK) != 0 { + if (self.0 & CollatorOptionsBitField::UPPER_FIRST_MASK) != 0 { + CaseFirst::UpperFirst + } else { + CaseFirst::LowerFirst + } + } else { + CaseFirst::Off + } + } + /// Whether case is the most significant part of the tertiary /// level. /// diff --git a/components/collator/tests/tests.rs b/components/collator/tests/tests.rs index b7f2b0517d5..0435d972c93 100644 --- a/components/collator/tests/tests.rs +++ b/components/collator/tests/tests.rs @@ -1453,6 +1453,158 @@ fn test_case_level() { ); } +#[test] +fn test_default_resolved_options() { + let collator = Collator::try_new(&Default::default(), CollatorOptions::new()).unwrap(); + let resolved = collator.resolved_options(); + assert_eq!(resolved.strength, Some(Strength::Tertiary)); + assert_eq!( + resolved.alternate_handling, + Some(AlternateHandling::NonIgnorable) + ); + assert_eq!(resolved.case_first, Some(CaseFirst::Off)); + assert_eq!(resolved.max_variable, Some(MaxVariable::Punctuation)); + assert_eq!(resolved.case_level, Some(CaseLevel::Off)); + assert_eq!(resolved.numeric, Some(Numeric::Off)); + assert_eq!( + resolved.backward_second_level, + Some(BackwardSecondLevel::Off) + ); + + assert_eq!(collator.compare("饾晵", "A"), core::cmp::Ordering::Less); + assert_eq!(collator.compare("cot茅", "c么te"), core::cmp::Ordering::Less); +} + +#[test] +fn test_data_resolved_options_th() { + let locale: DataLocale = langid!("th").into(); + let collator = Collator::try_new(&locale, CollatorOptions::new()).unwrap(); + let resolved = collator.resolved_options(); + assert_eq!(resolved.strength, Some(Strength::Tertiary)); + assert_eq!( + resolved.alternate_handling, + Some(AlternateHandling::Shifted) + ); + assert_eq!(resolved.case_first, Some(CaseFirst::Off)); + assert_eq!(resolved.max_variable, Some(MaxVariable::Punctuation)); + assert_eq!(resolved.case_level, Some(CaseLevel::Off)); + assert_eq!(resolved.numeric, Some(Numeric::Off)); + assert_eq!( + resolved.backward_second_level, + Some(BackwardSecondLevel::Off) + ); + + // There's a separate more comprehensive test for the shifted behavior + assert_eq!(collator.compare("饾晵", "A"), core::cmp::Ordering::Less); + assert_eq!(collator.compare("cot茅", "c么te"), core::cmp::Ordering::Less); +} + +#[test] +fn test_data_resolved_options_da() { + let locale: DataLocale = langid!("da").into(); + let collator = Collator::try_new(&locale, CollatorOptions::new()).unwrap(); + let resolved = collator.resolved_options(); + assert_eq!(resolved.strength, Some(Strength::Tertiary)); + assert_eq!( + resolved.alternate_handling, + Some(AlternateHandling::NonIgnorable) + ); + assert_eq!(resolved.case_first, Some(CaseFirst::UpperFirst)); + assert_eq!(resolved.max_variable, Some(MaxVariable::Punctuation)); + assert_eq!(resolved.case_level, Some(CaseLevel::Off)); + assert_eq!(resolved.numeric, Some(Numeric::Off)); + assert_eq!( + resolved.backward_second_level, + Some(BackwardSecondLevel::Off) + ); + + assert_eq!(collator.compare("饾晵", "A"), core::cmp::Ordering::Greater); + assert_eq!(collator.compare("cot茅", "c么te"), core::cmp::Ordering::Less); +} + +#[test] +fn test_data_resolved_options_fr_ca() { + let locale: DataLocale = langid!("fr-CA").into(); + let collator = Collator::try_new(&locale, CollatorOptions::new()).unwrap(); + let resolved = collator.resolved_options(); + assert_eq!(resolved.strength, Some(Strength::Tertiary)); + assert_eq!( + resolved.alternate_handling, + Some(AlternateHandling::NonIgnorable) + ); + assert_eq!(resolved.case_first, Some(CaseFirst::Off)); + assert_eq!(resolved.max_variable, Some(MaxVariable::Punctuation)); + assert_eq!(resolved.case_level, Some(CaseLevel::Off)); + assert_eq!(resolved.numeric, Some(Numeric::Off)); + assert_eq!( + resolved.backward_second_level, + Some(BackwardSecondLevel::On) + ); + + assert_eq!(collator.compare("饾晵", "A"), core::cmp::Ordering::Less); + assert_eq!( + collator.compare("cot茅", "c么te"), + core::cmp::Ordering::Greater + ); +} + +#[test] +fn test_manual_and_data_resolved_options_fr_ca() { + let locale: DataLocale = langid!("fr-CA").into(); + + let mut options = CollatorOptions::new(); + options.case_first = Some(CaseFirst::UpperFirst); + + let collator = Collator::try_new(&locale, options).unwrap(); + let resolved = collator.resolved_options(); + assert_eq!(resolved.strength, Some(Strength::Tertiary)); + assert_eq!( + resolved.alternate_handling, + Some(AlternateHandling::NonIgnorable) + ); + assert_eq!(resolved.case_first, Some(CaseFirst::UpperFirst)); + assert_eq!(resolved.max_variable, Some(MaxVariable::Punctuation)); + assert_eq!(resolved.case_level, Some(CaseLevel::Off)); + assert_eq!(resolved.numeric, Some(Numeric::Off)); + assert_eq!( + resolved.backward_second_level, + Some(BackwardSecondLevel::On) + ); + + assert_eq!(collator.compare("饾晵", "A"), core::cmp::Ordering::Greater); + assert_eq!( + collator.compare("cot茅", "c么te"), + core::cmp::Ordering::Greater + ); +} + +#[test] +fn test_manual_resolved_options_da() { + let locale: DataLocale = langid!("da").into(); + + let mut options = CollatorOptions::new(); + options.case_first = Some(CaseFirst::Off); + + let collator = Collator::try_new(&locale, options).unwrap(); + let resolved = collator.resolved_options(); + assert_eq!(resolved.strength, Some(Strength::Tertiary)); + assert_eq!( + resolved.alternate_handling, + Some(AlternateHandling::NonIgnorable) + ); + assert_eq!(resolved.case_first, Some(CaseFirst::Off)); + assert_eq!(resolved.max_variable, Some(MaxVariable::Punctuation)); + assert_eq!(resolved.case_level, Some(CaseLevel::Off)); + assert_eq!(resolved.numeric, Some(Numeric::Off)); + assert_eq!( + resolved.backward_second_level, + Some(BackwardSecondLevel::Off) + ); + + assert_eq!(collator.compare("饾晵", "A"), core::cmp::Ordering::Less); + assert_eq!(collator.compare("cot茅", "c么te"), core::cmp::Ordering::Less); +} + // TODO: Test languages that map to the root. // The languages that map to root without script reordering are: // ca (at least for now) @@ -1499,6 +1651,3 @@ fn test_case_level() { // TODO: Test Tibetan // TODO: Test de-AT-u-co-phonebk vs de-DE-u-co-phonebk - -// TODO: Test da defaulting to [caseFirst upper] -// TODO: Test fr-CA defaulting to backward second level From d85e6dfd09eebf88014b71e4d0a4ef99200d818f Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Tue, 7 Nov 2023 14:59:08 +0200 Subject: [PATCH 2/7] Introduce ResolvedCollatorOptions --- components/collator/src/comparison.rs | 4 +- components/collator/src/lib.rs | 1 + components/collator/src/options.rs | 46 +++++++--- components/collator/tests/tests.rs | 120 +++++++++----------------- 4 files changed, 79 insertions(+), 92 deletions(-) diff --git a/components/collator/src/comparison.rs b/components/collator/src/comparison.rs index fe57dc23fff..31a27cef368 100644 --- a/components/collator/src/comparison.rs +++ b/components/collator/src/comparison.rs @@ -21,7 +21,7 @@ use crate::provider::CollationJamoV1Marker; use crate::provider::CollationMetadataV1Marker; use crate::provider::CollationReorderingV1Marker; use crate::provider::CollationSpecialPrimariesV1Marker; -use crate::{AlternateHandling, CollatorOptions, MaxVariable, Strength}; +use crate::{AlternateHandling, CollatorOptions, MaxVariable, ResolvedCollatorOptions, Strength}; use core::cmp::Ordering; use core::convert::TryFrom; use icu_normalizer::provider::CanonicalDecompositionDataV1Marker; @@ -249,7 +249,7 @@ impl Collator { /// The resolved options showing how the default options, the requested options, /// and the options from locale data were combined. - pub fn resolved_options(&self) -> CollatorOptions { + pub fn resolved_options(&self) -> ResolvedCollatorOptions { self.options.into() } diff --git a/components/collator/src/lib.rs b/components/collator/src/lib.rs index 07bc959a426..23eda4d1ea2 100644 --- a/components/collator/src/lib.rs +++ b/components/collator/src/lib.rs @@ -294,6 +294,7 @@ pub use options::CaseLevel; pub use options::CollatorOptions; pub use options::MaxVariable; pub use options::Numeric; +pub use options::ResolvedCollatorOptions; pub use options::Strength; #[doc(no_inline)] diff --git a/components/collator/src/options.rs b/components/collator/src/options.rs index 262bf177b2c..8371bf87e54 100644 --- a/components/collator/src/options.rs +++ b/components/collator/src/options.rs @@ -351,28 +351,50 @@ impl CollatorOptions { } } -impl From for CollatorOptions { - fn from(options: CollatorOptionsBitField) -> CollatorOptions { +/// The resolved (actually used) options used by the collator. +/// +/// See the documentation of `CollatorOptions`. +#[non_exhaustive] +#[derive(Debug, Copy, Clone)] +pub struct ResolvedCollatorOptions { + /// Resolved strength collation option. + pub strength: Strength, + /// Resolved alternate handling collation option. + pub alternate_handling: AlternateHandling, + /// Resolved case first collation option. + pub case_first: CaseFirst, + /// Resolved max variable collation option. + pub max_variable: MaxVariable, + /// Resolved case level collation option. + pub case_level: CaseLevel, + /// Resolved numeric collation option. + pub numeric: Numeric, + /// Resolved backward second level collation option. + pub backward_second_level: BackwardSecondLevel, +} + +impl From for ResolvedCollatorOptions { + fn from(options: CollatorOptionsBitField) -> ResolvedCollatorOptions { Self { - strength: Some(options.strength()), - alternate_handling: Some(options.alternate_handling()), - case_first: Some(options.case_first()), - max_variable: Some(options.max_variable()), - case_level: Some(if options.case_level() { + strength: options.strength(), + alternate_handling: options.alternate_handling(), + case_first: options.case_first(), + max_variable: options.max_variable(), + case_level: if options.case_level() { CaseLevel::On } else { CaseLevel::Off - }), - numeric: Some(if options.numeric() { + }, + numeric: if options.numeric() { Numeric::On } else { Numeric::Off - }), - backward_second_level: Some(if options.backward_second_level() { + }, + backward_second_level: if options.backward_second_level() { BackwardSecondLevel::On } else { BackwardSecondLevel::Off - }), + }, } } } diff --git a/components/collator/tests/tests.rs b/components/collator/tests/tests.rs index f3c282a782f..85263912234 100644 --- a/components/collator/tests/tests.rs +++ b/components/collator/tests/tests.rs @@ -1457,19 +1457,13 @@ fn test_case_level() { fn test_default_resolved_options() { let collator = Collator::try_new(&Default::default(), CollatorOptions::new()).unwrap(); let resolved = collator.resolved_options(); - assert_eq!(resolved.strength, Some(Strength::Tertiary)); - assert_eq!( - resolved.alternate_handling, - Some(AlternateHandling::NonIgnorable) - ); - assert_eq!(resolved.case_first, Some(CaseFirst::Off)); - assert_eq!(resolved.max_variable, Some(MaxVariable::Punctuation)); - assert_eq!(resolved.case_level, Some(CaseLevel::Off)); - assert_eq!(resolved.numeric, Some(Numeric::Off)); - assert_eq!( - resolved.backward_second_level, - Some(BackwardSecondLevel::Off) - ); + assert_eq!(resolved.strength, Strength::Tertiary); + assert_eq!(resolved.alternate_handling, AlternateHandling::NonIgnorable); + assert_eq!(resolved.case_first, CaseFirst::Off); + assert_eq!(resolved.max_variable, MaxVariable::Punctuation); + assert_eq!(resolved.case_level, CaseLevel::Off); + assert_eq!(resolved.numeric, Numeric::Off); + assert_eq!(resolved.backward_second_level, BackwardSecondLevel::Off); assert_eq!(collator.compare("饾晵", "A"), core::cmp::Ordering::Less); assert_eq!(collator.compare("cot茅", "c么te"), core::cmp::Ordering::Less); @@ -1480,19 +1474,13 @@ fn test_data_resolved_options_th() { let locale: DataLocale = langid!("th").into(); let collator = Collator::try_new(&locale, CollatorOptions::new()).unwrap(); let resolved = collator.resolved_options(); - assert_eq!(resolved.strength, Some(Strength::Tertiary)); - assert_eq!( - resolved.alternate_handling, - Some(AlternateHandling::Shifted) - ); - assert_eq!(resolved.case_first, Some(CaseFirst::Off)); - assert_eq!(resolved.max_variable, Some(MaxVariable::Punctuation)); - assert_eq!(resolved.case_level, Some(CaseLevel::Off)); - assert_eq!(resolved.numeric, Some(Numeric::Off)); - assert_eq!( - resolved.backward_second_level, - Some(BackwardSecondLevel::Off) - ); + assert_eq!(resolved.strength, Strength::Tertiary); + assert_eq!(resolved.alternate_handling, AlternateHandling::Shifted); + assert_eq!(resolved.case_first, CaseFirst::Off); + assert_eq!(resolved.max_variable, MaxVariable::Punctuation); + assert_eq!(resolved.case_level, CaseLevel::Off); + assert_eq!(resolved.numeric, Numeric::Off); + assert_eq!(resolved.backward_second_level, BackwardSecondLevel::Off); // There's a separate more comprehensive test for the shifted behavior assert_eq!(collator.compare("饾晵", "A"), core::cmp::Ordering::Less); @@ -1504,19 +1492,13 @@ fn test_data_resolved_options_da() { let locale: DataLocale = langid!("da").into(); let collator = Collator::try_new(&locale, CollatorOptions::new()).unwrap(); let resolved = collator.resolved_options(); - assert_eq!(resolved.strength, Some(Strength::Tertiary)); - assert_eq!( - resolved.alternate_handling, - Some(AlternateHandling::NonIgnorable) - ); - assert_eq!(resolved.case_first, Some(CaseFirst::UpperFirst)); - assert_eq!(resolved.max_variable, Some(MaxVariable::Punctuation)); - assert_eq!(resolved.case_level, Some(CaseLevel::Off)); - assert_eq!(resolved.numeric, Some(Numeric::Off)); - assert_eq!( - resolved.backward_second_level, - Some(BackwardSecondLevel::Off) - ); + assert_eq!(resolved.strength, Strength::Tertiary); + assert_eq!(resolved.alternate_handling, AlternateHandling::NonIgnorable); + assert_eq!(resolved.case_first, CaseFirst::UpperFirst); + assert_eq!(resolved.max_variable, MaxVariable::Punctuation); + assert_eq!(resolved.case_level, CaseLevel::Off); + assert_eq!(resolved.numeric, Numeric::Off); + assert_eq!(resolved.backward_second_level, BackwardSecondLevel::Off); assert_eq!(collator.compare("饾晵", "A"), core::cmp::Ordering::Greater); assert_eq!(collator.compare("cot茅", "c么te"), core::cmp::Ordering::Less); @@ -1527,19 +1509,13 @@ fn test_data_resolved_options_fr_ca() { let locale: DataLocale = langid!("fr-CA").into(); let collator = Collator::try_new(&locale, CollatorOptions::new()).unwrap(); let resolved = collator.resolved_options(); - assert_eq!(resolved.strength, Some(Strength::Tertiary)); - assert_eq!( - resolved.alternate_handling, - Some(AlternateHandling::NonIgnorable) - ); - assert_eq!(resolved.case_first, Some(CaseFirst::Off)); - assert_eq!(resolved.max_variable, Some(MaxVariable::Punctuation)); - assert_eq!(resolved.case_level, Some(CaseLevel::Off)); - assert_eq!(resolved.numeric, Some(Numeric::Off)); - assert_eq!( - resolved.backward_second_level, - Some(BackwardSecondLevel::On) - ); + assert_eq!(resolved.strength, Strength::Tertiary); + assert_eq!(resolved.alternate_handling, AlternateHandling::NonIgnorable); + assert_eq!(resolved.case_first, CaseFirst::Off); + assert_eq!(resolved.max_variable, MaxVariable::Punctuation); + assert_eq!(resolved.case_level, CaseLevel::Off); + assert_eq!(resolved.numeric, Numeric::Off); + assert_eq!(resolved.backward_second_level, BackwardSecondLevel::On); assert_eq!(collator.compare("饾晵", "A"), core::cmp::Ordering::Less); assert_eq!( @@ -1557,19 +1533,13 @@ fn test_manual_and_data_resolved_options_fr_ca() { let collator = Collator::try_new(&locale, options).unwrap(); let resolved = collator.resolved_options(); - assert_eq!(resolved.strength, Some(Strength::Tertiary)); - assert_eq!( - resolved.alternate_handling, - Some(AlternateHandling::NonIgnorable) - ); - assert_eq!(resolved.case_first, Some(CaseFirst::UpperFirst)); - assert_eq!(resolved.max_variable, Some(MaxVariable::Punctuation)); - assert_eq!(resolved.case_level, Some(CaseLevel::Off)); - assert_eq!(resolved.numeric, Some(Numeric::Off)); - assert_eq!( - resolved.backward_second_level, - Some(BackwardSecondLevel::On) - ); + assert_eq!(resolved.strength, Strength::Tertiary); + assert_eq!(resolved.alternate_handling, AlternateHandling::NonIgnorable); + assert_eq!(resolved.case_first, CaseFirst::UpperFirst); + assert_eq!(resolved.max_variable, MaxVariable::Punctuation); + assert_eq!(resolved.case_level, CaseLevel::Off); + assert_eq!(resolved.numeric, Numeric::Off); + assert_eq!(resolved.backward_second_level, BackwardSecondLevel::On); assert_eq!(collator.compare("饾晵", "A"), core::cmp::Ordering::Greater); assert_eq!( @@ -1587,19 +1557,13 @@ fn test_manual_resolved_options_da() { let collator = Collator::try_new(&locale, options).unwrap(); let resolved = collator.resolved_options(); - assert_eq!(resolved.strength, Some(Strength::Tertiary)); - assert_eq!( - resolved.alternate_handling, - Some(AlternateHandling::NonIgnorable) - ); - assert_eq!(resolved.case_first, Some(CaseFirst::Off)); - assert_eq!(resolved.max_variable, Some(MaxVariable::Punctuation)); - assert_eq!(resolved.case_level, Some(CaseLevel::Off)); - assert_eq!(resolved.numeric, Some(Numeric::Off)); - assert_eq!( - resolved.backward_second_level, - Some(BackwardSecondLevel::Off) - ); + assert_eq!(resolved.strength, Strength::Tertiary); + assert_eq!(resolved.alternate_handling, AlternateHandling::NonIgnorable); + assert_eq!(resolved.case_first, CaseFirst::Off); + assert_eq!(resolved.max_variable, MaxVariable::Punctuation); + assert_eq!(resolved.case_level, CaseLevel::Off); + assert_eq!(resolved.numeric, Numeric::Off); + assert_eq!(resolved.backward_second_level, BackwardSecondLevel::Off); assert_eq!(collator.compare("饾晵", "A"), core::cmp::Ordering::Less); assert_eq!(collator.compare("cot茅", "c么te"), core::cmp::Ordering::Less); From cb1591307a356259b541d617291bab96134612a0 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Tue, 7 Nov 2023 15:43:51 +0200 Subject: [PATCH 3/7] Add FFI for Collator::resolved_options() --- ffi/capi/src/collator.rs | 100 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/ffi/capi/src/collator.rs b/ffi/capi/src/collator.rs index f09e5d7d317..98f0462f50e 100644 --- a/ffi/capi/src/collator.rs +++ b/ffi/capi/src/collator.rs @@ -131,12 +131,20 @@ pub mod ffi { pub fn compare_utf16(&self, left: &[u16], right: &[u16]) -> ICU4XOrdering { self.0.compare_utf16(left, right).into() } + + /// The resolved options showing how the default options, the requested options, + /// and the options from locale data were combined. None of the struct fields + /// will have `Auto` as the value. + #[diplomat::rust_link(icu::collator::Collator::resolved_options, FnInStruct)] + pub fn resolved_options(&self) -> ICU4XCollatorOptionsV1 { + self.0.resolved_options().into() + } } } use icu_collator::{ AlternateHandling, BackwardSecondLevel, CaseFirst, CaseLevel, CollatorOptions, MaxVariable, - Numeric, Strength, + Numeric, ResolvedCollatorOptions, Strength, }; impl From for Option { @@ -219,6 +227,82 @@ impl From for Option } } +impl From for ffi::ICU4XCollatorStrength { + fn from(strength: Strength) -> ffi::ICU4XCollatorStrength { + match strength { + Strength::Primary => ffi::ICU4XCollatorStrength::Primary, + Strength::Secondary => ffi::ICU4XCollatorStrength::Secondary, + Strength::Tertiary => ffi::ICU4XCollatorStrength::Tertiary, + Strength::Quaternary => ffi::ICU4XCollatorStrength::Quaternary, + Strength::Identical => ffi::ICU4XCollatorStrength::Identical, + _ => panic!("FFI out of sync"), + } + } +} + +impl From for ffi::ICU4XCollatorAlternateHandling { + fn from(alternate_handling: AlternateHandling) -> ffi::ICU4XCollatorAlternateHandling { + match alternate_handling { + AlternateHandling::NonIgnorable => ffi::ICU4XCollatorAlternateHandling::NonIgnorable, + AlternateHandling::Shifted => ffi::ICU4XCollatorAlternateHandling::Shifted, + _ => panic!("FFI out of sync"), + } + } +} + +impl From for ffi::ICU4XCollatorCaseFirst { + fn from(case_first: CaseFirst) -> ffi::ICU4XCollatorCaseFirst { + match case_first { + CaseFirst::Off => ffi::ICU4XCollatorCaseFirst::Off, + CaseFirst::LowerFirst => ffi::ICU4XCollatorCaseFirst::LowerFirst, + CaseFirst::UpperFirst => ffi::ICU4XCollatorCaseFirst::UpperFirst, + _ => panic!("FFI out of sync"), + } + } +} + +impl From for ffi::ICU4XCollatorMaxVariable { + fn from(max_variable: MaxVariable) -> ffi::ICU4XCollatorMaxVariable { + match max_variable { + MaxVariable::Space => ffi::ICU4XCollatorMaxVariable::Space, + MaxVariable::Punctuation => ffi::ICU4XCollatorMaxVariable::Punctuation, + MaxVariable::Symbol => ffi::ICU4XCollatorMaxVariable::Symbol, + MaxVariable::Currency => ffi::ICU4XCollatorMaxVariable::Currency, + _ => panic!("FFI out of sync"), + } + } +} + +impl From for ffi::ICU4XCollatorCaseLevel { + fn from(case_level: CaseLevel) -> ffi::ICU4XCollatorCaseLevel { + match case_level { + CaseLevel::Off => ffi::ICU4XCollatorCaseLevel::Off, + CaseLevel::On => ffi::ICU4XCollatorCaseLevel::On, + _ => panic!("FFI out of sync"), + } + } +} + +impl From for ffi::ICU4XCollatorNumeric { + fn from(numeric: Numeric) -> ffi::ICU4XCollatorNumeric { + match numeric { + Numeric::Off => ffi::ICU4XCollatorNumeric::Off, + Numeric::On => ffi::ICU4XCollatorNumeric::On, + _ => panic!("FFI out of sync"), + } + } +} + +impl From for ffi::ICU4XCollatorBackwardSecondLevel { + fn from(backward_second_level: BackwardSecondLevel) -> ffi::ICU4XCollatorBackwardSecondLevel { + match backward_second_level { + BackwardSecondLevel::Off => ffi::ICU4XCollatorBackwardSecondLevel::Off, + BackwardSecondLevel::On => ffi::ICU4XCollatorBackwardSecondLevel::On, + _ => panic!("FFI out of sync"), + } + } +} + impl From for CollatorOptions { fn from(options: ffi::ICU4XCollatorOptionsV1) -> CollatorOptions { let mut result = CollatorOptions::new(); @@ -233,3 +317,17 @@ impl From for CollatorOptions { result } } + +impl From for ffi::ICU4XCollatorOptionsV1 { + fn from(options: ResolvedCollatorOptions) -> ffi::ICU4XCollatorOptionsV1 { + Self { + strength: options.strength.into(), + alternate_handling: options.alternate_handling.into(), + case_first: options.case_first.into(), + max_variable: options.max_variable.into(), + case_level: options.case_level.into(), + numeric: options.numeric.into(), + backward_second_level: options.backward_second_level.into(), + } + } +} From b0c84845445bb79bfdbb7687b1c1e0f22595f5e1 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Wed, 8 Nov 2023 12:16:50 +0200 Subject: [PATCH 4/7] Separate input and output collator option bag types also on the FFI side --- components/collator/src/options.rs | 19 +++++++ ffi/capi/src/collator.rs | 81 ++++++++++++++++++++++++++---- 2 files changed, 90 insertions(+), 10 deletions(-) diff --git a/components/collator/src/options.rs b/components/collator/src/options.rs index 8371bf87e54..77e5c9da371 100644 --- a/components/collator/src/options.rs +++ b/components/collator/src/options.rs @@ -351,6 +351,25 @@ impl CollatorOptions { } } +// Make it possible to easily copy the resolved options of +// one collator into another collator. +impl From for CollatorOptions { + /// Convenience conversion for copying the options from an + /// existing collator into a new one (overriding any locale-provided + /// defaults of the new one!). + fn from(options: ResolvedCollatorOptions) -> CollatorOptions { + Self { + strength: Some(options.strength), + alternate_handling: Some(options.alternate_handling), + case_first: Some(options.case_first), + max_variable: Some(options.max_variable), + case_level: Some(options.case_level), + numeric: Some(options.numeric), + backward_second_level: Some(options.backward_second_level), + } + } +} + /// The resolved (actually used) options used by the collator. /// /// See the documentation of `CollatorOptions`. diff --git a/ffi/capi/src/collator.rs b/ffi/capi/src/collator.rs index 98f0462f50e..438fd3c9bd1 100644 --- a/ffi/capi/src/collator.rs +++ b/ffi/capi/src/collator.rs @@ -28,7 +28,39 @@ pub mod ffi { pub backward_second_level: ICU4XCollatorBackwardSecondLevel, } + // Note the flipped order of the words `Collator` and `Resolved`, because + // in FFI `Collator` is part of the `ICU4XCollator` prefix, but in Rust, + // `ResolvedCollatorOptions` makes more sense as English. + #[diplomat::rust_link(icu::collator::ResolvedCollatorOptions, Struct)] + pub struct ICU4XCollatorResolvedOptionsV1 { + pub strength: ICU4XCollatorStrength, + pub alternate_handling: ICU4XCollatorAlternateHandling, + pub case_first: ICU4XCollatorCaseFirst, + pub max_variable: ICU4XCollatorMaxVariable, + pub case_level: ICU4XCollatorCaseLevel, + pub numeric: ICU4XCollatorNumeric, + pub backward_second_level: ICU4XCollatorBackwardSecondLevel, + } + + impl ICU4XCollatorResolvedOptionsV1 { + /// Convenience conversion for copying the options from an + /// existing collator into a new one (overriding any locale-provided + /// defaults of the new one!). + pub fn into_options(&self) -> ICU4XCollatorOptionsV1 { + ICU4XCollatorOptionsV1 { + strength: self.strength, + alternate_handling: self.alternate_handling, + case_first: self.case_first, + max_variable: self.max_variable, + case_level: self.case_level, + numeric: self.numeric, + backward_second_level: self.backward_second_level, + } + } + } + #[diplomat::rust_link(icu::collator::Strength, Enum)] + #[derive(Eq, PartialEq, Debug, Copy, Clone, PartialOrd, Ord)] pub enum ICU4XCollatorStrength { Auto = 0, Primary = 1, @@ -39,6 +71,7 @@ pub mod ffi { } #[diplomat::rust_link(icu::collator::AlternateHandling, Enum)] + #[derive(Eq, PartialEq, Debug, Copy, Clone, PartialOrd, Ord)] pub enum ICU4XCollatorAlternateHandling { Auto = 0, NonIgnorable = 1, @@ -46,6 +79,7 @@ pub mod ffi { } #[diplomat::rust_link(icu::collator::CaseFirst, Enum)] + #[derive(Eq, PartialEq, Debug, Copy, Clone, PartialOrd, Ord)] pub enum ICU4XCollatorCaseFirst { Auto = 0, Off = 1, @@ -54,6 +88,7 @@ pub mod ffi { } #[diplomat::rust_link(icu::collator::MaxVariable, Enum)] + #[derive(Eq, PartialEq, Debug, Copy, Clone, PartialOrd, Ord)] pub enum ICU4XCollatorMaxVariable { Auto = 0, Space = 1, @@ -63,6 +98,7 @@ pub mod ffi { } #[diplomat::rust_link(icu::collator::CaseLevel, Enum)] + #[derive(Eq, PartialEq, Debug, Copy, Clone, PartialOrd, Ord)] pub enum ICU4XCollatorCaseLevel { Auto = 0, Off = 1, @@ -70,6 +106,7 @@ pub mod ffi { } #[diplomat::rust_link(icu::collator::Numeric, Enum)] + #[derive(Eq, PartialEq, Debug, Copy, Clone, PartialOrd, Ord)] pub enum ICU4XCollatorNumeric { Auto = 0, Off = 1, @@ -77,6 +114,7 @@ pub mod ffi { } #[diplomat::rust_link(icu::collator::BackwardSecondLevel, Enum)] + #[derive(Eq, PartialEq, Debug, Copy, Clone, PartialOrd, Ord)] pub enum ICU4XCollatorBackwardSecondLevel { Auto = 0, Off = 1, @@ -136,7 +174,7 @@ pub mod ffi { /// and the options from locale data were combined. None of the struct fields /// will have `Auto` as the value. #[diplomat::rust_link(icu::collator::Collator::resolved_options, FnInStruct)] - pub fn resolved_options(&self) -> ICU4XCollatorOptionsV1 { + pub fn resolved_options(&self) -> ICU4XCollatorResolvedOptionsV1 { self.0.resolved_options().into() } } @@ -235,7 +273,10 @@ impl From for ffi::ICU4XCollatorStrength { Strength::Tertiary => ffi::ICU4XCollatorStrength::Tertiary, Strength::Quaternary => ffi::ICU4XCollatorStrength::Quaternary, Strength::Identical => ffi::ICU4XCollatorStrength::Identical, - _ => panic!("FFI out of sync"), + _ => { + debug_assert!(false, "FFI out of sync"); + ffi::ICU4XCollatorStrength::Identical // Highest we know of + } } } } @@ -245,7 +286,11 @@ impl From for ffi::ICU4XCollatorAlternateHandling { match alternate_handling { AlternateHandling::NonIgnorable => ffi::ICU4XCollatorAlternateHandling::NonIgnorable, AlternateHandling::Shifted => ffi::ICU4XCollatorAlternateHandling::Shifted, - _ => panic!("FFI out of sync"), + _ => { + debug_assert!(false, "FFI out of sync"); + // Possible future values: ShiftTrimmed, Blanked + ffi::ICU4XCollatorAlternateHandling::Shifted // Highest we know of + } } } } @@ -256,7 +301,11 @@ impl From for ffi::ICU4XCollatorCaseFirst { CaseFirst::Off => ffi::ICU4XCollatorCaseFirst::Off, CaseFirst::LowerFirst => ffi::ICU4XCollatorCaseFirst::LowerFirst, CaseFirst::UpperFirst => ffi::ICU4XCollatorCaseFirst::UpperFirst, - _ => panic!("FFI out of sync"), + _ => { + debug_assert!(false, "FFI out of sync"); + // Does it even make sense that `CaseFirst` is non-exhaustive? + ffi::ICU4XCollatorCaseFirst::Off // The most neutral value + } } } } @@ -268,7 +317,10 @@ impl From for ffi::ICU4XCollatorMaxVariable { MaxVariable::Punctuation => ffi::ICU4XCollatorMaxVariable::Punctuation, MaxVariable::Symbol => ffi::ICU4XCollatorMaxVariable::Symbol, MaxVariable::Currency => ffi::ICU4XCollatorMaxVariable::Currency, - _ => panic!("FFI out of sync"), + _ => { + debug_assert!(false, "FFI out of sync"); + ffi::ICU4XCollatorMaxVariable::Currency // Highest we know of + } } } } @@ -278,7 +330,10 @@ impl From for ffi::ICU4XCollatorCaseLevel { match case_level { CaseLevel::Off => ffi::ICU4XCollatorCaseLevel::Off, CaseLevel::On => ffi::ICU4XCollatorCaseLevel::On, - _ => panic!("FFI out of sync"), + _ => { + debug_assert!(false, "FFI out of sync"); + ffi::ICU4XCollatorCaseLevel::On // The most enabled that we know of + } } } } @@ -288,7 +343,10 @@ impl From for ffi::ICU4XCollatorNumeric { match numeric { Numeric::Off => ffi::ICU4XCollatorNumeric::Off, Numeric::On => ffi::ICU4XCollatorNumeric::On, - _ => panic!("FFI out of sync"), + _ => { + debug_assert!(false, "FFI out of sync"); + ffi::ICU4XCollatorNumeric::On // The most enabled that we know of + } } } } @@ -298,7 +356,10 @@ impl From for ffi::ICU4XCollatorBackwardSecondLevel { match backward_second_level { BackwardSecondLevel::Off => ffi::ICU4XCollatorBackwardSecondLevel::Off, BackwardSecondLevel::On => ffi::ICU4XCollatorBackwardSecondLevel::On, - _ => panic!("FFI out of sync"), + _ => { + debug_assert!(false, "FFI out of sync"); + ffi::ICU4XCollatorBackwardSecondLevel::On // The most enabled that we know of + } } } } @@ -318,8 +379,8 @@ impl From for CollatorOptions { } } -impl From for ffi::ICU4XCollatorOptionsV1 { - fn from(options: ResolvedCollatorOptions) -> ffi::ICU4XCollatorOptionsV1 { +impl From for ffi::ICU4XCollatorResolvedOptionsV1 { + fn from(options: ResolvedCollatorOptions) -> ffi::ICU4XCollatorResolvedOptionsV1 { Self { strength: options.strength.into(), alternate_handling: options.alternate_handling.into(), From 474dcfe05dfc050f5bcde58dbbc9db1d7624ecd5 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Wed, 8 Nov 2023 13:49:16 +0200 Subject: [PATCH 5/7] Delete a convenience method on a non-opaque FFI --- ffi/capi/src/collator.rs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/ffi/capi/src/collator.rs b/ffi/capi/src/collator.rs index 438fd3c9bd1..eb81902602b 100644 --- a/ffi/capi/src/collator.rs +++ b/ffi/capi/src/collator.rs @@ -42,23 +42,6 @@ pub mod ffi { pub backward_second_level: ICU4XCollatorBackwardSecondLevel, } - impl ICU4XCollatorResolvedOptionsV1 { - /// Convenience conversion for copying the options from an - /// existing collator into a new one (overriding any locale-provided - /// defaults of the new one!). - pub fn into_options(&self) -> ICU4XCollatorOptionsV1 { - ICU4XCollatorOptionsV1 { - strength: self.strength, - alternate_handling: self.alternate_handling, - case_first: self.case_first, - max_variable: self.max_variable, - case_level: self.case_level, - numeric: self.numeric, - backward_second_level: self.backward_second_level, - } - } - } - #[diplomat::rust_link(icu::collator::Strength, Enum)] #[derive(Eq, PartialEq, Debug, Copy, Clone, PartialOrd, Ord)] pub enum ICU4XCollatorStrength { From e3e427efb025bf23ed3dc67ec8922edb60134e01 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Fri, 17 Nov 2023 11:04:20 +0200 Subject: [PATCH 6/7] Rerun cargo make diplomat-gen --- ffi/capi/c/include/ICU4XCollator.h | 3 + .../include/ICU4XCollatorResolvedOptionsV1.h | 50 + ffi/capi/cpp/docs/source/collator_ffi.rst | 26 + ffi/capi/cpp/include/ICU4XCollator.h | 3 + ffi/capi/cpp/include/ICU4XCollator.hpp | 15 + .../include/ICU4XCollatorResolvedOptionsV1.h | 50 + .../ICU4XCollatorResolvedOptionsV1.hpp | 38 + ffi/capi/dart/package/lib/src/lib.g.dart | 17606 +++++++--------- .../js/package/docs/source/collator_ffi.rst | 26 + ffi/capi/js/package/lib/ICU4XCollator.d.ts | 9 + ffi/capi/js/package/lib/ICU4XCollator.js | 11 + .../lib/ICU4XCollatorResolvedOptionsV1.d.ts | 21 + .../lib/ICU4XCollatorResolvedOptionsV1.js | 21 + ffi/capi/js/package/lib/index.d.ts | 1 + ffi/capi/js/package/lib/index.js | 1 + 15 files changed, 8071 insertions(+), 9810 deletions(-) create mode 100644 ffi/capi/c/include/ICU4XCollatorResolvedOptionsV1.h create mode 100644 ffi/capi/cpp/include/ICU4XCollatorResolvedOptionsV1.h create mode 100644 ffi/capi/cpp/include/ICU4XCollatorResolvedOptionsV1.hpp create mode 100644 ffi/capi/js/package/lib/ICU4XCollatorResolvedOptionsV1.d.ts create mode 100644 ffi/capi/js/package/lib/ICU4XCollatorResolvedOptionsV1.js diff --git a/ffi/capi/c/include/ICU4XCollator.h b/ffi/capi/c/include/ICU4XCollator.h index 973c2cedd96..b273aa7bb2a 100644 --- a/ffi/capi/c/include/ICU4XCollator.h +++ b/ffi/capi/c/include/ICU4XCollator.h @@ -19,6 +19,7 @@ typedef struct ICU4XCollator ICU4XCollator; #include "ICU4XCollatorOptionsV1.h" #include "diplomat_result_box_ICU4XCollator_ICU4XError.h" #include "ICU4XOrdering.h" +#include "ICU4XCollatorResolvedOptionsV1.h" #ifdef __cplusplus namespace capi { extern "C" { @@ -31,6 +32,8 @@ ICU4XOrdering ICU4XCollator_compare(const ICU4XCollator* self, const char* left_ ICU4XOrdering ICU4XCollator_compare_valid_utf8(const ICU4XCollator* self, const char* left_data, size_t left_len, const char* right_data, size_t right_len); ICU4XOrdering ICU4XCollator_compare_utf16(const ICU4XCollator* self, const uint16_t* left_data, size_t left_len, const uint16_t* right_data, size_t right_len); + +ICU4XCollatorResolvedOptionsV1 ICU4XCollator_resolved_options(const ICU4XCollator* self); void ICU4XCollator_destroy(ICU4XCollator* self); #ifdef __cplusplus diff --git a/ffi/capi/c/include/ICU4XCollatorResolvedOptionsV1.h b/ffi/capi/c/include/ICU4XCollatorResolvedOptionsV1.h new file mode 100644 index 00000000000..a332764e0ba --- /dev/null +++ b/ffi/capi/c/include/ICU4XCollatorResolvedOptionsV1.h @@ -0,0 +1,50 @@ +#ifndef ICU4XCollatorResolvedOptionsV1_H +#define ICU4XCollatorResolvedOptionsV1_H +#include +#include +#include +#include +#include "diplomat_runtime.h" + +#include "ICU4XCollatorStrength.h" +#include "ICU4XCollatorAlternateHandling.h" +#include "ICU4XCollatorCaseFirst.h" +#include "ICU4XCollatorMaxVariable.h" +#include "ICU4XCollatorCaseLevel.h" +#include "ICU4XCollatorNumeric.h" +#include "ICU4XCollatorBackwardSecondLevel.h" +#ifdef __cplusplus +namespace capi { +#endif + +typedef struct ICU4XCollatorResolvedOptionsV1 { + ICU4XCollatorStrength strength; + ICU4XCollatorAlternateHandling alternate_handling; + ICU4XCollatorCaseFirst case_first; + ICU4XCollatorMaxVariable max_variable; + ICU4XCollatorCaseLevel case_level; + ICU4XCollatorNumeric numeric; + ICU4XCollatorBackwardSecondLevel backward_second_level; +} ICU4XCollatorResolvedOptionsV1; +#ifdef __cplusplus +} // namespace capi +#endif +#include "ICU4XCollatorStrength.h" +#include "ICU4XCollatorAlternateHandling.h" +#include "ICU4XCollatorCaseFirst.h" +#include "ICU4XCollatorMaxVariable.h" +#include "ICU4XCollatorCaseLevel.h" +#include "ICU4XCollatorNumeric.h" +#include "ICU4XCollatorBackwardSecondLevel.h" +#ifdef __cplusplus +namespace capi { +extern "C" { +#endif + +void ICU4XCollatorResolvedOptionsV1_destroy(ICU4XCollatorResolvedOptionsV1* self); + +#ifdef __cplusplus +} // extern "C" +} // namespace capi +#endif +#endif diff --git a/ffi/capi/cpp/docs/source/collator_ffi.rst b/ffi/capi/cpp/docs/source/collator_ffi.rst index ce3c24f07b0..34d4a34d8c0 100644 --- a/ffi/capi/cpp/docs/source/collator_ffi.rst +++ b/ffi/capi/cpp/docs/source/collator_ffi.rst @@ -38,6 +38,13 @@ See the `Rust documentation for compare_utf16 `__ for more information. + .. cpp:function:: ICU4XCollatorResolvedOptionsV1 resolved_options() const + + The resolved options showing how the default options, the requested options, and the options from locale data were combined. None of the struct fields will have ``Auto`` as the value. + + See the `Rust documentation for resolved_options `__ for more information. + + .. cpp:enum-struct:: ICU4XCollatorAlternateHandling See the `Rust documentation for AlternateHandling `__ for more information. @@ -115,6 +122,25 @@ See the `Rust documentation for CollatorOptions `__ for more information. + .. cpp:member:: ICU4XCollatorStrength strength + + .. cpp:member:: ICU4XCollatorAlternateHandling alternate_handling + + .. cpp:member:: ICU4XCollatorCaseFirst case_first + + .. cpp:member:: ICU4XCollatorMaxVariable max_variable + + .. cpp:member:: ICU4XCollatorCaseLevel case_level + + .. cpp:member:: ICU4XCollatorNumeric numeric + + .. cpp:member:: ICU4XCollatorBackwardSecondLevel backward_second_level + +.. cpp:struct:: ICU4XCollatorResolvedOptionsV1 + + See the `Rust documentation for ResolvedCollatorOptions `__ for more information. + + .. cpp:member:: ICU4XCollatorStrength strength .. cpp:member:: ICU4XCollatorAlternateHandling alternate_handling diff --git a/ffi/capi/cpp/include/ICU4XCollator.h b/ffi/capi/cpp/include/ICU4XCollator.h index 973c2cedd96..b273aa7bb2a 100644 --- a/ffi/capi/cpp/include/ICU4XCollator.h +++ b/ffi/capi/cpp/include/ICU4XCollator.h @@ -19,6 +19,7 @@ typedef struct ICU4XCollator ICU4XCollator; #include "ICU4XCollatorOptionsV1.h" #include "diplomat_result_box_ICU4XCollator_ICU4XError.h" #include "ICU4XOrdering.h" +#include "ICU4XCollatorResolvedOptionsV1.h" #ifdef __cplusplus namespace capi { extern "C" { @@ -31,6 +32,8 @@ ICU4XOrdering ICU4XCollator_compare(const ICU4XCollator* self, const char* left_ ICU4XOrdering ICU4XCollator_compare_valid_utf8(const ICU4XCollator* self, const char* left_data, size_t left_len, const char* right_data, size_t right_len); ICU4XOrdering ICU4XCollator_compare_utf16(const ICU4XCollator* self, const uint16_t* left_data, size_t left_len, const uint16_t* right_data, size_t right_len); + +ICU4XCollatorResolvedOptionsV1 ICU4XCollator_resolved_options(const ICU4XCollator* self); void ICU4XCollator_destroy(ICU4XCollator* self); #ifdef __cplusplus diff --git a/ffi/capi/cpp/include/ICU4XCollator.hpp b/ffi/capi/cpp/include/ICU4XCollator.hpp index d661661f5ae..44f329f14fb 100644 --- a/ffi/capi/cpp/include/ICU4XCollator.hpp +++ b/ffi/capi/cpp/include/ICU4XCollator.hpp @@ -17,6 +17,7 @@ struct ICU4XCollatorOptionsV1; class ICU4XCollator; #include "ICU4XError.hpp" #include "ICU4XOrdering.hpp" +struct ICU4XCollatorResolvedOptionsV1; /** * A destruction policy for using ICU4XCollator with std::unique_ptr. @@ -68,6 +69,15 @@ class ICU4XCollator { * See the [Rust documentation for `compare_utf16`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.compare_utf16) for more information. */ ICU4XOrdering compare_utf16(const diplomat::span left, const diplomat::span right) const; + + /** + * The resolved options showing how the default options, the requested options, + * and the options from locale data were combined. None of the struct fields + * will have `Auto` as the value. + * + * See the [Rust documentation for `resolved_options`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.resolved_options) for more information. + */ + ICU4XCollatorResolvedOptionsV1 resolved_options() const; inline const capi::ICU4XCollator* AsFFI() const { return this->inner.get(); } inline capi::ICU4XCollator* AsFFIMut() { return this->inner.get(); } inline ICU4XCollator(capi::ICU4XCollator* i) : inner(i) {} @@ -81,6 +91,7 @@ class ICU4XCollator { #include "ICU4XDataProvider.hpp" #include "ICU4XLocale.hpp" #include "ICU4XCollatorOptionsV1.hpp" +#include "ICU4XCollatorResolvedOptionsV1.hpp" inline diplomat::result ICU4XCollator::create_v1(const ICU4XDataProvider& provider, const ICU4XLocale& locale, ICU4XCollatorOptionsV1 options) { ICU4XCollatorOptionsV1 diplomat_wrapped_struct_options = options; @@ -102,4 +113,8 @@ inline ICU4XOrdering ICU4XCollator::compare_valid_utf8(const std::string_view le inline ICU4XOrdering ICU4XCollator::compare_utf16(const diplomat::span left, const diplomat::span right) const { return static_cast(capi::ICU4XCollator_compare_utf16(this->inner.get(), left.data(), left.size(), right.data(), right.size())); } +inline ICU4XCollatorResolvedOptionsV1 ICU4XCollator::resolved_options() const { + capi::ICU4XCollatorResolvedOptionsV1 diplomat_raw_struct_out_value = capi::ICU4XCollator_resolved_options(this->inner.get()); + return ICU4XCollatorResolvedOptionsV1{ .strength = std::move(static_cast(diplomat_raw_struct_out_value.strength)), .alternate_handling = std::move(static_cast(diplomat_raw_struct_out_value.alternate_handling)), .case_first = std::move(static_cast(diplomat_raw_struct_out_value.case_first)), .max_variable = std::move(static_cast(diplomat_raw_struct_out_value.max_variable)), .case_level = std::move(static_cast(diplomat_raw_struct_out_value.case_level)), .numeric = std::move(static_cast(diplomat_raw_struct_out_value.numeric)), .backward_second_level = std::move(static_cast(diplomat_raw_struct_out_value.backward_second_level)) }; +} #endif diff --git a/ffi/capi/cpp/include/ICU4XCollatorResolvedOptionsV1.h b/ffi/capi/cpp/include/ICU4XCollatorResolvedOptionsV1.h new file mode 100644 index 00000000000..a332764e0ba --- /dev/null +++ b/ffi/capi/cpp/include/ICU4XCollatorResolvedOptionsV1.h @@ -0,0 +1,50 @@ +#ifndef ICU4XCollatorResolvedOptionsV1_H +#define ICU4XCollatorResolvedOptionsV1_H +#include +#include +#include +#include +#include "diplomat_runtime.h" + +#include "ICU4XCollatorStrength.h" +#include "ICU4XCollatorAlternateHandling.h" +#include "ICU4XCollatorCaseFirst.h" +#include "ICU4XCollatorMaxVariable.h" +#include "ICU4XCollatorCaseLevel.h" +#include "ICU4XCollatorNumeric.h" +#include "ICU4XCollatorBackwardSecondLevel.h" +#ifdef __cplusplus +namespace capi { +#endif + +typedef struct ICU4XCollatorResolvedOptionsV1 { + ICU4XCollatorStrength strength; + ICU4XCollatorAlternateHandling alternate_handling; + ICU4XCollatorCaseFirst case_first; + ICU4XCollatorMaxVariable max_variable; + ICU4XCollatorCaseLevel case_level; + ICU4XCollatorNumeric numeric; + ICU4XCollatorBackwardSecondLevel backward_second_level; +} ICU4XCollatorResolvedOptionsV1; +#ifdef __cplusplus +} // namespace capi +#endif +#include "ICU4XCollatorStrength.h" +#include "ICU4XCollatorAlternateHandling.h" +#include "ICU4XCollatorCaseFirst.h" +#include "ICU4XCollatorMaxVariable.h" +#include "ICU4XCollatorCaseLevel.h" +#include "ICU4XCollatorNumeric.h" +#include "ICU4XCollatorBackwardSecondLevel.h" +#ifdef __cplusplus +namespace capi { +extern "C" { +#endif + +void ICU4XCollatorResolvedOptionsV1_destroy(ICU4XCollatorResolvedOptionsV1* self); + +#ifdef __cplusplus +} // extern "C" +} // namespace capi +#endif +#endif diff --git a/ffi/capi/cpp/include/ICU4XCollatorResolvedOptionsV1.hpp b/ffi/capi/cpp/include/ICU4XCollatorResolvedOptionsV1.hpp new file mode 100644 index 00000000000..a25c14dbc61 --- /dev/null +++ b/ffi/capi/cpp/include/ICU4XCollatorResolvedOptionsV1.hpp @@ -0,0 +1,38 @@ +#ifndef ICU4XCollatorResolvedOptionsV1_HPP +#define ICU4XCollatorResolvedOptionsV1_HPP +#include +#include +#include +#include +#include +#include +#include +#include "diplomat_runtime.hpp" + +#include "ICU4XCollatorResolvedOptionsV1.h" + +#include "ICU4XCollatorStrength.hpp" +#include "ICU4XCollatorAlternateHandling.hpp" +#include "ICU4XCollatorCaseFirst.hpp" +#include "ICU4XCollatorMaxVariable.hpp" +#include "ICU4XCollatorCaseLevel.hpp" +#include "ICU4XCollatorNumeric.hpp" +#include "ICU4XCollatorBackwardSecondLevel.hpp" + + +/** + * See the [Rust documentation for `ResolvedCollatorOptions`](https://docs.rs/icu/latest/icu/collator/struct.ResolvedCollatorOptions.html) for more information. + */ +struct ICU4XCollatorResolvedOptionsV1 { + public: + ICU4XCollatorStrength strength; + ICU4XCollatorAlternateHandling alternate_handling; + ICU4XCollatorCaseFirst case_first; + ICU4XCollatorMaxVariable max_variable; + ICU4XCollatorCaseLevel case_level; + ICU4XCollatorNumeric numeric; + ICU4XCollatorBackwardSecondLevel backward_second_level; +}; + + +#endif diff --git a/ffi/capi/dart/package/lib/src/lib.g.dart b/ffi/capi/dart/package/lib/src/lib.g.dart index 513be9b41ce..45f086a7128 100644 --- a/ffi/capi/dart/package/lib/src/lib.g.dart +++ b/ffi/capi/dart/package/lib/src/lib.g.dart @@ -13,325 +13,262 @@ void init(String path) => _capi = ffi.DynamicLibrary.open(path).lookup; final _callocFree = Finalizer(ffi2.calloc.free); + /// The various calendar types currently supported by [`ICU4XCalendar`] -/// +/// /// See the [Rust documentation for `AnyCalendarKind`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html) for more information. enum AnyCalendarKind { /// The kind of an Iso calendar iso, - /// The kind of a Gregorian calendar gregorian, - /// The kind of a Buddhist calendar buddhist, - /// The kind of a Japanese calendar with modern eras japanese, - /// The kind of a Japanese calendar with modern and historic eras japaneseExtended, - /// The kind of an Ethiopian calendar, with Amete Mihret era ethiopian, - /// The kind of an Ethiopian calendar, with Amete Alem era ethiopianAmeteAlem, - /// The kind of a Indian calendar indian, - /// The kind of a Coptic calendar coptic, - /// The kind of a Dangi calendar dangi, - /// The kind of a Chinese calendar chinese, - /// The kind of a Hebrew calendar hebrew, - /// The kind of a Islamic civil calendar islamicCivil, - /// The kind of a Islamic observational calendar islamicObservational, - /// The kind of a Islamic tabular calendar islamicTabular, - /// The kind of a Islamic Umm al-Qura calendar islamicUmmAlQura, - /// The kind of a Persian calendar persian, - /// The kind of a Roc calendar roc; - /// Read the calendar type off of the -u-ca- extension on a locale. - /// - /// Errors if there is no calendar on the locale or if the locale's calendar - /// is not known or supported. - /// - /// See the [Rust documentation for `get_for_locale`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html#method.get_for_locale) for more information. - factory AnyCalendarKind.forLocale(Locale locale) { - final result = _ICU4XAnyCalendarKind_get_for_locale(locale._underlying); - return result.isOk - ? AnyCalendarKind.values[result.union.ok] - : throw VoidError(); + +/// Read the calendar type off of the -u-ca- extension on a locale. +/// +/// Errors if there is no calendar on the locale or if the locale's calendar +/// is not known or supported. +/// +/// See the [Rust documentation for `get_for_locale`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html#method.get_for_locale) for more information. +factory AnyCalendarKind.forLocale(Locale locale) { + + final result = _ICU4XAnyCalendarKind_get_for_locale(locale._underlying); + return result.isOk ? AnyCalendarKind.values[result.union.ok] : throw VoidError(); } // ignore: non_constant_identifier_names - static final _ICU4XAnyCalendarKind_get_for_locale = _capi< - ffi.NativeFunction< - _ResultInt32Void Function(ffi.Pointer)>>( - 'ICU4XAnyCalendarKind_get_for_locale') - .asFunction<_ResultInt32Void Function(ffi.Pointer)>( - isLeaf: true); - - /// Obtain the calendar type given a BCP-47 -u-ca- extension string. - /// - /// Errors if the calendar is not known or supported. - /// - /// See the [Rust documentation for `get_for_bcp47_value`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html#method.get_for_bcp47_value) for more information. - factory AnyCalendarKind.forBcp47(String s) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final result = - _ICU4XAnyCalendarKind_get_for_bcp47(sSlice._bytes, sSlice._length); - alloc.releaseAll(); - return result.isOk - ? AnyCalendarKind.values[result.union.ok] - : throw VoidError(); - } - // ignore: non_constant_identifier_names - static final _ICU4XAnyCalendarKind_get_for_bcp47 = _capi< - ffi.NativeFunction< - _ResultInt32Void Function(ffi.Pointer, - ffi.Size)>>('ICU4XAnyCalendarKind_get_for_bcp47') - .asFunction<_ResultInt32Void Function(ffi.Pointer, int)>( - isLeaf: true); - - /// Obtain the string suitable for use in the -u-ca- extension in a BCP47 locale. - /// - /// See the [Rust documentation for `as_bcp47_string`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html#method.as_bcp47_string) for more information. - String get bcp47 { - final writeable = _Writeable(); - final result = _ICU4XAnyCalendarKind_bcp47(index, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XAnyCalendarKind_bcp47 = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Int32, - ffi.Pointer)>>('ICU4XAnyCalendarKind_bcp47') - .asFunction<_ResultVoidInt32 Function(int, ffi.Pointer)>( - isLeaf: true); + static final _ICU4XAnyCalendarKind_get_for_locale= _capi)>>('ICU4XAnyCalendarKind_get_for_locale') + .asFunction<_ResultInt32Void Function(ffi.Pointer)>(isLeaf: true); + + + + +/// Obtain the calendar type given a BCP-47 -u-ca- extension string. +/// +/// Errors if the calendar is not known or supported. +/// +/// See the [Rust documentation for `get_for_bcp47_value`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html#method.get_for_bcp47_value) for more information. +factory AnyCalendarKind.forBcp47(String s) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final result = _ICU4XAnyCalendarKind_get_for_bcp47(sSlice._bytes,sSlice._length);alloc.releaseAll(); + return result.isOk ? AnyCalendarKind.values[result.union.ok] : throw VoidError(); + } + // ignore: non_constant_identifier_names + static final _ICU4XAnyCalendarKind_get_for_bcp47= _capi, ffi.Size)>>('ICU4XAnyCalendarKind_get_for_bcp47') + .asFunction<_ResultInt32Void Function(ffi.Pointer, int)>(isLeaf: true); + + + + +/// Obtain the string suitable for use in the -u-ca- extension in a BCP47 locale. +/// +/// See the [Rust documentation for `as_bcp47_string`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html#method.as_bcp47_string) for more information. +String get bcp47 { + + final writeable = _Writeable(); + final result = _ICU4XAnyCalendarKind_bcp47(index,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XAnyCalendarKind_bcp47= _capi)>>('ICU4XAnyCalendarKind_bcp47') + .asFunction<_ResultVoidInt32 Function(int, ffi.Pointer)>(isLeaf: true); + + } + /// An object capable of mapping from a BCP-47 time zone ID to an IANA ID. -/// +/// /// See the [Rust documentation for `IanaBcp47RoundTripMapper`](https://docs.rs/icu/latest/icu/timezone/struct.IanaBcp47RoundTripMapper.html) for more information. class Bcp47ToIanaMapper implements ffi.Finalizable { - final ffi.Pointer _underlying; - Bcp47ToIanaMapper._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XBcp47ToIanaMapper_destroy')); - - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/timezone/struct.IanaBcp47RoundTripMapper.html#method.new) for more information. - factory Bcp47ToIanaMapper(DataProvider provider) { - final result = _ICU4XBcp47ToIanaMapper_create(provider._underlying); - return result.isOk - ? Bcp47ToIanaMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XBcp47ToIanaMapper_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XBcp47ToIanaMapper_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Writes out the canonical IANA time zone ID corresponding to the given BCP-47 ID. - /// - /// See the [Rust documentation for `bcp47_to_iana`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.IanaBcp47RoundTripMapper.html#method.bcp47_to_iana) for more information. - String operator [](String value) { - final alloc = ffi2.Arena(); - final valueSlice = _SliceFfi2Utf8._fromDart(value, alloc); - - final writeable = _Writeable(); - final result = _ICU4XBcp47ToIanaMapper_get(_underlying, valueSlice._bytes, - valueSlice._length, writeable._underlying); - alloc.releaseAll(); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XBcp47ToIanaMapper_get = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer)>>('ICU4XBcp47ToIanaMapper_get') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(isLeaf: true); -} + final ffi.Pointer _underlying; + + Bcp47ToIanaMapper._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XBcp47ToIanaMapper_destroy')); + + +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/timezone/struct.IanaBcp47RoundTripMapper.html#method.new) for more information. +factory Bcp47ToIanaMapper(DataProvider provider) { + + final result = _ICU4XBcp47ToIanaMapper_create(provider._underlying); + return result.isOk ? Bcp47ToIanaMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XBcp47ToIanaMapper_create= _capi)>>('ICU4XBcp47ToIanaMapper_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Writes out the canonical IANA time zone ID corresponding to the given BCP-47 ID. +/// +/// See the [Rust documentation for `bcp47_to_iana`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.IanaBcp47RoundTripMapper.html#method.bcp47_to_iana) for more information. +String operator [](String value) { + final alloc = ffi2.Arena(); + final valueSlice = _SliceFfi2Utf8._fromDart(value, alloc); + + final writeable = _Writeable(); + final result = _ICU4XBcp47ToIanaMapper_get(_underlying,valueSlice._bytes,valueSlice._length,writeable._underlying);alloc.releaseAll(); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XBcp47ToIanaMapper_get= _capi, ffi.Pointer, ffi.Size, ffi.Pointer)>>('ICU4XBcp47ToIanaMapper_get') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int, ffi.Pointer)>(isLeaf: true); + + + } + /// An ICU4X Bidi object, containing loaded bidi data -/// +/// /// See the [Rust documentation for `BidiClassAdapter`](https://docs.rs/icu/latest/icu/properties/bidi/struct.BidiClassAdapter.html) for more information. class Bidi implements ffi.Finalizable { - final ffi.Pointer _underlying; - Bidi._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XBidi_destroy')); - - /// Creates a new [`ICU4XBidi`] from locale data. - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/properties/bidi/struct.BidiClassAdapter.html#method.new) for more information. - factory Bidi(DataProvider provider) { - final result = _ICU4XBidi_create(provider._underlying); - return result.isOk - ? Bidi._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XBidi_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XBidi_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Use the data loaded in this object to process a string and calculate bidi information - /// - /// Takes in a Level for the default level, if it is an invalid value it will default to LTR - /// - /// See the [Rust documentation for `new_with_data_source`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.BidiInfo.html#method.new_with_data_source) for more information. - BidiInfo forText(String text, int defaultLevel) { - final alloc = ffi2.Arena(); - final textSlice = _SliceFfi2Utf8._fromDart(text, alloc); - - final result = _ICU4XBidi_for_text( - _underlying, textSlice._bytes, textSlice._length, defaultLevel); - alloc.releaseAll(); - return BidiInfo._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XBidi_for_text = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Uint8)>>('ICU4XBidi_for_text') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int, int)>(isLeaf: true); - - /// Utility function for producing reorderings given a list of levels - /// - /// Produces a map saying which visual index maps to which source index. - /// - /// The levels array must not have values greater than 126 (this is the - /// Bidi maximum explicit depth plus one). - /// Failure to follow this invariant may lead to incorrect results, - /// but is still safe. - /// - /// See the [Rust documentation for `reorder_visual`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.BidiInfo.html#method.reorder_visual) for more information. - ReorderedIndexMap reorderVisual(Uint8List levels) { - final alloc = ffi2.Arena(); - final levelsSlice = _SliceFfiUint8._fromDart(levels, alloc); - - final result = _ICU4XBidi_reorder_visual( - _underlying, levelsSlice._bytes, levelsSlice._length); - alloc.releaseAll(); - return ReorderedIndexMap._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XBidi_reorder_visual = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XBidi_reorder_visual') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Check if a Level returned by level_at is an RTL level. - /// - /// Invalid levels (numbers greater than 125) will be assumed LTR - /// - /// See the [Rust documentation for `is_rtl`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Level.html#method.is_rtl) for more information. - static bool levelIsRtl(int level) { - final result = _ICU4XBidi_level_is_rtl(level); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XBidi_level_is_rtl = - _capi>( - 'ICU4XBidi_level_is_rtl') - .asFunction(isLeaf: true); - - /// Check if a Level returned by level_at is an LTR level. - /// - /// Invalid levels (numbers greater than 125) will be assumed LTR - /// - /// See the [Rust documentation for `is_ltr`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Level.html#method.is_ltr) for more information. - static bool levelIsLtr(int level) { - final result = _ICU4XBidi_level_is_ltr(level); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XBidi_level_is_ltr = - _capi>( - 'ICU4XBidi_level_is_ltr') - .asFunction(isLeaf: true); - - /// Get a basic RTL Level value - /// - /// See the [Rust documentation for `rtl`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Level.html#method.rtl) for more information. - static final int levelRtl = - _capi>('ICU4XBidi_level_rtl') - .asFunction(isLeaf: true)(); - - /// Get a simple LTR Level value - /// - /// See the [Rust documentation for `ltr`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Level.html#method.ltr) for more information. - static final int levelLtr = - _capi>('ICU4XBidi_level_ltr') - .asFunction(isLeaf: true)(); -} + final ffi.Pointer _underlying; + + Bidi._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XBidi_destroy')); + + +/// Creates a new [`ICU4XBidi`] from locale data. +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/properties/bidi/struct.BidiClassAdapter.html#method.new) for more information. +factory Bidi(DataProvider provider) { + + final result = _ICU4XBidi_create(provider._underlying); + return result.isOk ? Bidi._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XBidi_create= _capi)>>('ICU4XBidi_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Use the data loaded in this object to process a string and calculate bidi information +/// +/// Takes in a Level for the default level, if it is an invalid value it will default to LTR +/// +/// See the [Rust documentation for `new_with_data_source`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.BidiInfo.html#method.new_with_data_source) for more information. +BidiInfo forText(String text, int defaultLevel) { + final alloc = ffi2.Arena(); + final textSlice = _SliceFfi2Utf8._fromDart(text, alloc); + + final result = _ICU4XBidi_for_text(_underlying,textSlice._bytes,textSlice._length,defaultLevel);alloc.releaseAll(); + return BidiInfo._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XBidi_for_text= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size, ffi.Uint8)>>('ICU4XBidi_for_text') + .asFunction Function(ffi.Pointer, ffi.Pointer, int, int)>(isLeaf: true); + + + +/// Utility function for producing reorderings given a list of levels +/// +/// Produces a map saying which visual index maps to which source index. +/// +/// The levels array must not have values greater than 126 (this is the +/// Bidi maximum explicit depth plus one). +/// Failure to follow this invariant may lead to incorrect results, +/// but is still safe. +/// +/// See the [Rust documentation for `reorder_visual`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.BidiInfo.html#method.reorder_visual) for more information. +ReorderedIndexMap reorderVisual(Uint8List levels) { + final alloc = ffi2.Arena(); + final levelsSlice = _SliceFfiUint8._fromDart(levels, alloc); + + final result = _ICU4XBidi_reorder_visual(_underlying,levelsSlice._bytes,levelsSlice._length);alloc.releaseAll(); + return ReorderedIndexMap._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XBidi_reorder_visual= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XBidi_reorder_visual') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Check if a Level returned by level_at is an RTL level. +/// +/// Invalid levels (numbers greater than 125) will be assumed LTR +/// +/// See the [Rust documentation for `is_rtl`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Level.html#method.is_rtl) for more information. +static bool levelIsRtl(int level) { + + final result = _ICU4XBidi_level_is_rtl(level); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XBidi_level_is_rtl= _capi>('ICU4XBidi_level_is_rtl') + .asFunction(isLeaf: true); + + + +/// Check if a Level returned by level_at is an LTR level. +/// +/// Invalid levels (numbers greater than 125) will be assumed LTR +/// +/// See the [Rust documentation for `is_ltr`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Level.html#method.is_ltr) for more information. +static bool levelIsLtr(int level) { + + final result = _ICU4XBidi_level_is_ltr(level); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XBidi_level_is_ltr= _capi>('ICU4XBidi_level_is_ltr') + .asFunction(isLeaf: true); + + + +/// Get a basic RTL Level value +/// +/// See the [Rust documentation for `rtl`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Level.html#method.rtl) for more information. +static final int levelRtl = _capi>('ICU4XBidi_level_rtl').asFunction(isLeaf: true)(); + + +/// Get a simple LTR Level value +/// +/// See the [Rust documentation for `ltr`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Level.html#method.ltr) for more information. +static final int levelLtr = _capi>('ICU4XBidi_level_ltr').asFunction(isLeaf: true)(); + + } + enum BidiDirection { ltr, @@ -339,2895 +276,2291 @@ enum BidiDirection { mixed; } + /// An object containing bidi information for a given string, produced by `for_text()` on `ICU4XBidi` -/// +/// /// See the [Rust documentation for `BidiInfo`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.BidiInfo.html) for more information. class BidiInfo implements ffi.Finalizable { - final ffi.Pointer _underlying; - BidiInfo._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XBidiInfo_destroy')); + BidiInfo._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// The number of paragraphs contained here - int get paragraphCount { - final result = _ICU4XBidiInfo_paragraph_count(_underlying); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XBidiInfo_destroy')); + +/// The number of paragraphs contained here +int get paragraphCount { + + final result = _ICU4XBidiInfo_paragraph_count(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XBidiInfo_paragraph_count = - _capi)>>( - 'ICU4XBidiInfo_paragraph_count') - .asFunction)>(isLeaf: true); + static final _ICU4XBidiInfo_paragraph_count= _capi)>>('ICU4XBidiInfo_paragraph_count') + .asFunction)>(isLeaf: true); - /// Get the nth paragraph, returning `None` if out of bounds - BidiParagraph? paragraphAt(int n) { - final result = _ICU4XBidiInfo_paragraph_at(_underlying, n); - return result.address == 0 ? null : BidiParagraph._(result); - } + +/// Get the nth paragraph, returning `None` if out of bounds +BidiParagraph? paragraphAt(int n) { + + final result = _ICU4XBidiInfo_paragraph_at(_underlying,n); + return result.address == 0 ? null : BidiParagraph._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XBidiInfo_paragraph_at = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Size)>>('ICU4XBidiInfo_paragraph_at') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, int)>(isLeaf: true); + static final _ICU4XBidiInfo_paragraph_at= _capi Function(ffi.Pointer, ffi.Size)>>('ICU4XBidiInfo_paragraph_at') + .asFunction Function(ffi.Pointer, int)>(isLeaf: true); - /// The number of bytes in this full text - int get size { - final result = _ICU4XBidiInfo_size(_underlying); - return result; - } + +/// The number of bytes in this full text +int get size { + + final result = _ICU4XBidiInfo_size(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XBidiInfo_size = - _capi)>>( - 'ICU4XBidiInfo_size') - .asFunction)>(isLeaf: true); + static final _ICU4XBidiInfo_size= _capi)>>('ICU4XBidiInfo_size') + .asFunction)>(isLeaf: true); - /// Get the BIDI level at a particular byte index in the full text. - /// This integer is conceptually a `unicode_bidi::Level`, - /// and can be further inspected using the static methods on ICU4XBidi. - /// - /// Returns 0 (equivalent to `Level::ltr()`) on error - int levelAt(int pos) { - final result = _ICU4XBidiInfo_level_at(_underlying, pos); - return result; - } + +/// Get the BIDI level at a particular byte index in the full text. +/// This integer is conceptually a `unicode_bidi::Level`, +/// and can be further inspected using the static methods on ICU4XBidi. +/// +/// Returns 0 (equivalent to `Level::ltr()`) on error +int levelAt(int pos) { + + final result = _ICU4XBidiInfo_level_at(_underlying,pos); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XBidiInfo_level_at = _capi< - ffi.NativeFunction< - ffi.Uint8 Function( - ffi.Pointer, ffi.Size)>>('ICU4XBidiInfo_level_at') - .asFunction, int)>(isLeaf: true); -} + static final _ICU4XBidiInfo_level_at= _capi, ffi.Size)>>('ICU4XBidiInfo_level_at') + .asFunction, int)>(isLeaf: true); + + + } + /// Bidi information for a single processed paragraph class BidiParagraph implements ffi.Finalizable { - final ffi.Pointer _underlying; - BidiParagraph._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XBidiParagraph_destroy')); + BidiParagraph._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Given a paragraph index `n` within the surrounding text, this sets this - /// object to the paragraph at that index. Returns `ICU4XError::OutOfBoundsError` when out of bounds. - /// - /// This is equivalent to calling `paragraph_at()` on `ICU4XBidiInfo` but doesn't - /// create a new object - void setParagraphInText(int n) { - final result = _ICU4XBidiParagraph_set_paragraph_in_text(_underlying, n); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XBidiParagraph_destroy')); + + +/// Given a paragraph index `n` within the surrounding text, this sets this +/// object to the paragraph at that index. Returns `ICU4XError::OutOfBoundsError` when out of bounds. +/// +/// This is equivalent to calling `paragraph_at()` on `ICU4XBidiInfo` but doesn't +/// create a new object +void setParagraphInText(int n) { + + final result = _ICU4XBidiParagraph_set_paragraph_in_text(_underlying,n); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } } + // ignore: non_constant_identifier_names + static final _ICU4XBidiParagraph_set_paragraph_in_text= _capi, ffi.Size)>>('ICU4XBidiParagraph_set_paragraph_in_text') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, int)>(isLeaf: true); + + +/// The primary direction of this paragraph +/// +/// See the [Rust documentation for `level_at`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Paragraph.html#method.level_at) for more information. +BidiDirection get direction { + + final result = _ICU4XBidiParagraph_direction(_underlying); + return BidiDirection.values[result]; + } // ignore: non_constant_identifier_names - static final _ICU4XBidiParagraph_set_paragraph_in_text = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Size)>>('ICU4XBidiParagraph_set_paragraph_in_text') - .asFunction<_ResultVoidInt32 Function(ffi.Pointer, int)>( - isLeaf: true); + static final _ICU4XBidiParagraph_direction= _capi)>>('ICU4XBidiParagraph_direction') + .asFunction)>(isLeaf: true); - /// The primary direction of this paragraph - /// - /// See the [Rust documentation for `level_at`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Paragraph.html#method.level_at) for more information. - BidiDirection get direction { - final result = _ICU4XBidiParagraph_direction(_underlying); - return BidiDirection.values[result]; + + +/// The number of bytes in this paragraph +/// +/// See the [Rust documentation for `len`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.ParagraphInfo.html#method.len) for more information. +int get size { + + final result = _ICU4XBidiParagraph_size(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XBidiParagraph_size= _capi)>>('ICU4XBidiParagraph_size') + .asFunction)>(isLeaf: true); + + +/// The start index of this paragraph within the source text +int get rangeStart { + + final result = _ICU4XBidiParagraph_range_start(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XBidiParagraph_direction = - _capi)>>( - 'ICU4XBidiParagraph_direction') - .asFunction)>(isLeaf: true); + static final _ICU4XBidiParagraph_range_start= _capi)>>('ICU4XBidiParagraph_range_start') + .asFunction)>(isLeaf: true); + - /// The number of bytes in this paragraph - /// - /// See the [Rust documentation for `len`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.ParagraphInfo.html#method.len) for more information. - int get size { - final result = _ICU4XBidiParagraph_size(_underlying); - return result; + +/// The end index of this paragraph within the source text +int get rangeEnd { + + final result = _ICU4XBidiParagraph_range_end(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XBidiParagraph_range_end= _capi)>>('ICU4XBidiParagraph_range_end') + .asFunction)>(isLeaf: true); + + +/// Reorder a line based on display order. The ranges are specified relative to the source text and must be contained +/// within this paragraph's range. +/// +/// See the [Rust documentation for `level_at`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Paragraph.html#method.level_at) for more information. +String reorderLine(int rangeStart, int rangeEnd) { + + final writeable = _Writeable(); + final result = _ICU4XBidiParagraph_reorder_line(_underlying,rangeStart,rangeEnd,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XBidiParagraph_size = - _capi)>>( - 'ICU4XBidiParagraph_size') - .asFunction)>(isLeaf: true); + static final _ICU4XBidiParagraph_reorder_line= _capi, ffi.Size, ffi.Size, ffi.Pointer)>>('ICU4XBidiParagraph_reorder_line') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, int, int, ffi.Pointer)>(isLeaf: true); + - /// The start index of this paragraph within the source text - int get rangeStart { - final result = _ICU4XBidiParagraph_range_start(_underlying); - return result; + +/// Get the BIDI level at a particular byte index in this paragraph. +/// This integer is conceptually a `unicode_bidi::Level`, +/// and can be further inspected using the static methods on ICU4XBidi. +/// +/// Returns 0 (equivalent to `Level::ltr()`) on error +/// +/// See the [Rust documentation for `level_at`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Paragraph.html#method.level_at) for more information. +int levelAt(int pos) { + + final result = _ICU4XBidiParagraph_level_at(_underlying,pos); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XBidiParagraph_level_at= _capi, ffi.Size)>>('ICU4XBidiParagraph_level_at') + .asFunction, int)>(isLeaf: true); + + + } + + +/// See the [Rust documentation for `AnyCalendar`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendar.html) for more information. +class Calendar implements ffi.Finalizable { + + final ffi.Pointer _underlying; + Calendar._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCalendar_destroy')); + + +/// Creates a new [`ICU4XCalendar`] from the specified date and time. +/// +/// See the [Rust documentation for `new_for_locale`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendar.html#method.new_for_locale) for more information. +factory Calendar.forLocale(DataProvider provider, Locale locale) { + + final result = _ICU4XCalendar_create_for_locale(provider._underlying,locale._underlying); + return result.isOk ? Calendar._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XBidiParagraph_range_start = - _capi)>>( - 'ICU4XBidiParagraph_range_start') - .asFunction)>(isLeaf: true); + static final _ICU4XCalendar_create_for_locale= _capi, ffi.Pointer)>>('ICU4XCalendar_create_for_locale') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + - /// The end index of this paragraph within the source text - int get rangeEnd { - final result = _ICU4XBidiParagraph_range_end(_underlying); - return result; + +/// Creates a new [`ICU4XCalendar`] from the specified date and time. +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendar.html#method.new) for more information. +factory Calendar.forKind(DataProvider provider, AnyCalendarKind kind) { + + final result = _ICU4XCalendar_create_for_kind(provider._underlying,kind.index); + return result.isOk ? Calendar._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XCalendar_create_for_kind= _capi, ffi.Int32)>>('ICU4XCalendar_create_for_kind') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>(isLeaf: true); + + +/// Returns the kind of this calendar +/// +/// See the [Rust documentation for `kind`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendar.html#method.kind) for more information. +AnyCalendarKind get kind { + + final result = _ICU4XCalendar_kind(_underlying); + return AnyCalendarKind.values[result]; + } // ignore: non_constant_identifier_names - static final _ICU4XBidiParagraph_range_end = - _capi)>>( - 'ICU4XBidiParagraph_range_end') - .asFunction)>(isLeaf: true); + static final _ICU4XCalendar_kind= _capi)>>('ICU4XCalendar_kind') + .asFunction)>(isLeaf: true); - /// Reorder a line based on display order. The ranges are specified relative to the source text and must be contained - /// within this paragraph's range. - /// - /// See the [Rust documentation for `level_at`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Paragraph.html#method.level_at) for more information. - String reorderLine(int rangeStart, int rangeEnd) { - final writeable = _Writeable(); - final result = _ICU4XBidiParagraph_reorder_line( - _underlying, rangeStart, rangeEnd, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XBidiParagraph_reorder_line = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Size, - ffi.Size, - ffi.Pointer)>>('ICU4XBidiParagraph_reorder_line') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, int, int, - ffi.Pointer)>(isLeaf: true); - - /// Get the BIDI level at a particular byte index in this paragraph. - /// This integer is conceptually a `unicode_bidi::Level`, - /// and can be further inspected using the static methods on ICU4XBidi. - /// - /// Returns 0 (equivalent to `Level::ltr()`) on error - /// - /// See the [Rust documentation for `level_at`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Paragraph.html#method.level_at) for more information. - int levelAt(int pos) { - final result = _ICU4XBidiParagraph_level_at(_underlying, pos); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XBidiParagraph_level_at = _capi< - ffi.NativeFunction< - ffi.Uint8 Function(ffi.Pointer, - ffi.Size)>>('ICU4XBidiParagraph_level_at') - .asFunction, int)>(isLeaf: true); -} -/// See the [Rust documentation for `AnyCalendar`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendar.html) for more information. -class Calendar implements ffi.Finalizable { - final ffi.Pointer _underlying; + } - Calendar._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCalendar_destroy')); - - /// Creates a new [`ICU4XCalendar`] from the specified date and time. - /// - /// See the [Rust documentation for `new_for_locale`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendar.html#method.new_for_locale) for more information. - factory Calendar.forLocale(DataProvider provider, Locale locale) { - final result = _ICU4XCalendar_create_for_locale( - provider._underlying, locale._underlying); - return result.isOk - ? Calendar._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCalendar_create_for_locale = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XCalendar_create_for_locale') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Creates a new [`ICU4XCalendar`] from the specified date and time. - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendar.html#method.new) for more information. - factory Calendar.forKind(DataProvider provider, AnyCalendarKind kind) { - final result = - _ICU4XCalendar_create_for_kind(provider._underlying, kind.index); - return result.isOk - ? Calendar._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCalendar_create_for_kind = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Int32)>>('ICU4XCalendar_create_for_kind') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>( - isLeaf: true); - - /// Returns the kind of this calendar - /// - /// See the [Rust documentation for `kind`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendar.html#method.kind) for more information. - AnyCalendarKind get kind { - final result = _ICU4XCalendar_kind(_underlying); - return AnyCalendarKind.values[result]; - } - - // ignore: non_constant_identifier_names - static final _ICU4XCalendar_kind = - _capi)>>( - 'ICU4XCalendar_kind') - .asFunction)>(isLeaf: true); -} /// Lookup of the Canonical_Combining_Class Unicode property -/// +/// /// See the [Rust documentation for `CanonicalCombiningClassMap`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalCombiningClassMap.html) for more information. class CanonicalCombiningClassMap implements ffi.Finalizable { - final ffi.Pointer _underlying; - CanonicalCombiningClassMap._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; + + CanonicalCombiningClassMap._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XCanonicalCombiningClassMap_destroy')); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCanonicalCombiningClassMap_destroy')); - /// Construct a new ICU4XCanonicalCombiningClassMap instance for NFC - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalCombiningClassMap.html#method.new) for more information. - factory CanonicalCombiningClassMap(DataProvider provider) { - final result = - _ICU4XCanonicalCombiningClassMap_create(provider._underlying); - return result.isOk - ? CanonicalCombiningClassMap._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Construct a new ICU4XCanonicalCombiningClassMap instance for NFC +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalCombiningClassMap.html#method.new) for more information. +factory CanonicalCombiningClassMap(DataProvider provider) { + + final result = _ICU4XCanonicalCombiningClassMap_create(provider._underlying); + return result.isOk ? CanonicalCombiningClassMap._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCanonicalCombiningClassMap_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCanonicalCombiningClassMap_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCanonicalCombiningClassMap_create= _capi)>>('ICU4XCanonicalCombiningClassMap_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalCombiningClassMap.html#method.get) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/properties/properties/struct.CanonicalCombiningClass.html) - int operator [](int ch) { - final result = _ICU4XCanonicalCombiningClassMap_get(_underlying, ch); - return result; - } + +/// See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalCombiningClassMap.html#method.get) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/properties/properties/struct.CanonicalCombiningClass.html) +int operator [](int ch) { + + final result = _ICU4XCanonicalCombiningClassMap_get(_underlying,ch); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XCanonicalCombiningClassMap_get = _capi< - ffi.NativeFunction< - ffi.Uint8 Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCanonicalCombiningClassMap_get') - .asFunction, int)>(isLeaf: true); + static final _ICU4XCanonicalCombiningClassMap_get= _capi, ffi.Uint32)>>('ICU4XCanonicalCombiningClassMap_get') + .asFunction, int)>(isLeaf: true); - /// See the [Rust documentation for `get32`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalCombiningClassMap.html#method.get32) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/properties/properties/struct.CanonicalCombiningClass.html) - int get32(int ch) { - final result = _ICU4XCanonicalCombiningClassMap_get32(_underlying, ch); - return result; - } + +/// See the [Rust documentation for `get32`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalCombiningClassMap.html#method.get32) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/properties/properties/struct.CanonicalCombiningClass.html) +int get32(int ch) { + + final result = _ICU4XCanonicalCombiningClassMap_get32(_underlying,ch); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XCanonicalCombiningClassMap_get32 = _capi< - ffi.NativeFunction< - ffi.Uint8 Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCanonicalCombiningClassMap_get32') - .asFunction, int)>(isLeaf: true); -} + static final _ICU4XCanonicalCombiningClassMap_get32= _capi, ffi.Uint32)>>('ICU4XCanonicalCombiningClassMap_get32') + .asFunction, int)>(isLeaf: true); + + + } + /// The raw canonical composition operation. -/// +/// /// Callers should generally use ICU4XComposingNormalizer unless they specifically need raw composition operations -/// +/// /// See the [Rust documentation for `CanonicalComposition`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalComposition.html) for more information. class CanonicalComposition implements ffi.Finalizable { - final ffi.Pointer _underlying; - CanonicalComposition._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; + + CanonicalComposition._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XCanonicalComposition_destroy')); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCanonicalComposition_destroy')); - /// Construct a new ICU4XCanonicalComposition instance for NFC - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalComposition.html#method.new) for more information. - factory CanonicalComposition(DataProvider provider) { - final result = _ICU4XCanonicalComposition_create(provider._underlying); - return result.isOk - ? CanonicalComposition._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Construct a new ICU4XCanonicalComposition instance for NFC +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalComposition.html#method.new) for more information. +factory CanonicalComposition(DataProvider provider) { + + final result = _ICU4XCanonicalComposition_create(provider._underlying); + return result.isOk ? CanonicalComposition._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCanonicalComposition_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XCanonicalComposition_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCanonicalComposition_create= _capi)>>('ICU4XCanonicalComposition_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// Performs canonical composition (including Hangul) on a pair of characters - /// or returns NUL if these characters don鈥檛 compose. Composition exclusions are taken into account. - /// - /// See the [Rust documentation for `compose`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalComposition.html#method.compose) for more information. - int compose(int starter, int second) { - final result = - _ICU4XCanonicalComposition_compose(_underlying, starter, second); - return result; - } + +/// Performs canonical composition (including Hangul) on a pair of characters +/// or returns NUL if these characters don鈥檛 compose. Composition exclusions are taken into account. +/// +/// See the [Rust documentation for `compose`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalComposition.html#method.compose) for more information. +int compose(int starter, int second) { + + final result = _ICU4XCanonicalComposition_compose(_underlying,starter,second); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XCanonicalComposition_compose = _capi< - ffi.NativeFunction< - ffi.Uint32 Function(ffi.Pointer, ffi.Uint32, - ffi.Uint32)>>('ICU4XCanonicalComposition_compose') - .asFunction, int, int)>( - isLeaf: true); -} + static final _ICU4XCanonicalComposition_compose= _capi, ffi.Uint32, ffi.Uint32)>>('ICU4XCanonicalComposition_compose') + .asFunction, int, int)>(isLeaf: true); + + + } + /// The raw (non-recursive) canonical decomposition operation. -/// +/// /// Callers should generally use ICU4XDecomposingNormalizer unless they specifically need raw composition operations -/// +/// /// See the [Rust documentation for `CanonicalDecomposition`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalDecomposition.html) for more information. class CanonicalDecomposition implements ffi.Finalizable { - final ffi.Pointer _underlying; - CanonicalDecomposition._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + final ffi.Pointer _underlying; + + CanonicalDecomposition._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCanonicalDecomposition_destroy')); + + +/// Construct a new ICU4XCanonicalDecomposition instance for NFC +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalDecomposition.html#method.new) for more information. +factory CanonicalDecomposition(DataProvider provider) { + + final result = _ICU4XCanonicalDecomposition_create(provider._underlying); + return result.isOk ? CanonicalDecomposition._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XCanonicalDecomposition_create= _capi)>>('ICU4XCanonicalDecomposition_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XCanonicalDecomposition_destroy')); - /// Construct a new ICU4XCanonicalDecomposition instance for NFC - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalDecomposition.html#method.new) for more information. - factory CanonicalDecomposition(DataProvider provider) { - final result = _ICU4XCanonicalDecomposition_create(provider._underlying); - return result.isOk - ? CanonicalDecomposition._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Performs non-recursive canonical decomposition (including for Hangul). +/// +/// See the [Rust documentation for `decompose`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalDecomposition.html#method.decompose) for more information. +Decomposed decompose(int c) { + + final result = _ICU4XCanonicalDecomposition_decompose(_underlying,c); + return Decomposed._(result); } // ignore: non_constant_identifier_names - static final _ICU4XCanonicalDecomposition_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCanonicalDecomposition_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Performs non-recursive canonical decomposition (including for Hangul). - /// - /// See the [Rust documentation for `decompose`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalDecomposition.html#method.decompose) for more information. - Decomposed decompose(int c) { - final result = _ICU4XCanonicalDecomposition_decompose(_underlying, c); - return Decomposed._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCanonicalDecomposition_decompose = _capi< - ffi.NativeFunction< - _DecomposedFfi Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCanonicalDecomposition_decompose') - .asFunction<_DecomposedFfi Function(ffi.Pointer, int)>( - isLeaf: true); -} + static final _ICU4XCanonicalDecomposition_decompose= _capi, ffi.Uint32)>>('ICU4XCanonicalDecomposition_decompose') + .asFunction<_DecomposedFfi Function(ffi.Pointer, int)>(isLeaf: true); + + + } + /// See the [Rust documentation for `CaseMapCloser`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapCloser.html) for more information. class CaseMapCloser implements ffi.Finalizable { - final ffi.Pointer _underlying; - CaseMapCloser._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XCaseMapCloser_destroy')); + CaseMapCloser._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Construct a new ICU4XCaseMapper instance - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapCloser.html#method.new) for more information. - factory CaseMapCloser(DataProvider provider) { - final result = _ICU4XCaseMapCloser_create(provider._underlying); - return result.isOk - ? CaseMapCloser._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCaseMapCloser_destroy')); + + +/// Construct a new ICU4XCaseMapper instance +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapCloser.html#method.new) for more information. +factory CaseMapCloser(DataProvider provider) { + + final result = _ICU4XCaseMapCloser_create(provider._underlying); + return result.isOk ? CaseMapCloser._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCaseMapCloser_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XCaseMapCloser_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCaseMapCloser_create= _capi)>>('ICU4XCaseMapCloser_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + - /// Adds all simple case mappings and the full case folding for `c` to `builder`. - /// Also adds special case closure mappings. - /// - /// See the [Rust documentation for `add_case_closure_to`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapCloser.html#method.add_case_closure_to) for more information. - void addCaseClosureTo(int c, CodePointSetBuilder builder) { - _ICU4XCaseMapCloser_add_case_closure_to( - _underlying, c, builder._underlying); + +/// Adds all simple case mappings and the full case folding for `c` to `builder`. +/// Also adds special case closure mappings. +/// +/// See the [Rust documentation for `add_case_closure_to`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapCloser.html#method.add_case_closure_to) for more information. +void addCaseClosureTo(int c, CodePointSetBuilder builder) { + + _ICU4XCaseMapCloser_add_case_closure_to(_underlying,c,builder._underlying); } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapCloser_add_case_closure_to= _capi, ffi.Uint32, ffi.Pointer)>>('ICU4XCaseMapCloser_add_case_closure_to') + .asFunction, int, ffi.Pointer)>(isLeaf: true); + + +/// Finds all characters and strings which may casemap to `s` as their full case folding string +/// and adds them to the set. +/// +/// Returns true if the string was found +/// +/// See the [Rust documentation for `add_string_case_closure_to`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapCloser.html#method.add_string_case_closure_to) for more information. +bool addStringCaseClosureTo(String s, CodePointSetBuilder builder) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final result = _ICU4XCaseMapCloser_add_string_case_closure_to(_underlying,sSlice._bytes,sSlice._length,builder._underlying);alloc.releaseAll(); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XCaseMapCloser_add_case_closure_to = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, ffi.Uint32, - ffi.Pointer)>>( - 'ICU4XCaseMapCloser_add_case_closure_to') - .asFunction< - void Function(ffi.Pointer, int, - ffi.Pointer)>(isLeaf: true); - - /// Finds all characters and strings which may casemap to `s` as their full case folding string - /// and adds them to the set. - /// - /// Returns true if the string was found - /// - /// See the [Rust documentation for `add_string_case_closure_to`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapCloser.html#method.add_string_case_closure_to) for more information. - bool addStringCaseClosureTo(String s, CodePointSetBuilder builder) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final result = _ICU4XCaseMapCloser_add_string_case_closure_to( - _underlying, sSlice._bytes, sSlice._length, builder._underlying); - alloc.releaseAll(); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapCloser_add_string_case_closure_to = _capi< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer)>>( - 'ICU4XCaseMapCloser_add_string_case_closure_to') - .asFunction< - bool Function(ffi.Pointer, ffi.Pointer, int, - ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XCaseMapCloser_add_string_case_closure_to= _capi, ffi.Pointer, ffi.Size, ffi.Pointer)>>('ICU4XCaseMapCloser_add_string_case_closure_to') + .asFunction, ffi.Pointer, int, ffi.Pointer)>(isLeaf: true); + + + } + /// See the [Rust documentation for `CaseMapper`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html) for more information. class CaseMapper implements ffi.Finalizable { - final ffi.Pointer _underlying; - CaseMapper._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XCaseMapper_destroy')); - - /// Construct a new ICU4XCaseMapper instance - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.new) for more information. - factory CaseMapper(DataProvider provider) { - final result = _ICU4XCaseMapper_create(provider._underlying); - return result.isOk - ? CaseMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapper_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XCaseMapper_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Returns the full lowercase mapping of the given string - /// - /// See the [Rust documentation for `lowercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.lowercase) for more information. - String lowercase(String s, Locale locale) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final writeable = _Writeable(); - final result = _ICU4XCaseMapper_lowercase(_underlying, sSlice._bytes, - sSlice._length, locale._underlying, writeable._underlying); - alloc.releaseAll(); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapper_lowercase = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer, - ffi.Pointer)>>('ICU4XCaseMapper_lowercase') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>(isLeaf: true); - - /// Returns the full uppercase mapping of the given string - /// - /// See the [Rust documentation for `uppercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.uppercase) for more information. - String uppercase(String s, Locale locale) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final writeable = _Writeable(); - final result = _ICU4XCaseMapper_uppercase(_underlying, sSlice._bytes, - sSlice._length, locale._underlying, writeable._underlying); - alloc.releaseAll(); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapper_uppercase = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer, - ffi.Pointer)>>('ICU4XCaseMapper_uppercase') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - ffi.Pointer)>(isLeaf: true); - - /// Returns the full titlecase mapping of the given string, performing head adjustment without - /// loading additional data. - /// (if head adjustment is enabled in the options) - /// - /// The `v1` refers to the version of the options struct, which may change as we add more options - /// - /// See the [Rust documentation for `titlecase_segment_with_only_case_data`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.titlecase_segment_with_only_case_data) for more information. - String titlecaseSegmentWithOnlyCaseDataV1( - String s, Locale locale, TitlecaseOptionsV1 options) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final writeable = _Writeable(); - final result = _ICU4XCaseMapper_titlecase_segment_with_only_case_data_v1( - _underlying, - sSlice._bytes, - sSlice._length, - locale._underlying, - options._underlying, - writeable._underlying); - alloc.releaseAll(); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapper_titlecase_segment_with_only_case_data_v1 = - _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer, - _TitlecaseOptionsV1Ffi, - ffi.Pointer)>>( - 'ICU4XCaseMapper_titlecase_segment_with_only_case_data_v1') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - _TitlecaseOptionsV1Ffi, - ffi.Pointer)>(isLeaf: true); - - /// Case-folds the characters in the given string - /// - /// See the [Rust documentation for `fold`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.fold) for more information. - String fold(String s) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final writeable = _Writeable(); - final result = _ICU4XCaseMapper_fold( - _underlying, sSlice._bytes, sSlice._length, writeable._underlying); - alloc.releaseAll(); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapper_fold = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer)>>('ICU4XCaseMapper_fold') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(isLeaf: true); - - /// Case-folds the characters in the given string - /// using Turkic (T) mappings for dotted/dotless I. - /// - /// See the [Rust documentation for `fold_turkic`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.fold_turkic) for more information. - String foldTurkic(String s) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final writeable = _Writeable(); - final result = _ICU4XCaseMapper_fold_turkic( - _underlying, sSlice._bytes, sSlice._length, writeable._underlying); - alloc.releaseAll(); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapper_fold_turkic = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer)>>('ICU4XCaseMapper_fold_turkic') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(isLeaf: true); - - /// Adds all simple case mappings and the full case folding for `c` to `builder`. - /// Also adds special case closure mappings. - /// - /// In other words, this adds all characters that this casemaps to, as - /// well as all characters that may casemap to this one. - /// - /// Note that since ICU4XCodePointSetBuilder does not contain strings, this will - /// ignore string mappings. - /// - /// Identical to the similarly named method on `ICU4XCaseMapCloser`, use that if you - /// plan on using string case closure mappings too. - /// - /// See the [Rust documentation for `add_case_closure_to`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.add_case_closure_to) for more information. - void addCaseClosureTo(int c, CodePointSetBuilder builder) { - _ICU4XCaseMapper_add_case_closure_to(_underlying, c, builder._underlying); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapper_add_case_closure_to = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, ffi.Uint32, - ffi.Pointer)>>( - 'ICU4XCaseMapper_add_case_closure_to') - .asFunction< - void Function(ffi.Pointer, int, - ffi.Pointer)>(isLeaf: true); - - /// Returns the simple lowercase mapping of the given character. - /// - /// This function only implements simple and common mappings. - /// Full mappings, which can map one char to a string, are not included. - /// For full mappings, use `ICU4XCaseMapper::lowercase`. - /// - /// See the [Rust documentation for `simple_lowercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_lowercase) for more information. - int simpleLowercase(int ch) { - final result = _ICU4XCaseMapper_simple_lowercase(_underlying, ch); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapper_simple_lowercase = _capi< - ffi.NativeFunction< - ffi.Uint32 Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCaseMapper_simple_lowercase') - .asFunction, int)>(isLeaf: true); - - /// Returns the simple uppercase mapping of the given character. - /// - /// This function only implements simple and common mappings. - /// Full mappings, which can map one char to a string, are not included. - /// For full mappings, use `ICU4XCaseMapper::uppercase`. - /// - /// See the [Rust documentation for `simple_uppercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_uppercase) for more information. - int simpleUppercase(int ch) { - final result = _ICU4XCaseMapper_simple_uppercase(_underlying, ch); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapper_simple_uppercase = _capi< - ffi.NativeFunction< - ffi.Uint32 Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCaseMapper_simple_uppercase') - .asFunction, int)>(isLeaf: true); - - /// Returns the simple titlecase mapping of the given character. - /// - /// This function only implements simple and common mappings. - /// Full mappings, which can map one char to a string, are not included. - /// For full mappings, use `ICU4XCaseMapper::titlecase_segment`. - /// - /// See the [Rust documentation for `simple_titlecase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_titlecase) for more information. - int simpleTitlecase(int ch) { - final result = _ICU4XCaseMapper_simple_titlecase(_underlying, ch); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapper_simple_titlecase = _capi< - ffi.NativeFunction< - ffi.Uint32 Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCaseMapper_simple_titlecase') - .asFunction, int)>(isLeaf: true); - - /// Returns the simple casefolding of the given character. - /// - /// This function only implements simple folding. - /// For full folding, use `ICU4XCaseMapper::fold`. - /// - /// See the [Rust documentation for `simple_fold`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_fold) for more information. - int simpleFold(int ch) { - final result = _ICU4XCaseMapper_simple_fold(_underlying, ch); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapper_simple_fold = _capi< - ffi.NativeFunction< - ffi.Uint32 Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCaseMapper_simple_fold') - .asFunction, int)>(isLeaf: true); - - /// Returns the simple casefolding of the given character in the Turkic locale - /// - /// This function only implements simple folding. - /// For full folding, use `ICU4XCaseMapper::fold_turkic`. - /// - /// See the [Rust documentation for `simple_fold_turkic`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_fold_turkic) for more information. - int simpleFoldTurkic(int ch) { - final result = _ICU4XCaseMapper_simple_fold_turkic(_underlying, ch); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XCaseMapper_simple_fold_turkic = _capi< - ffi.NativeFunction< - ffi.Uint32 Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCaseMapper_simple_fold_turkic') - .asFunction, int)>(isLeaf: true); -} + final ffi.Pointer _underlying; + + CaseMapper._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCaseMapper_destroy')); + + +/// Construct a new ICU4XCaseMapper instance +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.new) for more information. +factory CaseMapper(DataProvider provider) { + + final result = _ICU4XCaseMapper_create(provider._underlying); + return result.isOk ? CaseMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapper_create= _capi)>>('ICU4XCaseMapper_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Returns the full lowercase mapping of the given string +/// +/// See the [Rust documentation for `lowercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.lowercase) for more information. +String lowercase(String s, Locale locale) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final writeable = _Writeable(); + final result = _ICU4XCaseMapper_lowercase(_underlying,sSlice._bytes,sSlice._length,locale._underlying,writeable._underlying);alloc.releaseAll(); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapper_lowercase= _capi, ffi.Pointer, ffi.Size, ffi.Pointer, ffi.Pointer)>>('ICU4XCaseMapper_lowercase') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Returns the full uppercase mapping of the given string +/// +/// See the [Rust documentation for `uppercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.uppercase) for more information. +String uppercase(String s, Locale locale) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final writeable = _Writeable(); + final result = _ICU4XCaseMapper_uppercase(_underlying,sSlice._bytes,sSlice._length,locale._underlying,writeable._underlying);alloc.releaseAll(); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapper_uppercase= _capi, ffi.Pointer, ffi.Size, ffi.Pointer, ffi.Pointer)>>('ICU4XCaseMapper_uppercase') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Returns the full titlecase mapping of the given string, performing head adjustment without +/// loading additional data. +/// (if head adjustment is enabled in the options) +/// +/// The `v1` refers to the version of the options struct, which may change as we add more options +/// +/// See the [Rust documentation for `titlecase_segment_with_only_case_data`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.titlecase_segment_with_only_case_data) for more information. +String titlecaseSegmentWithOnlyCaseDataV1(String s, Locale locale, TitlecaseOptionsV1 options) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final writeable = _Writeable(); + final result = _ICU4XCaseMapper_titlecase_segment_with_only_case_data_v1(_underlying,sSlice._bytes,sSlice._length,locale._underlying,options._underlying,writeable._underlying);alloc.releaseAll(); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapper_titlecase_segment_with_only_case_data_v1= _capi, ffi.Pointer, ffi.Size, ffi.Pointer, _TitlecaseOptionsV1Ffi, ffi.Pointer)>>('ICU4XCaseMapper_titlecase_segment_with_only_case_data_v1') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int, ffi.Pointer, _TitlecaseOptionsV1Ffi, ffi.Pointer)>(isLeaf: true); + + + +/// Case-folds the characters in the given string +/// +/// See the [Rust documentation for `fold`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.fold) for more information. +String fold(String s) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final writeable = _Writeable(); + final result = _ICU4XCaseMapper_fold(_underlying,sSlice._bytes,sSlice._length,writeable._underlying);alloc.releaseAll(); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapper_fold= _capi, ffi.Pointer, ffi.Size, ffi.Pointer)>>('ICU4XCaseMapper_fold') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int, ffi.Pointer)>(isLeaf: true); + + + +/// Case-folds the characters in the given string +/// using Turkic (T) mappings for dotted/dotless I. +/// +/// See the [Rust documentation for `fold_turkic`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.fold_turkic) for more information. +String foldTurkic(String s) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final writeable = _Writeable(); + final result = _ICU4XCaseMapper_fold_turkic(_underlying,sSlice._bytes,sSlice._length,writeable._underlying);alloc.releaseAll(); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapper_fold_turkic= _capi, ffi.Pointer, ffi.Size, ffi.Pointer)>>('ICU4XCaseMapper_fold_turkic') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int, ffi.Pointer)>(isLeaf: true); + + + +/// Adds all simple case mappings and the full case folding for `c` to `builder`. +/// Also adds special case closure mappings. +/// +/// In other words, this adds all characters that this casemaps to, as +/// well as all characters that may casemap to this one. +/// +/// Note that since ICU4XCodePointSetBuilder does not contain strings, this will +/// ignore string mappings. +/// +/// Identical to the similarly named method on `ICU4XCaseMapCloser`, use that if you +/// plan on using string case closure mappings too. +/// +/// See the [Rust documentation for `add_case_closure_to`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.add_case_closure_to) for more information. +void addCaseClosureTo(int c, CodePointSetBuilder builder) { + + _ICU4XCaseMapper_add_case_closure_to(_underlying,c,builder._underlying); + } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapper_add_case_closure_to= _capi, ffi.Uint32, ffi.Pointer)>>('ICU4XCaseMapper_add_case_closure_to') + .asFunction, int, ffi.Pointer)>(isLeaf: true); + + + +/// Returns the simple lowercase mapping of the given character. +/// +/// This function only implements simple and common mappings. +/// Full mappings, which can map one char to a string, are not included. +/// For full mappings, use `ICU4XCaseMapper::lowercase`. +/// +/// See the [Rust documentation for `simple_lowercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_lowercase) for more information. +int simpleLowercase(int ch) { + + final result = _ICU4XCaseMapper_simple_lowercase(_underlying,ch); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapper_simple_lowercase= _capi, ffi.Uint32)>>('ICU4XCaseMapper_simple_lowercase') + .asFunction, int)>(isLeaf: true); + + + +/// Returns the simple uppercase mapping of the given character. +/// +/// This function only implements simple and common mappings. +/// Full mappings, which can map one char to a string, are not included. +/// For full mappings, use `ICU4XCaseMapper::uppercase`. +/// +/// See the [Rust documentation for `simple_uppercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_uppercase) for more information. +int simpleUppercase(int ch) { + + final result = _ICU4XCaseMapper_simple_uppercase(_underlying,ch); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapper_simple_uppercase= _capi, ffi.Uint32)>>('ICU4XCaseMapper_simple_uppercase') + .asFunction, int)>(isLeaf: true); + + + +/// Returns the simple titlecase mapping of the given character. +/// +/// This function only implements simple and common mappings. +/// Full mappings, which can map one char to a string, are not included. +/// For full mappings, use `ICU4XCaseMapper::titlecase_segment`. +/// +/// See the [Rust documentation for `simple_titlecase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_titlecase) for more information. +int simpleTitlecase(int ch) { + + final result = _ICU4XCaseMapper_simple_titlecase(_underlying,ch); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapper_simple_titlecase= _capi, ffi.Uint32)>>('ICU4XCaseMapper_simple_titlecase') + .asFunction, int)>(isLeaf: true); + + + +/// Returns the simple casefolding of the given character. +/// +/// This function only implements simple folding. +/// For full folding, use `ICU4XCaseMapper::fold`. +/// +/// See the [Rust documentation for `simple_fold`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_fold) for more information. +int simpleFold(int ch) { + + final result = _ICU4XCaseMapper_simple_fold(_underlying,ch); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapper_simple_fold= _capi, ffi.Uint32)>>('ICU4XCaseMapper_simple_fold') + .asFunction, int)>(isLeaf: true); + + + +/// Returns the simple casefolding of the given character in the Turkic locale +/// +/// This function only implements simple folding. +/// For full folding, use `ICU4XCaseMapper::fold_turkic`. +/// +/// See the [Rust documentation for `simple_fold_turkic`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_fold_turkic) for more information. +int simpleFoldTurkic(int ch) { + + final result = _ICU4XCaseMapper_simple_fold_turkic(_underlying,ch); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XCaseMapper_simple_fold_turkic= _capi, ffi.Uint32)>>('ICU4XCaseMapper_simple_fold_turkic') + .asFunction, int)>(isLeaf: true); + + + } + /// An ICU4X Unicode Map Property object, capable of querying whether a code point (key) to obtain the Unicode property value, for a specific Unicode property. -/// +/// /// For properties whose values fit into 16 bits. -/// +/// /// See the [Rust documentation for `properties`](https://docs.rs/icu/latest/icu/properties/index.html) for more information. -/// +/// /// See the [Rust documentation for `CodePointMapData`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapData.html) for more information. -/// +/// /// See the [Rust documentation for `CodePointMapDataBorrowed`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html) for more information. class CodePointMapData16 implements ffi.Finalizable { - final ffi.Pointer _underlying; - CodePointMapData16._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XCodePointMapData16_destroy')); + CodePointMapData16._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Gets the value for a code point. - /// - /// See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.get) for more information. - int operator [](int cp) { - final result = _ICU4XCodePointMapData16_get(_underlying, cp); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCodePointMapData16_destroy')); + +/// Gets the value for a code point. +/// +/// See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.get) for more information. +int operator [](int cp) { + + final result = _ICU4XCodePointMapData16_get(_underlying,cp); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData16_get = _capi< - ffi.NativeFunction< - ffi.Uint16 Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCodePointMapData16_get') - .asFunction, int)>(isLeaf: true); + static final _ICU4XCodePointMapData16_get= _capi, ffi.Uint32)>>('ICU4XCodePointMapData16_get') + .asFunction, int)>(isLeaf: true); - /// Gets the value for a code point (specified as a 32 bit integer, in UTF-32) - int get32(int cp) { - final result = _ICU4XCodePointMapData16_get32(_underlying, cp); - return result; - } + +/// Gets the value for a code point (specified as a 32 bit integer, in UTF-32) +int get32(int cp) { + + final result = _ICU4XCodePointMapData16_get32(_underlying,cp); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData16_get32 = _capi< - ffi.NativeFunction< - ffi.Uint16 Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCodePointMapData16_get32') - .asFunction, int)>(isLeaf: true); + static final _ICU4XCodePointMapData16_get32= _capi, ffi.Uint32)>>('ICU4XCodePointMapData16_get32') + .asFunction, int)>(isLeaf: true); - /// Produces an iterator over ranges of code points that map to `value` - /// - /// See the [Rust documentation for `iter_ranges_for_value`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.iter_ranges_for_value) for more information. - CodePointRangeIterator iterRangesForValue(int value) { - final result = - _ICU4XCodePointMapData16_iter_ranges_for_value(_underlying, value); - return CodePointRangeIterator._(result); - } + +/// Produces an iterator over ranges of code points that map to `value` +/// +/// See the [Rust documentation for `iter_ranges_for_value`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.iter_ranges_for_value) for more information. +CodePointRangeIterator iterRangesForValue(int value) { + + final result = _ICU4XCodePointMapData16_iter_ranges_for_value(_underlying,value); + return CodePointRangeIterator._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData16_iter_ranges_for_value = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Uint16)>>('ICU4XCodePointMapData16_iter_ranges_for_value') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, int)>(isLeaf: true); + static final _ICU4XCodePointMapData16_iter_ranges_for_value= _capi Function(ffi.Pointer, ffi.Uint16)>>('ICU4XCodePointMapData16_iter_ranges_for_value') + .asFunction Function(ffi.Pointer, int)>(isLeaf: true); - /// Produces an iterator over ranges of code points that do not map to `value` - /// - /// See the [Rust documentation for `iter_ranges_for_value_complemented`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.iter_ranges_for_value_complemented) for more information. - CodePointRangeIterator iterRangesForValueComplemented(int value) { - final result = _ICU4XCodePointMapData16_iter_ranges_for_value_complemented( - _underlying, value); - return CodePointRangeIterator._(result); - } + +/// Produces an iterator over ranges of code points that do not map to `value` +/// +/// See the [Rust documentation for `iter_ranges_for_value_complemented`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.iter_ranges_for_value_complemented) for more information. +CodePointRangeIterator iterRangesForValueComplemented(int value) { + + final result = _ICU4XCodePointMapData16_iter_ranges_for_value_complemented(_underlying,value); + return CodePointRangeIterator._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData16_iter_ranges_for_value_complemented = - _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Uint16)>>( - 'ICU4XCodePointMapData16_iter_ranges_for_value_complemented') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, int)>(isLeaf: true); + static final _ICU4XCodePointMapData16_iter_ranges_for_value_complemented= _capi Function(ffi.Pointer, ffi.Uint16)>>('ICU4XCodePointMapData16_iter_ranges_for_value_complemented') + .asFunction Function(ffi.Pointer, int)>(isLeaf: true); - /// Gets a [`ICU4XCodePointSetData`] representing all entries in this map that map to the given value - /// - /// See the [Rust documentation for `get_set_for_value`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.get_set_for_value) for more information. - CodePointSetData getSetForValue(int value) { - final result = - _ICU4XCodePointMapData16_get_set_for_value(_underlying, value); - return CodePointSetData._(result); - } + +/// Gets a [`ICU4XCodePointSetData`] representing all entries in this map that map to the given value +/// +/// See the [Rust documentation for `get_set_for_value`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.get_set_for_value) for more information. +CodePointSetData getSetForValue(int value) { + + final result = _ICU4XCodePointMapData16_get_set_for_value(_underlying,value); + return CodePointSetData._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData16_get_set_for_value = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Uint16)>>('ICU4XCodePointMapData16_get_set_for_value') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, int)>(isLeaf: true); + static final _ICU4XCodePointMapData16_get_set_for_value= _capi Function(ffi.Pointer, ffi.Uint16)>>('ICU4XCodePointMapData16_get_set_for_value') + .asFunction Function(ffi.Pointer, int)>(isLeaf: true); + - /// See the [Rust documentation for `script`](https://docs.rs/icu/latest/icu/properties/maps/fn.script.html) for more information. - factory CodePointMapData16.loadScript(DataProvider provider) { - final result = _ICU4XCodePointMapData16_load_script(provider._underlying); - return result.isOk - ? CodePointMapData16._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// See the [Rust documentation for `script`](https://docs.rs/icu/latest/icu/properties/maps/fn.script.html) for more information. +factory CodePointMapData16.loadScript(DataProvider provider) { + + final result = _ICU4XCodePointMapData16_load_script(provider._underlying); + return result.isOk ? CodePointMapData16._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData16_load_script = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointMapData16_load_script') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); -} + static final _ICU4XCodePointMapData16_load_script= _capi)>>('ICU4XCodePointMapData16_load_script') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + } + /// An ICU4X Unicode Map Property object, capable of querying whether a code point (key) to obtain the Unicode property value, for a specific Unicode property. -/// +/// /// For properties whose values fit into 8 bits. -/// +/// /// See the [Rust documentation for `properties`](https://docs.rs/icu/latest/icu/properties/index.html) for more information. -/// +/// /// See the [Rust documentation for `CodePointMapData`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapData.html) for more information. -/// +/// /// See the [Rust documentation for `CodePointMapDataBorrowed`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html) for more information. class CodePointMapData8 implements ffi.Finalizable { - final ffi.Pointer _underlying; - CodePointMapData8._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XCodePointMapData8_destroy')); + final ffi.Pointer _underlying; - /// Gets the value for a code point. - /// - /// See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.get) for more information. - int operator [](int cp) { - final result = _ICU4XCodePointMapData8_get(_underlying, cp); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_get = _capi< - ffi.NativeFunction< - ffi.Uint8 Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCodePointMapData8_get') - .asFunction, int)>(isLeaf: true); - - /// Gets the value for a code point (specified as a 32 bit integer, in UTF-32) - int get32(int cp) { - final result = _ICU4XCodePointMapData8_get32(_underlying, cp); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_get32 = _capi< - ffi.NativeFunction< - ffi.Uint8 Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCodePointMapData8_get32') - .asFunction, int)>(isLeaf: true); - - /// Converts a general category to its corresponding mask value - /// - /// Nonexistant general categories will map to the empty mask - /// - /// See the [Rust documentation for `GeneralCategoryGroup`](https://docs.rs/icu/latest/icu/properties/struct.GeneralCategoryGroup.html) for more information. - static int generalCategoryToMask(int gc) { - final result = _ICU4XCodePointMapData8_general_category_to_mask(gc); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_general_category_to_mask = - _capi>( - 'ICU4XCodePointMapData8_general_category_to_mask') - .asFunction(isLeaf: true); - - /// Produces an iterator over ranges of code points that map to `value` - /// - /// See the [Rust documentation for `iter_ranges_for_value`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.iter_ranges_for_value) for more information. - CodePointRangeIterator iterRangesForValue(int value) { - final result = - _ICU4XCodePointMapData8_iter_ranges_for_value(_underlying, value); - return CodePointRangeIterator._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_iter_ranges_for_value = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Uint8)>>('ICU4XCodePointMapData8_iter_ranges_for_value') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, int)>(isLeaf: true); - - /// Produces an iterator over ranges of code points that do not map to `value` - /// - /// See the [Rust documentation for `iter_ranges_for_value_complemented`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.iter_ranges_for_value_complemented) for more information. - CodePointRangeIterator iterRangesForValueComplemented(int value) { - final result = _ICU4XCodePointMapData8_iter_ranges_for_value_complemented( - _underlying, value); - return CodePointRangeIterator._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_iter_ranges_for_value_complemented = - _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Uint8)>>( - 'ICU4XCodePointMapData8_iter_ranges_for_value_complemented') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, int)>(isLeaf: true); - - /// Given a mask value (the nth bit marks property value = n), produce an iterator over ranges of code points - /// whose property values are contained in the mask. - /// - /// The main mask property supported is that for General_Category, which can be obtained via `general_category_to_mask()` or - /// by using `ICU4XGeneralCategoryNameToMaskMapper` - /// - /// Should only be used on maps for properties with values less than 32 (like Generak_Category), - /// other maps will have unpredictable results - /// - /// See the [Rust documentation for `iter_ranges_for_group`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.iter_ranges_for_group) for more information. - CodePointRangeIterator iterRangesForMask(int mask) { - final result = - _ICU4XCodePointMapData8_iter_ranges_for_mask(_underlying, mask); - return CodePointRangeIterator._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_iter_ranges_for_mask = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCodePointMapData8_iter_ranges_for_mask') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, int)>(isLeaf: true); - - /// Gets a [`ICU4XCodePointSetData`] representing all entries in this map that map to the given value - /// - /// See the [Rust documentation for `get_set_for_value`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.get_set_for_value) for more information. - CodePointSetData getSetForValue(int value) { - final result = - _ICU4XCodePointMapData8_get_set_for_value(_underlying, value); - return CodePointSetData._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_get_set_for_value = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Uint8)>>('ICU4XCodePointMapData8_get_set_for_value') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, int)>(isLeaf: true); - - /// See the [Rust documentation for `general_category`](https://docs.rs/icu/latest/icu/properties/maps/fn.general_category.html) for more information. - factory CodePointMapData8.loadGeneralCategory(DataProvider provider) { - final result = - _ICU4XCodePointMapData8_load_general_category(provider._underlying); - return result.isOk - ? CodePointMapData8._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_load_general_category = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointMapData8_load_general_category') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `bidi_class`](https://docs.rs/icu/latest/icu/properties/maps/fn.bidi_class.html) for more information. - factory CodePointMapData8.loadBidiClass(DataProvider provider) { - final result = - _ICU4XCodePointMapData8_load_bidi_class(provider._underlying); - return result.isOk - ? CodePointMapData8._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_load_bidi_class = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointMapData8_load_bidi_class') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `east_asian_width`](https://docs.rs/icu/latest/icu/properties/maps/fn.east_asian_width.html) for more information. - factory CodePointMapData8.loadEastAsianWidth(DataProvider provider) { - final result = - _ICU4XCodePointMapData8_load_east_asian_width(provider._underlying); - return result.isOk - ? CodePointMapData8._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_load_east_asian_width = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointMapData8_load_east_asian_width') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `indic_syllabic_category`](https://docs.rs/icu/latest/icu/properties/maps/fn.indic_syllabic_category.html) for more information. - factory CodePointMapData8.loadIndicSyllabicCategory(DataProvider provider) { - final result = _ICU4XCodePointMapData8_load_indic_syllabic_category( - provider._underlying); - return result.isOk - ? CodePointMapData8._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_load_indic_syllabic_category = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointMapData8_load_indic_syllabic_category') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `line_break`](https://docs.rs/icu/latest/icu/properties/maps/fn.line_break.html) for more information. - factory CodePointMapData8.loadLineBreak(DataProvider provider) { - final result = - _ICU4XCodePointMapData8_load_line_break(provider._underlying); - return result.isOk - ? CodePointMapData8._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_load_line_break = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointMapData8_load_line_break') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `grapheme_cluster_break`](https://docs.rs/icu/latest/icu/properties/maps/fn.grapheme_cluster_break.html) for more information. - factory CodePointMapData8.graphemeClusterBreak(DataProvider provider) { - final result = _ICU4XCodePointMapData8_try_grapheme_cluster_break( - provider._underlying); - return result.isOk - ? CodePointMapData8._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_try_grapheme_cluster_break = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointMapData8_try_grapheme_cluster_break') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `word_break`](https://docs.rs/icu/latest/icu/properties/maps/fn.word_break.html) for more information. - factory CodePointMapData8.loadWordBreak(DataProvider provider) { - final result = - _ICU4XCodePointMapData8_load_word_break(provider._underlying); - return result.isOk - ? CodePointMapData8._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_load_word_break = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointMapData8_load_word_break') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `sentence_break`](https://docs.rs/icu/latest/icu/properties/maps/fn.sentence_break.html) for more information. - factory CodePointMapData8.loadSentenceBreak(DataProvider provider) { - final result = - _ICU4XCodePointMapData8_load_sentence_break(provider._underlying); - return result.isOk - ? CodePointMapData8._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointMapData8_load_sentence_break = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointMapData8_load_sentence_break') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); -} + CodePointMapData8._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } -/// An iterator over code point ranges, produced by `ICU4XCodePointSetData` or -/// one of the `ICU4XCodePointMapData` types -class CodePointRangeIterator implements ffi.Finalizable { - final ffi.Pointer _underlying; + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCodePointMapData8_destroy')); - CodePointRangeIterator._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + +/// Gets the value for a code point. +/// +/// See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.get) for more information. +int operator [](int cp) { + + final result = _ICU4XCodePointMapData8_get(_underlying,cp); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointMapData8_get= _capi, ffi.Uint32)>>('ICU4XCodePointMapData8_get') + .asFunction, int)>(isLeaf: true); - static final _finalizer = - ffi.NativeFinalizer(_capi('CodePointRangeIterator_destroy')); - /// Advance the iterator by one and return the next range. - /// - /// If the iterator is out of items, `done` will be true - CodePointRangeIteratorResult next() { - final result = _CodePointRangeIterator_next(_underlying); - return CodePointRangeIteratorResult._(result); + +/// Gets the value for a code point (specified as a 32 bit integer, in UTF-32) +int get32(int cp) { + + final result = _ICU4XCodePointMapData8_get32(_underlying,cp); + return result; } - // ignore: non_constant_identifier_names - static final _CodePointRangeIterator_next = _capi< - ffi.NativeFunction< - _CodePointRangeIteratorResultFfi Function( - ffi.Pointer)>>('CodePointRangeIterator_next') - .asFunction< - _CodePointRangeIteratorResultFfi Function( - ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XCodePointMapData8_get32= _capi, ffi.Uint32)>>('ICU4XCodePointMapData8_get32') + .asFunction, int)>(isLeaf: true); -/// Result of a single iteration of [`CodePointRangeIterator`]. -/// Logically can be considered to be an `Option>`, -/// -/// `start` and `end` represent an inclusive range of code points [start, end], -/// and `done` will be true if the iterator has already finished. The last contentful -/// iteration will NOT produce a range done=true, in other words `start` and `end` are useful -/// values if and only if `done=false`. -class _CodePointRangeIteratorResultFfi extends ffi.Struct { - @ffi.Uint32() - external int start; - @ffi.Uint32() - external int end; - @ffi.Bool() - external bool done; -} -class CodePointRangeIteratorResult { - final _CodePointRangeIteratorResultFfi _underlying; + +/// Converts a general category to its corresponding mask value +/// +/// Nonexistant general categories will map to the empty mask +/// +/// See the [Rust documentation for `GeneralCategoryGroup`](https://docs.rs/icu/latest/icu/properties/struct.GeneralCategoryGroup.html) for more information. +static int generalCategoryToMask(int gc) { + + final result = _ICU4XCodePointMapData8_general_category_to_mask(gc); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointMapData8_general_category_to_mask= _capi>('ICU4XCodePointMapData8_general_category_to_mask') + .asFunction(isLeaf: true); - // ignore: unused_element - CodePointRangeIteratorResult._(this._underlying); - factory CodePointRangeIteratorResult() { - final pointer = ffi2.calloc<_CodePointRangeIteratorResultFfi>(); - final result = CodePointRangeIteratorResult._(pointer.ref); - _callocFree.attach(result, pointer.cast()); - return result; + +/// Produces an iterator over ranges of code points that map to `value` +/// +/// See the [Rust documentation for `iter_ranges_for_value`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.iter_ranges_for_value) for more information. +CodePointRangeIterator iterRangesForValue(int value) { + + final result = _ICU4XCodePointMapData8_iter_ranges_for_value(_underlying,value); + return CodePointRangeIterator._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointMapData8_iter_ranges_for_value= _capi Function(ffi.Pointer, ffi.Uint8)>>('ICU4XCodePointMapData8_iter_ranges_for_value') + .asFunction Function(ffi.Pointer, int)>(isLeaf: true); - int get start => _underlying.start; - set start(int start) { - _underlying.start = start; - } - int get end => _underlying.end; - set end(int end) { - _underlying.end = end; + +/// Produces an iterator over ranges of code points that do not map to `value` +/// +/// See the [Rust documentation for `iter_ranges_for_value_complemented`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.iter_ranges_for_value_complemented) for more information. +CodePointRangeIterator iterRangesForValueComplemented(int value) { + + final result = _ICU4XCodePointMapData8_iter_ranges_for_value_complemented(_underlying,value); + return CodePointRangeIterator._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointMapData8_iter_ranges_for_value_complemented= _capi Function(ffi.Pointer, ffi.Uint8)>>('ICU4XCodePointMapData8_iter_ranges_for_value_complemented') + .asFunction Function(ffi.Pointer, int)>(isLeaf: true); - bool get done => _underlying.done; - set done(bool done) { - _underlying.done = done; + + +/// Given a mask value (the nth bit marks property value = n), produce an iterator over ranges of code points +/// whose property values are contained in the mask. +/// +/// The main mask property supported is that for General_Category, which can be obtained via `general_category_to_mask()` or +/// by using `ICU4XGeneralCategoryNameToMaskMapper` +/// +/// Should only be used on maps for properties with values less than 32 (like Generak_Category), +/// other maps will have unpredictable results +/// +/// See the [Rust documentation for `iter_ranges_for_group`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.iter_ranges_for_group) for more information. +CodePointRangeIterator iterRangesForMask(int mask) { + + final result = _ICU4XCodePointMapData8_iter_ranges_for_mask(_underlying,mask); + return CodePointRangeIterator._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointMapData8_iter_ranges_for_mask= _capi Function(ffi.Pointer, ffi.Uint32)>>('ICU4XCodePointMapData8_iter_ranges_for_mask') + .asFunction Function(ffi.Pointer, int)>(isLeaf: true); - @override - bool operator ==(Object other) => - other is CodePointRangeIteratorResult && - other._underlying.start == _underlying.start && - other._underlying.end == _underlying.end && - other._underlying.done == _underlying.done; - @override - int get hashCode => Object.hashAll([ - _underlying.start, - _underlying.end, - _underlying.done, - ]); -} + +/// Gets a [`ICU4XCodePointSetData`] representing all entries in this map that map to the given value +/// +/// See the [Rust documentation for `get_set_for_value`](https://docs.rs/icu/latest/icu/properties/maps/struct.CodePointMapDataBorrowed.html#method.get_set_for_value) for more information. +CodePointSetData getSetForValue(int value) { + + final result = _ICU4XCodePointMapData8_get_set_for_value(_underlying,value); + return CodePointSetData._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointMapData8_get_set_for_value= _capi Function(ffi.Pointer, ffi.Uint8)>>('ICU4XCodePointMapData8_get_set_for_value') + .asFunction Function(ffi.Pointer, int)>(isLeaf: true); -/// See the [Rust documentation for `CodePointInversionListBuilder`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html) for more information. -class CodePointSetBuilder implements ffi.Finalizable { - final ffi.Pointer _underlying; - CodePointSetBuilder._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + +/// See the [Rust documentation for `general_category`](https://docs.rs/icu/latest/icu/properties/maps/fn.general_category.html) for more information. +factory CodePointMapData8.loadGeneralCategory(DataProvider provider) { + + final result = _ICU4XCodePointMapData8_load_general_category(provider._underlying); + return result.isOk ? CodePointMapData8._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointMapData8_load_general_category= _capi)>>('ICU4XCodePointMapData8_load_general_category') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XCodePointSetBuilder_destroy')); - /// Make a new set builder containing nothing - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.new) for more information. - factory CodePointSetBuilder() { - final result = _ICU4XCodePointSetBuilder_create(); - return CodePointSetBuilder._(result); + +/// See the [Rust documentation for `bidi_class`](https://docs.rs/icu/latest/icu/properties/maps/fn.bidi_class.html) for more information. +factory CodePointMapData8.loadBidiClass(DataProvider provider) { + + final result = _ICU4XCodePointMapData8_load_bidi_class(provider._underlying); + return result.isOk ? CodePointMapData8._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_create = - _capi Function()>>( - 'ICU4XCodePointSetBuilder_create') - .asFunction Function()>(isLeaf: true); + static final _ICU4XCodePointMapData8_load_bidi_class= _capi)>>('ICU4XCodePointMapData8_load_bidi_class') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// Build this into a set - /// - /// This object is repopulated with an empty builder - /// - /// See the [Rust documentation for `build`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.build) for more information. - CodePointSetData build() { - final result = _ICU4XCodePointSetBuilder_build(_underlying); - return CodePointSetData._(result); - } + +/// See the [Rust documentation for `east_asian_width`](https://docs.rs/icu/latest/icu/properties/maps/fn.east_asian_width.html) for more information. +factory CodePointMapData8.loadEastAsianWidth(DataProvider provider) { + + final result = _ICU4XCodePointMapData8_load_east_asian_width(provider._underlying); + return result.isOk ? CodePointMapData8._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_build = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XCodePointSetBuilder_build') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointMapData8_load_east_asian_width= _capi)>>('ICU4XCodePointMapData8_load_east_asian_width') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// Complements this set - /// - /// (Elements in this set are removed and vice versa) - /// - /// See the [Rust documentation for `complement`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement) for more information. - void complement() { - _ICU4XCodePointSetBuilder_complement(_underlying); - } + +/// See the [Rust documentation for `indic_syllabic_category`](https://docs.rs/icu/latest/icu/properties/maps/fn.indic_syllabic_category.html) for more information. +factory CodePointMapData8.loadIndicSyllabicCategory(DataProvider provider) { + + final result = _ICU4XCodePointMapData8_load_indic_syllabic_category(provider._underlying); + return result.isOk ? CodePointMapData8._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_complement = - _capi)>>( - 'ICU4XCodePointSetBuilder_complement') - .asFunction)>(isLeaf: true); + static final _ICU4XCodePointMapData8_load_indic_syllabic_category= _capi)>>('ICU4XCodePointMapData8_load_indic_syllabic_category') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// Returns whether this set is empty - /// - /// See the [Rust documentation for `is_empty`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.is_empty) for more information. - bool get isEmpty { - final result = _ICU4XCodePointSetBuilder_is_empty(_underlying); - return result; - } + +/// See the [Rust documentation for `line_break`](https://docs.rs/icu/latest/icu/properties/maps/fn.line_break.html) for more information. +factory CodePointMapData8.loadLineBreak(DataProvider provider) { + + final result = _ICU4XCodePointMapData8_load_line_break(provider._underlying); + return result.isOk ? CodePointMapData8._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_is_empty = - _capi)>>( - 'ICU4XCodePointSetBuilder_is_empty') - .asFunction)>(isLeaf: true); + static final _ICU4XCodePointMapData8_load_line_break= _capi)>>('ICU4XCodePointMapData8_load_line_break') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// Add a single character to the set - /// - /// See the [Rust documentation for `add_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_char) for more information. - void addChar(int ch) { - _ICU4XCodePointSetBuilder_add_char(_underlying, ch); - } + +/// See the [Rust documentation for `grapheme_cluster_break`](https://docs.rs/icu/latest/icu/properties/maps/fn.grapheme_cluster_break.html) for more information. +factory CodePointMapData8.graphemeClusterBreak(DataProvider provider) { + + final result = _ICU4XCodePointMapData8_try_grapheme_cluster_break(provider._underlying); + return result.isOk ? CodePointMapData8._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_add_char = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCodePointSetBuilder_add_char') - .asFunction, int)>(isLeaf: true); + static final _ICU4XCodePointMapData8_try_grapheme_cluster_break= _capi)>>('ICU4XCodePointMapData8_try_grapheme_cluster_break') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// Add an inclusive range of characters to the set - /// - /// See the [Rust documentation for `add_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_range) for more information. - void addInclusiveRange(int start, int end) { - _ICU4XCodePointSetBuilder_add_inclusive_range(_underlying, start, end); - } + +/// See the [Rust documentation for `word_break`](https://docs.rs/icu/latest/icu/properties/maps/fn.word_break.html) for more information. +factory CodePointMapData8.loadWordBreak(DataProvider provider) { + + final result = _ICU4XCodePointMapData8_load_word_break(provider._underlying); + return result.isOk ? CodePointMapData8._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_add_inclusive_range = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, ffi.Uint32, - ffi.Uint32)>>('ICU4XCodePointSetBuilder_add_inclusive_range') - .asFunction, int, int)>( - isLeaf: true); + static final _ICU4XCodePointMapData8_load_word_break= _capi)>>('ICU4XCodePointMapData8_load_word_break') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// Add all elements that belong to the provided set to the set - /// - /// See the [Rust documentation for `add_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_set) for more information. - void addSet(CodePointSetData data) { - _ICU4XCodePointSetBuilder_add_set(_underlying, data._underlying); - } + +/// See the [Rust documentation for `sentence_break`](https://docs.rs/icu/latest/icu/properties/maps/fn.sentence_break.html) for more information. +factory CodePointMapData8.loadSentenceBreak(DataProvider provider) { + + final result = _ICU4XCodePointMapData8_load_sentence_break(provider._underlying); + return result.isOk ? CodePointMapData8._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_add_set = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XCodePointSetBuilder_add_set') - .asFunction< - void Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); + static final _ICU4XCodePointMapData8_load_sentence_break= _capi)>>('ICU4XCodePointMapData8_load_sentence_break') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// Remove a single character to the set - /// - /// See the [Rust documentation for `remove_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.remove_char) for more information. - void removeChar(int ch) { - _ICU4XCodePointSetBuilder_remove_char(_underlying, ch); - } + } + + +/// An iterator over code point ranges, produced by `ICU4XCodePointSetData` or +/// one of the `ICU4XCodePointMapData` types +class CodePointRangeIterator implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + CodePointRangeIterator._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('CodePointRangeIterator_destroy')); + + +/// Advance the iterator by one and return the next range. +/// +/// If the iterator is out of items, `done` will be true +CodePointRangeIteratorResult next() { + + final result = _CodePointRangeIterator_next(_underlying); + return CodePointRangeIteratorResult._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_remove_char = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCodePointSetBuilder_remove_char') - .asFunction, int)>(isLeaf: true); + static final _CodePointRangeIterator_next= _capi)>>('CodePointRangeIterator_next') + .asFunction<_CodePointRangeIteratorResultFfi Function(ffi.Pointer)>(isLeaf: true); + + + } - /// Remove an inclusive range of characters from the set - /// - /// See the [Rust documentation for `remove_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.remove_range) for more information. - void removeInclusiveRange(int start, int end) { - _ICU4XCodePointSetBuilder_remove_inclusive_range(_underlying, start, end); + +/// Result of a single iteration of [`CodePointRangeIterator`]. +/// Logically can be considered to be an `Option>`, +/// +/// `start` and `end` represent an inclusive range of code points [start, end], +/// and `done` will be true if the iterator has already finished. The last contentful +/// iteration will NOT produce a range done=true, in other words `start` and `end` are useful +/// values if and only if `done=false`. +class _CodePointRangeIteratorResultFfi extends ffi.Struct { + @ffi.Uint32() + external int start; + @ffi.Uint32() + external int end; + @ffi.Bool() + external bool done; +} + +class CodePointRangeIteratorResult { + final _CodePointRangeIteratorResultFfi _underlying; + + // ignore: unused_element + CodePointRangeIteratorResult._(this._underlying); + + factory CodePointRangeIteratorResult() { + final pointer = ffi2.calloc<_CodePointRangeIteratorResultFfi>(); + final result = CodePointRangeIteratorResult._(pointer.ref); + _callocFree.attach(result, pointer.cast()); + return result; + } + + int get start => _underlying.start; + set start(int start) { + _underlying.start = start; + } +int get end => _underlying.end; + set end(int end) { + _underlying.end = end; + } +bool get done => _underlying.done; + set done(bool done) { + _underlying.done = done; + } + + + @override + bool operator ==(Object other) => + other is CodePointRangeIteratorResult + && other._underlying.start == _underlying.start + && other._underlying.end == _underlying.end + && other._underlying.done == _underlying.done; + + @override + int get hashCode => Object.hashAll([_underlying.start,_underlying.end,_underlying.done,]); +} + + +/// See the [Rust documentation for `CodePointInversionListBuilder`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html) for more information. +class CodePointSetBuilder implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + CodePointSetBuilder._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCodePointSetBuilder_destroy')); + + +/// Make a new set builder containing nothing +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.new) for more information. +factory CodePointSetBuilder() { + + final result = _ICU4XCodePointSetBuilder_create(); + return CodePointSetBuilder._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetBuilder_create= _capi Function()>>('ICU4XCodePointSetBuilder_create') + .asFunction Function()>(isLeaf: true); + + +/// Build this into a set +/// +/// This object is repopulated with an empty builder +/// +/// See the [Rust documentation for `build`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.build) for more information. +CodePointSetData build() { + + final result = _ICU4XCodePointSetBuilder_build(_underlying); + return CodePointSetData._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_remove_inclusive_range = _capi< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, ffi.Uint32, ffi.Uint32)>>( - 'ICU4XCodePointSetBuilder_remove_inclusive_range') - .asFunction, int, int)>( - isLeaf: true); + static final _ICU4XCodePointSetBuilder_build= _capi Function(ffi.Pointer)>>('ICU4XCodePointSetBuilder_build') + .asFunction Function(ffi.Pointer)>(isLeaf: true); - /// Remove all elements that belong to the provided set from the set - /// - /// See the [Rust documentation for `remove_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.remove_set) for more information. - void removeSet(CodePointSetData data) { - _ICU4XCodePointSetBuilder_remove_set(_underlying, data._underlying); + + +/// Complements this set +/// +/// (Elements in this set are removed and vice versa) +/// +/// See the [Rust documentation for `complement`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement) for more information. +void complement() { + + _ICU4XCodePointSetBuilder_complement(_underlying); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetBuilder_complement= _capi)>>('ICU4XCodePointSetBuilder_complement') + .asFunction)>(isLeaf: true); + + +/// Returns whether this set is empty +/// +/// See the [Rust documentation for `is_empty`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.is_empty) for more information. +bool get isEmpty { + + final result = _ICU4XCodePointSetBuilder_is_empty(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_remove_set = _capi< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XCodePointSetBuilder_remove_set') - .asFunction< - void Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); + static final _ICU4XCodePointSetBuilder_is_empty= _capi)>>('ICU4XCodePointSetBuilder_is_empty') + .asFunction)>(isLeaf: true); + - /// Removes all elements from the set except a single character - /// - /// See the [Rust documentation for `retain_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.retain_char) for more information. - void retainChar(int ch) { - _ICU4XCodePointSetBuilder_retain_char(_underlying, ch); + +/// Add a single character to the set +/// +/// See the [Rust documentation for `add_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_char) for more information. +void addChar(int ch) { + + _ICU4XCodePointSetBuilder_add_char(_underlying,ch); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetBuilder_add_char= _capi, ffi.Uint32)>>('ICU4XCodePointSetBuilder_add_char') + .asFunction, int)>(isLeaf: true); + + +/// Add an inclusive range of characters to the set +/// +/// See the [Rust documentation for `add_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_range) for more information. +void addInclusiveRange(int start, int end) { + + _ICU4XCodePointSetBuilder_add_inclusive_range(_underlying,start,end); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_retain_char = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCodePointSetBuilder_retain_char') - .asFunction, int)>(isLeaf: true); + static final _ICU4XCodePointSetBuilder_add_inclusive_range= _capi, ffi.Uint32, ffi.Uint32)>>('ICU4XCodePointSetBuilder_add_inclusive_range') + .asFunction, int, int)>(isLeaf: true); - /// Removes all elements from the set except an inclusive range of characters f - /// - /// See the [Rust documentation for `retain_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.retain_range) for more information. - void retainInclusiveRange(int start, int end) { - _ICU4XCodePointSetBuilder_retain_inclusive_range(_underlying, start, end); + + +/// Add all elements that belong to the provided set to the set +/// +/// See the [Rust documentation for `add_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_set) for more information. +void addSet(CodePointSetData data) { + + _ICU4XCodePointSetBuilder_add_set(_underlying,data._underlying); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetBuilder_add_set= _capi, ffi.Pointer)>>('ICU4XCodePointSetBuilder_add_set') + .asFunction, ffi.Pointer)>(isLeaf: true); + + +/// Remove a single character to the set +/// +/// See the [Rust documentation for `remove_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.remove_char) for more information. +void removeChar(int ch) { + + _ICU4XCodePointSetBuilder_remove_char(_underlying,ch); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_retain_inclusive_range = _capi< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, ffi.Uint32, ffi.Uint32)>>( - 'ICU4XCodePointSetBuilder_retain_inclusive_range') - .asFunction, int, int)>( - isLeaf: true); + static final _ICU4XCodePointSetBuilder_remove_char= _capi, ffi.Uint32)>>('ICU4XCodePointSetBuilder_remove_char') + .asFunction, int)>(isLeaf: true); + - /// Removes all elements from the set except all elements in the provided set - /// - /// See the [Rust documentation for `retain_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.retain_set) for more information. - void retainSet(CodePointSetData data) { - _ICU4XCodePointSetBuilder_retain_set(_underlying, data._underlying); + +/// Remove an inclusive range of characters from the set +/// +/// See the [Rust documentation for `remove_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.remove_range) for more information. +void removeInclusiveRange(int start, int end) { + + _ICU4XCodePointSetBuilder_remove_inclusive_range(_underlying,start,end); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetBuilder_remove_inclusive_range= _capi, ffi.Uint32, ffi.Uint32)>>('ICU4XCodePointSetBuilder_remove_inclusive_range') + .asFunction, int, int)>(isLeaf: true); + + +/// Remove all elements that belong to the provided set from the set +/// +/// See the [Rust documentation for `remove_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.remove_set) for more information. +void removeSet(CodePointSetData data) { + + _ICU4XCodePointSetBuilder_remove_set(_underlying,data._underlying); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_retain_set = _capi< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XCodePointSetBuilder_retain_set') - .asFunction< - void Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); + static final _ICU4XCodePointSetBuilder_remove_set= _capi, ffi.Pointer)>>('ICU4XCodePointSetBuilder_remove_set') + .asFunction, ffi.Pointer)>(isLeaf: true); - /// Complement a single character to the set - /// - /// (Characters which are in this set are removed and vice versa) - /// - /// See the [Rust documentation for `complement_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement_char) for more information. - void complementChar(int ch) { - _ICU4XCodePointSetBuilder_complement_char(_underlying, ch); + + +/// Removes all elements from the set except a single character +/// +/// See the [Rust documentation for `retain_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.retain_char) for more information. +void retainChar(int ch) { + + _ICU4XCodePointSetBuilder_retain_char(_underlying,ch); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetBuilder_retain_char= _capi, ffi.Uint32)>>('ICU4XCodePointSetBuilder_retain_char') + .asFunction, int)>(isLeaf: true); + + +/// Removes all elements from the set except an inclusive range of characters f +/// +/// See the [Rust documentation for `retain_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.retain_range) for more information. +void retainInclusiveRange(int start, int end) { + + _ICU4XCodePointSetBuilder_retain_inclusive_range(_underlying,start,end); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_complement_char = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCodePointSetBuilder_complement_char') - .asFunction, int)>(isLeaf: true); + static final _ICU4XCodePointSetBuilder_retain_inclusive_range= _capi, ffi.Uint32, ffi.Uint32)>>('ICU4XCodePointSetBuilder_retain_inclusive_range') + .asFunction, int, int)>(isLeaf: true); - /// Complement an inclusive range of characters from the set - /// - /// (Characters which are in this set are removed and vice versa) - /// - /// See the [Rust documentation for `complement_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement_range) for more information. - void complementInclusiveRange(int start, int end) { - _ICU4XCodePointSetBuilder_complement_inclusive_range( - _underlying, start, end); + + +/// Removes all elements from the set except all elements in the provided set +/// +/// See the [Rust documentation for `retain_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.retain_set) for more information. +void retainSet(CodePointSetData data) { + + _ICU4XCodePointSetBuilder_retain_set(_underlying,data._underlying); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetBuilder_retain_set= _capi, ffi.Pointer)>>('ICU4XCodePointSetBuilder_retain_set') + .asFunction, ffi.Pointer)>(isLeaf: true); + + +/// Complement a single character to the set +/// +/// (Characters which are in this set are removed and vice versa) +/// +/// See the [Rust documentation for `complement_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement_char) for more information. +void complementChar(int ch) { + + _ICU4XCodePointSetBuilder_complement_char(_underlying,ch); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_complement_inclusive_range = _capi< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, ffi.Uint32, ffi.Uint32)>>( - 'ICU4XCodePointSetBuilder_complement_inclusive_range') - .asFunction, int, int)>( - isLeaf: true); + static final _ICU4XCodePointSetBuilder_complement_char= _capi, ffi.Uint32)>>('ICU4XCodePointSetBuilder_complement_char') + .asFunction, int)>(isLeaf: true); + - /// Complement all elements that belong to the provided set from the set - /// - /// (Characters which are in this set are removed and vice versa) - /// - /// See the [Rust documentation for `complement_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement_set) for more information. - void complementSet(CodePointSetData data) { - _ICU4XCodePointSetBuilder_complement_set(_underlying, data._underlying); + +/// Complement an inclusive range of characters from the set +/// +/// (Characters which are in this set are removed and vice versa) +/// +/// See the [Rust documentation for `complement_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement_range) for more information. +void complementInclusiveRange(int start, int end) { + + _ICU4XCodePointSetBuilder_complement_inclusive_range(_underlying,start,end); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetBuilder_complement_inclusive_range= _capi, ffi.Uint32, ffi.Uint32)>>('ICU4XCodePointSetBuilder_complement_inclusive_range') + .asFunction, int, int)>(isLeaf: true); + + +/// Complement all elements that belong to the provided set from the set +/// +/// (Characters which are in this set are removed and vice versa) +/// +/// See the [Rust documentation for `complement_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement_set) for more information. +void complementSet(CodePointSetData data) { + + _ICU4XCodePointSetBuilder_complement_set(_underlying,data._underlying); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetBuilder_complement_set = _capi< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XCodePointSetBuilder_complement_set') - .asFunction< - void Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XCodePointSetBuilder_complement_set= _capi, ffi.Pointer)>>('ICU4XCodePointSetBuilder_complement_set') + .asFunction, ffi.Pointer)>(isLeaf: true); + + + } + /// An ICU4X Unicode Set Property object, capable of querying whether a code point is contained in a set based on a Unicode property. -/// +/// /// See the [Rust documentation for `properties`](https://docs.rs/icu/latest/icu/properties/index.html) for more information. -/// +/// /// See the [Rust documentation for `CodePointSetData`](https://docs.rs/icu/latest/icu/properties/sets/struct.CodePointSetData.html) for more information. -/// +/// /// See the [Rust documentation for `CodePointSetDataBorrowed`](https://docs.rs/icu/latest/icu/properties/sets/struct.CodePointSetDataBorrowed.html) for more information. class CodePointSetData implements ffi.Finalizable { - final ffi.Pointer _underlying; - CodePointSetData._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + final ffi.Pointer _underlying; + + CodePointSetData._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCodePointSetData_destroy')); + + +/// Checks whether the code point is in the set. +/// +/// See the [Rust documentation for `contains`](https://docs.rs/icu/latest/icu/properties/sets/struct.CodePointSetDataBorrowed.html#method.contains) for more information. +bool contains(int cp) { + + final result = _ICU4XCodePointSetData_contains(_underlying,cp); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_contains= _capi, ffi.Uint32)>>('ICU4XCodePointSetData_contains') + .asFunction, int)>(isLeaf: true); - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XCodePointSetData_destroy')); - /// Checks whether the code point is in the set. - /// - /// See the [Rust documentation for `contains`](https://docs.rs/icu/latest/icu/properties/sets/struct.CodePointSetDataBorrowed.html#method.contains) for more information. - bool contains(int cp) { - final result = _ICU4XCodePointSetData_contains(_underlying, cp); - return result; + +/// Produces an iterator over ranges of code points contained in this set +/// +/// See the [Rust documentation for `iter_ranges`](https://docs.rs/icu/latest/icu/properties/sets/struct.CodePointSetDataBorrowed.html#method.iter_ranges) for more information. +CodePointRangeIterator get iterRanges { + + final result = _ICU4XCodePointSetData_iter_ranges(_underlying); + return CodePointRangeIterator._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_iter_ranges= _capi Function(ffi.Pointer)>>('ICU4XCodePointSetData_iter_ranges') + .asFunction Function(ffi.Pointer)>(isLeaf: true); + + +/// Produces an iterator over ranges of code points not contained in this set +/// +/// See the [Rust documentation for `iter_ranges_complemented`](https://docs.rs/icu/latest/icu/properties/sets/struct.CodePointSetDataBorrowed.html#method.iter_ranges_complemented) for more information. +CodePointRangeIterator get iterRangesComplemented { + + final result = _ICU4XCodePointSetData_iter_ranges_complemented(_underlying); + return CodePointRangeIterator._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_contains = _capi< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XCodePointSetData_contains') - .asFunction, int)>(isLeaf: true); + static final _ICU4XCodePointSetData_iter_ranges_complemented= _capi Function(ffi.Pointer)>>('ICU4XCodePointSetData_iter_ranges_complemented') + .asFunction Function(ffi.Pointer)>(isLeaf: true); - /// Produces an iterator over ranges of code points contained in this set - /// - /// See the [Rust documentation for `iter_ranges`](https://docs.rs/icu/latest/icu/properties/sets/struct.CodePointSetDataBorrowed.html#method.iter_ranges) for more information. - CodePointRangeIterator get iterRanges { - final result = _ICU4XCodePointSetData_iter_ranges(_underlying); - return CodePointRangeIterator._(result); + + +/// which is a mask with the same format as the `U_GC_XX_MASK` mask in ICU4C +/// +/// See the [Rust documentation for `for_general_category_group`](https://docs.rs/icu/latest/icu/properties/sets/fn.for_general_category_group.html) for more information. +factory CodePointSetData.loadForGeneralCategoryGroup(DataProvider provider, int group) { + + final result = _ICU4XCodePointSetData_load_for_general_category_group(provider._underlying,group); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_for_general_category_group= _capi, ffi.Uint32)>>('ICU4XCodePointSetData_load_for_general_category_group') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>(isLeaf: true); + + +/// See the [Rust documentation for `ascii_hex_digit`](https://docs.rs/icu/latest/icu/properties/sets/fn.ascii_hex_digit.html) for more information. +factory CodePointSetData.loadAsciiHexDigit(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_ascii_hex_digit(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_iter_ranges = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_iter_ranges') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_ascii_hex_digit= _capi)>>('ICU4XCodePointSetData_load_ascii_hex_digit') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + - /// Produces an iterator over ranges of code points not contained in this set - /// - /// See the [Rust documentation for `iter_ranges_complemented`](https://docs.rs/icu/latest/icu/properties/sets/struct.CodePointSetDataBorrowed.html#method.iter_ranges_complemented) for more information. - CodePointRangeIterator get iterRangesComplemented { - final result = _ICU4XCodePointSetData_iter_ranges_complemented(_underlying); - return CodePointRangeIterator._(result); + +/// See the [Rust documentation for `alnum`](https://docs.rs/icu/latest/icu/properties/sets/fn.alnum.html) for more information. +factory CodePointSetData.loadAlnum(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_alnum(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_alnum= _capi)>>('ICU4XCodePointSetData_load_alnum') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + +/// See the [Rust documentation for `alphabetic`](https://docs.rs/icu/latest/icu/properties/sets/fn.alphabetic.html) for more information. +factory CodePointSetData.loadAlphabetic(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_alphabetic(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_iter_ranges_complemented = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_iter_ranges_complemented') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); - - /// which is a mask with the same format as the `U_GC_XX_MASK` mask in ICU4C - /// - /// See the [Rust documentation for `for_general_category_group`](https://docs.rs/icu/latest/icu/properties/sets/fn.for_general_category_group.html) for more information. - factory CodePointSetData.loadForGeneralCategoryGroup( - DataProvider provider, int group) { - final result = _ICU4XCodePointSetData_load_for_general_category_group( - provider._underlying, group); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_for_general_category_group = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Uint32)>>( - 'ICU4XCodePointSetData_load_for_general_category_group') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>( - isLeaf: true); - - /// See the [Rust documentation for `ascii_hex_digit`](https://docs.rs/icu/latest/icu/properties/sets/fn.ascii_hex_digit.html) for more information. - factory CodePointSetData.loadAsciiHexDigit(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_ascii_hex_digit(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_ascii_hex_digit = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_ascii_hex_digit') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `alnum`](https://docs.rs/icu/latest/icu/properties/sets/fn.alnum.html) for more information. - factory CodePointSetData.loadAlnum(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_alnum(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_alnum = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XCodePointSetData_load_alnum') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `alphabetic`](https://docs.rs/icu/latest/icu/properties/sets/fn.alphabetic.html) for more information. - factory CodePointSetData.loadAlphabetic(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_alphabetic(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_alphabetic = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_alphabetic') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `bidi_control`](https://docs.rs/icu/latest/icu/properties/sets/fn.bidi_control.html) for more information. - factory CodePointSetData.loadBidiControl(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_bidi_control(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_bidi_control = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_bidi_control') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `bidi_mirrored`](https://docs.rs/icu/latest/icu/properties/sets/fn.bidi_mirrored.html) for more information. - factory CodePointSetData.loadBidiMirrored(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_bidi_mirrored(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_bidi_mirrored = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_bidi_mirrored') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `blank`](https://docs.rs/icu/latest/icu/properties/sets/fn.blank.html) for more information. - factory CodePointSetData.loadBlank(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_blank(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_blank = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XCodePointSetData_load_blank') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `cased`](https://docs.rs/icu/latest/icu/properties/sets/fn.cased.html) for more information. - factory CodePointSetData.loadCased(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_cased(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_cased = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XCodePointSetData_load_cased') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `case_ignorable`](https://docs.rs/icu/latest/icu/properties/sets/fn.case_ignorable.html) for more information. - factory CodePointSetData.loadCaseIgnorable(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_case_ignorable(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_case_ignorable = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_case_ignorable') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `full_composition_exclusion`](https://docs.rs/icu/latest/icu/properties/sets/fn.full_composition_exclusion.html) for more information. - factory CodePointSetData.loadFullCompositionExclusion(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_full_composition_exclusion( - provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_full_composition_exclusion = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_full_composition_exclusion') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `changes_when_casefolded`](https://docs.rs/icu/latest/icu/properties/sets/fn.changes_when_casefolded.html) for more information. - factory CodePointSetData.loadChangesWhenCasefolded(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_changes_when_casefolded( - provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_changes_when_casefolded = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_changes_when_casefolded') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `changes_when_casemapped`](https://docs.rs/icu/latest/icu/properties/sets/fn.changes_when_casemapped.html) for more information. - factory CodePointSetData.loadChangesWhenCasemapped(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_changes_when_casemapped( - provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_changes_when_casemapped = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_changes_when_casemapped') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `changes_when_nfkc_casefolded`](https://docs.rs/icu/latest/icu/properties/sets/fn.changes_when_nfkc_casefolded.html) for more information. - factory CodePointSetData.loadChangesWhenNfkcCasefolded( - DataProvider provider) { - final result = _ICU4XCodePointSetData_load_changes_when_nfkc_casefolded( - provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_changes_when_nfkc_casefolded = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_changes_when_nfkc_casefolded') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `changes_when_lowercased`](https://docs.rs/icu/latest/icu/properties/sets/fn.changes_when_lowercased.html) for more information. - factory CodePointSetData.loadChangesWhenLowercased(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_changes_when_lowercased( - provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_changes_when_lowercased = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_changes_when_lowercased') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `changes_when_titlecased`](https://docs.rs/icu/latest/icu/properties/sets/fn.changes_when_titlecased.html) for more information. - factory CodePointSetData.loadChangesWhenTitlecased(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_changes_when_titlecased( - provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_changes_when_titlecased = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_changes_when_titlecased') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `changes_when_uppercased`](https://docs.rs/icu/latest/icu/properties/sets/fn.changes_when_uppercased.html) for more information. - factory CodePointSetData.loadChangesWhenUppercased(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_changes_when_uppercased( - provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_changes_when_uppercased = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_changes_when_uppercased') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `dash`](https://docs.rs/icu/latest/icu/properties/sets/fn.dash.html) for more information. - factory CodePointSetData.loadDash(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_dash(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_dash = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XCodePointSetData_load_dash') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `deprecated`](https://docs.rs/icu/latest/icu/properties/sets/fn.deprecated.html) for more information. - factory CodePointSetData.loadDeprecated(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_deprecated(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_deprecated = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_deprecated') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `default_ignorable_code_point`](https://docs.rs/icu/latest/icu/properties/sets/fn.default_ignorable_code_point.html) for more information. - factory CodePointSetData.loadDefaultIgnorableCodePoint( - DataProvider provider) { - final result = _ICU4XCodePointSetData_load_default_ignorable_code_point( - provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_default_ignorable_code_point = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_default_ignorable_code_point') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_alphabetic= _capi)>>('ICU4XCodePointSetData_load_alphabetic') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + - /// See the [Rust documentation for `diacritic`](https://docs.rs/icu/latest/icu/properties/sets/fn.diacritic.html) for more information. - factory CodePointSetData.loadDiacritic(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_diacritic(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// See the [Rust documentation for `bidi_control`](https://docs.rs/icu/latest/icu/properties/sets/fn.bidi_control.html) for more information. +factory CodePointSetData.loadBidiControl(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_bidi_control(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_diacritic = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_diacritic') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `emoji_modifier_base`](https://docs.rs/icu/latest/icu/properties/sets/fn.emoji_modifier_base.html) for more information. - factory CodePointSetData.loadEmojiModifierBase(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_emoji_modifier_base(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_emoji_modifier_base = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_emoji_modifier_base') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `emoji_component`](https://docs.rs/icu/latest/icu/properties/sets/fn.emoji_component.html) for more information. - factory CodePointSetData.loadEmojiComponent(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_emoji_component(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_emoji_component = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_emoji_component') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `emoji_modifier`](https://docs.rs/icu/latest/icu/properties/sets/fn.emoji_modifier.html) for more information. - factory CodePointSetData.loadEmojiModifier(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_emoji_modifier(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_emoji_modifier = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_emoji_modifier') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `emoji`](https://docs.rs/icu/latest/icu/properties/sets/fn.emoji.html) for more information. - factory CodePointSetData.loadEmoji(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_emoji(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_emoji = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XCodePointSetData_load_emoji') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `emoji_presentation`](https://docs.rs/icu/latest/icu/properties/sets/fn.emoji_presentation.html) for more information. - factory CodePointSetData.loadEmojiPresentation(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_emoji_presentation(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_emoji_presentation = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_emoji_presentation') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_bidi_control= _capi)>>('ICU4XCodePointSetData_load_bidi_control') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// See the [Rust documentation for `extender`](https://docs.rs/icu/latest/icu/properties/sets/fn.extender.html) for more information. - factory CodePointSetData.loadExtender(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_extender(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + + +/// See the [Rust documentation for `bidi_mirrored`](https://docs.rs/icu/latest/icu/properties/sets/fn.bidi_mirrored.html) for more information. +factory CodePointSetData.loadBidiMirrored(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_bidi_mirrored(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_extender = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_extender') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `extended_pictographic`](https://docs.rs/icu/latest/icu/properties/sets/fn.extended_pictographic.html) for more information. - factory CodePointSetData.loadExtendedPictographic(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_extended_pictographic(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_extended_pictographic = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_extended_pictographic') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `graph`](https://docs.rs/icu/latest/icu/properties/sets/fn.graph.html) for more information. - factory CodePointSetData.loadGraph(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_graph(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_graph = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XCodePointSetData_load_graph') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `grapheme_base`](https://docs.rs/icu/latest/icu/properties/sets/fn.grapheme_base.html) for more information. - factory CodePointSetData.loadGraphemeBase(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_grapheme_base(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_grapheme_base = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_grapheme_base') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `grapheme_extend`](https://docs.rs/icu/latest/icu/properties/sets/fn.grapheme_extend.html) for more information. - factory CodePointSetData.loadGraphemeExtend(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_grapheme_extend(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_grapheme_extend = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_grapheme_extend') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `grapheme_link`](https://docs.rs/icu/latest/icu/properties/sets/fn.grapheme_link.html) for more information. - factory CodePointSetData.loadGraphemeLink(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_grapheme_link(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_grapheme_link = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_grapheme_link') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_bidi_mirrored= _capi)>>('ICU4XCodePointSetData_load_bidi_mirrored') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// See the [Rust documentation for `hex_digit`](https://docs.rs/icu/latest/icu/properties/sets/fn.hex_digit.html) for more information. - factory CodePointSetData.loadHexDigit(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_hex_digit(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + + +/// See the [Rust documentation for `blank`](https://docs.rs/icu/latest/icu/properties/sets/fn.blank.html) for more information. +factory CodePointSetData.loadBlank(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_blank(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_hex_digit = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_hex_digit') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_blank= _capi)>>('ICU4XCodePointSetData_load_blank') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// See the [Rust documentation for `hyphen`](https://docs.rs/icu/latest/icu/properties/sets/fn.hyphen.html) for more information. - factory CodePointSetData.loadHyphen(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_hyphen(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + + +/// See the [Rust documentation for `cased`](https://docs.rs/icu/latest/icu/properties/sets/fn.cased.html) for more information. +factory CodePointSetData.loadCased(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_cased(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_hyphen = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_hyphen') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `id_continue`](https://docs.rs/icu/latest/icu/properties/sets/fn.id_continue.html) for more information. - factory CodePointSetData.loadIdContinue(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_id_continue(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_id_continue = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_id_continue') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `ideographic`](https://docs.rs/icu/latest/icu/properties/sets/fn.ideographic.html) for more information. - factory CodePointSetData.loadIdeographic(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_ideographic(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_ideographic = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_ideographic') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_cased= _capi)>>('ICU4XCodePointSetData_load_cased') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// See the [Rust documentation for `id_start`](https://docs.rs/icu/latest/icu/properties/sets/fn.id_start.html) for more information. - factory CodePointSetData.loadIdStart(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_id_start(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + + +/// See the [Rust documentation for `case_ignorable`](https://docs.rs/icu/latest/icu/properties/sets/fn.case_ignorable.html) for more information. +factory CodePointSetData.loadCaseIgnorable(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_case_ignorable(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_id_start = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_id_start') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `ids_binary_operator`](https://docs.rs/icu/latest/icu/properties/sets/fn.ids_binary_operator.html) for more information. - factory CodePointSetData.loadIdsBinaryOperator(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_ids_binary_operator(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_ids_binary_operator = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_ids_binary_operator') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `ids_trinary_operator`](https://docs.rs/icu/latest/icu/properties/sets/fn.ids_trinary_operator.html) for more information. - factory CodePointSetData.loadIdsTrinaryOperator(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_ids_trinary_operator(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_ids_trinary_operator = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_ids_trinary_operator') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `join_control`](https://docs.rs/icu/latest/icu/properties/sets/fn.join_control.html) for more information. - factory CodePointSetData.loadJoinControl(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_join_control(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_join_control = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_join_control') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `logical_order_exception`](https://docs.rs/icu/latest/icu/properties/sets/fn.logical_order_exception.html) for more information. - factory CodePointSetData.loadLogicalOrderException(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_logical_order_exception( - provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_logical_order_exception = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_logical_order_exception') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_case_ignorable= _capi)>>('ICU4XCodePointSetData_load_case_ignorable') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// See the [Rust documentation for `lowercase`](https://docs.rs/icu/latest/icu/properties/sets/fn.lowercase.html) for more information. - factory CodePointSetData.loadLowercase(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_lowercase(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + + +/// See the [Rust documentation for `full_composition_exclusion`](https://docs.rs/icu/latest/icu/properties/sets/fn.full_composition_exclusion.html) for more information. +factory CodePointSetData.loadFullCompositionExclusion(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_full_composition_exclusion(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_lowercase = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_lowercase') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `math`](https://docs.rs/icu/latest/icu/properties/sets/fn.math.html) for more information. - factory CodePointSetData.loadMath(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_math(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_math = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XCodePointSetData_load_math') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `noncharacter_code_point`](https://docs.rs/icu/latest/icu/properties/sets/fn.noncharacter_code_point.html) for more information. - factory CodePointSetData.loadNoncharacterCodePoint(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_noncharacter_code_point( - provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_noncharacter_code_point = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_noncharacter_code_point') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_full_composition_exclusion= _capi)>>('ICU4XCodePointSetData_load_full_composition_exclusion') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + - /// See the [Rust documentation for `nfc_inert`](https://docs.rs/icu/latest/icu/properties/sets/fn.nfc_inert.html) for more information. - factory CodePointSetData.loadNfcInert(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_nfc_inert(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// See the [Rust documentation for `changes_when_casefolded`](https://docs.rs/icu/latest/icu/properties/sets/fn.changes_when_casefolded.html) for more information. +factory CodePointSetData.loadChangesWhenCasefolded(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_changes_when_casefolded(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_nfc_inert = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_nfc_inert') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_changes_when_casefolded= _capi)>>('ICU4XCodePointSetData_load_changes_when_casefolded') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + - /// See the [Rust documentation for `nfd_inert`](https://docs.rs/icu/latest/icu/properties/sets/fn.nfd_inert.html) for more information. - factory CodePointSetData.loadNfdInert(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_nfd_inert(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// See the [Rust documentation for `changes_when_casemapped`](https://docs.rs/icu/latest/icu/properties/sets/fn.changes_when_casemapped.html) for more information. +factory CodePointSetData.loadChangesWhenCasemapped(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_changes_when_casemapped(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_nfd_inert = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_nfd_inert') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_changes_when_casemapped= _capi)>>('ICU4XCodePointSetData_load_changes_when_casemapped') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + - /// See the [Rust documentation for `nfkc_inert`](https://docs.rs/icu/latest/icu/properties/sets/fn.nfkc_inert.html) for more information. - factory CodePointSetData.loadNfkcInert(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_nfkc_inert(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// See the [Rust documentation for `changes_when_nfkc_casefolded`](https://docs.rs/icu/latest/icu/properties/sets/fn.changes_when_nfkc_casefolded.html) for more information. +factory CodePointSetData.loadChangesWhenNfkcCasefolded(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_changes_when_nfkc_casefolded(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_nfkc_inert = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_nfkc_inert') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_changes_when_nfkc_casefolded= _capi)>>('ICU4XCodePointSetData_load_changes_when_nfkc_casefolded') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + - /// See the [Rust documentation for `nfkd_inert`](https://docs.rs/icu/latest/icu/properties/sets/fn.nfkd_inert.html) for more information. - factory CodePointSetData.loadNfkdInert(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_nfkd_inert(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// See the [Rust documentation for `changes_when_lowercased`](https://docs.rs/icu/latest/icu/properties/sets/fn.changes_when_lowercased.html) for more information. +factory CodePointSetData.loadChangesWhenLowercased(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_changes_when_lowercased(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_nfkd_inert = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_nfkd_inert') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `pattern_syntax`](https://docs.rs/icu/latest/icu/properties/sets/fn.pattern_syntax.html) for more information. - factory CodePointSetData.loadPatternSyntax(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_pattern_syntax(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_pattern_syntax = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_pattern_syntax') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `pattern_white_space`](https://docs.rs/icu/latest/icu/properties/sets/fn.pattern_white_space.html) for more information. - factory CodePointSetData.loadPatternWhiteSpace(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_pattern_white_space(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_pattern_white_space = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_pattern_white_space') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `prepended_concatenation_mark`](https://docs.rs/icu/latest/icu/properties/sets/fn.prepended_concatenation_mark.html) for more information. - factory CodePointSetData.loadPrependedConcatenationMark( - DataProvider provider) { - final result = _ICU4XCodePointSetData_load_prepended_concatenation_mark( - provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_prepended_concatenation_mark = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_prepended_concatenation_mark') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `print`](https://docs.rs/icu/latest/icu/properties/sets/fn.print.html) for more information. - factory CodePointSetData.loadPrint(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_print(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_print = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XCodePointSetData_load_print') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `quotation_mark`](https://docs.rs/icu/latest/icu/properties/sets/fn.quotation_mark.html) for more information. - factory CodePointSetData.loadQuotationMark(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_quotation_mark(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_quotation_mark = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_quotation_mark') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_changes_when_lowercased= _capi)>>('ICU4XCodePointSetData_load_changes_when_lowercased') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + - /// See the [Rust documentation for `radical`](https://docs.rs/icu/latest/icu/properties/sets/fn.radical.html) for more information. - factory CodePointSetData.loadRadical(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_radical(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// See the [Rust documentation for `changes_when_titlecased`](https://docs.rs/icu/latest/icu/properties/sets/fn.changes_when_titlecased.html) for more information. +factory CodePointSetData.loadChangesWhenTitlecased(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_changes_when_titlecased(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_radical = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_radical') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `regional_indicator`](https://docs.rs/icu/latest/icu/properties/sets/fn.regional_indicator.html) for more information. - factory CodePointSetData.loadRegionalIndicator(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_regional_indicator(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_regional_indicator = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_regional_indicator') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `soft_dotted`](https://docs.rs/icu/latest/icu/properties/sets/fn.soft_dotted.html) for more information. - factory CodePointSetData.loadSoftDotted(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_soft_dotted(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_soft_dotted = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_soft_dotted') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `segment_starter`](https://docs.rs/icu/latest/icu/properties/sets/fn.segment_starter.html) for more information. - factory CodePointSetData.loadSegmentStarter(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_segment_starter(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_segment_starter = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_segment_starter') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `case_sensitive`](https://docs.rs/icu/latest/icu/properties/sets/fn.case_sensitive.html) for more information. - factory CodePointSetData.loadCaseSensitive(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_case_sensitive(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_case_sensitive = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_case_sensitive') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `sentence_terminal`](https://docs.rs/icu/latest/icu/properties/sets/fn.sentence_terminal.html) for more information. - factory CodePointSetData.loadSentenceTerminal(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_sentence_terminal(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_sentence_terminal = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_sentence_terminal') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `terminal_punctuation`](https://docs.rs/icu/latest/icu/properties/sets/fn.terminal_punctuation.html) for more information. - factory CodePointSetData.loadTerminalPunctuation(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_terminal_punctuation(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_terminal_punctuation = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_terminal_punctuation') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `unified_ideograph`](https://docs.rs/icu/latest/icu/properties/sets/fn.unified_ideograph.html) for more information. - factory CodePointSetData.loadUnifiedIdeograph(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_unified_ideograph(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_unified_ideograph = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_unified_ideograph') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_changes_when_titlecased= _capi)>>('ICU4XCodePointSetData_load_changes_when_titlecased') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// See the [Rust documentation for `uppercase`](https://docs.rs/icu/latest/icu/properties/sets/fn.uppercase.html) for more information. - factory CodePointSetData.loadUppercase(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_uppercase(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + + +/// See the [Rust documentation for `changes_when_uppercased`](https://docs.rs/icu/latest/icu/properties/sets/fn.changes_when_uppercased.html) for more information. +factory CodePointSetData.loadChangesWhenUppercased(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_changes_when_uppercased(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_uppercase = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_uppercase') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `variation_selector`](https://docs.rs/icu/latest/icu/properties/sets/fn.variation_selector.html) for more information. - factory CodePointSetData.loadVariationSelector(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_variation_selector(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_variation_selector = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_variation_selector') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `white_space`](https://docs.rs/icu/latest/icu/properties/sets/fn.white_space.html) for more information. - factory CodePointSetData.loadWhiteSpace(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_white_space(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_white_space = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_white_space') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_changes_when_uppercased= _capi)>>('ICU4XCodePointSetData_load_changes_when_uppercased') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// See the [Rust documentation for `xdigit`](https://docs.rs/icu/latest/icu/properties/sets/fn.xdigit.html) for more information. - factory CodePointSetData.loadXdigit(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_xdigit(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + + +/// See the [Rust documentation for `dash`](https://docs.rs/icu/latest/icu/properties/sets/fn.dash.html) for more information. +factory CodePointSetData.loadDash(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_dash(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_xdigit = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_xdigit') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `xid_continue`](https://docs.rs/icu/latest/icu/properties/sets/fn.xid_continue.html) for more information. - factory CodePointSetData.loadXidContinue(DataProvider provider) { - final result = - _ICU4XCodePointSetData_load_xid_continue(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_xid_continue = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_xid_continue') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XCodePointSetData_load_dash= _capi)>>('ICU4XCodePointSetData_load_dash') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + - /// See the [Rust documentation for `xid_start`](https://docs.rs/icu/latest/icu/properties/sets/fn.xid_start.html) for more information. - factory CodePointSetData.loadXidStart(DataProvider provider) { - final result = _ICU4XCodePointSetData_load_xid_start(provider._underlying); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// See the [Rust documentation for `deprecated`](https://docs.rs/icu/latest/icu/properties/sets/fn.deprecated.html) for more information. +factory CodePointSetData.loadDeprecated(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_deprecated(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_xid_start = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XCodePointSetData_load_xid_start') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Loads data for a property specified as a string as long as it is one of the - /// [ECMA-262 binary properties][ecma] (not including Any, ASCII, and Assigned pseudoproperties). - /// - /// Returns `ICU4XError::PropertyUnexpectedPropertyNameError` in case the string does not - /// match any property in the list - /// - /// [ecma]: https://tc39.es/ecma262/#table-binary-unicode-properties - /// - /// See the [Rust documentation for `for_ecma262`](https://docs.rs/icu/latest/icu/properties/sets/fn.for_ecma262.html) for more information. - factory CodePointSetData.loadForEcma262( - DataProvider provider, String propertyName) { - final alloc = ffi2.Arena(); - final propertyNameSlice = _SliceFfi2Utf8._fromDart(propertyName, alloc); - - final result = _ICU4XCodePointSetData_load_for_ecma262(provider._underlying, - propertyNameSlice._bytes, propertyNameSlice._length); - alloc.releaseAll(); - return result.isOk - ? CodePointSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCodePointSetData_load_for_ecma262 = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XCodePointSetData_load_for_ecma262') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); -} + static final _ICU4XCodePointSetData_load_deprecated= _capi)>>('ICU4XCodePointSetData_load_deprecated') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `default_ignorable_code_point`](https://docs.rs/icu/latest/icu/properties/sets/fn.default_ignorable_code_point.html) for more information. +factory CodePointSetData.loadDefaultIgnorableCodePoint(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_default_ignorable_code_point(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_default_ignorable_code_point= _capi)>>('ICU4XCodePointSetData_load_default_ignorable_code_point') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `diacritic`](https://docs.rs/icu/latest/icu/properties/sets/fn.diacritic.html) for more information. +factory CodePointSetData.loadDiacritic(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_diacritic(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_diacritic= _capi)>>('ICU4XCodePointSetData_load_diacritic') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `emoji_modifier_base`](https://docs.rs/icu/latest/icu/properties/sets/fn.emoji_modifier_base.html) for more information. +factory CodePointSetData.loadEmojiModifierBase(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_emoji_modifier_base(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_emoji_modifier_base= _capi)>>('ICU4XCodePointSetData_load_emoji_modifier_base') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `emoji_component`](https://docs.rs/icu/latest/icu/properties/sets/fn.emoji_component.html) for more information. +factory CodePointSetData.loadEmojiComponent(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_emoji_component(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_emoji_component= _capi)>>('ICU4XCodePointSetData_load_emoji_component') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `emoji_modifier`](https://docs.rs/icu/latest/icu/properties/sets/fn.emoji_modifier.html) for more information. +factory CodePointSetData.loadEmojiModifier(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_emoji_modifier(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_emoji_modifier= _capi)>>('ICU4XCodePointSetData_load_emoji_modifier') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `emoji`](https://docs.rs/icu/latest/icu/properties/sets/fn.emoji.html) for more information. +factory CodePointSetData.loadEmoji(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_emoji(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_emoji= _capi)>>('ICU4XCodePointSetData_load_emoji') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `emoji_presentation`](https://docs.rs/icu/latest/icu/properties/sets/fn.emoji_presentation.html) for more information. +factory CodePointSetData.loadEmojiPresentation(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_emoji_presentation(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_emoji_presentation= _capi)>>('ICU4XCodePointSetData_load_emoji_presentation') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `extender`](https://docs.rs/icu/latest/icu/properties/sets/fn.extender.html) for more information. +factory CodePointSetData.loadExtender(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_extender(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_extender= _capi)>>('ICU4XCodePointSetData_load_extender') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `extended_pictographic`](https://docs.rs/icu/latest/icu/properties/sets/fn.extended_pictographic.html) for more information. +factory CodePointSetData.loadExtendedPictographic(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_extended_pictographic(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_extended_pictographic= _capi)>>('ICU4XCodePointSetData_load_extended_pictographic') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `graph`](https://docs.rs/icu/latest/icu/properties/sets/fn.graph.html) for more information. +factory CodePointSetData.loadGraph(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_graph(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_graph= _capi)>>('ICU4XCodePointSetData_load_graph') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `grapheme_base`](https://docs.rs/icu/latest/icu/properties/sets/fn.grapheme_base.html) for more information. +factory CodePointSetData.loadGraphemeBase(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_grapheme_base(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_grapheme_base= _capi)>>('ICU4XCodePointSetData_load_grapheme_base') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `grapheme_extend`](https://docs.rs/icu/latest/icu/properties/sets/fn.grapheme_extend.html) for more information. +factory CodePointSetData.loadGraphemeExtend(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_grapheme_extend(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_grapheme_extend= _capi)>>('ICU4XCodePointSetData_load_grapheme_extend') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `grapheme_link`](https://docs.rs/icu/latest/icu/properties/sets/fn.grapheme_link.html) for more information. +factory CodePointSetData.loadGraphemeLink(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_grapheme_link(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_grapheme_link= _capi)>>('ICU4XCodePointSetData_load_grapheme_link') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `hex_digit`](https://docs.rs/icu/latest/icu/properties/sets/fn.hex_digit.html) for more information. +factory CodePointSetData.loadHexDigit(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_hex_digit(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_hex_digit= _capi)>>('ICU4XCodePointSetData_load_hex_digit') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `hyphen`](https://docs.rs/icu/latest/icu/properties/sets/fn.hyphen.html) for more information. +factory CodePointSetData.loadHyphen(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_hyphen(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_hyphen= _capi)>>('ICU4XCodePointSetData_load_hyphen') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `id_continue`](https://docs.rs/icu/latest/icu/properties/sets/fn.id_continue.html) for more information. +factory CodePointSetData.loadIdContinue(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_id_continue(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_id_continue= _capi)>>('ICU4XCodePointSetData_load_id_continue') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `ideographic`](https://docs.rs/icu/latest/icu/properties/sets/fn.ideographic.html) for more information. +factory CodePointSetData.loadIdeographic(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_ideographic(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_ideographic= _capi)>>('ICU4XCodePointSetData_load_ideographic') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `id_start`](https://docs.rs/icu/latest/icu/properties/sets/fn.id_start.html) for more information. +factory CodePointSetData.loadIdStart(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_id_start(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_id_start= _capi)>>('ICU4XCodePointSetData_load_id_start') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `ids_binary_operator`](https://docs.rs/icu/latest/icu/properties/sets/fn.ids_binary_operator.html) for more information. +factory CodePointSetData.loadIdsBinaryOperator(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_ids_binary_operator(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_ids_binary_operator= _capi)>>('ICU4XCodePointSetData_load_ids_binary_operator') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `ids_trinary_operator`](https://docs.rs/icu/latest/icu/properties/sets/fn.ids_trinary_operator.html) for more information. +factory CodePointSetData.loadIdsTrinaryOperator(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_ids_trinary_operator(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_ids_trinary_operator= _capi)>>('ICU4XCodePointSetData_load_ids_trinary_operator') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `join_control`](https://docs.rs/icu/latest/icu/properties/sets/fn.join_control.html) for more information. +factory CodePointSetData.loadJoinControl(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_join_control(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_join_control= _capi)>>('ICU4XCodePointSetData_load_join_control') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `logical_order_exception`](https://docs.rs/icu/latest/icu/properties/sets/fn.logical_order_exception.html) for more information. +factory CodePointSetData.loadLogicalOrderException(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_logical_order_exception(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_logical_order_exception= _capi)>>('ICU4XCodePointSetData_load_logical_order_exception') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `lowercase`](https://docs.rs/icu/latest/icu/properties/sets/fn.lowercase.html) for more information. +factory CodePointSetData.loadLowercase(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_lowercase(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_lowercase= _capi)>>('ICU4XCodePointSetData_load_lowercase') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `math`](https://docs.rs/icu/latest/icu/properties/sets/fn.math.html) for more information. +factory CodePointSetData.loadMath(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_math(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_math= _capi)>>('ICU4XCodePointSetData_load_math') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `noncharacter_code_point`](https://docs.rs/icu/latest/icu/properties/sets/fn.noncharacter_code_point.html) for more information. +factory CodePointSetData.loadNoncharacterCodePoint(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_noncharacter_code_point(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_noncharacter_code_point= _capi)>>('ICU4XCodePointSetData_load_noncharacter_code_point') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `nfc_inert`](https://docs.rs/icu/latest/icu/properties/sets/fn.nfc_inert.html) for more information. +factory CodePointSetData.loadNfcInert(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_nfc_inert(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_nfc_inert= _capi)>>('ICU4XCodePointSetData_load_nfc_inert') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `nfd_inert`](https://docs.rs/icu/latest/icu/properties/sets/fn.nfd_inert.html) for more information. +factory CodePointSetData.loadNfdInert(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_nfd_inert(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_nfd_inert= _capi)>>('ICU4XCodePointSetData_load_nfd_inert') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `nfkc_inert`](https://docs.rs/icu/latest/icu/properties/sets/fn.nfkc_inert.html) for more information. +factory CodePointSetData.loadNfkcInert(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_nfkc_inert(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_nfkc_inert= _capi)>>('ICU4XCodePointSetData_load_nfkc_inert') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `nfkd_inert`](https://docs.rs/icu/latest/icu/properties/sets/fn.nfkd_inert.html) for more information. +factory CodePointSetData.loadNfkdInert(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_nfkd_inert(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_nfkd_inert= _capi)>>('ICU4XCodePointSetData_load_nfkd_inert') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `pattern_syntax`](https://docs.rs/icu/latest/icu/properties/sets/fn.pattern_syntax.html) for more information. +factory CodePointSetData.loadPatternSyntax(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_pattern_syntax(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_pattern_syntax= _capi)>>('ICU4XCodePointSetData_load_pattern_syntax') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `pattern_white_space`](https://docs.rs/icu/latest/icu/properties/sets/fn.pattern_white_space.html) for more information. +factory CodePointSetData.loadPatternWhiteSpace(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_pattern_white_space(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_pattern_white_space= _capi)>>('ICU4XCodePointSetData_load_pattern_white_space') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `prepended_concatenation_mark`](https://docs.rs/icu/latest/icu/properties/sets/fn.prepended_concatenation_mark.html) for more information. +factory CodePointSetData.loadPrependedConcatenationMark(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_prepended_concatenation_mark(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_prepended_concatenation_mark= _capi)>>('ICU4XCodePointSetData_load_prepended_concatenation_mark') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `print`](https://docs.rs/icu/latest/icu/properties/sets/fn.print.html) for more information. +factory CodePointSetData.loadPrint(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_print(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_print= _capi)>>('ICU4XCodePointSetData_load_print') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `quotation_mark`](https://docs.rs/icu/latest/icu/properties/sets/fn.quotation_mark.html) for more information. +factory CodePointSetData.loadQuotationMark(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_quotation_mark(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_quotation_mark= _capi)>>('ICU4XCodePointSetData_load_quotation_mark') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `radical`](https://docs.rs/icu/latest/icu/properties/sets/fn.radical.html) for more information. +factory CodePointSetData.loadRadical(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_radical(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_radical= _capi)>>('ICU4XCodePointSetData_load_radical') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `regional_indicator`](https://docs.rs/icu/latest/icu/properties/sets/fn.regional_indicator.html) for more information. +factory CodePointSetData.loadRegionalIndicator(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_regional_indicator(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_regional_indicator= _capi)>>('ICU4XCodePointSetData_load_regional_indicator') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `soft_dotted`](https://docs.rs/icu/latest/icu/properties/sets/fn.soft_dotted.html) for more information. +factory CodePointSetData.loadSoftDotted(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_soft_dotted(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_soft_dotted= _capi)>>('ICU4XCodePointSetData_load_soft_dotted') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `segment_starter`](https://docs.rs/icu/latest/icu/properties/sets/fn.segment_starter.html) for more information. +factory CodePointSetData.loadSegmentStarter(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_segment_starter(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_segment_starter= _capi)>>('ICU4XCodePointSetData_load_segment_starter') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `case_sensitive`](https://docs.rs/icu/latest/icu/properties/sets/fn.case_sensitive.html) for more information. +factory CodePointSetData.loadCaseSensitive(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_case_sensitive(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_case_sensitive= _capi)>>('ICU4XCodePointSetData_load_case_sensitive') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `sentence_terminal`](https://docs.rs/icu/latest/icu/properties/sets/fn.sentence_terminal.html) for more information. +factory CodePointSetData.loadSentenceTerminal(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_sentence_terminal(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_sentence_terminal= _capi)>>('ICU4XCodePointSetData_load_sentence_terminal') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `terminal_punctuation`](https://docs.rs/icu/latest/icu/properties/sets/fn.terminal_punctuation.html) for more information. +factory CodePointSetData.loadTerminalPunctuation(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_terminal_punctuation(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_terminal_punctuation= _capi)>>('ICU4XCodePointSetData_load_terminal_punctuation') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `unified_ideograph`](https://docs.rs/icu/latest/icu/properties/sets/fn.unified_ideograph.html) for more information. +factory CodePointSetData.loadUnifiedIdeograph(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_unified_ideograph(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_unified_ideograph= _capi)>>('ICU4XCodePointSetData_load_unified_ideograph') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `uppercase`](https://docs.rs/icu/latest/icu/properties/sets/fn.uppercase.html) for more information. +factory CodePointSetData.loadUppercase(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_uppercase(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_uppercase= _capi)>>('ICU4XCodePointSetData_load_uppercase') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `variation_selector`](https://docs.rs/icu/latest/icu/properties/sets/fn.variation_selector.html) for more information. +factory CodePointSetData.loadVariationSelector(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_variation_selector(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_variation_selector= _capi)>>('ICU4XCodePointSetData_load_variation_selector') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `white_space`](https://docs.rs/icu/latest/icu/properties/sets/fn.white_space.html) for more information. +factory CodePointSetData.loadWhiteSpace(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_white_space(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_white_space= _capi)>>('ICU4XCodePointSetData_load_white_space') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `xdigit`](https://docs.rs/icu/latest/icu/properties/sets/fn.xdigit.html) for more information. +factory CodePointSetData.loadXdigit(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_xdigit(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_xdigit= _capi)>>('ICU4XCodePointSetData_load_xdigit') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `xid_continue`](https://docs.rs/icu/latest/icu/properties/sets/fn.xid_continue.html) for more information. +factory CodePointSetData.loadXidContinue(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_xid_continue(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_xid_continue= _capi)>>('ICU4XCodePointSetData_load_xid_continue') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `xid_start`](https://docs.rs/icu/latest/icu/properties/sets/fn.xid_start.html) for more information. +factory CodePointSetData.loadXidStart(DataProvider provider) { + + final result = _ICU4XCodePointSetData_load_xid_start(provider._underlying); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_xid_start= _capi)>>('ICU4XCodePointSetData_load_xid_start') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Loads data for a property specified as a string as long as it is one of the +/// [ECMA-262 binary properties][ecma] (not including Any, ASCII, and Assigned pseudoproperties). +/// +/// Returns `ICU4XError::PropertyUnexpectedPropertyNameError` in case the string does not +/// match any property in the list +/// +/// [ecma]: https://tc39.es/ecma262/#table-binary-unicode-properties +/// +/// See the [Rust documentation for `for_ecma262`](https://docs.rs/icu/latest/icu/properties/sets/fn.for_ecma262.html) for more information. +factory CodePointSetData.loadForEcma262(DataProvider provider, String propertyName) { + final alloc = ffi2.Arena(); + final propertyNameSlice = _SliceFfi2Utf8._fromDart(propertyName, alloc); + + final result = _ICU4XCodePointSetData_load_for_ecma262(provider._underlying,propertyNameSlice._bytes,propertyNameSlice._length);alloc.releaseAll(); + return result.isOk ? CodePointSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCodePointSetData_load_for_ecma262= _capi, ffi.Pointer, ffi.Size)>>('ICU4XCodePointSetData_load_for_ecma262') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + } + /// See the [Rust documentation for `Collator`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html) for more information. class Collator implements ffi.Finalizable { - final ffi.Pointer _underlying; - Collator._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCollator_destroy')); - - /// Construct a new Collator instance. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.try_new) for more information. - factory Collator.v1( - DataProvider provider, Locale locale, CollatorOptionsV1 options) { - final result = _ICU4XCollator_create_v1( - provider._underlying, locale._underlying, options._underlying); - return result.isOk - ? Collator._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCollator_create_v1 = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - _CollatorOptionsV1Ffi)>>('ICU4XCollator_create_v1') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, _CollatorOptionsV1Ffi)>(isLeaf: true); - - /// Compare guaranteed well-formed UTF-8 strings. - /// - /// Note: In C++, passing ill-formed UTF-8 strings is undefined behavior - /// (and may be memory-unsafe to do so, too). - /// - /// See the [Rust documentation for `compare`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.compare) for more information. - Ordering compare(String left, String right) { - final alloc = ffi2.Arena(); - final leftSlice = _SliceFfi2Utf8._fromDart(left, alloc); - final rightSlice = _SliceFfi2Utf8._fromDart(right, alloc); - - final result = _ICU4XCollator_compare_valid_utf8( - _underlying, - leftSlice._bytes, - leftSlice._length, - rightSlice._bytes, - rightSlice._length); - alloc.releaseAll(); - return Ordering.values.firstWhere((v) => v._underlying == result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCollator_compare_valid_utf8 = _capi< - ffi.NativeFunction< - ffi.Int32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer, - ffi.Size)>>('ICU4XCollator_compare_valid_utf8') - .asFunction< - int Function(ffi.Pointer, ffi.Pointer, int, - ffi.Pointer, int)>(isLeaf: true); - - /// Compare potentially ill-formed UTF-16 strings, with unpaired surrogates - /// compared as REPLACEMENT CHARACTER. - /// - /// See the [Rust documentation for `compare_utf16`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.compare_utf16) for more information. - Ordering compareUtf16(Uint16List left, Uint16List right) { - final alloc = ffi2.Arena(); - final leftSlice = _SliceFfiUint16._fromDart(left, alloc); - final rightSlice = _SliceFfiUint16._fromDart(right, alloc); - - final result = _ICU4XCollator_compare_utf16(_underlying, leftSlice._bytes, - leftSlice._length, rightSlice._bytes, rightSlice._length); - alloc.releaseAll(); - return Ordering.values.firstWhere((v) => v._underlying == result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCollator_compare_utf16 = _capi< - ffi.NativeFunction< - ffi.Int32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer, - ffi.Size)>>('ICU4XCollator_compare_utf16') - .asFunction< - int Function(ffi.Pointer, ffi.Pointer, int, - ffi.Pointer, int)>(isLeaf: true); -} + final ffi.Pointer _underlying; + + Collator._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCollator_destroy')); + + +/// Construct a new Collator instance. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.try_new) for more information. +factory Collator.v1(DataProvider provider, Locale locale, CollatorOptionsV1 options) { + + final result = _ICU4XCollator_create_v1(provider._underlying,locale._underlying,options._underlying); + return result.isOk ? Collator._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCollator_create_v1= _capi, ffi.Pointer, _CollatorOptionsV1Ffi)>>('ICU4XCollator_create_v1') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, _CollatorOptionsV1Ffi)>(isLeaf: true); + + + +/// Compare guaranteed well-formed UTF-8 strings. +/// +/// Note: In C++, passing ill-formed UTF-8 strings is undefined behavior +/// (and may be memory-unsafe to do so, too). +/// +/// See the [Rust documentation for `compare`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.compare) for more information. +Ordering compare(String left, String right) { + final alloc = ffi2.Arena(); + final leftSlice = _SliceFfi2Utf8._fromDart(left, alloc); + final rightSlice = _SliceFfi2Utf8._fromDart(right, alloc); + + final result = _ICU4XCollator_compare_valid_utf8(_underlying,leftSlice._bytes,leftSlice._length,rightSlice._bytes,rightSlice._length);alloc.releaseAll(); + return Ordering.values.firstWhere((v) => v._underlying == result); + } + // ignore: non_constant_identifier_names + static final _ICU4XCollator_compare_valid_utf8= _capi, ffi.Pointer, ffi.Size, ffi.Pointer, ffi.Size)>>('ICU4XCollator_compare_valid_utf8') + .asFunction, ffi.Pointer, int, ffi.Pointer, int)>(isLeaf: true); + + + +/// Compare potentially ill-formed UTF-16 strings, with unpaired surrogates +/// compared as REPLACEMENT CHARACTER. +/// +/// See the [Rust documentation for `compare_utf16`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.compare_utf16) for more information. +Ordering compareUtf16(Uint16List left, Uint16List right) { + final alloc = ffi2.Arena(); + final leftSlice = _SliceFfiUint16._fromDart(left, alloc); + final rightSlice = _SliceFfiUint16._fromDart(right, alloc); + + final result = _ICU4XCollator_compare_utf16(_underlying,leftSlice._bytes,leftSlice._length,rightSlice._bytes,rightSlice._length);alloc.releaseAll(); + return Ordering.values.firstWhere((v) => v._underlying == result); + } + // ignore: non_constant_identifier_names + static final _ICU4XCollator_compare_utf16= _capi, ffi.Pointer, ffi.Size, ffi.Pointer, ffi.Size)>>('ICU4XCollator_compare_utf16') + .asFunction, ffi.Pointer, int, ffi.Pointer, int)>(isLeaf: true); + + + +/// The resolved options showing how the default options, the requested options, +/// and the options from locale data were combined. None of the struct fields +/// will have `Auto` as the value. +/// +/// See the [Rust documentation for `resolved_options`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.resolved_options) for more information. +CollatorResolvedOptionsV1 get resolvedOptions { + + final result = _ICU4XCollator_resolved_options(_underlying); + return CollatorResolvedOptionsV1._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XCollator_resolved_options= _capi)>>('ICU4XCollator_resolved_options') + .asFunction<_CollatorResolvedOptionsV1Ffi Function(ffi.Pointer)>(isLeaf: true); + + + } + /// See the [Rust documentation for `AlternateHandling`](https://docs.rs/icu/latest/icu/collator/enum.AlternateHandling.html) for more information. enum CollatorAlternateHandling { @@ -3236,6 +2569,7 @@ enum CollatorAlternateHandling { shifted; } + /// See the [Rust documentation for `BackwardSecondLevel`](https://docs.rs/icu/latest/icu/collator/enum.BackwardSecondLevel.html) for more information. enum CollatorBackwardSecondLevel { auto, @@ -3243,6 +2577,7 @@ enum CollatorBackwardSecondLevel { on; } + /// See the [Rust documentation for `CaseFirst`](https://docs.rs/icu/latest/icu/collator/enum.CaseFirst.html) for more information. enum CollatorCaseFirst { auto, @@ -3251,6 +2586,7 @@ enum CollatorCaseFirst { upperFirst; } + /// See the [Rust documentation for `CaseLevel`](https://docs.rs/icu/latest/icu/collator/enum.CaseLevel.html) for more information. enum CollatorCaseLevel { auto, @@ -3258,6 +2594,7 @@ enum CollatorCaseLevel { on; } + /// See the [Rust documentation for `MaxVariable`](https://docs.rs/icu/latest/icu/collator/enum.MaxVariable.html) for more information. enum CollatorMaxVariable { auto, @@ -3267,6 +2604,7 @@ enum CollatorMaxVariable { currency; } + /// See the [Rust documentation for `Numeric`](https://docs.rs/icu/latest/icu/collator/enum.Numeric.html) for more information. enum CollatorNumeric { auto, @@ -3274,1373 +2612,1166 @@ enum CollatorNumeric { on; } -/// See the [Rust documentation for `CollatorOptions`](https://docs.rs/icu/latest/icu/collator/struct.CollatorOptions.html) for more information. -class _CollatorOptionsV1Ffi extends ffi.Struct { - @ffi.Int32() - external int strength; - @ffi.Int32() - external int alternateHandling; - @ffi.Int32() - external int caseFirst; - @ffi.Int32() - external int maxVariable; - @ffi.Int32() - external int caseLevel; - @ffi.Int32() - external int numeric; - @ffi.Int32() - external int backwardSecondLevel; -} -class CollatorOptionsV1 { - final _CollatorOptionsV1Ffi _underlying; +/// See the [Rust documentation for `CollatorOptions`](https://docs.rs/icu/latest/icu/collator/struct.CollatorOptions.html) for more information. +class _CollatorOptionsV1Ffi extends ffi.Struct { + @ffi.Int32() + external int strength; + @ffi.Int32() + external int alternateHandling; + @ffi.Int32() + external int caseFirst; + @ffi.Int32() + external int maxVariable; + @ffi.Int32() + external int caseLevel; + @ffi.Int32() + external int numeric; + @ffi.Int32() + external int backwardSecondLevel; +} + +class CollatorOptionsV1 { + final _CollatorOptionsV1Ffi _underlying; + + // ignore: unused_element + CollatorOptionsV1._(this._underlying); + + factory CollatorOptionsV1() { + final pointer = ffi2.calloc<_CollatorOptionsV1Ffi>(); + final result = CollatorOptionsV1._(pointer.ref); + _callocFree.attach(result, pointer.cast()); + return result; + } + + CollatorStrength get strength => CollatorStrength.values[_underlying.strength]; + set strength(CollatorStrength strength) { + _underlying.strength = strength.index; + } +CollatorAlternateHandling get alternateHandling => CollatorAlternateHandling.values[_underlying.alternateHandling]; + set alternateHandling(CollatorAlternateHandling alternateHandling) { + _underlying.alternateHandling = alternateHandling.index; + } +CollatorCaseFirst get caseFirst => CollatorCaseFirst.values[_underlying.caseFirst]; + set caseFirst(CollatorCaseFirst caseFirst) { + _underlying.caseFirst = caseFirst.index; + } +CollatorMaxVariable get maxVariable => CollatorMaxVariable.values[_underlying.maxVariable]; + set maxVariable(CollatorMaxVariable maxVariable) { + _underlying.maxVariable = maxVariable.index; + } +CollatorCaseLevel get caseLevel => CollatorCaseLevel.values[_underlying.caseLevel]; + set caseLevel(CollatorCaseLevel caseLevel) { + _underlying.caseLevel = caseLevel.index; + } +CollatorNumeric get numeric => CollatorNumeric.values[_underlying.numeric]; + set numeric(CollatorNumeric numeric) { + _underlying.numeric = numeric.index; + } +CollatorBackwardSecondLevel get backwardSecondLevel => CollatorBackwardSecondLevel.values[_underlying.backwardSecondLevel]; + set backwardSecondLevel(CollatorBackwardSecondLevel backwardSecondLevel) { + _underlying.backwardSecondLevel = backwardSecondLevel.index; + } + + + @override + bool operator ==(Object other) => + other is CollatorOptionsV1 + && other._underlying.strength == _underlying.strength + && other._underlying.alternateHandling == _underlying.alternateHandling + && other._underlying.caseFirst == _underlying.caseFirst + && other._underlying.maxVariable == _underlying.maxVariable + && other._underlying.caseLevel == _underlying.caseLevel + && other._underlying.numeric == _underlying.numeric + && other._underlying.backwardSecondLevel == _underlying.backwardSecondLevel; + + @override + int get hashCode => Object.hashAll([_underlying.strength,_underlying.alternateHandling,_underlying.caseFirst,_underlying.maxVariable,_underlying.caseLevel,_underlying.numeric,_underlying.backwardSecondLevel,]); +} + + +/// See the [Rust documentation for `ResolvedCollatorOptions`](https://docs.rs/icu/latest/icu/collator/struct.ResolvedCollatorOptions.html) for more information. +class _CollatorResolvedOptionsV1Ffi extends ffi.Struct { + @ffi.Int32() + external int strength; + @ffi.Int32() + external int alternateHandling; + @ffi.Int32() + external int caseFirst; + @ffi.Int32() + external int maxVariable; + @ffi.Int32() + external int caseLevel; + @ffi.Int32() + external int numeric; + @ffi.Int32() + external int backwardSecondLevel; +} + +class CollatorResolvedOptionsV1 { + final _CollatorResolvedOptionsV1Ffi _underlying; + + // ignore: unused_element + CollatorResolvedOptionsV1._(this._underlying); + + factory CollatorResolvedOptionsV1() { + final pointer = ffi2.calloc<_CollatorResolvedOptionsV1Ffi>(); + final result = CollatorResolvedOptionsV1._(pointer.ref); + _callocFree.attach(result, pointer.cast()); + return result; + } + + CollatorStrength get strength => CollatorStrength.values[_underlying.strength]; + set strength(CollatorStrength strength) { + _underlying.strength = strength.index; + } +CollatorAlternateHandling get alternateHandling => CollatorAlternateHandling.values[_underlying.alternateHandling]; + set alternateHandling(CollatorAlternateHandling alternateHandling) { + _underlying.alternateHandling = alternateHandling.index; + } +CollatorCaseFirst get caseFirst => CollatorCaseFirst.values[_underlying.caseFirst]; + set caseFirst(CollatorCaseFirst caseFirst) { + _underlying.caseFirst = caseFirst.index; + } +CollatorMaxVariable get maxVariable => CollatorMaxVariable.values[_underlying.maxVariable]; + set maxVariable(CollatorMaxVariable maxVariable) { + _underlying.maxVariable = maxVariable.index; + } +CollatorCaseLevel get caseLevel => CollatorCaseLevel.values[_underlying.caseLevel]; + set caseLevel(CollatorCaseLevel caseLevel) { + _underlying.caseLevel = caseLevel.index; + } +CollatorNumeric get numeric => CollatorNumeric.values[_underlying.numeric]; + set numeric(CollatorNumeric numeric) { + _underlying.numeric = numeric.index; + } +CollatorBackwardSecondLevel get backwardSecondLevel => CollatorBackwardSecondLevel.values[_underlying.backwardSecondLevel]; + set backwardSecondLevel(CollatorBackwardSecondLevel backwardSecondLevel) { + _underlying.backwardSecondLevel = backwardSecondLevel.index; + } + + + @override + bool operator ==(Object other) => + other is CollatorResolvedOptionsV1 + && other._underlying.strength == _underlying.strength + && other._underlying.alternateHandling == _underlying.alternateHandling + && other._underlying.caseFirst == _underlying.caseFirst + && other._underlying.maxVariable == _underlying.maxVariable + && other._underlying.caseLevel == _underlying.caseLevel + && other._underlying.numeric == _underlying.numeric + && other._underlying.backwardSecondLevel == _underlying.backwardSecondLevel; + + @override + int get hashCode => Object.hashAll([_underlying.strength,_underlying.alternateHandling,_underlying.caseFirst,_underlying.maxVariable,_underlying.caseLevel,_underlying.numeric,_underlying.backwardSecondLevel,]); +} + + +/// See the [Rust documentation for `Strength`](https://docs.rs/icu/latest/icu/collator/enum.Strength.html) for more information. +enum CollatorStrength { + auto, + primary, + secondary, + tertiary, + quaternary, + identical; +} + + +/// See the [Rust documentation for `ComposingNormalizer`](https://docs.rs/icu/latest/icu/normalizer/struct.ComposingNormalizer.html) for more information. +class ComposingNormalizer implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + ComposingNormalizer._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XComposingNormalizer_destroy')); + + +/// Construct a new ICU4XComposingNormalizer instance for NFC +/// +/// See the [Rust documentation for `new_nfc`](https://docs.rs/icu/latest/icu/normalizer/struct.ComposingNormalizer.html#method.new_nfc) for more information. +factory ComposingNormalizer.nfc(DataProvider provider) { + + final result = _ICU4XComposingNormalizer_create_nfc(provider._underlying); + return result.isOk ? ComposingNormalizer._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XComposingNormalizer_create_nfc= _capi)>>('ICU4XComposingNormalizer_create_nfc') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Construct a new ICU4XComposingNormalizer instance for NFKC +/// +/// See the [Rust documentation for `new_nfkc`](https://docs.rs/icu/latest/icu/normalizer/struct.ComposingNormalizer.html#method.new_nfkc) for more information. +factory ComposingNormalizer.nfkc(DataProvider provider) { + + final result = _ICU4XComposingNormalizer_create_nfkc(provider._underlying); + return result.isOk ? ComposingNormalizer._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XComposingNormalizer_create_nfkc= _capi)>>('ICU4XComposingNormalizer_create_nfkc') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Normalize a (potentially ill-formed) UTF8 string +/// +/// Errors are mapped to REPLACEMENT CHARACTER +/// +/// See the [Rust documentation for `normalize_utf8`](https://docs.rs/icu/latest/icu/normalizer/struct.ComposingNormalizer.html#method.normalize_utf8) for more information. +String normalize(String s) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final writeable = _Writeable(); + final result = _ICU4XComposingNormalizer_normalize(_underlying,sSlice._bytes,sSlice._length,writeable._underlying);alloc.releaseAll(); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XComposingNormalizer_normalize= _capi, ffi.Pointer, ffi.Size, ffi.Pointer)>>('ICU4XComposingNormalizer_normalize') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int, ffi.Pointer)>(isLeaf: true); + + + +/// Check if a (potentially ill-formed) UTF8 string is normalized +/// +/// Errors are mapped to REPLACEMENT CHARACTER +/// +/// See the [Rust documentation for `is_normalized_utf8`](https://docs.rs/icu/latest/icu/normalizer/struct.ComposingNormalizer.html#method.is_normalized_utf8) for more information. +bool isNormalized(String s) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final result = _ICU4XComposingNormalizer_is_normalized(_underlying,sSlice._bytes,sSlice._length);alloc.releaseAll(); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XComposingNormalizer_is_normalized= _capi, ffi.Pointer, ffi.Size)>>('ICU4XComposingNormalizer_is_normalized') + .asFunction, ffi.Pointer, int)>(isLeaf: true); + + + } + + +/// See the [Rust documentation for `CustomTimeZone`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html) for more information. +class CustomTimeZone implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + CustomTimeZone._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XCustomTimeZone_destroy')); + + +/// Creates a time zone from an offset string. +/// +/// See the [Rust documentation for `from_str`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.from_str) for more information. +factory CustomTimeZone.fromString(String s) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final result = _ICU4XCustomTimeZone_create_from_string(sSlice._bytes,sSlice._length);alloc.releaseAll(); + return result.isOk ? CustomTimeZone._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_create_from_string= _capi, ffi.Size)>>('ICU4XCustomTimeZone_create_from_string') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>(isLeaf: true); + + + +/// Creates a time zone with no information. +/// +/// See the [Rust documentation for `new_empty`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.new_empty) for more information. +factory CustomTimeZone.empty() { + + final result = _ICU4XCustomTimeZone_create_empty(); + return CustomTimeZone._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_create_empty= _capi Function()>>('ICU4XCustomTimeZone_create_empty') + .asFunction Function()>(isLeaf: true); + + + +/// Creates a time zone for UTC. +/// +/// See the [Rust documentation for `utc`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.utc) for more information. +factory CustomTimeZone.utc() { + + final result = _ICU4XCustomTimeZone_create_utc(); + return CustomTimeZone._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_create_utc= _capi Function()>>('ICU4XCustomTimeZone_create_utc') + .asFunction Function()>(isLeaf: true); + + + +/// Sets the `gmt_offset` field from offset seconds. +/// +/// Errors if the offset seconds are out of range. +/// +/// See the [Rust documentation for `try_from_offset_seconds`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.try_from_offset_seconds) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html) +void trySetGmtOffsetSeconds(int offsetSeconds) { + + final result = _ICU4XCustomTimeZone_try_set_gmt_offset_seconds(_underlying,offsetSeconds); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_try_set_gmt_offset_seconds= _capi, ffi.Int32)>>('ICU4XCustomTimeZone_try_set_gmt_offset_seconds') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, int)>(isLeaf: true); + + + +/// Clears the `gmt_offset` field. +/// +/// See the [Rust documentation for `offset_seconds`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.offset_seconds) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html) +void clearGmtOffset() { + + _ICU4XCustomTimeZone_clear_gmt_offset(_underlying); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_clear_gmt_offset= _capi)>>('ICU4XCustomTimeZone_clear_gmt_offset') + .asFunction)>(isLeaf: true); + + + +/// Returns the value of the `gmt_offset` field as offset seconds. +/// +/// Errors if the `gmt_offset` field is empty. +/// +/// See the [Rust documentation for `offset_seconds`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.offset_seconds) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html) +int get gmtOffsetSeconds { + + final result = _ICU4XCustomTimeZone_gmt_offset_seconds(_underlying); + return result.isOk ? result.union.ok : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_gmt_offset_seconds= _capi)>>('ICU4XCustomTimeZone_gmt_offset_seconds') + .asFunction<_ResultInt32Int32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Returns whether the `gmt_offset` field is positive. +/// +/// Errors if the `gmt_offset` field is empty. +/// +/// See the [Rust documentation for `is_positive`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.is_positive) for more information. +bool get isGmtOffsetPositive { + + final result = _ICU4XCustomTimeZone_is_gmt_offset_positive(_underlying); + return result.isOk ? result.union.ok : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_is_gmt_offset_positive= _capi)>>('ICU4XCustomTimeZone_is_gmt_offset_positive') + .asFunction<_ResultBoolInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Returns whether the `gmt_offset` field is zero. +/// +/// Errors if the `gmt_offset` field is empty (which is not the same as zero). +/// +/// See the [Rust documentation for `is_zero`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.is_zero) for more information. +bool get isGmtOffsetZero { + + final result = _ICU4XCustomTimeZone_is_gmt_offset_zero(_underlying); + return result.isOk ? result.union.ok : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_is_gmt_offset_zero= _capi)>>('ICU4XCustomTimeZone_is_gmt_offset_zero') + .asFunction<_ResultBoolInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Returns whether the `gmt_offset` field has nonzero minutes. +/// +/// Errors if the `gmt_offset` field is empty. +/// +/// See the [Rust documentation for `has_minutes`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.has_minutes) for more information. +bool gmtOffsetHasMinutes() { + + final result = _ICU4XCustomTimeZone_gmt_offset_has_minutes(_underlying); + return result.isOk ? result.union.ok : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_gmt_offset_has_minutes= _capi)>>('ICU4XCustomTimeZone_gmt_offset_has_minutes') + .asFunction<_ResultBoolInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Returns whether the `gmt_offset` field has nonzero seconds. +/// +/// Errors if the `gmt_offset` field is empty. +/// +/// See the [Rust documentation for `has_seconds`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.has_seconds) for more information. +bool gmtOffsetHasSeconds() { + + final result = _ICU4XCustomTimeZone_gmt_offset_has_seconds(_underlying); + return result.isOk ? result.union.ok : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_gmt_offset_has_seconds= _capi)>>('ICU4XCustomTimeZone_gmt_offset_has_seconds') + .asFunction<_ResultBoolInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Sets the `time_zone_id` field from a BCP-47 string. +/// +/// Errors if the string is not a valid BCP-47 time zone ID. +/// +/// See the [Rust documentation for `time_zone_id`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.time_zone_id) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.TimeZoneBcp47Id.html) +void trySetTimeZoneId(String id) { + final alloc = ffi2.Arena(); + final idSlice = _SliceFfi2Utf8._fromDart(id, alloc); + + final result = _ICU4XCustomTimeZone_try_set_time_zone_id(_underlying,idSlice._bytes,idSlice._length);alloc.releaseAll(); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_try_set_time_zone_id= _capi, ffi.Pointer, ffi.Size)>>('ICU4XCustomTimeZone_try_set_time_zone_id') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Sets the `time_zone_id` field from an IANA string by looking up +/// the corresponding BCP-47 string. +/// +/// Errors if the string is not a valid BCP-47 time zone ID. +/// +/// See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47MapperBorrowed.html#method.get) for more information. +void trySetIanaTimeZoneId(IanaToBcp47Mapper mapper, String id) { + final alloc = ffi2.Arena(); + final idSlice = _SliceFfi2Utf8._fromDart(id, alloc); + + final result = _ICU4XCustomTimeZone_try_set_iana_time_zone_id(_underlying,mapper._underlying,idSlice._bytes,idSlice._length);alloc.releaseAll(); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_try_set_iana_time_zone_id= _capi, ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XCustomTimeZone_try_set_iana_time_zone_id') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Clears the `time_zone_id` field. +/// +/// See the [Rust documentation for `time_zone_id`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.time_zone_id) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.TimeZoneBcp47Id.html) +void clearTimeZoneId() { + + _ICU4XCustomTimeZone_clear_time_zone_id(_underlying); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_clear_time_zone_id= _capi)>>('ICU4XCustomTimeZone_clear_time_zone_id') + .asFunction)>(isLeaf: true); + + + +/// Writes the value of the `time_zone_id` field as a string. +/// +/// Errors if the `time_zone_id` field is empty. +/// +/// See the [Rust documentation for `time_zone_id`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.time_zone_id) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.TimeZoneBcp47Id.html) +String get timeZoneId { + + final writeable = _Writeable(); + final result = _ICU4XCustomTimeZone_time_zone_id(_underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_time_zone_id= _capi, ffi.Pointer)>>('ICU4XCustomTimeZone_time_zone_id') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Sets the `metazone_id` field from a string. +/// +/// Errors if the string is not a valid BCP-47 metazone ID. +/// +/// See the [Rust documentation for `metazone_id`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.metazone_id) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.MetazoneId.html) +void trySetMetazoneId(String id) { + final alloc = ffi2.Arena(); + final idSlice = _SliceFfi2Utf8._fromDart(id, alloc); + + final result = _ICU4XCustomTimeZone_try_set_metazone_id(_underlying,idSlice._bytes,idSlice._length);alloc.releaseAll(); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_try_set_metazone_id= _capi, ffi.Pointer, ffi.Size)>>('ICU4XCustomTimeZone_try_set_metazone_id') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Clears the `metazone_id` field. +/// +/// See the [Rust documentation for `metazone_id`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.metazone_id) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.MetazoneId.html) +void clearMetazoneId() { + + _ICU4XCustomTimeZone_clear_metazone_id(_underlying); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_clear_metazone_id= _capi)>>('ICU4XCustomTimeZone_clear_metazone_id') + .asFunction)>(isLeaf: true); + + + +/// Writes the value of the `metazone_id` field as a string. +/// +/// Errors if the `metazone_id` field is empty. +/// +/// See the [Rust documentation for `metazone_id`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.metazone_id) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.MetazoneId.html) +String get metazoneId { + + final writeable = _Writeable(); + final result = _ICU4XCustomTimeZone_metazone_id(_underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_metazone_id= _capi, ffi.Pointer)>>('ICU4XCustomTimeZone_metazone_id') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Sets the `zone_variant` field from a string. +/// +/// Errors if the string is not a valid zone variant. +/// +/// See the [Rust documentation for `zone_variant`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html) +void trySetZoneVariant(String id) { + final alloc = ffi2.Arena(); + final idSlice = _SliceFfi2Utf8._fromDart(id, alloc); + + final result = _ICU4XCustomTimeZone_try_set_zone_variant(_underlying,idSlice._bytes,idSlice._length);alloc.releaseAll(); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_try_set_zone_variant= _capi, ffi.Pointer, ffi.Size)>>('ICU4XCustomTimeZone_try_set_zone_variant') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Clears the `zone_variant` field. +/// +/// See the [Rust documentation for `zone_variant`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html) +void clearZoneVariant() { + + _ICU4XCustomTimeZone_clear_zone_variant(_underlying); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_clear_zone_variant= _capi)>>('ICU4XCustomTimeZone_clear_zone_variant') + .asFunction)>(isLeaf: true); + + + +/// Writes the value of the `zone_variant` field as a string. +/// +/// Errors if the `zone_variant` field is empty. +/// +/// See the [Rust documentation for `zone_variant`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html) +String get zoneVariant { + + final writeable = _Writeable(); + final result = _ICU4XCustomTimeZone_zone_variant(_underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_zone_variant= _capi, ffi.Pointer)>>('ICU4XCustomTimeZone_zone_variant') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Sets the `zone_variant` field to standard time. +/// +/// See the [Rust documentation for `standard`](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html#method.standard) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) +void setStandardTime() { + + _ICU4XCustomTimeZone_set_standard_time(_underlying); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_set_standard_time= _capi)>>('ICU4XCustomTimeZone_set_standard_time') + .asFunction)>(isLeaf: true); + + + +/// Sets the `zone_variant` field to daylight time. +/// +/// See the [Rust documentation for `daylight`](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html#method.daylight) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) +void setDaylightTime() { + + _ICU4XCustomTimeZone_set_daylight_time(_underlying); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_set_daylight_time= _capi)>>('ICU4XCustomTimeZone_set_daylight_time') + .asFunction)>(isLeaf: true); + + + +/// Returns whether the `zone_variant` field is standard time. +/// +/// Errors if the `zone_variant` field is empty. +/// +/// See the [Rust documentation for `standard`](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html#method.standard) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) +bool get isStandardTime { + + final result = _ICU4XCustomTimeZone_is_standard_time(_underlying); + return result.isOk ? result.union.ok : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_is_standard_time= _capi)>>('ICU4XCustomTimeZone_is_standard_time') + .asFunction<_ResultBoolInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Returns whether the `zone_variant` field is daylight time. +/// +/// Errors if the `zone_variant` field is empty. +/// +/// See the [Rust documentation for `daylight`](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html#method.daylight) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) +bool get isDaylightTime { + + final result = _ICU4XCustomTimeZone_is_daylight_time(_underlying); + return result.isOk ? result.union.ok : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_is_daylight_time= _capi)>>('ICU4XCustomTimeZone_is_daylight_time') + .asFunction<_ResultBoolInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Sets the metazone based on the time zone and the local timestamp. +/// +/// See the [Rust documentation for `maybe_calculate_metazone`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.maybe_calculate_metazone) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.MetazoneCalculator.html#method.compute_metazone_from_time_zone) +void maybeCalculateMetazone(MetazoneCalculator metazoneCalculator, IsoDateTime localDatetime) { + + _ICU4XCustomTimeZone_maybe_calculate_metazone(_underlying,metazoneCalculator._underlying,localDatetime._underlying); + } + // ignore: non_constant_identifier_names + static final _ICU4XCustomTimeZone_maybe_calculate_metazone= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XCustomTimeZone_maybe_calculate_metazone') + .asFunction, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + } + + +/// An ICU4X data provider, capable of loading ICU4X data keys from some source. +/// +/// See the [Rust documentation for `icu_provider`](https://docs.rs/icu_provider/latest/icu_provider/index.html) for more information. +class DataProvider implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + DataProvider._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - // ignore: unused_element - CollatorOptionsV1._(this._underlying); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XDataProvider_destroy')); - factory CollatorOptionsV1() { - final pointer = ffi2.calloc<_CollatorOptionsV1Ffi>(); - final result = CollatorOptionsV1._(pointer.ref); - _callocFree.attach(result, pointer.cast()); - return result; + +/// Constructs an [`ICU4XDataProvider`] that uses compiled data. +/// +/// Requires the `compiled_data` feature. +/// +/// This provider cannot be modified or combined with other providers, so `enable_fallback`, +/// `enabled_fallback_with`, `fork_by_locale`, and `fork_by_key` will return `Err`s. +factory DataProvider.compiled() { + + final result = _ICU4XDataProvider_create_compiled(); + return DataProvider._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XDataProvider_create_compiled= _capi Function()>>('ICU4XDataProvider_create_compiled') + .asFunction Function()>(isLeaf: true); - CollatorStrength get strength => - CollatorStrength.values[_underlying.strength]; - set strength(CollatorStrength strength) { - _underlying.strength = strength.index; - } - CollatorAlternateHandling get alternateHandling => - CollatorAlternateHandling.values[_underlying.alternateHandling]; - set alternateHandling(CollatorAlternateHandling alternateHandling) { - _underlying.alternateHandling = alternateHandling.index; + +/// Constructs a `BlobDataProvider` and returns it as an [`ICU4XDataProvider`]. +/// +/// See the [Rust documentation for `BlobDataProvider`](https://docs.rs/icu_provider_blob/latest/icu_provider_blob/struct.BlobDataProvider.html) for more information. +factory DataProvider.fromByteSlice(Uint8List blob) { + final alloc = ffi2.Arena(); + final blobSlice = _SliceFfiUint8._fromDart(blob, alloc); + + final result = _ICU4XDataProvider_create_from_byte_slice(blobSlice._bytes,blobSlice._length);alloc.releaseAll(); + return result.isOk ? DataProvider._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XDataProvider_create_from_byte_slice= _capi, ffi.Size)>>('ICU4XDataProvider_create_from_byte_slice') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>(isLeaf: true); + - CollatorCaseFirst get caseFirst => - CollatorCaseFirst.values[_underlying.caseFirst]; - set caseFirst(CollatorCaseFirst caseFirst) { - _underlying.caseFirst = caseFirst.index; + +/// Constructs an empty [`ICU4XDataProvider`]. +/// +/// See the [Rust documentation for `EmptyDataProvider`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/empty/struct.EmptyDataProvider.html) for more information. +factory DataProvider.empty() { + + final result = _ICU4XDataProvider_create_empty(); + return DataProvider._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XDataProvider_create_empty= _capi Function()>>('ICU4XDataProvider_create_empty') + .asFunction Function()>(isLeaf: true); + - CollatorMaxVariable get maxVariable => - CollatorMaxVariable.values[_underlying.maxVariable]; - set maxVariable(CollatorMaxVariable maxVariable) { - _underlying.maxVariable = maxVariable.index; + +/// Creates a provider that tries the current provider and then, if the current provider +/// doesn't support the data key, another provider `other`. +/// +/// This takes ownership of the `other` provider, leaving an empty provider in its place. +/// +/// The providers must be the same type (Any or Buffer). This condition is satisfied if +/// both providers originate from the same constructor, such as `create_from_byte_slice` +/// or `create_fs`. If the condition is not upheld, a runtime error occurs. +/// +/// See the [Rust documentation for `ForkByKeyProvider`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fork/type.ForkByKeyProvider.html) for more information. +void forkByKey(DataProvider other) { + + final result = _ICU4XDataProvider_fork_by_key(_underlying,other._underlying); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } } + // ignore: non_constant_identifier_names + static final _ICU4XDataProvider_fork_by_key= _capi, ffi.Pointer)>>('ICU4XDataProvider_fork_by_key') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + - CollatorCaseLevel get caseLevel => - CollatorCaseLevel.values[_underlying.caseLevel]; - set caseLevel(CollatorCaseLevel caseLevel) { - _underlying.caseLevel = caseLevel.index; + +/// Same as `fork_by_key` but forks by locale instead of key. +/// +/// See the [Rust documentation for `MissingLocalePredicate`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fork/predicates/struct.MissingLocalePredicate.html) for more information. +void forkByLocale(DataProvider other) { + + final result = _ICU4XDataProvider_fork_by_locale(_underlying,other._underlying); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } } + // ignore: non_constant_identifier_names + static final _ICU4XDataProvider_fork_by_locale= _capi, ffi.Pointer)>>('ICU4XDataProvider_fork_by_locale') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + - CollatorNumeric get numeric => CollatorNumeric.values[_underlying.numeric]; - set numeric(CollatorNumeric numeric) { - _underlying.numeric = numeric.index; + +/// Enables locale fallbacking for data requests made to this provider. +/// +/// Note that the test provider (from `create_test`) already has fallbacking enabled. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html#method.try_new) for more information. +/// +/// Additional information: [1](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html) +void enableLocaleFallback() { + + final result = _ICU4XDataProvider_enable_locale_fallback(_underlying); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } } + // ignore: non_constant_identifier_names + static final _ICU4XDataProvider_enable_locale_fallback= _capi)>>('ICU4XDataProvider_enable_locale_fallback') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer)>(isLeaf: true); + - CollatorBackwardSecondLevel get backwardSecondLevel => - CollatorBackwardSecondLevel.values[_underlying.backwardSecondLevel]; - set backwardSecondLevel(CollatorBackwardSecondLevel backwardSecondLevel) { - _underlying.backwardSecondLevel = backwardSecondLevel.index; + +/// See the [Rust documentation for `new_with_fallbacker`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html#method.new_with_fallbacker) for more information. +/// +/// Additional information: [1](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html) +void enableLocaleFallbackWith(LocaleFallbacker fallbacker) { + + final result = _ICU4XDataProvider_enable_locale_fallback_with(_underlying,fallbacker._underlying); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } } + // ignore: non_constant_identifier_names + static final _ICU4XDataProvider_enable_locale_fallback_with= _capi, ffi.Pointer)>>('ICU4XDataProvider_enable_locale_fallback_with') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); - @override - bool operator ==(Object other) => - other is CollatorOptionsV1 && - other._underlying.strength == _underlying.strength && - other._underlying.alternateHandling == _underlying.alternateHandling && - other._underlying.caseFirst == _underlying.caseFirst && - other._underlying.maxVariable == _underlying.maxVariable && - other._underlying.caseLevel == _underlying.caseLevel && - other._underlying.numeric == _underlying.numeric && - other._underlying.backwardSecondLevel == _underlying.backwardSecondLevel; - @override - int get hashCode => Object.hashAll([ - _underlying.strength, - _underlying.alternateHandling, - _underlying.caseFirst, - _underlying.maxVariable, - _underlying.caseLevel, - _underlying.numeric, - _underlying.backwardSecondLevel, - ]); -} + } -/// See the [Rust documentation for `Strength`](https://docs.rs/icu/latest/icu/collator/enum.Strength.html) for more information. -enum CollatorStrength { - auto, - primary, - secondary, - tertiary, - quaternary, - identical; -} -/// See the [Rust documentation for `ComposingNormalizer`](https://docs.rs/icu/latest/icu/normalizer/struct.ComposingNormalizer.html) for more information. -class ComposingNormalizer implements ffi.Finalizable { - final ffi.Pointer _underlying; +/// An ICU4X Date object capable of containing a date and time for any calendar. +/// +/// See the [Rust documentation for `Date`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html) for more information. +class Date implements ffi.Finalizable { - ComposingNormalizer._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XComposingNormalizer_destroy')); + Date._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Construct a new ICU4XComposingNormalizer instance for NFC - /// - /// See the [Rust documentation for `new_nfc`](https://docs.rs/icu/latest/icu/normalizer/struct.ComposingNormalizer.html#method.new_nfc) for more information. - factory ComposingNormalizer.nfc(DataProvider provider) { - final result = _ICU4XComposingNormalizer_create_nfc(provider._underlying); - return result.isOk - ? ComposingNormalizer._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XDate_destroy')); + + +/// Creates a new [`ICU4XDate`] representing the ISO date and time +/// given but in a given calendar +/// +/// See the [Rust documentation for `new_from_iso`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.new_from_iso) for more information. +factory Date.fromIsoInCalendar(int year, int month, int day, Calendar calendar) { + + final result = _ICU4XDate_create_from_iso_in_calendar(year,month,day,calendar._underlying); + return result.isOk ? Date._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XComposingNormalizer_create_nfc = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XComposingNormalizer_create_nfc') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Construct a new ICU4XComposingNormalizer instance for NFKC - /// - /// See the [Rust documentation for `new_nfkc`](https://docs.rs/icu/latest/icu/normalizer/struct.ComposingNormalizer.html#method.new_nfkc) for more information. - factory ComposingNormalizer.nfkc(DataProvider provider) { - final result = _ICU4XComposingNormalizer_create_nfkc(provider._underlying); - return result.isOk - ? ComposingNormalizer._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XComposingNormalizer_create_nfkc = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XComposingNormalizer_create_nfkc') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Normalize a (potentially ill-formed) UTF8 string - /// - /// Errors are mapped to REPLACEMENT CHARACTER - /// - /// See the [Rust documentation for `normalize_utf8`](https://docs.rs/icu/latest/icu/normalizer/struct.ComposingNormalizer.html#method.normalize_utf8) for more information. - String normalize(String s) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final writeable = _Writeable(); - final result = _ICU4XComposingNormalizer_normalize( - _underlying, sSlice._bytes, sSlice._length, writeable._underlying); - alloc.releaseAll(); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XComposingNormalizer_normalize = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer)>>( - 'ICU4XComposingNormalizer_normalize') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(isLeaf: true); - - /// Check if a (potentially ill-formed) UTF8 string is normalized - /// - /// Errors are mapped to REPLACEMENT CHARACTER - /// - /// See the [Rust documentation for `is_normalized_utf8`](https://docs.rs/icu/latest/icu/normalizer/struct.ComposingNormalizer.html#method.is_normalized_utf8) for more information. - bool isNormalized(String s) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final result = _ICU4XComposingNormalizer_is_normalized( - _underlying, sSlice._bytes, sSlice._length); - alloc.releaseAll(); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XComposingNormalizer_is_normalized = _capi< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, ffi.Pointer, - ffi.Size)>>('ICU4XComposingNormalizer_is_normalized') - .asFunction< - bool Function(ffi.Pointer, ffi.Pointer, - int)>(isLeaf: true); -} + static final _ICU4XDate_create_from_iso_in_calendar= _capi)>>('ICU4XDate_create_from_iso_in_calendar') + .asFunction<_ResultOpaqueInt32 Function(int, int, int, ffi.Pointer)>(isLeaf: true); -/// See the [Rust documentation for `CustomTimeZone`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html) for more information. -class CustomTimeZone implements ffi.Finalizable { - final ffi.Pointer _underlying; - CustomTimeZone._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XCustomTimeZone_destroy')); - - /// Creates a time zone from an offset string. - /// - /// See the [Rust documentation for `from_str`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.from_str) for more information. - factory CustomTimeZone.fromString(String s) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final result = - _ICU4XCustomTimeZone_create_from_string(sSlice._bytes, sSlice._length); - alloc.releaseAll(); - return result.isOk - ? CustomTimeZone._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_create_from_string = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Size)>>('ICU4XCustomTimeZone_create_from_string') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>( - isLeaf: true); - - /// Creates a time zone with no information. - /// - /// See the [Rust documentation for `new_empty`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.new_empty) for more information. - factory CustomTimeZone.empty() { - final result = _ICU4XCustomTimeZone_create_empty(); - return CustomTimeZone._(result); - } - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_create_empty = - _capi Function()>>( - 'ICU4XCustomTimeZone_create_empty') - .asFunction Function()>(isLeaf: true); - - /// Creates a time zone for UTC. - /// - /// See the [Rust documentation for `utc`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.utc) for more information. - factory CustomTimeZone.utc() { - final result = _ICU4XCustomTimeZone_create_utc(); - return CustomTimeZone._(result); - } - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_create_utc = - _capi Function()>>( - 'ICU4XCustomTimeZone_create_utc') - .asFunction Function()>(isLeaf: true); - - /// Sets the `gmt_offset` field from offset seconds. - /// - /// Errors if the offset seconds are out of range. - /// - /// See the [Rust documentation for `try_from_offset_seconds`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.try_from_offset_seconds) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html) - void trySetGmtOffsetSeconds(int offsetSeconds) { - final result = _ICU4XCustomTimeZone_try_set_gmt_offset_seconds( - _underlying, offsetSeconds); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } + +/// Creates a new [`ICU4XDate`] from the given codes, which are interpreted in the given calendar system +/// +/// See the [Rust documentation for `try_new_from_codes`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.try_new_from_codes) for more information. +factory Date.fromCodesInCalendar(String eraCode, int year, String monthCode, int day, Calendar calendar) { + final alloc = ffi2.Arena(); + final eraCodeSlice = _SliceFfi2Utf8._fromDart(eraCode, alloc); + final monthCodeSlice = _SliceFfi2Utf8._fromDart(monthCode, alloc); + + final result = _ICU4XDate_create_from_codes_in_calendar(eraCodeSlice._bytes,eraCodeSlice._length,year,monthCodeSlice._bytes,monthCodeSlice._length,day,calendar._underlying);alloc.releaseAll(); + return result.isOk ? Date._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_try_set_gmt_offset_seconds = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Int32)>>('ICU4XCustomTimeZone_try_set_gmt_offset_seconds') - .asFunction<_ResultVoidInt32 Function(ffi.Pointer, int)>( - isLeaf: true); + static final _ICU4XDate_create_from_codes_in_calendar= _capi, ffi.Size, ffi.Int32, ffi.Pointer, ffi.Size, ffi.Uint8, ffi.Pointer)>>('ICU4XDate_create_from_codes_in_calendar') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int, int, ffi.Pointer, int, int, ffi.Pointer)>(isLeaf: true); - /// Clears the `gmt_offset` field. - /// - /// See the [Rust documentation for `offset_seconds`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.offset_seconds) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html) - void clearGmtOffset() { - _ICU4XCustomTimeZone_clear_gmt_offset(_underlying); - } + +/// Convert this date to one in a different calendar +/// +/// See the [Rust documentation for `to_calendar`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_calendar) for more information. +Date toCalendar(Calendar calendar) { + + final result = _ICU4XDate_to_calendar(_underlying,calendar._underlying); + return Date._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_clear_gmt_offset = - _capi)>>( - 'ICU4XCustomTimeZone_clear_gmt_offset') - .asFunction)>(isLeaf: true); + static final _ICU4XDate_to_calendar= _capi Function(ffi.Pointer, ffi.Pointer)>>('ICU4XDate_to_calendar') + .asFunction Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); - /// Returns the value of the `gmt_offset` field as offset seconds. - /// - /// Errors if the `gmt_offset` field is empty. - /// - /// See the [Rust documentation for `offset_seconds`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.offset_seconds) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html) - int get gmtOffsetSeconds { - final result = _ICU4XCustomTimeZone_gmt_offset_seconds(_underlying); - return result.isOk - ? result.union.ok - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_gmt_offset_seconds = _capi< - ffi.NativeFunction< - _ResultInt32Int32 Function(ffi.Pointer)>>( - 'ICU4XCustomTimeZone_gmt_offset_seconds') - .asFunction<_ResultInt32Int32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Returns whether the `gmt_offset` field is positive. - /// - /// Errors if the `gmt_offset` field is empty. - /// - /// See the [Rust documentation for `is_positive`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.is_positive) for more information. - bool get isGmtOffsetPositive { - final result = _ICU4XCustomTimeZone_is_gmt_offset_positive(_underlying); - return result.isOk - ? result.union.ok - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_is_gmt_offset_positive = _capi< - ffi.NativeFunction< - _ResultBoolInt32 Function(ffi.Pointer)>>( - 'ICU4XCustomTimeZone_is_gmt_offset_positive') - .asFunction<_ResultBoolInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Returns whether the `gmt_offset` field is zero. - /// - /// Errors if the `gmt_offset` field is empty (which is not the same as zero). - /// - /// See the [Rust documentation for `is_zero`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.is_zero) for more information. - bool get isGmtOffsetZero { - final result = _ICU4XCustomTimeZone_is_gmt_offset_zero(_underlying); - return result.isOk - ? result.union.ok - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_is_gmt_offset_zero = _capi< - ffi.NativeFunction< - _ResultBoolInt32 Function(ffi.Pointer)>>( - 'ICU4XCustomTimeZone_is_gmt_offset_zero') - .asFunction<_ResultBoolInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Returns whether the `gmt_offset` field has nonzero minutes. - /// - /// Errors if the `gmt_offset` field is empty. - /// - /// See the [Rust documentation for `has_minutes`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.has_minutes) for more information. - bool gmtOffsetHasMinutes() { - final result = _ICU4XCustomTimeZone_gmt_offset_has_minutes(_underlying); - return result.isOk - ? result.union.ok - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_gmt_offset_has_minutes = _capi< - ffi.NativeFunction< - _ResultBoolInt32 Function(ffi.Pointer)>>( - 'ICU4XCustomTimeZone_gmt_offset_has_minutes') - .asFunction<_ResultBoolInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Returns whether the `gmt_offset` field has nonzero seconds. - /// - /// Errors if the `gmt_offset` field is empty. - /// - /// See the [Rust documentation for `has_seconds`](https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.has_seconds) for more information. - bool gmtOffsetHasSeconds() { - final result = _ICU4XCustomTimeZone_gmt_offset_has_seconds(_underlying); - return result.isOk - ? result.union.ok - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_gmt_offset_has_seconds = _capi< - ffi.NativeFunction< - _ResultBoolInt32 Function(ffi.Pointer)>>( - 'ICU4XCustomTimeZone_gmt_offset_has_seconds') - .asFunction<_ResultBoolInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Sets the `time_zone_id` field from a BCP-47 string. - /// - /// Errors if the string is not a valid BCP-47 time zone ID. - /// - /// See the [Rust documentation for `time_zone_id`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.time_zone_id) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.TimeZoneBcp47Id.html) - void trySetTimeZoneId(String id) { - final alloc = ffi2.Arena(); - final idSlice = _SliceFfi2Utf8._fromDart(id, alloc); - - final result = _ICU4XCustomTimeZone_try_set_time_zone_id( - _underlying, idSlice._bytes, idSlice._length); - alloc.releaseAll(); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } + +/// Converts this date to ISO +/// +/// See the [Rust documentation for `to_iso`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_iso) for more information. +IsoDate toIso() { + + final result = _ICU4XDate_to_iso(_underlying); + return IsoDate._(result); } - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_try_set_time_zone_id = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XCustomTimeZone_try_set_time_zone_id') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Sets the `time_zone_id` field from an IANA string by looking up - /// the corresponding BCP-47 string. - /// - /// Errors if the string is not a valid BCP-47 time zone ID. - /// - /// See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47MapperBorrowed.html#method.get) for more information. - void trySetIanaTimeZoneId(IanaToBcp47Mapper mapper, String id) { - final alloc = ffi2.Arena(); - final idSlice = _SliceFfi2Utf8._fromDart(id, alloc); - - final result = _ICU4XCustomTimeZone_try_set_iana_time_zone_id( - _underlying, mapper._underlying, idSlice._bytes, idSlice._length); - alloc.releaseAll(); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } - } + static final _ICU4XDate_to_iso= _capi Function(ffi.Pointer)>>('ICU4XDate_to_iso') + .asFunction Function(ffi.Pointer)>(isLeaf: true); - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_try_set_iana_time_zone_id = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XCustomTimeZone_try_set_iana_time_zone_id') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - int)>(isLeaf: true); - /// Clears the `time_zone_id` field. - /// - /// See the [Rust documentation for `time_zone_id`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.time_zone_id) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.TimeZoneBcp47Id.html) - void clearTimeZoneId() { - _ICU4XCustomTimeZone_clear_time_zone_id(_underlying); + +/// Returns the 1-indexed day in the month for this date +/// +/// See the [Rust documentation for `day_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_month) for more information. +int get dayOfMonth { + + final result = _ICU4XDate_day_of_month(_underlying); + return result; } - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_clear_time_zone_id = - _capi)>>( - 'ICU4XCustomTimeZone_clear_time_zone_id') - .asFunction)>(isLeaf: true); - - /// Writes the value of the `time_zone_id` field as a string. - /// - /// Errors if the `time_zone_id` field is empty. - /// - /// See the [Rust documentation for `time_zone_id`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.time_zone_id) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.TimeZoneBcp47Id.html) - String get timeZoneId { - final writeable = _Writeable(); - final result = - _ICU4XCustomTimeZone_time_zone_id(_underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_time_zone_id = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XCustomTimeZone_time_zone_id') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Sets the `metazone_id` field from a string. - /// - /// Errors if the string is not a valid BCP-47 metazone ID. - /// - /// See the [Rust documentation for `metazone_id`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.metazone_id) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.MetazoneId.html) - void trySetMetazoneId(String id) { - final alloc = ffi2.Arena(); - final idSlice = _SliceFfi2Utf8._fromDart(id, alloc); - - final result = _ICU4XCustomTimeZone_try_set_metazone_id( - _underlying, idSlice._bytes, idSlice._length); - alloc.releaseAll(); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } - } + static final _ICU4XDate_day_of_month= _capi)>>('ICU4XDate_day_of_month') + .asFunction)>(isLeaf: true); - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_try_set_metazone_id = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XCustomTimeZone_try_set_metazone_id') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - /// Clears the `metazone_id` field. - /// - /// See the [Rust documentation for `metazone_id`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.metazone_id) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.MetazoneId.html) - void clearMetazoneId() { - _ICU4XCustomTimeZone_clear_metazone_id(_underlying); + +/// Returns the day in the week for this day +/// +/// See the [Rust documentation for `day_of_week`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_week) for more information. +IsoWeekday get dayOfWeek { + + final result = _ICU4XDate_day_of_week(_underlying); + return IsoWeekday.values.firstWhere((v) => v._underlying == result); } - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_clear_metazone_id = - _capi)>>( - 'ICU4XCustomTimeZone_clear_metazone_id') - .asFunction)>(isLeaf: true); + static final _ICU4XDate_day_of_week= _capi)>>('ICU4XDate_day_of_week') + .asFunction)>(isLeaf: true); - /// Writes the value of the `metazone_id` field as a string. - /// - /// Errors if the `metazone_id` field is empty. - /// - /// See the [Rust documentation for `metazone_id`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.metazone_id) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.MetazoneId.html) - String get metazoneId { - final writeable = _Writeable(); - final result = - _ICU4XCustomTimeZone_metazone_id(_underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_metazone_id = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XCustomTimeZone_metazone_id') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Sets the `zone_variant` field from a string. - /// - /// Errors if the string is not a valid zone variant. - /// - /// See the [Rust documentation for `zone_variant`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html) - void trySetZoneVariant(String id) { - final alloc = ffi2.Arena(); - final idSlice = _SliceFfi2Utf8._fromDart(id, alloc); - - final result = _ICU4XCustomTimeZone_try_set_zone_variant( - _underlying, idSlice._bytes, idSlice._length); - alloc.releaseAll(); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } - } + +/// Returns the week number in this month, 1-indexed, based on what +/// is considered the first day of the week (often a locale preference). +/// +/// `first_weekday` can be obtained via `first_weekday()` on [`ICU4XWeekCalculator`] +/// +/// See the [Rust documentation for `week_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_month) for more information. +int weekOfMonth(IsoWeekday firstWeekday) { + + final result = _ICU4XDate_week_of_month(_underlying,firstWeekday._underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_try_set_zone_variant = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XCustomTimeZone_try_set_zone_variant') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); + static final _ICU4XDate_week_of_month= _capi, ffi.Int32)>>('ICU4XDate_week_of_month') + .asFunction, int)>(isLeaf: true); - /// Clears the `zone_variant` field. - /// - /// See the [Rust documentation for `zone_variant`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html) - void clearZoneVariant() { - _ICU4XCustomTimeZone_clear_zone_variant(_underlying); - } + +/// Returns the week number in this year, using week data +/// +/// See the [Rust documentation for `week_of_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_year) for more information. +WeekOf weekOfYear(WeekCalculator calculator) { + + final result = _ICU4XDate_week_of_year(_underlying,calculator._underlying); + return result.isOk ? WeekOf._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_clear_zone_variant = - _capi)>>( - 'ICU4XCustomTimeZone_clear_zone_variant') - .asFunction)>(isLeaf: true); + static final _ICU4XDate_week_of_year= _capi, ffi.Pointer)>>('ICU4XDate_week_of_year') + .asFunction<_ResultWeekOfFfiInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); - /// Writes the value of the `zone_variant` field as a string. - /// - /// Errors if the `zone_variant` field is empty. - /// - /// See the [Rust documentation for `zone_variant`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html) - String get zoneVariant { - final writeable = _Writeable(); - final result = - _ICU4XCustomTimeZone_zone_variant(_underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_zone_variant = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XCustomTimeZone_zone_variant') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Sets the `zone_variant` field to standard time. - /// - /// See the [Rust documentation for `standard`](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html#method.standard) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) - void setStandardTime() { - _ICU4XCustomTimeZone_set_standard_time(_underlying); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_set_standard_time = - _capi)>>( - 'ICU4XCustomTimeZone_set_standard_time') - .asFunction)>(isLeaf: true); - /// Sets the `zone_variant` field to daylight time. - /// - /// See the [Rust documentation for `daylight`](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html#method.daylight) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) - void setDaylightTime() { - _ICU4XCustomTimeZone_set_daylight_time(_underlying); + +/// Returns 1-indexed number of the month of this date in its year +/// +/// Note that for lunar calendars this may not lead to the same month +/// having the same ordinal month across years; use month_code if you care +/// about month identity. +/// +/// See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. +int get ordinalMonth { + + final result = _ICU4XDate_ordinal_month(_underlying); + return result; } - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_set_daylight_time = - _capi)>>( - 'ICU4XCustomTimeZone_set_daylight_time') - .asFunction)>(isLeaf: true); + static final _ICU4XDate_ordinal_month= _capi)>>('ICU4XDate_ordinal_month') + .asFunction)>(isLeaf: true); - /// Returns whether the `zone_variant` field is standard time. - /// - /// Errors if the `zone_variant` field is empty. - /// - /// See the [Rust documentation for `standard`](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html#method.standard) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) - bool get isStandardTime { - final result = _ICU4XCustomTimeZone_is_standard_time(_underlying); - return result.isOk - ? result.union.ok - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } + +/// Returns the month code for this date. Typically something +/// like "M01", "M02", but can be more complicated for lunar calendars. +/// +/// See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. +String get monthCode { + + final writeable = _Writeable(); + final result = _ICU4XDate_month_code(_underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_is_standard_time = _capi< - ffi.NativeFunction< - _ResultBoolInt32 Function(ffi.Pointer)>>( - 'ICU4XCustomTimeZone_is_standard_time') - .asFunction<_ResultBoolInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Returns whether the `zone_variant` field is daylight time. - /// - /// Errors if the `zone_variant` field is empty. - /// - /// See the [Rust documentation for `daylight`](https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html#method.daylight) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant) - bool get isDaylightTime { - final result = _ICU4XCustomTimeZone_is_daylight_time(_underlying); - return result.isOk - ? result.union.ok - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_is_daylight_time = _capi< - ffi.NativeFunction< - _ResultBoolInt32 Function(ffi.Pointer)>>( - 'ICU4XCustomTimeZone_is_daylight_time') - .asFunction<_ResultBoolInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XDate_month_code= _capi, ffi.Pointer)>>('ICU4XDate_month_code') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); - /// Sets the metazone based on the time zone and the local timestamp. - /// - /// See the [Rust documentation for `maybe_calculate_metazone`](https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.maybe_calculate_metazone) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/timezone/struct.MetazoneCalculator.html#method.compute_metazone_from_time_zone) - void maybeCalculateMetazone( - MetazoneCalculator metazoneCalculator, IsoDateTime localDatetime) { - _ICU4XCustomTimeZone_maybe_calculate_metazone( - _underlying, metazoneCalculator._underlying, localDatetime._underlying); - } + +/// Returns the year number in the current era for this date +/// +/// See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) for more information. +int get yearInEra { + + final result = _ICU4XDate_year_in_era(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XCustomTimeZone_maybe_calculate_metazone = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XCustomTimeZone_maybe_calculate_metazone') - .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XDate_year_in_era= _capi)>>('ICU4XDate_year_in_era') + .asFunction)>(isLeaf: true); -/// An ICU4X data provider, capable of loading ICU4X data keys from some source. -/// -/// See the [Rust documentation for `icu_provider`](https://docs.rs/icu_provider/latest/icu_provider/index.html) for more information. -class DataProvider implements ffi.Finalizable { - final ffi.Pointer _underlying; - DataProvider._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XDataProvider_destroy')); - - /// Constructs an [`ICU4XDataProvider`] that uses compiled data. - /// - /// Requires the `compiled_data` feature. - /// - /// This provider cannot be modified or combined with other providers, so `enable_fallback`, - /// `enabled_fallback_with`, `fork_by_locale`, and `fork_by_key` will return `Err`s. - factory DataProvider.compiled() { - final result = _ICU4XDataProvider_create_compiled(); - return DataProvider._(result); - } - // ignore: non_constant_identifier_names - static final _ICU4XDataProvider_create_compiled = - _capi Function()>>( - 'ICU4XDataProvider_create_compiled') - .asFunction Function()>(isLeaf: true); - - /// Constructs a `BlobDataProvider` and returns it as an [`ICU4XDataProvider`]. - /// - /// See the [Rust documentation for `BlobDataProvider`](https://docs.rs/icu_provider_blob/latest/icu_provider_blob/struct.BlobDataProvider.html) for more information. - factory DataProvider.fromByteSlice(Uint8List blob) { - final alloc = ffi2.Arena(); - final blobSlice = _SliceFfiUint8._fromDart(blob, alloc); - - final result = _ICU4XDataProvider_create_from_byte_slice( - blobSlice._bytes, blobSlice._length); - alloc.releaseAll(); - return result.isOk - ? DataProvider._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XDataProvider_create_from_byte_slice = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Size)>>('ICU4XDataProvider_create_from_byte_slice') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>( - isLeaf: true); - - /// Constructs an empty [`ICU4XDataProvider`]. - /// - /// See the [Rust documentation for `EmptyDataProvider`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/empty/struct.EmptyDataProvider.html) for more information. - factory DataProvider.empty() { - final result = _ICU4XDataProvider_create_empty(); - return DataProvider._(result); - } - // ignore: non_constant_identifier_names - static final _ICU4XDataProvider_create_empty = - _capi Function()>>( - 'ICU4XDataProvider_create_empty') - .asFunction Function()>(isLeaf: true); - - /// Creates a provider that tries the current provider and then, if the current provider - /// doesn't support the data key, another provider `other`. - /// - /// This takes ownership of the `other` provider, leaving an empty provider in its place. - /// - /// The providers must be the same type (Any or Buffer). This condition is satisfied if - /// both providers originate from the same constructor, such as `create_from_byte_slice` - /// or `create_fs`. If the condition is not upheld, a runtime error occurs. - /// - /// See the [Rust documentation for `ForkByKeyProvider`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fork/type.ForkByKeyProvider.html) for more information. - void forkByKey(DataProvider other) { - final result = - _ICU4XDataProvider_fork_by_key(_underlying, other._underlying); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } + +/// Returns the era for this date, +/// +/// See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/struct.Date.html#method.year) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/types/struct.Era.html) +String get era { + + final writeable = _Writeable(); + final result = _ICU4XDate_era(_underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } - // ignore: non_constant_identifier_names - static final _ICU4XDataProvider_fork_by_key = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XDataProvider_fork_by_key') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); + static final _ICU4XDate_era= _capi, ffi.Pointer)>>('ICU4XDate_era') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); - /// Same as `fork_by_key` but forks by locale instead of key. - /// - /// See the [Rust documentation for `MissingLocalePredicate`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fork/predicates/struct.MissingLocalePredicate.html) for more information. - void forkByLocale(DataProvider other) { - final result = - _ICU4XDataProvider_fork_by_locale(_underlying, other._underlying); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } - } - // ignore: non_constant_identifier_names - static final _ICU4XDataProvider_fork_by_locale = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XDataProvider_fork_by_locale') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Enables locale fallbacking for data requests made to this provider. - /// - /// Note that the test provider (from `create_test`) already has fallbacking enabled. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html#method.try_new) for more information. - /// - /// Additional information: [1](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html) - void enableLocaleFallback() { - final result = _ICU4XDataProvider_enable_locale_fallback(_underlying); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } + +/// Returns the number of months in the year represented by this date +/// +/// See the [Rust documentation for `months_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.months_in_year) for more information. +int get monthsInYear { + + final result = _ICU4XDate_months_in_year(_underlying); + return result; } - // ignore: non_constant_identifier_names - static final _ICU4XDataProvider_enable_locale_fallback = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer)>>( - 'ICU4XDataProvider_enable_locale_fallback') - .asFunction<_ResultVoidInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `new_with_fallbacker`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html#method.new_with_fallbacker) for more information. - /// - /// Additional information: [1](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html) - void enableLocaleFallbackWith(LocaleFallbacker fallbacker) { - final result = _ICU4XDataProvider_enable_locale_fallback_with( - _underlying, fallbacker._underlying); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } - } + static final _ICU4XDate_months_in_year= _capi)>>('ICU4XDate_months_in_year') + .asFunction)>(isLeaf: true); + + +/// Returns the number of days in the month represented by this date +/// +/// See the [Rust documentation for `days_in_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_month) for more information. +int get daysInMonth { + + final result = _ICU4XDate_days_in_month(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XDataProvider_enable_locale_fallback_with = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XDataProvider_enable_locale_fallback_with') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XDate_days_in_month= _capi)>>('ICU4XDate_days_in_month') + .asFunction)>(isLeaf: true); -/// An ICU4X Date object capable of containing a date and time for any calendar. -/// -/// See the [Rust documentation for `Date`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html) for more information. -class Date implements ffi.Finalizable { - final ffi.Pointer _underlying; - Date._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + +/// Returns the number of days in the year represented by this date +/// +/// See the [Rust documentation for `days_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_year) for more information. +int get daysInYear { + + final result = _ICU4XDate_days_in_year(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XDate_days_in_year= _capi)>>('ICU4XDate_days_in_year') + .asFunction)>(isLeaf: true); - static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XDate_destroy')); - /// Creates a new [`ICU4XDate`] representing the ISO date and time - /// given but in a given calendar - /// - /// See the [Rust documentation for `new_from_iso`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.new_from_iso) for more information. - factory Date.fromIsoInCalendar( - int year, int month, int day, Calendar calendar) { - final result = _ICU4XDate_create_from_iso_in_calendar( - year, month, day, calendar._underlying); - return result.isOk - ? Date._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Returns the [`ICU4XCalendar`] object backing this date +/// +/// See the [Rust documentation for `calendar`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.calendar) for more information. +Calendar get calendar { + + final result = _ICU4XDate_calendar(_underlying); + return Calendar._(result); } // ignore: non_constant_identifier_names - static final _ICU4XDate_create_from_iso_in_calendar = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Int32, ffi.Uint8, ffi.Uint8, - ffi.Pointer)>>( - 'ICU4XDate_create_from_iso_in_calendar') - .asFunction< - _ResultOpaqueInt32 Function( - int, int, int, ffi.Pointer)>(isLeaf: true); - - /// Creates a new [`ICU4XDate`] from the given codes, which are interpreted in the given calendar system - /// - /// See the [Rust documentation for `try_new_from_codes`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.try_new_from_codes) for more information. - factory Date.fromCodesInCalendar( - String eraCode, int year, String monthCode, int day, Calendar calendar) { - final alloc = ffi2.Arena(); - final eraCodeSlice = _SliceFfi2Utf8._fromDart(eraCode, alloc); - final monthCodeSlice = _SliceFfi2Utf8._fromDart(monthCode, alloc); - - final result = _ICU4XDate_create_from_codes_in_calendar( - eraCodeSlice._bytes, - eraCodeSlice._length, - year, - monthCodeSlice._bytes, - monthCodeSlice._length, - day, - calendar._underlying); - alloc.releaseAll(); - return result.isOk - ? Date._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XDate_create_from_codes_in_calendar = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Size, - ffi.Int32, - ffi.Pointer, - ffi.Size, - ffi.Uint8, - ffi.Pointer)>>( - 'ICU4XDate_create_from_codes_in_calendar') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - int, - int, - ffi.Pointer, - int, - int, - ffi.Pointer)>(isLeaf: true); - - /// Convert this date to one in a different calendar - /// - /// See the [Rust documentation for `to_calendar`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_calendar) for more information. - Date toCalendar(Calendar calendar) { - final result = _ICU4XDate_to_calendar(_underlying, calendar._underlying); - return Date._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDate_to_calendar = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XDate_to_calendar') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Converts this date to ISO - /// - /// See the [Rust documentation for `to_iso`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_iso) for more information. - IsoDate toIso() { - final result = _ICU4XDate_to_iso(_underlying); - return IsoDate._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDate_to_iso = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XDate_to_iso') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); - - /// Returns the 1-indexed day in the month for this date - /// - /// See the [Rust documentation for `day_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_month) for more information. - int get dayOfMonth { - final result = _ICU4XDate_day_of_month(_underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XDate_day_of_month = - _capi)>>( - 'ICU4XDate_day_of_month') - .asFunction)>(isLeaf: true); + static final _ICU4XDate_calendar= _capi Function(ffi.Pointer)>>('ICU4XDate_calendar') + .asFunction Function(ffi.Pointer)>(isLeaf: true); - /// Returns the day in the week for this day - /// - /// See the [Rust documentation for `day_of_week`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_week) for more information. - IsoWeekday get dayOfWeek { - final result = _ICU4XDate_day_of_week(_underlying); - return IsoWeekday.values.firstWhere((v) => v._underlying == result); - } - // ignore: non_constant_identifier_names - static final _ICU4XDate_day_of_week = - _capi)>>( - 'ICU4XDate_day_of_week') - .asFunction)>(isLeaf: true); + } - /// Returns the week number in this month, 1-indexed, based on what - /// is considered the first day of the week (often a locale preference). - /// - /// `first_weekday` can be obtained via `first_weekday()` on [`ICU4XWeekCalculator`] - /// - /// See the [Rust documentation for `week_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_month) for more information. - int weekOfMonth(IsoWeekday firstWeekday) { - final result = - _ICU4XDate_week_of_month(_underlying, firstWeekday._underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XDate_week_of_month = _capi< - ffi.NativeFunction< - ffi.Uint32 Function(ffi.Pointer, - ffi.Int32)>>('ICU4XDate_week_of_month') - .asFunction, int)>(isLeaf: true); - - /// Returns the week number in this year, using week data - /// - /// See the [Rust documentation for `week_of_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_year) for more information. - WeekOf weekOfYear(WeekCalculator calculator) { - final result = _ICU4XDate_week_of_year(_underlying, calculator._underlying); - return result.isOk - ? WeekOf._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDate_week_of_year = _capi< - ffi.NativeFunction< - _ResultWeekOfFfiInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XDate_week_of_year') - .asFunction< - _ResultWeekOfFfiInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Returns 1-indexed number of the month of this date in its year - /// - /// Note that for lunar calendars this may not lead to the same month - /// having the same ordinal month across years; use month_code if you care - /// about month identity. - /// - /// See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. - int get ordinalMonth { - final result = _ICU4XDate_ordinal_month(_underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XDate_ordinal_month = - _capi)>>( - 'ICU4XDate_ordinal_month') - .asFunction)>(isLeaf: true); - /// Returns the month code for this date. Typically something - /// like "M01", "M02", but can be more complicated for lunar calendars. - /// - /// See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. - String get monthCode { - final writeable = _Writeable(); - final result = _ICU4XDate_month_code(_underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } +/// An ICU4X DateFormatter object capable of formatting a [`ICU4XDate`] as a string, +/// using some calendar specified at runtime in the locale. +/// +/// See the [Rust documentation for `DateFormatter`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html) for more information. +class DateFormatter implements ffi.Finalizable { - // ignore: non_constant_identifier_names - static final _ICU4XDate_month_code = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XDate_month_code') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); + final ffi.Pointer _underlying; - /// Returns the year number in the current era for this date - /// - /// See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) for more information. - int get yearInEra { - final result = _ICU4XDate_year_in_era(_underlying); - return result; - } + DateFormatter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XDateFormatter_destroy')); + +/// Creates a new [`ICU4XDateFormatter`] from locale data. +/// +/// See the [Rust documentation for `try_new_with_length`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.try_new_with_length) for more information. +factory DateFormatter.withLength(DataProvider provider, Locale locale, DateLength dateLength) { + + final result = _ICU4XDateFormatter_create_with_length(provider._underlying,locale._underlying,dateLength.index); + return result.isOk ? DateFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XDate_year_in_era = - _capi)>>( - 'ICU4XDate_year_in_era') - .asFunction)>(isLeaf: true); + static final _ICU4XDateFormatter_create_with_length= _capi, ffi.Pointer, ffi.Int32)>>('ICU4XDateFormatter_create_with_length') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); - /// Returns the era for this date, - /// - /// See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/struct.Date.html#method.year) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/types/struct.Era.html) - String get era { - final writeable = _Writeable(); - final result = _ICU4XDate_era(_underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDate_era = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XDate_era') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Returns the number of months in the year represented by this date - /// - /// See the [Rust documentation for `months_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.months_in_year) for more information. - int get monthsInYear { - final result = _ICU4XDate_months_in_year(_underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XDate_months_in_year = - _capi)>>( - 'ICU4XDate_months_in_year') - .asFunction)>(isLeaf: true); - /// Returns the number of days in the month represented by this date - /// - /// See the [Rust documentation for `days_in_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_month) for more information. - int get daysInMonth { - final result = _ICU4XDate_days_in_month(_underlying); - return result; + +/// Formats a [`ICU4XDate`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information. +String formatDate(Date value) { + + final writeable = _Writeable(); + final result = _ICU4XDateFormatter_format_date(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } - // ignore: non_constant_identifier_names - static final _ICU4XDate_days_in_month = - _capi)>>( - 'ICU4XDate_days_in_month') - .asFunction)>(isLeaf: true); + static final _ICU4XDateFormatter_format_date= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XDateFormatter_format_date') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); - /// Returns the number of days in the year represented by this date - /// - /// See the [Rust documentation for `days_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_year) for more information. - int get daysInYear { - final result = _ICU4XDate_days_in_year(_underlying); - return result; - } + +/// Formats a [`ICU4XIsoDate`] to a string. +/// +/// Will convert to this formatter's calendar first +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information. +String formatIsoDate(IsoDate value) { + + final writeable = _Writeable(); + final result = _ICU4XDateFormatter_format_iso_date(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XDate_days_in_year = - _capi)>>( - 'ICU4XDate_days_in_year') - .asFunction)>(isLeaf: true); + static final _ICU4XDateFormatter_format_iso_date= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XDateFormatter_format_iso_date') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); - /// Returns the [`ICU4XCalendar`] object backing this date - /// - /// See the [Rust documentation for `calendar`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.calendar) for more information. - Calendar get calendar { - final result = _ICU4XDate_calendar(_underlying); - return Calendar._(result); + + +/// Formats a [`ICU4XDateTime`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information. +String formatDatetime(DateTime value) { + + final writeable = _Writeable(); + final result = _ICU4XDateFormatter_format_datetime(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XDateFormatter_format_datetime= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XDateFormatter_format_datetime') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + +/// Formats a [`ICU4XIsoDateTime`] to a string. +/// +/// Will convert to this formatter's calendar first +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information. +String formatIsoDatetime(IsoDateTime value) { + + final writeable = _Writeable(); + final result = _ICU4XDateFormatter_format_iso_datetime(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XDate_calendar = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XDate_calendar') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); -} + static final _ICU4XDateFormatter_format_iso_datetime= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XDateFormatter_format_iso_datetime') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); -/// An ICU4X DateFormatter object capable of formatting a [`ICU4XDate`] as a string, -/// using some calendar specified at runtime in the locale. -/// -/// See the [Rust documentation for `DateFormatter`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html) for more information. -class DateFormatter implements ffi.Finalizable { - final ffi.Pointer _underlying; - DateFormatter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XDateFormatter_destroy')); - - /// Creates a new [`ICU4XDateFormatter`] from locale data. - /// - /// See the [Rust documentation for `try_new_with_length`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.try_new_with_length) for more information. - factory DateFormatter.withLength( - DataProvider provider, Locale locale, DateLength dateLength) { - final result = _ICU4XDateFormatter_create_with_length( - provider._underlying, locale._underlying, dateLength.index); - return result.isOk - ? DateFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XDateFormatter_create_with_length = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int32)>>('ICU4XDateFormatter_create_with_length') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Formats a [`ICU4XDate`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information. - String formatDate(Date value) { - final writeable = _Writeable(); - final result = _ICU4XDateFormatter_format_date( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateFormatter_format_date = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('ICU4XDateFormatter_format_date') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Formats a [`ICU4XIsoDate`] to a string. - /// - /// Will convert to this formatter's calendar first - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information. - String formatIsoDate(IsoDate value) { - final writeable = _Writeable(); - final result = _ICU4XDateFormatter_format_iso_date( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateFormatter_format_iso_date = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XDateFormatter_format_iso_date') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Formats a [`ICU4XDateTime`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information. - String formatDatetime(DateTime value) { - final writeable = _Writeable(); - final result = _ICU4XDateFormatter_format_datetime( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateFormatter_format_datetime = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XDateFormatter_format_datetime') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Formats a [`ICU4XIsoDateTime`] to a string. - /// - /// Will convert to this formatter's calendar first - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information. - String formatIsoDatetime(IsoDateTime value) { - final writeable = _Writeable(); - final result = _ICU4XDateFormatter_format_iso_datetime( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateFormatter_format_iso_datetime = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XDateFormatter_format_iso_datetime') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + } + /// See the [Rust documentation for `Date`](https://docs.rs/icu/latest/icu/datetime/options/length/enum.Date.html) for more information. enum DateLength { @@ -4650,701 +3781,546 @@ enum DateLength { short; } + /// An ICU4X DateTime object capable of containing a date and time for any calendar. -/// +/// /// See the [Rust documentation for `DateTime`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html) for more information. class DateTime implements ffi.Finalizable { - final ffi.Pointer _underlying; - DateTime._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + final ffi.Pointer _underlying; + + DateTime._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XDateTime_destroy')); + + +/// Creates a new [`ICU4XDateTime`] representing the ISO date and time +/// given but in a given calendar +/// +/// See the [Rust documentation for `new_from_iso`](https://docs.rs/icu/latest/icu/struct.DateTime.html#method.new_from_iso) for more information. +factory DateTime.fromIsoInCalendar(int year, int month, int day, int hour, int minute, int second, int nanosecond, Calendar calendar) { + + final result = _ICU4XDateTime_create_from_iso_in_calendar(year,month,day,hour,minute,second,nanosecond,calendar._underlying); + return result.isOk ? DateTime._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XDateTime_create_from_iso_in_calendar= _capi)>>('ICU4XDateTime_create_from_iso_in_calendar') + .asFunction<_ResultOpaqueInt32 Function(int, int, int, int, int, int, int, ffi.Pointer)>(isLeaf: true); - static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XDateTime_destroy')); - /// Creates a new [`ICU4XDateTime`] representing the ISO date and time - /// given but in a given calendar - /// - /// See the [Rust documentation for `new_from_iso`](https://docs.rs/icu/latest/icu/struct.DateTime.html#method.new_from_iso) for more information. - factory DateTime.fromIsoInCalendar(int year, int month, int day, int hour, - int minute, int second, int nanosecond, Calendar calendar) { - final result = _ICU4XDateTime_create_from_iso_in_calendar(year, month, day, - hour, minute, second, nanosecond, calendar._underlying); - return result.isOk - ? DateTime._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Creates a new [`ICU4XDateTime`] from the given codes, which are interpreted in the given calendar system +/// +/// See the [Rust documentation for `try_new_from_codes`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.try_new_from_codes) for more information. +factory DateTime.fromCodesInCalendar(String eraCode, int year, String monthCode, int day, int hour, int minute, int second, int nanosecond, Calendar calendar) { + final alloc = ffi2.Arena(); + final eraCodeSlice = _SliceFfi2Utf8._fromDart(eraCode, alloc); + final monthCodeSlice = _SliceFfi2Utf8._fromDart(monthCode, alloc); + + final result = _ICU4XDateTime_create_from_codes_in_calendar(eraCodeSlice._bytes,eraCodeSlice._length,year,monthCodeSlice._bytes,monthCodeSlice._length,day,hour,minute,second,nanosecond,calendar._underlying);alloc.releaseAll(); + return result.isOk ? DateTime._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XDateTime_create_from_iso_in_calendar = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Int32, - ffi.Uint8, - ffi.Uint8, - ffi.Uint8, - ffi.Uint8, - ffi.Uint8, - ffi.Uint32, - ffi.Pointer)>>( - 'ICU4XDateTime_create_from_iso_in_calendar') - .asFunction< - _ResultOpaqueInt32 Function(int, int, int, int, int, int, int, - ffi.Pointer)>(isLeaf: true); - - /// Creates a new [`ICU4XDateTime`] from the given codes, which are interpreted in the given calendar system - /// - /// See the [Rust documentation for `try_new_from_codes`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.try_new_from_codes) for more information. - factory DateTime.fromCodesInCalendar( - String eraCode, - int year, - String monthCode, - int day, - int hour, - int minute, - int second, - int nanosecond, - Calendar calendar) { - final alloc = ffi2.Arena(); - final eraCodeSlice = _SliceFfi2Utf8._fromDart(eraCode, alloc); - final monthCodeSlice = _SliceFfi2Utf8._fromDart(monthCode, alloc); - - final result = _ICU4XDateTime_create_from_codes_in_calendar( - eraCodeSlice._bytes, - eraCodeSlice._length, - year, - monthCodeSlice._bytes, - monthCodeSlice._length, - day, - hour, - minute, - second, - nanosecond, - calendar._underlying); - alloc.releaseAll(); - return result.isOk - ? DateTime._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XDateTime_create_from_codes_in_calendar = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Size, - ffi.Int32, - ffi.Pointer, - ffi.Size, - ffi.Uint8, - ffi.Uint8, - ffi.Uint8, - ffi.Uint8, - ffi.Uint32, - ffi.Pointer)>>( - 'ICU4XDateTime_create_from_codes_in_calendar') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - int, - int, - ffi.Pointer, - int, - int, - int, - int, - int, - int, - ffi.Pointer)>(isLeaf: true); - - /// Creates a new [`ICU4XDateTime`] from an [`ICU4XDate`] and [`ICU4XTime`] object - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.new) for more information. - factory DateTime.fromDateAndTime(Date date, Time time) { - final result = _ICU4XDateTime_create_from_date_and_time( - date._underlying, time._underlying); - return DateTime._(result); - } - // ignore: non_constant_identifier_names - static final _ICU4XDateTime_create_from_date_and_time = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XDateTime_create_from_date_and_time') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Gets a copy of the date contained in this object - /// - /// See the [Rust documentation for `date`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#structfield.date) for more information. - Date get date { - final result = _ICU4XDateTime_date(_underlying); - return Date._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateTime_date = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XDateTime_date') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); - - /// Gets the time contained in this object - /// - /// See the [Rust documentation for `time`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#structfield.time) for more information. - Time get time { - final result = _ICU4XDateTime_time(_underlying); - return Time._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateTime_time = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XDateTime_time') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); - - /// Converts this date to ISO - /// - /// See the [Rust documentation for `to_iso`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.to_iso) for more information. - IsoDateTime toIso() { - final result = _ICU4XDateTime_to_iso(_underlying); - return IsoDateTime._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateTime_to_iso = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XDateTime_to_iso') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); - - /// Convert this datetime to one in a different calendar - /// - /// See the [Rust documentation for `to_calendar`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.to_calendar) for more information. - DateTime toCalendar(Calendar calendar) { - final result = - _ICU4XDateTime_to_calendar(_underlying, calendar._underlying); - return DateTime._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateTime_to_calendar = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XDateTime_to_calendar') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Returns the hour in this time - /// - /// See the [Rust documentation for `hour`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.hour) for more information. - int get hour { - final result = _ICU4XDateTime_hour(_underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateTime_hour = - _capi)>>( - 'ICU4XDateTime_hour') - .asFunction)>(isLeaf: true); + static final _ICU4XDateTime_create_from_codes_in_calendar= _capi, ffi.Size, ffi.Int32, ffi.Pointer, ffi.Size, ffi.Uint8, ffi.Uint8, ffi.Uint8, ffi.Uint8, ffi.Uint32, ffi.Pointer)>>('ICU4XDateTime_create_from_codes_in_calendar') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int, int, ffi.Pointer, int, int, int, int, int, int, ffi.Pointer)>(isLeaf: true); + - /// Returns the minute in this time - /// - /// See the [Rust documentation for `minute`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.minute) for more information. - int get minute { - final result = _ICU4XDateTime_minute(_underlying); - return result; + +/// Creates a new [`ICU4XDateTime`] from an [`ICU4XDate`] and [`ICU4XTime`] object +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.new) for more information. +factory DateTime.fromDateAndTime(Date date, Time time) { + + final result = _ICU4XDateTime_create_from_date_and_time(date._underlying,time._underlying); + return DateTime._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XDateTime_create_from_date_and_time= _capi Function(ffi.Pointer, ffi.Pointer)>>('ICU4XDateTime_create_from_date_and_time') + .asFunction Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + +/// Gets a copy of the date contained in this object +/// +/// See the [Rust documentation for `date`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#structfield.date) for more information. +Date get date { + + final result = _ICU4XDateTime_date(_underlying); + return Date._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XDateTime_minute = - _capi)>>( - 'ICU4XDateTime_minute') - .asFunction)>(isLeaf: true); + static final _ICU4XDateTime_date= _capi Function(ffi.Pointer)>>('ICU4XDateTime_date') + .asFunction Function(ffi.Pointer)>(isLeaf: true); - /// Returns the second in this time - /// - /// See the [Rust documentation for `second`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.second) for more information. - int get second { - final result = _ICU4XDateTime_second(_underlying); - return result; + + +/// Gets the time contained in this object +/// +/// See the [Rust documentation for `time`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#structfield.time) for more information. +Time get time { + + final result = _ICU4XDateTime_time(_underlying); + return Time._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XDateTime_time= _capi Function(ffi.Pointer)>>('ICU4XDateTime_time') + .asFunction Function(ffi.Pointer)>(isLeaf: true); + + +/// Converts this date to ISO +/// +/// See the [Rust documentation for `to_iso`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.to_iso) for more information. +IsoDateTime toIso() { + + final result = _ICU4XDateTime_to_iso(_underlying); + return IsoDateTime._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XDateTime_second = - _capi)>>( - 'ICU4XDateTime_second') - .asFunction)>(isLeaf: true); + static final _ICU4XDateTime_to_iso= _capi Function(ffi.Pointer)>>('ICU4XDateTime_to_iso') + .asFunction Function(ffi.Pointer)>(isLeaf: true); + - /// Returns the nanosecond in this time - /// - /// See the [Rust documentation for `nanosecond`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.nanosecond) for more information. - int get nanosecond { - final result = _ICU4XDateTime_nanosecond(_underlying); - return result; + +/// Convert this datetime to one in a different calendar +/// +/// See the [Rust documentation for `to_calendar`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.to_calendar) for more information. +DateTime toCalendar(Calendar calendar) { + + final result = _ICU4XDateTime_to_calendar(_underlying,calendar._underlying); + return DateTime._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XDateTime_to_calendar= _capi Function(ffi.Pointer, ffi.Pointer)>>('ICU4XDateTime_to_calendar') + .asFunction Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + +/// Returns the hour in this time +/// +/// See the [Rust documentation for `hour`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.hour) for more information. +int get hour { + + final result = _ICU4XDateTime_hour(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XDateTime_nanosecond = - _capi)>>( - 'ICU4XDateTime_nanosecond') - .asFunction)>(isLeaf: true); + static final _ICU4XDateTime_hour= _capi)>>('ICU4XDateTime_hour') + .asFunction)>(isLeaf: true); - /// Returns the 1-indexed day in the month for this date - /// - /// See the [Rust documentation for `day_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_month) for more information. - int get dayOfMonth { - final result = _ICU4XDateTime_day_of_month(_underlying); - return result; + + +/// Returns the minute in this time +/// +/// See the [Rust documentation for `minute`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.minute) for more information. +int get minute { + + final result = _ICU4XDateTime_minute(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XDateTime_minute= _capi)>>('ICU4XDateTime_minute') + .asFunction)>(isLeaf: true); + + +/// Returns the second in this time +/// +/// See the [Rust documentation for `second`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.second) for more information. +int get second { + + final result = _ICU4XDateTime_second(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XDateTime_day_of_month = - _capi)>>( - 'ICU4XDateTime_day_of_month') - .asFunction)>(isLeaf: true); + static final _ICU4XDateTime_second= _capi)>>('ICU4XDateTime_second') + .asFunction)>(isLeaf: true); + - /// Returns the day in the week for this day - /// - /// See the [Rust documentation for `day_of_week`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_week) for more information. - IsoWeekday get dayOfWeek { - final result = _ICU4XDateTime_day_of_week(_underlying); - return IsoWeekday.values.firstWhere((v) => v._underlying == result); + +/// Returns the nanosecond in this time +/// +/// See the [Rust documentation for `nanosecond`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.nanosecond) for more information. +int get nanosecond { + + final result = _ICU4XDateTime_nanosecond(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XDateTime_nanosecond= _capi)>>('ICU4XDateTime_nanosecond') + .asFunction)>(isLeaf: true); + + +/// Returns the 1-indexed day in the month for this date +/// +/// See the [Rust documentation for `day_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_month) for more information. +int get dayOfMonth { + + final result = _ICU4XDateTime_day_of_month(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XDateTime_day_of_week = - _capi)>>( - 'ICU4XDateTime_day_of_week') - .asFunction)>(isLeaf: true); + static final _ICU4XDateTime_day_of_month= _capi)>>('ICU4XDateTime_day_of_month') + .asFunction)>(isLeaf: true); - /// Returns the week number in this month, 1-indexed, based on what - /// is considered the first day of the week (often a locale preference). - /// - /// `first_weekday` can be obtained via `first_weekday()` on [`ICU4XWeekCalculator`] - /// - /// See the [Rust documentation for `week_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_month) for more information. - int weekOfMonth(IsoWeekday firstWeekday) { - final result = - _ICU4XDateTime_week_of_month(_underlying, firstWeekday._underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateTime_week_of_month = _capi< - ffi.NativeFunction< - ffi.Uint32 Function(ffi.Pointer, - ffi.Int32)>>('ICU4XDateTime_week_of_month') - .asFunction, int)>(isLeaf: true); - - /// Returns the week number in this year, using week data - /// - /// See the [Rust documentation for `week_of_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_year) for more information. - WeekOf weekOfYear(WeekCalculator calculator) { - final result = - _ICU4XDateTime_week_of_year(_underlying, calculator._underlying); - return result.isOk - ? WeekOf._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateTime_week_of_year = _capi< - ffi.NativeFunction< - _ResultWeekOfFfiInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XDateTime_week_of_year') - .asFunction< - _ResultWeekOfFfiInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Returns 1-indexed number of the month of this date in its year - /// - /// Note that for lunar calendars this may not lead to the same month - /// having the same ordinal month across years; use month_code if you care - /// about month identity. - /// - /// See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. - int get ordinalMonth { - final result = _ICU4XDateTime_ordinal_month(_underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateTime_ordinal_month = - _capi)>>( - 'ICU4XDateTime_ordinal_month') - .asFunction)>(isLeaf: true); - /// Returns the month code for this date. Typically something - /// like "M01", "M02", but can be more complicated for lunar calendars. - /// - /// See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. - String get monthCode { - final writeable = _Writeable(); - final result = - _ICU4XDateTime_month_code(_underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateTime_month_code = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XDateTime_month_code') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Returns the year number in the current era for this date - /// - /// See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) for more information. - int get yearInEra { - final result = _ICU4XDateTime_year_in_era(_underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateTime_year_in_era = - _capi)>>( - 'ICU4XDateTime_year_in_era') - .asFunction)>(isLeaf: true); + +/// Returns the day in the week for this day +/// +/// See the [Rust documentation for `day_of_week`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_week) for more information. +IsoWeekday get dayOfWeek { + + final result = _ICU4XDateTime_day_of_week(_underlying); + return IsoWeekday.values.firstWhere((v) => v._underlying == result); + } + // ignore: non_constant_identifier_names + static final _ICU4XDateTime_day_of_week= _capi)>>('ICU4XDateTime_day_of_week') + .asFunction)>(isLeaf: true); - /// Returns the era for this date, - /// - /// See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) for more information. - String get era { - final writeable = _Writeable(); - final result = _ICU4XDateTime_era(_underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + + +/// Returns the week number in this month, 1-indexed, based on what +/// is considered the first day of the week (often a locale preference). +/// +/// `first_weekday` can be obtained via `first_weekday()` on [`ICU4XWeekCalculator`] +/// +/// See the [Rust documentation for `week_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_month) for more information. +int weekOfMonth(IsoWeekday firstWeekday) { + + final result = _ICU4XDateTime_week_of_month(_underlying,firstWeekday._underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XDateTime_week_of_month= _capi, ffi.Int32)>>('ICU4XDateTime_week_of_month') + .asFunction, int)>(isLeaf: true); + + +/// Returns the week number in this year, using week data +/// +/// See the [Rust documentation for `week_of_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_year) for more information. +WeekOf weekOfYear(WeekCalculator calculator) { + + final result = _ICU4XDateTime_week_of_year(_underlying,calculator._underlying); + return result.isOk ? WeekOf._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XDateTime_era = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XDateTime_era') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); + static final _ICU4XDateTime_week_of_year= _capi, ffi.Pointer)>>('ICU4XDateTime_week_of_year') + .asFunction<_ResultWeekOfFfiInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); - /// Returns the number of months in the year represented by this date - /// - /// See the [Rust documentation for `months_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.months_in_year) for more information. - int get monthsInYear { - final result = _ICU4XDateTime_months_in_year(_underlying); - return result; + + +/// Returns 1-indexed number of the month of this date in its year +/// +/// Note that for lunar calendars this may not lead to the same month +/// having the same ordinal month across years; use month_code if you care +/// about month identity. +/// +/// See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. +int get ordinalMonth { + + final result = _ICU4XDateTime_ordinal_month(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XDateTime_ordinal_month= _capi)>>('ICU4XDateTime_ordinal_month') + .asFunction)>(isLeaf: true); + + +/// Returns the month code for this date. Typically something +/// like "M01", "M02", but can be more complicated for lunar calendars. +/// +/// See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. +String get monthCode { + + final writeable = _Writeable(); + final result = _ICU4XDateTime_month_code(_underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XDateTime_months_in_year = - _capi)>>( - 'ICU4XDateTime_months_in_year') - .asFunction)>(isLeaf: true); + static final _ICU4XDateTime_month_code= _capi, ffi.Pointer)>>('ICU4XDateTime_month_code') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + - /// Returns the number of days in the month represented by this date - /// - /// See the [Rust documentation for `days_in_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_month) for more information. - int get daysInMonth { - final result = _ICU4XDateTime_days_in_month(_underlying); - return result; + +/// Returns the year number in the current era for this date +/// +/// See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) for more information. +int get yearInEra { + + final result = _ICU4XDateTime_year_in_era(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XDateTime_year_in_era= _capi)>>('ICU4XDateTime_year_in_era') + .asFunction)>(isLeaf: true); + + +/// Returns the era for this date, +/// +/// See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) for more information. +String get era { + + final writeable = _Writeable(); + final result = _ICU4XDateTime_era(_underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XDateTime_days_in_month = - _capi)>>( - 'ICU4XDateTime_days_in_month') - .asFunction)>(isLeaf: true); + static final _ICU4XDateTime_era= _capi, ffi.Pointer)>>('ICU4XDateTime_era') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); - /// Returns the number of days in the year represented by this date - /// - /// See the [Rust documentation for `days_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_year) for more information. - int get daysInYear { - final result = _ICU4XDateTime_days_in_year(_underlying); - return result; + + +/// Returns the number of months in the year represented by this date +/// +/// See the [Rust documentation for `months_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.months_in_year) for more information. +int get monthsInYear { + + final result = _ICU4XDateTime_months_in_year(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XDateTime_months_in_year= _capi)>>('ICU4XDateTime_months_in_year') + .asFunction)>(isLeaf: true); + + +/// Returns the number of days in the month represented by this date +/// +/// See the [Rust documentation for `days_in_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_month) for more information. +int get daysInMonth { + + final result = _ICU4XDateTime_days_in_month(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XDateTime_days_in_year = - _capi)>>( - 'ICU4XDateTime_days_in_year') - .asFunction)>(isLeaf: true); + static final _ICU4XDateTime_days_in_month= _capi)>>('ICU4XDateTime_days_in_month') + .asFunction)>(isLeaf: true); + - /// Returns the [`ICU4XCalendar`] object backing this date - /// - /// See the [Rust documentation for `calendar`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.calendar) for more information. - Calendar get calendar { - final result = _ICU4XDateTime_calendar(_underlying); - return Calendar._(result); + +/// Returns the number of days in the year represented by this date +/// +/// See the [Rust documentation for `days_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_year) for more information. +int get daysInYear { + + final result = _ICU4XDateTime_days_in_year(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XDateTime_days_in_year= _capi)>>('ICU4XDateTime_days_in_year') + .asFunction)>(isLeaf: true); + + +/// Returns the [`ICU4XCalendar`] object backing this date +/// +/// See the [Rust documentation for `calendar`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.calendar) for more information. +Calendar get calendar { + + final result = _ICU4XDateTime_calendar(_underlying); + return Calendar._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XDateTime_calendar = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XDateTime_calendar') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); -} + static final _ICU4XDateTime_calendar= _capi Function(ffi.Pointer)>>('ICU4XDateTime_calendar') + .asFunction Function(ffi.Pointer)>(isLeaf: true); + + + } + /// An ICU4X DateFormatter object capable of formatting a [`ICU4XDateTime`] as a string, /// using some calendar specified at runtime in the locale. -/// +/// /// See the [Rust documentation for `DateTimeFormatter`](https://docs.rs/icu/latest/icu/datetime/struct.DateTimeFormatter.html) for more information. class DateTimeFormatter implements ffi.Finalizable { - final ffi.Pointer _underlying; - DateTimeFormatter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XDateTimeFormatter_destroy')); - - /// Creates a new [`ICU4XDateTimeFormatter`] from locale data. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/struct.DateTimeFormatter.html#method.try_new) for more information. - factory DateTimeFormatter.withLengths(DataProvider provider, Locale locale, - DateLength dateLength, TimeLength timeLength) { - final result = _ICU4XDateTimeFormatter_create_with_lengths( - provider._underlying, - locale._underlying, - dateLength.index, - timeLength.index); - return result.isOk - ? DateTimeFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XDateTimeFormatter_create_with_lengths = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int32, - ffi.Int32)>>('ICU4XDateTimeFormatter_create_with_lengths') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, int, int)>(isLeaf: true); - - /// Formats a [`ICU4XDateTime`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateTimeFormatter.html#method.format) for more information. - String formatDatetime(DateTime value) { - final writeable = _Writeable(); - final result = _ICU4XDateTimeFormatter_format_datetime( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateTimeFormatter_format_datetime = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XDateTimeFormatter_format_datetime') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Formats a [`ICU4XIsoDateTime`] to a string. - /// - /// Will convert to this formatter's calendar first - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateTimeFormatter.html#method.format) for more information. - String formatIsoDatetime(IsoDateTime value) { - final writeable = _Writeable(); - final result = _ICU4XDateTimeFormatter_format_iso_datetime( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDateTimeFormatter_format_iso_datetime = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XDateTimeFormatter_format_iso_datetime') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + final ffi.Pointer _underlying; + + DateTimeFormatter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XDateTimeFormatter_destroy')); + + +/// Creates a new [`ICU4XDateTimeFormatter`] from locale data. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/struct.DateTimeFormatter.html#method.try_new) for more information. +factory DateTimeFormatter.withLengths(DataProvider provider, Locale locale, DateLength dateLength, TimeLength timeLength) { + + final result = _ICU4XDateTimeFormatter_create_with_lengths(provider._underlying,locale._underlying,dateLength.index,timeLength.index); + return result.isOk ? DateTimeFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XDateTimeFormatter_create_with_lengths= _capi, ffi.Pointer, ffi.Int32, ffi.Int32)>>('ICU4XDateTimeFormatter_create_with_lengths') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int, int)>(isLeaf: true); + + + +/// Formats a [`ICU4XDateTime`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateTimeFormatter.html#method.format) for more information. +String formatDatetime(DateTime value) { + + final writeable = _Writeable(); + final result = _ICU4XDateTimeFormatter_format_datetime(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XDateTimeFormatter_format_datetime= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XDateTimeFormatter_format_datetime') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Formats a [`ICU4XIsoDateTime`] to a string. +/// +/// Will convert to this formatter's calendar first +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateTimeFormatter.html#method.format) for more information. +String formatIsoDatetime(IsoDateTime value) { + + final writeable = _Writeable(); + final result = _ICU4XDateTimeFormatter_format_iso_datetime(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XDateTimeFormatter_format_iso_datetime= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XDateTimeFormatter_format_iso_datetime') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + } + /// The outcome of non-recursive canonical decomposition of a character. /// `second` will be NUL when the decomposition expands to a single character /// (which may or may not be the original one) -/// +/// /// See the [Rust documentation for `Decomposed`](https://docs.rs/icu/latest/icu/normalizer/properties/enum.Decomposed.html) for more information. class _DecomposedFfi extends ffi.Struct { - @ffi.Uint32() - external int first; - @ffi.Uint32() - external int second; + @ffi.Uint32() + external int first; + @ffi.Uint32() + external int second; } class Decomposed { - final _DecomposedFfi _underlying; + final _DecomposedFfi _underlying; - // ignore: unused_element - Decomposed._(this._underlying); + // ignore: unused_element + Decomposed._(this._underlying); - factory Decomposed() { - final pointer = ffi2.calloc<_DecomposedFfi>(); - final result = Decomposed._(pointer.ref); - _callocFree.attach(result, pointer.cast()); - return result; - } + factory Decomposed() { + final pointer = ffi2.calloc<_DecomposedFfi>(); + final result = Decomposed._(pointer.ref); + _callocFree.attach(result, pointer.cast()); + return result; + } + + int get first => _underlying.first; + set first(int first) { + _underlying.first = first; + } +int get second => _underlying.second; + set second(int second) { + _underlying.second = second; + } + + + @override + bool operator ==(Object other) => + other is Decomposed + && other._underlying.first == _underlying.first + && other._underlying.second == _underlying.second; + + @override + int get hashCode => Object.hashAll([_underlying.first,_underlying.second,]); +} + + +/// See the [Rust documentation for `DecomposingNormalizer`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html) for more information. +class DecomposingNormalizer implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + DecomposingNormalizer._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - int get first => _underlying.first; - set first(int first) { - _underlying.first = first; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XDecomposingNormalizer_destroy')); - int get second => _underlying.second; - set second(int second) { - _underlying.second = second; + +/// Construct a new ICU4XDecomposingNormalizer instance for NFC +/// +/// See the [Rust documentation for `new_nfd`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html#method.new_nfd) for more information. +factory DecomposingNormalizer.nfd(DataProvider provider) { + + final result = _ICU4XDecomposingNormalizer_create_nfd(provider._underlying); + return result.isOk ? DecomposingNormalizer._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XDecomposingNormalizer_create_nfd= _capi)>>('ICU4XDecomposingNormalizer_create_nfd') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - @override - bool operator ==(Object other) => - other is Decomposed && - other._underlying.first == _underlying.first && - other._underlying.second == _underlying.second; - @override - int get hashCode => Object.hashAll([ - _underlying.first, - _underlying.second, - ]); -} + +/// Construct a new ICU4XDecomposingNormalizer instance for NFKC +/// +/// See the [Rust documentation for `new_nfkd`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html#method.new_nfkd) for more information. +factory DecomposingNormalizer.nfkd(DataProvider provider) { + + final result = _ICU4XDecomposingNormalizer_create_nfkd(provider._underlying); + return result.isOk ? DecomposingNormalizer._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XDecomposingNormalizer_create_nfkd= _capi)>>('ICU4XDecomposingNormalizer_create_nfkd') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); -/// See the [Rust documentation for `DecomposingNormalizer`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html) for more information. -class DecomposingNormalizer implements ffi.Finalizable { - final ffi.Pointer _underlying; - DecomposingNormalizer._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + +/// Normalize a (potentially ill-formed) UTF8 string +/// +/// Errors are mapped to REPLACEMENT CHARACTER +/// +/// See the [Rust documentation for `normalize_utf8`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html#method.normalize_utf8) for more information. +String normalize(String s) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final writeable = _Writeable(); + final result = _ICU4XDecomposingNormalizer_normalize(_underlying,sSlice._bytes,sSlice._length,writeable._underlying);alloc.releaseAll(); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XDecomposingNormalizer_normalize= _capi, ffi.Pointer, ffi.Size, ffi.Pointer)>>('ICU4XDecomposingNormalizer_normalize') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int, ffi.Pointer)>(isLeaf: true); - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XDecomposingNormalizer_destroy')); - /// Construct a new ICU4XDecomposingNormalizer instance for NFC - /// - /// See the [Rust documentation for `new_nfd`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html#method.new_nfd) for more information. - factory DecomposingNormalizer.nfd(DataProvider provider) { - final result = _ICU4XDecomposingNormalizer_create_nfd(provider._underlying); - return result.isOk - ? DecomposingNormalizer._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Check if a (potentially ill-formed) UTF8 string is normalized +/// +/// Errors are mapped to REPLACEMENT CHARACTER +/// +/// See the [Rust documentation for `is_normalized_utf8`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html#method.is_normalized_utf8) for more information. +bool isNormalized(String s) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final result = _ICU4XDecomposingNormalizer_is_normalized(_underlying,sSlice._bytes,sSlice._length);alloc.releaseAll(); + return result; } // ignore: non_constant_identifier_names - static final _ICU4XDecomposingNormalizer_create_nfd = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XDecomposingNormalizer_create_nfd') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Construct a new ICU4XDecomposingNormalizer instance for NFKC - /// - /// See the [Rust documentation for `new_nfkd`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html#method.new_nfkd) for more information. - factory DecomposingNormalizer.nfkd(DataProvider provider) { - final result = - _ICU4XDecomposingNormalizer_create_nfkd(provider._underlying); - return result.isOk - ? DecomposingNormalizer._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XDecomposingNormalizer_create_nfkd = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XDecomposingNormalizer_create_nfkd') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Normalize a (potentially ill-formed) UTF8 string - /// - /// Errors are mapped to REPLACEMENT CHARACTER - /// - /// See the [Rust documentation for `normalize_utf8`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html#method.normalize_utf8) for more information. - String normalize(String s) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final writeable = _Writeable(); - final result = _ICU4XDecomposingNormalizer_normalize( - _underlying, sSlice._bytes, sSlice._length, writeable._underlying); - alloc.releaseAll(); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XDecomposingNormalizer_normalize = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer)>>( - 'ICU4XDecomposingNormalizer_normalize') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(isLeaf: true); - - /// Check if a (potentially ill-formed) UTF8 string is normalized - /// - /// Errors are mapped to REPLACEMENT CHARACTER - /// - /// See the [Rust documentation for `is_normalized_utf8`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html#method.is_normalized_utf8) for more information. - bool isNormalized(String s) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final result = _ICU4XDecomposingNormalizer_is_normalized( - _underlying, sSlice._bytes, sSlice._length); - alloc.releaseAll(); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XDecomposingNormalizer_is_normalized = _capi< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, ffi.Pointer, - ffi.Size)>>('ICU4XDecomposingNormalizer_is_normalized') - .asFunction< - bool Function(ffi.Pointer, ffi.Pointer, - int)>(isLeaf: true); -} + static final _ICU4XDecomposingNormalizer_is_normalized= _capi, ffi.Pointer, ffi.Size)>>('ICU4XDecomposingNormalizer_is_normalized') + .asFunction, ffi.Pointer, int)>(isLeaf: true); + + + } + /// See the [Rust documentation for `Fallback`](https://docs.rs/icu/latest/icu/displaynames/options/enum.Fallback.html) for more information. enum DisplayNamesFallback { @@ -5352,61 +4328,56 @@ enum DisplayNamesFallback { none; } + /// See the [Rust documentation for `DisplayNamesOptions`](https://docs.rs/icu/latest/icu/displaynames/options/struct.DisplayNamesOptions.html) for more information. class _DisplayNamesOptionsV1Ffi extends ffi.Struct { - @ffi.Int32() - external int style; - @ffi.Int32() - external int fallback; - @ffi.Int32() - external int languageDisplay; + @ffi.Int32() + external int style; + @ffi.Int32() + external int fallback; + @ffi.Int32() + external int languageDisplay; } class DisplayNamesOptionsV1 { - final _DisplayNamesOptionsV1Ffi _underlying; - - // ignore: unused_element - DisplayNamesOptionsV1._(this._underlying); + final _DisplayNamesOptionsV1Ffi _underlying; - factory DisplayNamesOptionsV1() { - final pointer = ffi2.calloc<_DisplayNamesOptionsV1Ffi>(); - final result = DisplayNamesOptionsV1._(pointer.ref); - _callocFree.attach(result, pointer.cast()); - return result; - } + // ignore: unused_element + DisplayNamesOptionsV1._(this._underlying); - DisplayNamesStyle get style => DisplayNamesStyle.values[_underlying.style]; - set style(DisplayNamesStyle style) { - _underlying.style = style.index; - } + factory DisplayNamesOptionsV1() { + final pointer = ffi2.calloc<_DisplayNamesOptionsV1Ffi>(); + final result = DisplayNamesOptionsV1._(pointer.ref); + _callocFree.attach(result, pointer.cast()); + return result; + } - DisplayNamesFallback get fallback => - DisplayNamesFallback.values[_underlying.fallback]; - set fallback(DisplayNamesFallback fallback) { - _underlying.fallback = fallback.index; - } + DisplayNamesStyle get style => DisplayNamesStyle.values[_underlying.style]; + set style(DisplayNamesStyle style) { + _underlying.style = style.index; + } +DisplayNamesFallback get fallback => DisplayNamesFallback.values[_underlying.fallback]; + set fallback(DisplayNamesFallback fallback) { + _underlying.fallback = fallback.index; + } +LanguageDisplay get languageDisplay => LanguageDisplay.values[_underlying.languageDisplay]; + set languageDisplay(LanguageDisplay languageDisplay) { + _underlying.languageDisplay = languageDisplay.index; + } - LanguageDisplay get languageDisplay => - LanguageDisplay.values[_underlying.languageDisplay]; - set languageDisplay(LanguageDisplay languageDisplay) { - _underlying.languageDisplay = languageDisplay.index; - } - @override - bool operator ==(Object other) => - other is DisplayNamesOptionsV1 && - other._underlying.style == _underlying.style && - other._underlying.fallback == _underlying.fallback && - other._underlying.languageDisplay == _underlying.languageDisplay; + @override + bool operator ==(Object other) => + other is DisplayNamesOptionsV1 + && other._underlying.style == _underlying.style + && other._underlying.fallback == _underlying.fallback + && other._underlying.languageDisplay == _underlying.languageDisplay; - @override - int get hashCode => Object.hashAll([ - _underlying.style, - _underlying.fallback, - _underlying.languageDisplay, - ]); + @override + int get hashCode => Object.hashAll([_underlying.style,_underlying.fallback,_underlying.languageDisplay,]); } + /// See the [Rust documentation for `Style`](https://docs.rs/icu/latest/icu/displaynames/options/enum.Style.html) for more information. enum DisplayNamesStyle { auto, @@ -5416,19 +4387,19 @@ enum DisplayNamesStyle { menu; } + /// A common enum for errors that ICU4X may return, organized by API -/// +/// /// The error names are stable and can be checked against as strings in the JS API -/// +/// /// Additional information: [1](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FixedDecimalError.html), [2](https://docs.rs/icu/latest/icu/calendar/enum.CalendarError.html), [3](https://docs.rs/icu/latest/icu/collator/enum.CollatorError.html), [4](https://docs.rs/icu/latest/icu/datetime/enum.DateTimeError.html), [5](https://docs.rs/icu/latest/icu/decimal/enum.DecimalError.html), [6](https://docs.rs/icu/latest/icu/list/enum.ListError.html), [7](https://docs.rs/icu/latest/icu/locid/enum.ParserError.html), [8](https://docs.rs/icu/latest/icu/locid_transform/enum.LocaleTransformError.html), [9](https://docs.rs/icu/latest/icu/normalizer/enum.NormalizerError.html), [10](https://docs.rs/icu/latest/icu/plurals/enum.PluralsError.html), [11](https://docs.rs/icu/latest/icu/properties/enum.PropertiesError.html), [12](https://docs.rs/icu/latest/icu/provider/struct.DataError.html), [13](https://docs.rs/icu/latest/icu/provider/enum.DataErrorKind.html), [14](https://docs.rs/icu/latest/icu/segmenter/enum.SegmenterError.html), [15](https://docs.rs/icu/latest/icu/timezone/enum.TimeZoneError.html) enum Error { /// The error is not currently categorized as ICU4XError. - /// Please file a bug +/// Please file a bug unknownError, - /// An error arising from writing to a string - /// Typically found when not enough space is allocated - /// Most APIs that return a string may return this error +/// Typically found when not enough space is allocated +/// Most APIs that return a string may return this error writeableError, outOfBoundsError, dataMissingDataKeyError, @@ -5445,15 +4416,12 @@ enum Error { dataIoError, dataUnavailableBufferFormatError, dataMismatchedAnyBufferError, - /// The subtag being requested was not set localeUndefinedSubtagError, - /// The locale or subtag string failed to parse localeParserLanguageError, localeParserSubtagError, localeParserExtensionError, - /// Attempted to construct an invalid data struct dataStructValidityError, propertyUnknownScriptIdError, @@ -5492,630 +4460,575 @@ enum Error { int get _underlying { switch (this) { - case unknownError: - return 0; - case writeableError: - return 1; - case outOfBoundsError: - return 2; - case dataMissingDataKeyError: - return 256; - case dataMissingVariantError: - return 257; - case dataMissingLocaleError: - return 258; - case dataNeedsVariantError: - return 259; - case dataNeedsLocaleError: - return 260; - case dataExtraneousLocaleError: - return 261; - case dataFilteredResourceError: - return 262; - case dataMismatchedTypeError: - return 263; - case dataMissingPayloadError: - return 264; - case dataInvalidStateError: - return 265; - case dataCustomError: - return 266; - case dataIoError: - return 267; - case dataUnavailableBufferFormatError: - return 268; - case dataMismatchedAnyBufferError: - return 269; - case localeUndefinedSubtagError: - return 512; - case localeParserLanguageError: - return 513; - case localeParserSubtagError: - return 514; - case localeParserExtensionError: - return 515; - case dataStructValidityError: - return 768; - case propertyUnknownScriptIdError: - return 1024; - case propertyUnknownGeneralCategoryGroupError: - return 1025; - case propertyUnexpectedPropertyNameError: - return 1026; - case fixedDecimalLimitError: - return 1280; - case fixedDecimalSyntaxError: - return 1281; - case pluralsParserError: - return 1536; - case calendarParseError: - return 1792; - case calendarOverflowError: - return 1793; - case calendarUnderflowError: - return 1794; - case calendarOutOfRangeError: - return 1795; - case calendarUnknownEraError: - return 1796; - case calendarUnknownMonthCodeError: - return 1797; - case calendarMissingInputError: - return 1798; - case calendarUnknownKindError: - return 1799; - case calendarMissingError: - return 1800; - case dateTimePatternError: - return 2048; - case dateTimeMissingInputFieldError: - return 2049; - case dateTimeSkeletonError: - return 2050; - case dateTimeUnsupportedFieldError: - return 2051; - case dateTimeUnsupportedOptionsError: - return 2052; - case dateTimeMissingWeekdaySymbolError: - return 2053; - case dateTimeMissingMonthSymbolError: - return 2054; - case dateTimeFixedDecimalError: - return 2055; - case dateTimeMismatchedCalendarError: - return 2056; - case tinyStrTooLargeError: - return 2304; - case tinyStrContainsNullError: - return 2305; - case tinyStrNonAsciiError: - return 2306; - case timeZoneOffsetOutOfBoundsError: - return 2560; - case timeZoneInvalidOffsetError: - return 2561; - case timeZoneMissingInputError: - return 2562; - case timeZoneInvalidIdError: - return 2563; - case normalizerFutureExtensionError: - return 2816; - case normalizerValidationError: - return 2817; + case unknownError: + return 0; + case writeableError: + return 1; + case outOfBoundsError: + return 2; + case dataMissingDataKeyError: + return 256; + case dataMissingVariantError: + return 257; + case dataMissingLocaleError: + return 258; + case dataNeedsVariantError: + return 259; + case dataNeedsLocaleError: + return 260; + case dataExtraneousLocaleError: + return 261; + case dataFilteredResourceError: + return 262; + case dataMismatchedTypeError: + return 263; + case dataMissingPayloadError: + return 264; + case dataInvalidStateError: + return 265; + case dataCustomError: + return 266; + case dataIoError: + return 267; + case dataUnavailableBufferFormatError: + return 268; + case dataMismatchedAnyBufferError: + return 269; + case localeUndefinedSubtagError: + return 512; + case localeParserLanguageError: + return 513; + case localeParserSubtagError: + return 514; + case localeParserExtensionError: + return 515; + case dataStructValidityError: + return 768; + case propertyUnknownScriptIdError: + return 1024; + case propertyUnknownGeneralCategoryGroupError: + return 1025; + case propertyUnexpectedPropertyNameError: + return 1026; + case fixedDecimalLimitError: + return 1280; + case fixedDecimalSyntaxError: + return 1281; + case pluralsParserError: + return 1536; + case calendarParseError: + return 1792; + case calendarOverflowError: + return 1793; + case calendarUnderflowError: + return 1794; + case calendarOutOfRangeError: + return 1795; + case calendarUnknownEraError: + return 1796; + case calendarUnknownMonthCodeError: + return 1797; + case calendarMissingInputError: + return 1798; + case calendarUnknownKindError: + return 1799; + case calendarMissingError: + return 1800; + case dateTimePatternError: + return 2048; + case dateTimeMissingInputFieldError: + return 2049; + case dateTimeSkeletonError: + return 2050; + case dateTimeUnsupportedFieldError: + return 2051; + case dateTimeUnsupportedOptionsError: + return 2052; + case dateTimeMissingWeekdaySymbolError: + return 2053; + case dateTimeMissingMonthSymbolError: + return 2054; + case dateTimeFixedDecimalError: + return 2055; + case dateTimeMismatchedCalendarError: + return 2056; + case tinyStrTooLargeError: + return 2304; + case tinyStrContainsNullError: + return 2305; + case tinyStrNonAsciiError: + return 2306; + case timeZoneOffsetOutOfBoundsError: + return 2560; + case timeZoneInvalidOffsetError: + return 2561; + case timeZoneMissingInputError: + return 2562; + case timeZoneInvalidIdError: + return 2563; + case normalizerFutureExtensionError: + return 2816; + case normalizerValidationError: + return 2817; } } + } + /// See the [Rust documentation for `FixedDecimal`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html) for more information. class FixedDecimal implements ffi.Finalizable { - final ffi.Pointer _underlying; - FixedDecimal._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XFixedDecimal_destroy')); + FixedDecimal._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Construct an [`ICU4XFixedDecimal`] from an integer. - /// - /// See the [Rust documentation for `FixedDecimal`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html) for more information. - factory FixedDecimal.fromInt(int v) { - final result = _ICU4XFixedDecimal_create_from_i64(v); - return FixedDecimal._(result); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XFixedDecimal_destroy')); + + +/// Construct an [`ICU4XFixedDecimal`] from an integer. +/// +/// See the [Rust documentation for `FixedDecimal`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html) for more information. +factory FixedDecimal.fromInt(int v) { + + final result = _ICU4XFixedDecimal_create_from_i64(v); + return FixedDecimal._(result); } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_create_from_i64 = - _capi Function(ffi.Int64)>>( - 'ICU4XFixedDecimal_create_from_i64') - .asFunction Function(int)>(isLeaf: true); + static final _ICU4XFixedDecimal_create_from_i64= _capi Function(ffi.Int64)>>('ICU4XFixedDecimal_create_from_i64') + .asFunction Function(int)>(isLeaf: true); - /// Construct an [`ICU4XFixedDecimal`] from an float, with a given power of 10 for the lower magnitude - /// - /// See the [Rust documentation for `try_from_f64`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64) for more information. - /// - /// See the [Rust documentation for `FloatPrecision`](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html) for more information. - factory FixedDecimal.fromDoubleWithLowerMagnitude(double f, int magnitude) { - final result = - _ICU4XFixedDecimal_create_from_f64_with_lower_magnitude(f, magnitude); - return result.isOk - ? FixedDecimal._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + + +/// Construct an [`ICU4XFixedDecimal`] from an float, with a given power of 10 for the lower magnitude +/// +/// See the [Rust documentation for `try_from_f64`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64) for more information. +/// +/// See the [Rust documentation for `FloatPrecision`](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html) for more information. +factory FixedDecimal.fromDoubleWithLowerMagnitude(double f, int magnitude) { + + final result = _ICU4XFixedDecimal_create_from_f64_with_lower_magnitude(f,magnitude); + return result.isOk ? FixedDecimal._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_create_from_f64_with_lower_magnitude = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Double, ffi.Int16)>>( - 'ICU4XFixedDecimal_create_from_f64_with_lower_magnitude') - .asFunction<_ResultOpaqueInt32 Function(double, int)>(isLeaf: true); - - /// Construct an [`ICU4XFixedDecimal`] from an float, for a given number of significant digits - /// - /// See the [Rust documentation for `try_from_f64`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64) for more information. - /// - /// See the [Rust documentation for `FloatPrecision`](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html) for more information. - factory FixedDecimal.fromDoubleWithSignificantDigits(double f, int digits) { - final result = - _ICU4XFixedDecimal_create_from_f64_with_significant_digits(f, digits); - return result.isOk - ? FixedDecimal._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_create_from_f64_with_significant_digits = - _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Double, ffi.Uint8)>>( - 'ICU4XFixedDecimal_create_from_f64_with_significant_digits') - .asFunction<_ResultOpaqueInt32 Function(double, int)>(isLeaf: true); - - /// Construct an [`ICU4XFixedDecimal`] from an float, with enough digits to recover - /// the original floating point in IEEE 754 without needing trailing zeros - /// - /// See the [Rust documentation for `try_from_f64`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64) for more information. - /// - /// See the [Rust documentation for `FloatPrecision`](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html) for more information. - factory FixedDecimal.fromDoubleWithDoublePrecision(double f) { - final result = - _ICU4XFixedDecimal_create_from_f64_with_floating_precision(f); - return result.isOk - ? FixedDecimal._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_create_from_f64_with_floating_precision = - _capi>( - 'ICU4XFixedDecimal_create_from_f64_with_floating_precision') - .asFunction<_ResultOpaqueInt32 Function(double)>(isLeaf: true); - - /// Construct an [`ICU4XFixedDecimal`] from a string. - /// - /// See the [Rust documentation for `from_str`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.from_str) for more information. - factory FixedDecimal.fromString(String v) { - final alloc = ffi2.Arena(); - final vSlice = _SliceFfi2Utf8._fromDart(v, alloc); - - final result = - _ICU4XFixedDecimal_create_from_string(vSlice._bytes, vSlice._length); - alloc.releaseAll(); - return result.isOk - ? FixedDecimal._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_create_from_string = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Size)>>('ICU4XFixedDecimal_create_from_string') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>( - isLeaf: true); - - /// See the [Rust documentation for `digit_at`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.digit_at) for more information. - int digitAt(int magnitude) { - final result = _ICU4XFixedDecimal_digit_at(_underlying, magnitude); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_digit_at = _capi< - ffi.NativeFunction< - ffi.Uint8 Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_digit_at') - .asFunction, int)>(isLeaf: true); - - /// See the [Rust documentation for `magnitude_range`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.magnitude_range) for more information. - int get magnitudeStart { - final result = _ICU4XFixedDecimal_magnitude_start(_underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_magnitude_start = - _capi)>>( - 'ICU4XFixedDecimal_magnitude_start') - .asFunction)>(isLeaf: true); + static final _ICU4XFixedDecimal_create_from_f64_with_lower_magnitude= _capi>('ICU4XFixedDecimal_create_from_f64_with_lower_magnitude') + .asFunction<_ResultOpaqueInt32 Function(double, int)>(isLeaf: true); - /// See the [Rust documentation for `magnitude_range`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.magnitude_range) for more information. - int get magnitudeEnd { - final result = _ICU4XFixedDecimal_magnitude_end(_underlying); - return result; - } + +/// Construct an [`ICU4XFixedDecimal`] from an float, for a given number of significant digits +/// +/// See the [Rust documentation for `try_from_f64`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64) for more information. +/// +/// See the [Rust documentation for `FloatPrecision`](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html) for more information. +factory FixedDecimal.fromDoubleWithSignificantDigits(double f, int digits) { + + final result = _ICU4XFixedDecimal_create_from_f64_with_significant_digits(f,digits); + return result.isOk ? FixedDecimal._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_magnitude_end = - _capi)>>( - 'ICU4XFixedDecimal_magnitude_end') - .asFunction)>(isLeaf: true); + static final _ICU4XFixedDecimal_create_from_f64_with_significant_digits= _capi>('ICU4XFixedDecimal_create_from_f64_with_significant_digits') + .asFunction<_ResultOpaqueInt32 Function(double, int)>(isLeaf: true); - /// See the [Rust documentation for `nonzero_magnitude_start`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.nonzero_magnitude_start) for more information. - int get nonzeroMagnitudeStart { - final result = _ICU4XFixedDecimal_nonzero_magnitude_start(_underlying); - return result; - } + +/// Construct an [`ICU4XFixedDecimal`] from an float, with enough digits to recover +/// the original floating point in IEEE 754 without needing trailing zeros +/// +/// See the [Rust documentation for `try_from_f64`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64) for more information. +/// +/// See the [Rust documentation for `FloatPrecision`](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html) for more information. +factory FixedDecimal.fromDoubleWithDoublePrecision(double f) { + + final result = _ICU4XFixedDecimal_create_from_f64_with_floating_precision(f); + return result.isOk ? FixedDecimal._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_nonzero_magnitude_start = - _capi)>>( - 'ICU4XFixedDecimal_nonzero_magnitude_start') - .asFunction)>(isLeaf: true); + static final _ICU4XFixedDecimal_create_from_f64_with_floating_precision= _capi>('ICU4XFixedDecimal_create_from_f64_with_floating_precision') + .asFunction<_ResultOpaqueInt32 Function(double)>(isLeaf: true); - /// See the [Rust documentation for `nonzero_magnitude_end`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.nonzero_magnitude_end) for more information. - int get nonzeroMagnitudeEnd { - final result = _ICU4XFixedDecimal_nonzero_magnitude_end(_underlying); - return result; - } + +/// Construct an [`ICU4XFixedDecimal`] from a string. +/// +/// See the [Rust documentation for `from_str`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.from_str) for more information. +factory FixedDecimal.fromString(String v) { + final alloc = ffi2.Arena(); + final vSlice = _SliceFfi2Utf8._fromDart(v, alloc); + + final result = _ICU4XFixedDecimal_create_from_string(vSlice._bytes,vSlice._length);alloc.releaseAll(); + return result.isOk ? FixedDecimal._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_nonzero_magnitude_end = - _capi)>>( - 'ICU4XFixedDecimal_nonzero_magnitude_end') - .asFunction)>(isLeaf: true); + static final _ICU4XFixedDecimal_create_from_string= _capi, ffi.Size)>>('ICU4XFixedDecimal_create_from_string') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>(isLeaf: true); - /// See the [Rust documentation for `is_zero`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.is_zero) for more information. - bool get isZero { - final result = _ICU4XFixedDecimal_is_zero(_underlying); - return result; - } + +/// See the [Rust documentation for `digit_at`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.digit_at) for more information. +int digitAt(int magnitude) { + + final result = _ICU4XFixedDecimal_digit_at(_underlying,magnitude); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_is_zero = - _capi)>>( - 'ICU4XFixedDecimal_is_zero') - .asFunction)>(isLeaf: true); + static final _ICU4XFixedDecimal_digit_at= _capi, ffi.Int16)>>('ICU4XFixedDecimal_digit_at') + .asFunction, int)>(isLeaf: true); - /// Multiply the [`ICU4XFixedDecimal`] by a given power of ten. - /// - /// See the [Rust documentation for `multiply_pow10`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.multiply_pow10) for more information. - void multiplyPow10(int power) { - _ICU4XFixedDecimal_multiply_pow10(_underlying, power); - } + +/// See the [Rust documentation for `magnitude_range`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.magnitude_range) for more information. +int get magnitudeStart { + + final result = _ICU4XFixedDecimal_magnitude_start(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_multiply_pow10 = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_multiply_pow10') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_magnitude_start= _capi)>>('ICU4XFixedDecimal_magnitude_start') + .asFunction)>(isLeaf: true); - /// See the [Rust documentation for `sign`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.sign) for more information. - FixedDecimalSign get sign { - final result = _ICU4XFixedDecimal_sign(_underlying); - return FixedDecimalSign.values[result]; - } + +/// See the [Rust documentation for `magnitude_range`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.magnitude_range) for more information. +int get magnitudeEnd { + + final result = _ICU4XFixedDecimal_magnitude_end(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_sign = - _capi)>>( - 'ICU4XFixedDecimal_sign') - .asFunction)>(isLeaf: true); + static final _ICU4XFixedDecimal_magnitude_end= _capi)>>('ICU4XFixedDecimal_magnitude_end') + .asFunction)>(isLeaf: true); - /// Set the sign of the [`ICU4XFixedDecimal`]. - /// - /// See the [Rust documentation for `set_sign`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.set_sign) for more information. - set sign(FixedDecimalSign sign) { - _ICU4XFixedDecimal_set_sign(_underlying, sign.index); - } + +/// See the [Rust documentation for `nonzero_magnitude_start`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.nonzero_magnitude_start) for more information. +int get nonzeroMagnitudeStart { + + final result = _ICU4XFixedDecimal_nonzero_magnitude_start(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_set_sign = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int32)>>('ICU4XFixedDecimal_set_sign') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_nonzero_magnitude_start= _capi)>>('ICU4XFixedDecimal_nonzero_magnitude_start') + .asFunction)>(isLeaf: true); - /// See the [Rust documentation for `apply_sign_display`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.apply_sign_display) for more information. - void applySignDisplay(FixedDecimalSignDisplay signDisplay) { - _ICU4XFixedDecimal_apply_sign_display(_underlying, signDisplay.index); - } + +/// See the [Rust documentation for `nonzero_magnitude_end`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.nonzero_magnitude_end) for more information. +int get nonzeroMagnitudeEnd { + + final result = _ICU4XFixedDecimal_nonzero_magnitude_end(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_apply_sign_display = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int32)>>('ICU4XFixedDecimal_apply_sign_display') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_nonzero_magnitude_end= _capi)>>('ICU4XFixedDecimal_nonzero_magnitude_end') + .asFunction)>(isLeaf: true); - /// See the [Rust documentation for `trim_start`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trim_start) for more information. - void trimStart() { - _ICU4XFixedDecimal_trim_start(_underlying); - } + +/// See the [Rust documentation for `is_zero`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.is_zero) for more information. +bool get isZero { + + final result = _ICU4XFixedDecimal_is_zero(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_trim_start = - _capi)>>( - 'ICU4XFixedDecimal_trim_start') - .asFunction)>(isLeaf: true); + static final _ICU4XFixedDecimal_is_zero= _capi)>>('ICU4XFixedDecimal_is_zero') + .asFunction)>(isLeaf: true); - /// See the [Rust documentation for `trim_end`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trim_end) for more information. - void trimEnd() { - _ICU4XFixedDecimal_trim_end(_underlying); - } + +/// Multiply the [`ICU4XFixedDecimal`] by a given power of ten. +/// +/// See the [Rust documentation for `multiply_pow10`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.multiply_pow10) for more information. +void multiplyPow10(int power) { + + _ICU4XFixedDecimal_multiply_pow10(_underlying,power); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_trim_end = - _capi)>>( - 'ICU4XFixedDecimal_trim_end') - .asFunction)>(isLeaf: true); + static final _ICU4XFixedDecimal_multiply_pow10= _capi, ffi.Int16)>>('ICU4XFixedDecimal_multiply_pow10') + .asFunction, int)>(isLeaf: true); - /// Zero-pad the [`ICU4XFixedDecimal`] on the left to a particular position - /// - /// See the [Rust documentation for `pad_start`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.pad_start) for more information. - void padStart(int position) { - _ICU4XFixedDecimal_pad_start(_underlying, position); - } + +/// See the [Rust documentation for `sign`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.sign) for more information. +FixedDecimalSign get sign { + + final result = _ICU4XFixedDecimal_sign(_underlying); + return FixedDecimalSign.values[result]; + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_pad_start = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_pad_start') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_sign= _capi)>>('ICU4XFixedDecimal_sign') + .asFunction)>(isLeaf: true); - /// Zero-pad the [`ICU4XFixedDecimal`] on the right to a particular position - /// - /// See the [Rust documentation for `pad_end`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.pad_end) for more information. - void padEnd(int position) { - _ICU4XFixedDecimal_pad_end(_underlying, position); - } + +/// Set the sign of the [`ICU4XFixedDecimal`]. +/// +/// See the [Rust documentation for `set_sign`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.set_sign) for more information. +set sign(FixedDecimalSign sign) { + + _ICU4XFixedDecimal_set_sign(_underlying,sign.index); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_pad_end = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_pad_end') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_set_sign= _capi, ffi.Int32)>>('ICU4XFixedDecimal_set_sign') + .asFunction, int)>(isLeaf: true); - /// Truncate the [`ICU4XFixedDecimal`] on the left to a particular position, deleting digits if necessary. This is useful for, e.g. abbreviating years - /// ("2022" -> "22") - /// - /// See the [Rust documentation for `set_max_position`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.set_max_position) for more information. - void setMaxPosition(int position) { - _ICU4XFixedDecimal_set_max_position(_underlying, position); - } + +/// See the [Rust documentation for `apply_sign_display`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.apply_sign_display) for more information. +void applySignDisplay(FixedDecimalSignDisplay signDisplay) { + + _ICU4XFixedDecimal_apply_sign_display(_underlying,signDisplay.index); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_set_max_position = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_set_max_position') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_apply_sign_display= _capi, ffi.Int32)>>('ICU4XFixedDecimal_apply_sign_display') + .asFunction, int)>(isLeaf: true); - /// See the [Rust documentation for `trunc`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trunc) for more information. - void trunc(int position) { - _ICU4XFixedDecimal_trunc(_underlying, position); - } + +/// See the [Rust documentation for `trim_start`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trim_start) for more information. +void trimStart() { + + _ICU4XFixedDecimal_trim_start(_underlying); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_trunc = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_trunc') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_trim_start= _capi)>>('ICU4XFixedDecimal_trim_start') + .asFunction)>(isLeaf: true); - /// See the [Rust documentation for `half_trunc`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_trunc) for more information. - void halfTrunc(int position) { - _ICU4XFixedDecimal_half_trunc(_underlying, position); - } + +/// See the [Rust documentation for `trim_end`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trim_end) for more information. +void trimEnd() { + + _ICU4XFixedDecimal_trim_end(_underlying); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_half_trunc = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_half_trunc') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_trim_end= _capi)>>('ICU4XFixedDecimal_trim_end') + .asFunction)>(isLeaf: true); - /// See the [Rust documentation for `expand`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.expand) for more information. - void expand(int position) { - _ICU4XFixedDecimal_expand(_underlying, position); - } + +/// Zero-pad the [`ICU4XFixedDecimal`] on the left to a particular position +/// +/// See the [Rust documentation for `pad_start`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.pad_start) for more information. +void padStart(int position) { + + _ICU4XFixedDecimal_pad_start(_underlying,position); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_expand = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_expand') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_pad_start= _capi, ffi.Int16)>>('ICU4XFixedDecimal_pad_start') + .asFunction, int)>(isLeaf: true); - /// See the [Rust documentation for `half_expand`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_expand) for more information. - void halfExpand(int position) { - _ICU4XFixedDecimal_half_expand(_underlying, position); - } + +/// Zero-pad the [`ICU4XFixedDecimal`] on the right to a particular position +/// +/// See the [Rust documentation for `pad_end`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.pad_end) for more information. +void padEnd(int position) { + + _ICU4XFixedDecimal_pad_end(_underlying,position); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_half_expand = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_half_expand') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_pad_end= _capi, ffi.Int16)>>('ICU4XFixedDecimal_pad_end') + .asFunction, int)>(isLeaf: true); - /// See the [Rust documentation for `ceil`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.ceil) for more information. - void ceil(int position) { - _ICU4XFixedDecimal_ceil(_underlying, position); - } + +/// Truncate the [`ICU4XFixedDecimal`] on the left to a particular position, deleting digits if necessary. This is useful for, e.g. abbreviating years +/// ("2022" -> "22") +/// +/// See the [Rust documentation for `set_max_position`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.set_max_position) for more information. +void setMaxPosition(int position) { + + _ICU4XFixedDecimal_set_max_position(_underlying,position); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_ceil = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_ceil') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_set_max_position= _capi, ffi.Int16)>>('ICU4XFixedDecimal_set_max_position') + .asFunction, int)>(isLeaf: true); - /// See the [Rust documentation for `half_ceil`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_ceil) for more information. - void halfCeil(int position) { - _ICU4XFixedDecimal_half_ceil(_underlying, position); - } + +/// See the [Rust documentation for `trunc`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trunc) for more information. +void trunc(int position) { + + _ICU4XFixedDecimal_trunc(_underlying,position); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_half_ceil = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_half_ceil') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_trunc= _capi, ffi.Int16)>>('ICU4XFixedDecimal_trunc') + .asFunction, int)>(isLeaf: true); + - /// See the [Rust documentation for `floor`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.floor) for more information. - void floor(int position) { - _ICU4XFixedDecimal_floor(_underlying, position); + +/// See the [Rust documentation for `half_trunc`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_trunc) for more information. +void halfTrunc(int position) { + + _ICU4XFixedDecimal_half_trunc(_underlying,position); } + // ignore: non_constant_identifier_names + static final _ICU4XFixedDecimal_half_trunc= _capi, ffi.Int16)>>('ICU4XFixedDecimal_half_trunc') + .asFunction, int)>(isLeaf: true); + + +/// See the [Rust documentation for `expand`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.expand) for more information. +void expand(int position) { + + _ICU4XFixedDecimal_expand(_underlying,position); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_floor = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_floor') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_expand= _capi, ffi.Int16)>>('ICU4XFixedDecimal_expand') + .asFunction, int)>(isLeaf: true); + - /// See the [Rust documentation for `half_floor`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_floor) for more information. - void halfFloor(int position) { - _ICU4XFixedDecimal_half_floor(_underlying, position); + +/// See the [Rust documentation for `half_expand`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_expand) for more information. +void halfExpand(int position) { + + _ICU4XFixedDecimal_half_expand(_underlying,position); } + // ignore: non_constant_identifier_names + static final _ICU4XFixedDecimal_half_expand= _capi, ffi.Int16)>>('ICU4XFixedDecimal_half_expand') + .asFunction, int)>(isLeaf: true); + + +/// See the [Rust documentation for `ceil`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.ceil) for more information. +void ceil(int position) { + + _ICU4XFixedDecimal_ceil(_underlying,position); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_half_floor = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_half_floor') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_ceil= _capi, ffi.Int16)>>('ICU4XFixedDecimal_ceil') + .asFunction, int)>(isLeaf: true); + - /// See the [Rust documentation for `half_even`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_even) for more information. - void halfEven(int position) { - _ICU4XFixedDecimal_half_even(_underlying, position); + +/// See the [Rust documentation for `half_ceil`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_ceil) for more information. +void halfCeil(int position) { + + _ICU4XFixedDecimal_half_ceil(_underlying,position); } + // ignore: non_constant_identifier_names + static final _ICU4XFixedDecimal_half_ceil= _capi, ffi.Int16)>>('ICU4XFixedDecimal_half_ceil') + .asFunction, int)>(isLeaf: true); + + +/// See the [Rust documentation for `floor`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.floor) for more information. +void floor(int position) { + + _ICU4XFixedDecimal_floor(_underlying,position); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_half_even = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Int16)>>('ICU4XFixedDecimal_half_even') - .asFunction, int)>(isLeaf: true); + static final _ICU4XFixedDecimal_floor= _capi, ffi.Int16)>>('ICU4XFixedDecimal_floor') + .asFunction, int)>(isLeaf: true); - /// Concatenates `other` to the end of `self`. - /// - /// If successful, `other` will be set to 0 and a successful status is returned. - /// - /// If not successful, `other` will be unchanged and an error is returned. - /// - /// See the [Rust documentation for `concatenate_end`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.concatenate_end) for more information. - void concatenateEnd(FixedDecimal other) { - final result = - _ICU4XFixedDecimal_concatenate_end(_underlying, other._underlying); - if (!result.isOk) { - throw VoidError(); - } + + +/// See the [Rust documentation for `half_floor`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_floor) for more information. +void halfFloor(int position) { + + _ICU4XFixedDecimal_half_floor(_underlying,position); } + // ignore: non_constant_identifier_names + static final _ICU4XFixedDecimal_half_floor= _capi, ffi.Int16)>>('ICU4XFixedDecimal_half_floor') + .asFunction, int)>(isLeaf: true); + + +/// See the [Rust documentation for `half_even`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_even) for more information. +void halfEven(int position) { + + _ICU4XFixedDecimal_half_even(_underlying,position); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_concatenate_end = _capi< - ffi.NativeFunction< - _ResultVoidVoid Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XFixedDecimal_concatenate_end') - .asFunction< - _ResultVoidVoid Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Format the [`ICU4XFixedDecimal`] as a string. - /// - /// See the [Rust documentation for `write_to`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.write_to) for more information. - @override - String toString() { - final writeable = _Writeable(); - _ICU4XFixedDecimal_to_string(_underlying, writeable._underlying); - return writeable.finalize(); + static final _ICU4XFixedDecimal_half_even= _capi, ffi.Int16)>>('ICU4XFixedDecimal_half_even') + .asFunction, int)>(isLeaf: true); + + + +/// Concatenates `other` to the end of `self`. +/// +/// If successful, `other` will be set to 0 and a successful status is returned. +/// +/// If not successful, `other` will be unchanged and an error is returned. +/// +/// See the [Rust documentation for `concatenate_end`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.concatenate_end) for more information. +void concatenateEnd(FixedDecimal other) { + + final result = _ICU4XFixedDecimal_concatenate_end(_underlying,other._underlying); + if (!result.isOk) { throw VoidError(); } } + // ignore: non_constant_identifier_names + static final _ICU4XFixedDecimal_concatenate_end= _capi, ffi.Pointer)>>('ICU4XFixedDecimal_concatenate_end') + .asFunction<_ResultVoidVoid Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + +/// Format the [`ICU4XFixedDecimal`] as a string. +/// +/// See the [Rust documentation for `write_to`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.write_to) for more information. +@override + String toString() { + + final writeable = _Writeable(); + _ICU4XFixedDecimal_to_string(_underlying,writeable._underlying); + return writeable.finalize(); + } // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimal_to_string = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XFixedDecimal_to_string') - .asFunction< - void Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XFixedDecimal_to_string= _capi, ffi.Pointer)>>('ICU4XFixedDecimal_to_string') + .asFunction, ffi.Pointer)>(isLeaf: true); + + + } + /// An ICU4X Fixed Decimal Format object, capable of formatting a [`ICU4XFixedDecimal`] as a string. -/// +/// /// See the [Rust documentation for `FixedDecimalFormatter`](https://docs.rs/icu/latest/icu/decimal/struct.FixedDecimalFormatter.html) for more information. class FixedDecimalFormatter implements ffi.Finalizable { - final ffi.Pointer _underlying; - FixedDecimalFormatter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XFixedDecimalFormatter_destroy')); - - /// Creates a new [`ICU4XFixedDecimalFormatter`] from locale data. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/decimal/struct.FixedDecimalFormatter.html#method.try_new) for more information. - factory FixedDecimalFormatter.withGroupingStrategy(DataProvider provider, - Locale locale, FixedDecimalGroupingStrategy groupingStrategy) { - final result = _ICU4XFixedDecimalFormatter_create_with_grouping_strategy( - provider._underlying, locale._underlying, groupingStrategy.index); - return result.isOk - ? FixedDecimalFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimalFormatter_create_with_grouping_strategy = - _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Int32)>>( - 'ICU4XFixedDecimalFormatter_create_with_grouping_strategy') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Formats a [`ICU4XFixedDecimal`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/decimal/struct.FixedDecimalFormatter.html#method.format) for more information. - String format(FixedDecimal value) { - final writeable = _Writeable(); - final result = _ICU4XFixedDecimalFormatter_format( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XFixedDecimalFormatter_format = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XFixedDecimalFormatter_format') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + final ffi.Pointer _underlying; + + FixedDecimalFormatter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XFixedDecimalFormatter_destroy')); + + +/// Creates a new [`ICU4XFixedDecimalFormatter`] from locale data. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/decimal/struct.FixedDecimalFormatter.html#method.try_new) for more information. +factory FixedDecimalFormatter.withGroupingStrategy(DataProvider provider, Locale locale, FixedDecimalGroupingStrategy groupingStrategy) { + + final result = _ICU4XFixedDecimalFormatter_create_with_grouping_strategy(provider._underlying,locale._underlying,groupingStrategy.index); + return result.isOk ? FixedDecimalFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XFixedDecimalFormatter_create_with_grouping_strategy= _capi, ffi.Pointer, ffi.Int32)>>('ICU4XFixedDecimalFormatter_create_with_grouping_strategy') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Formats a [`ICU4XFixedDecimal`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/decimal/struct.FixedDecimalFormatter.html#method.format) for more information. +String format(FixedDecimal value) { + + final writeable = _Writeable(); + final result = _ICU4XFixedDecimalFormatter_format(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XFixedDecimalFormatter_format= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XFixedDecimalFormatter_format') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + } + /// See the [Rust documentation for `GroupingStrategy`](https://docs.rs/icu/latest/icu/decimal/options/enum.GroupingStrategy.html) for more information. enum FixedDecimalGroupingStrategy { @@ -6125,22 +5038,22 @@ enum FixedDecimalGroupingStrategy { min2; } + /// The sign of a FixedDecimal, as shown in formatting. -/// +/// /// See the [Rust documentation for `Sign`](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.Sign.html) for more information. enum FixedDecimalSign { /// No sign (implicitly positive, e.g., 1729). none, - /// A negative sign, e.g., -1729. negative, - /// An explicit positive sign, e.g., +1729. positive; } + /// ECMA-402 compatible sign display preference. -/// +/// /// See the [Rust documentation for `SignDisplay`](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.SignDisplay.html) for more information. enum FixedDecimalSignDisplay { auto, @@ -6150,1163 +5063,979 @@ enum FixedDecimalSignDisplay { negative; } + /// A type capable of looking up General Category mask values from a string name. -/// +/// /// See the [Rust documentation for `get_name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.GeneralCategoryGroup.html#method.get_name_to_enum_mapper) for more information. -/// +/// /// See the [Rust documentation for `PropertyValueNameToEnumMapper`](https://docs.rs/icu/latest/icu/properties/names/struct.PropertyValueNameToEnumMapper.html) for more information. class GeneralCategoryNameToMaskMapper implements ffi.Finalizable { - final ffi.Pointer _underlying; - GeneralCategoryNameToMaskMapper._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = ffi.NativeFinalizer( - _capi('ICU4XGeneralCategoryNameToMaskMapper_destroy')); + GeneralCategoryNameToMaskMapper._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Get the mask value matching the given name, using strict matching - /// - /// Returns 0 if the name is unknown for this property - int getStrict(String name) { - final alloc = ffi2.Arena(); - final nameSlice = _SliceFfi2Utf8._fromDart(name, alloc); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XGeneralCategoryNameToMaskMapper_destroy')); - final result = _ICU4XGeneralCategoryNameToMaskMapper_get_strict( - _underlying, nameSlice._bytes, nameSlice._length); - alloc.releaseAll(); - return result; + +/// Get the mask value matching the given name, using strict matching +/// +/// Returns 0 if the name is unknown for this property +int getStrict(String name) { + final alloc = ffi2.Arena(); + final nameSlice = _SliceFfi2Utf8._fromDart(name, alloc); + + final result = _ICU4XGeneralCategoryNameToMaskMapper_get_strict(_underlying,nameSlice._bytes,nameSlice._length);alloc.releaseAll(); + return result; } - // ignore: non_constant_identifier_names - static final _ICU4XGeneralCategoryNameToMaskMapper_get_strict = _capi< - ffi.NativeFunction< - ffi.Uint32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XGeneralCategoryNameToMaskMapper_get_strict') - .asFunction< - int Function(ffi.Pointer, ffi.Pointer, - int)>(isLeaf: true); + static final _ICU4XGeneralCategoryNameToMaskMapper_get_strict= _capi, ffi.Pointer, ffi.Size)>>('ICU4XGeneralCategoryNameToMaskMapper_get_strict') + .asFunction, ffi.Pointer, int)>(isLeaf: true); - /// Get the mask value matching the given name, using loose matching - /// - /// Returns 0 if the name is unknown for this property - int getLoose(String name) { - final alloc = ffi2.Arena(); - final nameSlice = _SliceFfi2Utf8._fromDart(name, alloc); - final result = _ICU4XGeneralCategoryNameToMaskMapper_get_loose( - _underlying, nameSlice._bytes, nameSlice._length); - alloc.releaseAll(); - return result; + +/// Get the mask value matching the given name, using loose matching +/// +/// Returns 0 if the name is unknown for this property +int getLoose(String name) { + final alloc = ffi2.Arena(); + final nameSlice = _SliceFfi2Utf8._fromDart(name, alloc); + + final result = _ICU4XGeneralCategoryNameToMaskMapper_get_loose(_underlying,nameSlice._bytes,nameSlice._length);alloc.releaseAll(); + return result; } - // ignore: non_constant_identifier_names - static final _ICU4XGeneralCategoryNameToMaskMapper_get_loose = _capi< - ffi.NativeFunction< - ffi.Uint32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XGeneralCategoryNameToMaskMapper_get_loose') - .asFunction< - int Function(ffi.Pointer, ffi.Pointer, - int)>(isLeaf: true); + static final _ICU4XGeneralCategoryNameToMaskMapper_get_loose= _capi, ffi.Pointer, ffi.Size)>>('ICU4XGeneralCategoryNameToMaskMapper_get_loose') + .asFunction, ffi.Pointer, int)>(isLeaf: true); + - /// See the [Rust documentation for `get_name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.GeneralCategoryGroup.html#method.get_name_to_enum_mapper) for more information. - factory GeneralCategoryNameToMaskMapper.load(DataProvider provider) { - final result = - _ICU4XGeneralCategoryNameToMaskMapper_load(provider._underlying); - return result.isOk - ? GeneralCategoryNameToMaskMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// See the [Rust documentation for `get_name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.GeneralCategoryGroup.html#method.get_name_to_enum_mapper) for more information. +factory GeneralCategoryNameToMaskMapper.load(DataProvider provider) { + + final result = _ICU4XGeneralCategoryNameToMaskMapper_load(provider._underlying); + return result.isOk ? GeneralCategoryNameToMaskMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XGeneralCategoryNameToMaskMapper_load = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XGeneralCategoryNameToMaskMapper_load') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); -} + static final _ICU4XGeneralCategoryNameToMaskMapper_load= _capi)>>('ICU4XGeneralCategoryNameToMaskMapper_load') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + } + /// See the [Rust documentation for `GraphemeClusterBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterBreakIterator.html) for more information. class GraphemeClusterBreakIteratorLatin1 implements ffi.Finalizable { - final ffi.Pointer _underlying; - GraphemeClusterBreakIteratorLatin1._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = ffi.NativeFinalizer( - _capi('ICU4XGraphemeClusterBreakIteratorLatin1_destroy')); + GraphemeClusterBreakIteratorLatin1._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is - /// out of range of a 32-bit signed integer. - /// - /// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterBreakIterator.html#method.next) for more information. - int next() { - final result = _ICU4XGraphemeClusterBreakIteratorLatin1_next(_underlying); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XGraphemeClusterBreakIteratorLatin1_destroy')); + +/// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is +/// out of range of a 32-bit signed integer. +/// +/// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterBreakIterator.html#method.next) for more information. +int next() { + + final result = _ICU4XGraphemeClusterBreakIteratorLatin1_next(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XGraphemeClusterBreakIteratorLatin1_next = - _capi)>>( - 'ICU4XGraphemeClusterBreakIteratorLatin1_next') - .asFunction)>(isLeaf: true); -} + static final _ICU4XGraphemeClusterBreakIteratorLatin1_next= _capi)>>('ICU4XGraphemeClusterBreakIteratorLatin1_next') + .asFunction)>(isLeaf: true); + + + } + /// See the [Rust documentation for `GraphemeClusterBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterBreakIterator.html) for more information. class GraphemeClusterBreakIteratorUtf16 implements ffi.Finalizable { - final ffi.Pointer _underlying; - GraphemeClusterBreakIteratorUtf16._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = ffi.NativeFinalizer( - _capi('ICU4XGraphemeClusterBreakIteratorUtf16_destroy')); + GraphemeClusterBreakIteratorUtf16._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is - /// out of range of a 32-bit signed integer. - /// - /// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterBreakIterator.html#method.next) for more information. - int next() { - final result = _ICU4XGraphemeClusterBreakIteratorUtf16_next(_underlying); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XGraphemeClusterBreakIteratorUtf16_destroy')); + +/// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is +/// out of range of a 32-bit signed integer. +/// +/// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterBreakIterator.html#method.next) for more information. +int next() { + + final result = _ICU4XGraphemeClusterBreakIteratorUtf16_next(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XGraphemeClusterBreakIteratorUtf16_next = - _capi)>>( - 'ICU4XGraphemeClusterBreakIteratorUtf16_next') - .asFunction)>(isLeaf: true); -} + static final _ICU4XGraphemeClusterBreakIteratorUtf16_next= _capi)>>('ICU4XGraphemeClusterBreakIteratorUtf16_next') + .asFunction)>(isLeaf: true); + + + } + /// See the [Rust documentation for `GraphemeClusterBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterBreakIterator.html) for more information. class GraphemeClusterBreakIteratorUtf8 implements ffi.Finalizable { - final ffi.Pointer _underlying; - GraphemeClusterBreakIteratorUtf8._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = ffi.NativeFinalizer( - _capi('ICU4XGraphemeClusterBreakIteratorUtf8_destroy')); + GraphemeClusterBreakIteratorUtf8._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is - /// out of range of a 32-bit signed integer. - /// - /// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterBreakIterator.html#method.next) for more information. - int next() { - final result = _ICU4XGraphemeClusterBreakIteratorUtf8_next(_underlying); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XGraphemeClusterBreakIteratorUtf8_destroy')); + +/// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is +/// out of range of a 32-bit signed integer. +/// +/// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterBreakIterator.html#method.next) for more information. +int next() { + + final result = _ICU4XGraphemeClusterBreakIteratorUtf8_next(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XGraphemeClusterBreakIteratorUtf8_next = - _capi)>>( - 'ICU4XGraphemeClusterBreakIteratorUtf8_next') - .asFunction)>(isLeaf: true); -} + static final _ICU4XGraphemeClusterBreakIteratorUtf8_next= _capi)>>('ICU4XGraphemeClusterBreakIteratorUtf8_next') + .asFunction)>(isLeaf: true); + + + } + /// An ICU4X grapheme-cluster-break segmenter, capable of finding grapheme cluster breakpoints /// in strings. -/// +/// /// See the [Rust documentation for `GraphemeClusterSegmenter`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenter.html) for more information. class GraphemeClusterSegmenter implements ffi.Finalizable { - final ffi.Pointer _underlying; - GraphemeClusterSegmenter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + final ffi.Pointer _underlying; + + GraphemeClusterSegmenter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XGraphemeClusterSegmenter_destroy')); + + +/// Construct an [`ICU4XGraphemeClusterSegmenter`]. +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenter.html#method.new) for more information. +factory GraphemeClusterSegmenter(DataProvider provider) { + + final result = _ICU4XGraphemeClusterSegmenter_create(provider._underlying); + return result.isOk ? GraphemeClusterSegmenter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XGraphemeClusterSegmenter_create= _capi)>>('ICU4XGraphemeClusterSegmenter_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XGraphemeClusterSegmenter_destroy')); - /// Construct an [`ICU4XGraphemeClusterSegmenter`]. - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenter.html#method.new) for more information. - factory GraphemeClusterSegmenter(DataProvider provider) { - final result = _ICU4XGraphemeClusterSegmenter_create(provider._underlying); - return result.isOk - ? GraphemeClusterSegmenter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Segments a (potentially ill-formed) UTF-8 string. +/// +/// See the [Rust documentation for `segment_utf8`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenter.html#method.segment_utf8) for more information. +GraphemeClusterBreakIteratorUtf8 segmentUtf8(String input) { + final alloc = ffi2.Arena(); + final inputSlice = _SliceFfi2Utf8._fromDart(input, alloc); + + final result = _ICU4XGraphemeClusterSegmenter_segment_utf8(_underlying,inputSlice._bytes,inputSlice._length);alloc.releaseAll(); + return GraphemeClusterBreakIteratorUtf8._(result); } // ignore: non_constant_identifier_names - static final _ICU4XGraphemeClusterSegmenter_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XGraphemeClusterSegmenter_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Segments a (potentially ill-formed) UTF-8 string. - /// - /// See the [Rust documentation for `segment_utf8`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenter.html#method.segment_utf8) for more information. - GraphemeClusterBreakIteratorUtf8 segmentUtf8(String input) { - final alloc = ffi2.Arena(); - final inputSlice = _SliceFfi2Utf8._fromDart(input, alloc); - - final result = _ICU4XGraphemeClusterSegmenter_segment_utf8( - _underlying, inputSlice._bytes, inputSlice._length); - alloc.releaseAll(); - return GraphemeClusterBreakIteratorUtf8._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XGraphemeClusterSegmenter_segment_utf8 = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XGraphemeClusterSegmenter_segment_utf8') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Segments a UTF-16 string. - /// - /// See the [Rust documentation for `segment_utf16`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenter.html#method.segment_utf16) for more information. - GraphemeClusterBreakIteratorUtf16 segmentUtf16(Uint16List input) { - final alloc = ffi2.Arena(); - final inputSlice = _SliceFfiUint16._fromDart(input, alloc); - - final result = _ICU4XGraphemeClusterSegmenter_segment_utf16( - _underlying, inputSlice._bytes, inputSlice._length); - alloc.releaseAll(); - return GraphemeClusterBreakIteratorUtf16._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XGraphemeClusterSegmenter_segment_utf16 = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XGraphemeClusterSegmenter_segment_utf16') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Segments a Latin-1 string. - /// - /// See the [Rust documentation for `segment_latin1`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenter.html#method.segment_latin1) for more information. - GraphemeClusterBreakIteratorLatin1 segmentLatin1(Uint8List input) { - final alloc = ffi2.Arena(); - final inputSlice = _SliceFfiUint8._fromDart(input, alloc); - - final result = _ICU4XGraphemeClusterSegmenter_segment_latin1( - _underlying, inputSlice._bytes, inputSlice._length); - alloc.releaseAll(); - return GraphemeClusterBreakIteratorLatin1._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XGraphemeClusterSegmenter_segment_latin1 = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XGraphemeClusterSegmenter_segment_latin1') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); -} + static final _ICU4XGraphemeClusterSegmenter_segment_utf8= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XGraphemeClusterSegmenter_segment_utf8') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Segments a UTF-16 string. +/// +/// See the [Rust documentation for `segment_utf16`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenter.html#method.segment_utf16) for more information. +GraphemeClusterBreakIteratorUtf16 segmentUtf16(Uint16List input) { + final alloc = ffi2.Arena(); + final inputSlice = _SliceFfiUint16._fromDart(input, alloc); + + final result = _ICU4XGraphemeClusterSegmenter_segment_utf16(_underlying,inputSlice._bytes,inputSlice._length);alloc.releaseAll(); + return GraphemeClusterBreakIteratorUtf16._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XGraphemeClusterSegmenter_segment_utf16= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XGraphemeClusterSegmenter_segment_utf16') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Segments a Latin-1 string. +/// +/// See the [Rust documentation for `segment_latin1`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenter.html#method.segment_latin1) for more information. +GraphemeClusterBreakIteratorLatin1 segmentLatin1(Uint8List input) { + final alloc = ffi2.Arena(); + final inputSlice = _SliceFfiUint8._fromDart(input, alloc); + + final result = _ICU4XGraphemeClusterSegmenter_segment_latin1(_underlying,inputSlice._bytes,inputSlice._length);alloc.releaseAll(); + return GraphemeClusterBreakIteratorLatin1._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XGraphemeClusterSegmenter_segment_latin1= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XGraphemeClusterSegmenter_segment_latin1') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + } + /// An ICU4X TypedDateFormatter object capable of formatting a [`ICU4XIsoDateTime`] as a string, /// using the Gregorian Calendar. -/// +/// /// See the [Rust documentation for `TypedDateFormatter`](https://docs.rs/icu/latest/icu/datetime/struct.TypedDateFormatter.html) for more information. class GregorianDateFormatter implements ffi.Finalizable { - final ffi.Pointer _underlying; - GregorianDateFormatter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XGregorianDateFormatter_destroy')); - - /// Creates a new [`ICU4XGregorianDateFormatter`] from locale data. - /// - /// See the [Rust documentation for `try_new_with_length`](https://docs.rs/icu/latest/icu/datetime/struct.TypedDateFormatter.html#method.try_new_with_length) for more information. - factory GregorianDateFormatter.withLength( - DataProvider provider, Locale locale, DateLength length) { - final result = _ICU4XGregorianDateFormatter_create_with_length( - provider._underlying, locale._underlying, length.index); - return result.isOk - ? GregorianDateFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XGregorianDateFormatter_create_with_length = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int32)>>('ICU4XGregorianDateFormatter_create_with_length') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Formats a [`ICU4XIsoDate`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TypedDateFormatter.html#method.format) for more information. - String formatIsoDate(IsoDate value) { - final writeable = _Writeable(); - final result = _ICU4XGregorianDateFormatter_format_iso_date( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XGregorianDateFormatter_format_iso_date = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XGregorianDateFormatter_format_iso_date') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Formats a [`ICU4XIsoDateTime`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TypedDateFormatter.html#method.format) for more information. - String formatIsoDatetime(IsoDateTime value) { - final writeable = _Writeable(); - final result = _ICU4XGregorianDateFormatter_format_iso_datetime( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XGregorianDateFormatter_format_iso_datetime = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XGregorianDateFormatter_format_iso_datetime') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + final ffi.Pointer _underlying; + + GregorianDateFormatter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XGregorianDateFormatter_destroy')); + + +/// Creates a new [`ICU4XGregorianDateFormatter`] from locale data. +/// +/// See the [Rust documentation for `try_new_with_length`](https://docs.rs/icu/latest/icu/datetime/struct.TypedDateFormatter.html#method.try_new_with_length) for more information. +factory GregorianDateFormatter.withLength(DataProvider provider, Locale locale, DateLength length) { + + final result = _ICU4XGregorianDateFormatter_create_with_length(provider._underlying,locale._underlying,length.index); + return result.isOk ? GregorianDateFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XGregorianDateFormatter_create_with_length= _capi, ffi.Pointer, ffi.Int32)>>('ICU4XGregorianDateFormatter_create_with_length') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Formats a [`ICU4XIsoDate`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TypedDateFormatter.html#method.format) for more information. +String formatIsoDate(IsoDate value) { + + final writeable = _Writeable(); + final result = _ICU4XGregorianDateFormatter_format_iso_date(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XGregorianDateFormatter_format_iso_date= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XGregorianDateFormatter_format_iso_date') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Formats a [`ICU4XIsoDateTime`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TypedDateFormatter.html#method.format) for more information. +String formatIsoDatetime(IsoDateTime value) { + + final writeable = _Writeable(); + final result = _ICU4XGregorianDateFormatter_format_iso_datetime(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XGregorianDateFormatter_format_iso_datetime= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XGregorianDateFormatter_format_iso_datetime') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + } + /// An ICU4X TypedDateTimeFormatter object capable of formatting a [`ICU4XIsoDateTime`] as a string, /// using the Gregorian Calendar. -/// +/// /// See the [Rust documentation for `TypedDateTimeFormatter`](https://docs.rs/icu/latest/icu/datetime/struct.TypedDateTimeFormatter.html) for more information. class GregorianDateTimeFormatter implements ffi.Finalizable { - final ffi.Pointer _underlying; - GregorianDateTimeFormatter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + final ffi.Pointer _underlying; + + GregorianDateTimeFormatter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XGregorianDateTimeFormatter_destroy')); + + +/// Creates a new [`ICU4XGregorianDateFormatter`] from locale data. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/struct.TypedDateTimeFormatter.html#method.try_new) for more information. +factory GregorianDateTimeFormatter.withLengths(DataProvider provider, Locale locale, DateLength dateLength, TimeLength timeLength) { + + final result = _ICU4XGregorianDateTimeFormatter_create_with_lengths(provider._underlying,locale._underlying,dateLength.index,timeLength.index); + return result.isOk ? GregorianDateTimeFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XGregorianDateTimeFormatter_create_with_lengths= _capi, ffi.Pointer, ffi.Int32, ffi.Int32)>>('ICU4XGregorianDateTimeFormatter_create_with_lengths') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int, int)>(isLeaf: true); - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XGregorianDateTimeFormatter_destroy')); - /// Creates a new [`ICU4XGregorianDateFormatter`] from locale data. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/struct.TypedDateTimeFormatter.html#method.try_new) for more information. - factory GregorianDateTimeFormatter.withLengths(DataProvider provider, - Locale locale, DateLength dateLength, TimeLength timeLength) { - final result = _ICU4XGregorianDateTimeFormatter_create_with_lengths( - provider._underlying, - locale._underlying, - dateLength.index, - timeLength.index); - return result.isOk - ? GregorianDateTimeFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Formats a [`ICU4XIsoDateTime`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TypedDateTimeFormatter.html#method.format) for more information. +String formatIsoDatetime(IsoDateTime value) { + + final writeable = _Writeable(); + final result = _ICU4XGregorianDateTimeFormatter_format_iso_datetime(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XGregorianDateTimeFormatter_create_with_lengths = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Int32, ffi.Int32)>>( - 'ICU4XGregorianDateTimeFormatter_create_with_lengths') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, int, int)>(isLeaf: true); - - /// Formats a [`ICU4XIsoDateTime`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TypedDateTimeFormatter.html#method.format) for more information. - String formatIsoDatetime(IsoDateTime value) { - final writeable = _Writeable(); - final result = _ICU4XGregorianDateTimeFormatter_format_iso_datetime( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XGregorianDateTimeFormatter_format_iso_datetime = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XGregorianDateTimeFormatter_format_iso_datetime') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XGregorianDateTimeFormatter_format_iso_datetime= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XGregorianDateTimeFormatter_format_iso_datetime') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + } + /// An object capable of formatting a date time with time zone to a string. -/// +/// /// See the [Rust documentation for `TypedZonedDateTimeFormatter`](https://docs.rs/icu/latest/icu/datetime/struct.TypedZonedDateTimeFormatter.html) for more information. class GregorianZonedDateTimeFormatter implements ffi.Finalizable { - final ffi.Pointer _underlying; - GregorianZonedDateTimeFormatter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = ffi.NativeFinalizer( - _capi('ICU4XGregorianZonedDateTimeFormatter_destroy')); - - /// Creates a new [`ICU4XGregorianZonedDateTimeFormatter`] from locale data. - /// - /// This function has `date_length` and `time_length` arguments and uses default options - /// for the time zone. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/struct.TypedZonedDateTimeFormatter.html#method.try_new) for more information. - factory GregorianZonedDateTimeFormatter.withLengths(DataProvider provider, - Locale locale, DateLength dateLength, TimeLength timeLength) { - final result = _ICU4XGregorianZonedDateTimeFormatter_create_with_lengths( - provider._underlying, - locale._underlying, - dateLength.index, - timeLength.index); - return result.isOk - ? GregorianZonedDateTimeFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XGregorianZonedDateTimeFormatter_create_with_lengths = - _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Int32, ffi.Int32)>>( - 'ICU4XGregorianZonedDateTimeFormatter_create_with_lengths') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, int, int)>(isLeaf: true); - - /// Creates a new [`ICU4XGregorianZonedDateTimeFormatter`] from locale data. - /// - /// This function has `date_length` and `time_length` arguments and uses an ISO-8601 style - /// fallback for the time zone with the given configurations. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/struct.TypedZonedDateTimeFormatter.html#method.try_new) for more information. - factory GregorianZonedDateTimeFormatter.withLengthsAndIso8601TimeZoneFallback( - DataProvider provider, - Locale locale, - DateLength dateLength, - TimeLength timeLength, - IsoTimeZoneOptions zoneOptions) { - final result = - _ICU4XGregorianZonedDateTimeFormatter_create_with_lengths_and_iso_8601_time_zone_fallback( - provider._underlying, - locale._underlying, - dateLength.index, - timeLength.index, - zoneOptions._underlying); - return result.isOk - ? GregorianZonedDateTimeFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XGregorianZonedDateTimeFormatter_create_with_lengths_and_iso_8601_time_zone_fallback = - _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int32, - ffi.Int32, - _IsoTimeZoneOptionsFfi)>>( - 'ICU4XGregorianZonedDateTimeFormatter_create_with_lengths_and_iso_8601_time_zone_fallback') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - _IsoTimeZoneOptionsFfi)>(isLeaf: true); - - /// Formats a [`ICU4XIsoDateTime`] and [`ICU4XCustomTimeZone`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TypedZonedDateTimeFormatter.html#method.format) for more information. - String formatIsoDatetimeWithCustomTimeZone( - IsoDateTime datetime, CustomTimeZone timeZone) { - final writeable = _Writeable(); - final result = - _ICU4XGregorianZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone( - _underlying, - datetime._underlying, - timeZone._underlying, - writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XGregorianZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone = - _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>( - 'ICU4XGregorianZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(isLeaf: true); -} + final ffi.Pointer _underlying; + + GregorianZonedDateTimeFormatter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XGregorianZonedDateTimeFormatter_destroy')); + + +/// Creates a new [`ICU4XGregorianZonedDateTimeFormatter`] from locale data. +/// +/// This function has `date_length` and `time_length` arguments and uses default options +/// for the time zone. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/struct.TypedZonedDateTimeFormatter.html#method.try_new) for more information. +factory GregorianZonedDateTimeFormatter.withLengths(DataProvider provider, Locale locale, DateLength dateLength, TimeLength timeLength) { + + final result = _ICU4XGregorianZonedDateTimeFormatter_create_with_lengths(provider._underlying,locale._underlying,dateLength.index,timeLength.index); + return result.isOk ? GregorianZonedDateTimeFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XGregorianZonedDateTimeFormatter_create_with_lengths= _capi, ffi.Pointer, ffi.Int32, ffi.Int32)>>('ICU4XGregorianZonedDateTimeFormatter_create_with_lengths') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int, int)>(isLeaf: true); + + + +/// Creates a new [`ICU4XGregorianZonedDateTimeFormatter`] from locale data. +/// +/// This function has `date_length` and `time_length` arguments and uses an ISO-8601 style +/// fallback for the time zone with the given configurations. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/struct.TypedZonedDateTimeFormatter.html#method.try_new) for more information. +factory GregorianZonedDateTimeFormatter.withLengthsAndIso8601TimeZoneFallback(DataProvider provider, Locale locale, DateLength dateLength, TimeLength timeLength, IsoTimeZoneOptions zoneOptions) { + + final result = _ICU4XGregorianZonedDateTimeFormatter_create_with_lengths_and_iso_8601_time_zone_fallback(provider._underlying,locale._underlying,dateLength.index,timeLength.index,zoneOptions._underlying); + return result.isOk ? GregorianZonedDateTimeFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XGregorianZonedDateTimeFormatter_create_with_lengths_and_iso_8601_time_zone_fallback= _capi, ffi.Pointer, ffi.Int32, ffi.Int32, _IsoTimeZoneOptionsFfi)>>('ICU4XGregorianZonedDateTimeFormatter_create_with_lengths_and_iso_8601_time_zone_fallback') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int, int, _IsoTimeZoneOptionsFfi)>(isLeaf: true); + + + +/// Formats a [`ICU4XIsoDateTime`] and [`ICU4XCustomTimeZone`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TypedZonedDateTimeFormatter.html#method.format) for more information. +String formatIsoDatetimeWithCustomTimeZone(IsoDateTime datetime, CustomTimeZone timeZone) { + + final writeable = _Writeable(); + final result = _ICU4XGregorianZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone(_underlying,datetime._underlying,timeZone._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XGregorianZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone= _capi, ffi.Pointer, ffi.Pointer, ffi.Pointer)>>('ICU4XGregorianZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + } + /// An object capable of mapping from an IANA time zone ID to a BCP-47 ID. -/// +/// /// This can be used via `try_set_iana_time_zone_id()` on [`ICU4XCustomTimeZone`]. -/// +/// /// [`ICU4XCustomTimeZone`]: crate::timezone::ffi::ICU4XCustomTimeZone -/// +/// /// See the [Rust documentation for `IanaToBcp47Mapper`](https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47Mapper.html) for more information. class IanaToBcp47Mapper implements ffi.Finalizable { - final ffi.Pointer _underlying; - IanaToBcp47Mapper._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + final ffi.Pointer _underlying; + + IanaToBcp47Mapper._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XIanaToBcp47Mapper_destroy')); + + +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47Mapper.html#method.new) for more information. +factory IanaToBcp47Mapper(DataProvider provider) { + + final result = _ICU4XIanaToBcp47Mapper_create(provider._underlying); + return result.isOk ? IanaToBcp47Mapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XIanaToBcp47Mapper_create= _capi)>>('ICU4XIanaToBcp47Mapper_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + } + + +/// An ICU4X Date object capable of containing a ISO-8601 date +/// +/// See the [Rust documentation for `Date`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html) for more information. +class IsoDate implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + IsoDate._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XIsoDate_destroy')); + + +/// Creates a new [`ICU4XIsoDate`] from the specified date and time. +/// +/// See the [Rust documentation for `try_new_iso_date`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.try_new_iso_date) for more information. +factory IsoDate(int year, int month, int day) { + + final result = _ICU4XIsoDate_create(year,month,day); + return result.isOk ? IsoDate._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDate_create= _capi>('ICU4XIsoDate_create') + .asFunction<_ResultOpaqueInt32 Function(int, int, int)>(isLeaf: true); - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XIanaToBcp47Mapper_destroy')); - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47Mapper.html#method.new) for more information. - factory IanaToBcp47Mapper(DataProvider provider) { - final result = _ICU4XIanaToBcp47Mapper_create(provider._underlying); - return result.isOk - ? IanaToBcp47Mapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Creates a new [`ICU4XIsoDate`] representing January 1, 1970. +/// +/// See the [Rust documentation for `unix_epoch`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.unix_epoch) for more information. +factory IsoDate.forUnixEpoch() { + + final result = _ICU4XIsoDate_create_for_unix_epoch(); + return IsoDate._(result); } // ignore: non_constant_identifier_names - static final _ICU4XIanaToBcp47Mapper_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XIanaToBcp47Mapper_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); -} + static final _ICU4XIsoDate_create_for_unix_epoch= _capi Function()>>('ICU4XIsoDate_create_for_unix_epoch') + .asFunction Function()>(isLeaf: true); -/// An ICU4X Date object capable of containing a ISO-8601 date -/// -/// See the [Rust documentation for `Date`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html) for more information. -class IsoDate implements ffi.Finalizable { - final ffi.Pointer _underlying; - IsoDate._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + +/// Convert this date to one in a different calendar +/// +/// See the [Rust documentation for `to_calendar`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_calendar) for more information. +Date toCalendar(Calendar calendar) { + + final result = _ICU4XIsoDate_to_calendar(_underlying,calendar._underlying); + return Date._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDate_to_calendar= _capi Function(ffi.Pointer, ffi.Pointer)>>('ICU4XIsoDate_to_calendar') + .asFunction Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); - static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XIsoDate_destroy')); - /// Creates a new [`ICU4XIsoDate`] from the specified date and time. - /// - /// See the [Rust documentation for `try_new_iso_date`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.try_new_iso_date) for more information. - factory IsoDate(int year, int month, int day) { - final result = _ICU4XIsoDate_create(year, month, day); - return result.isOk - ? IsoDate._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// See the [Rust documentation for `to_any`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_any) for more information. +Date toAny() { + + final result = _ICU4XIsoDate_to_any(_underlying); + return Date._(result); } // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Int32, ffi.Uint8, ffi.Uint8)>>('ICU4XIsoDate_create') - .asFunction<_ResultOpaqueInt32 Function(int, int, int)>(isLeaf: true); + static final _ICU4XIsoDate_to_any= _capi Function(ffi.Pointer)>>('ICU4XIsoDate_to_any') + .asFunction Function(ffi.Pointer)>(isLeaf: true); - /// Creates a new [`ICU4XIsoDate`] representing January 1, 1970. - /// - /// See the [Rust documentation for `unix_epoch`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.unix_epoch) for more information. - factory IsoDate.forUnixEpoch() { - final result = _ICU4XIsoDate_create_for_unix_epoch(); - return IsoDate._(result); + + +/// Returns the 1-indexed day in the month for this date +/// +/// See the [Rust documentation for `day_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_month) for more information. +int get dayOfMonth { + + final result = _ICU4XIsoDate_day_of_month(_underlying); + return result; } // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_create_for_unix_epoch = - _capi Function()>>( - 'ICU4XIsoDate_create_for_unix_epoch') - .asFunction Function()>(isLeaf: true); + static final _ICU4XIsoDate_day_of_month= _capi)>>('ICU4XIsoDate_day_of_month') + .asFunction)>(isLeaf: true); - /// Convert this date to one in a different calendar - /// - /// See the [Rust documentation for `to_calendar`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_calendar) for more information. - Date toCalendar(Calendar calendar) { - final result = _ICU4XIsoDate_to_calendar(_underlying, calendar._underlying); - return Date._(result); - } + +/// Returns the day in the week for this day +/// +/// See the [Rust documentation for `day_of_week`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_week) for more information. +IsoWeekday get dayOfWeek { + + final result = _ICU4XIsoDate_day_of_week(_underlying); + return IsoWeekday.values.firstWhere((v) => v._underlying == result); + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_to_calendar = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XIsoDate_to_calendar') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); + static final _ICU4XIsoDate_day_of_week= _capi)>>('ICU4XIsoDate_day_of_week') + .asFunction)>(isLeaf: true); - /// See the [Rust documentation for `to_any`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_any) for more information. - Date toAny() { - final result = _ICU4XIsoDate_to_any(_underlying); - return Date._(result); - } + +/// Returns the week number in this month, 1-indexed, based on what +/// is considered the first day of the week (often a locale preference). +/// +/// `first_weekday` can be obtained via `first_weekday()` on [`ICU4XWeekCalculator`] +/// +/// See the [Rust documentation for `week_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_month) for more information. +int weekOfMonth(IsoWeekday firstWeekday) { + + final result = _ICU4XIsoDate_week_of_month(_underlying,firstWeekday._underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_to_any = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XIsoDate_to_any') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XIsoDate_week_of_month= _capi, ffi.Int32)>>('ICU4XIsoDate_week_of_month') + .asFunction, int)>(isLeaf: true); - /// Returns the 1-indexed day in the month for this date - /// - /// See the [Rust documentation for `day_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_month) for more information. - int get dayOfMonth { - final result = _ICU4XIsoDate_day_of_month(_underlying); - return result; - } + +/// Returns the week number in this year, using week data +/// +/// See the [Rust documentation for `week_of_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_year) for more information. +WeekOf weekOfYear(WeekCalculator calculator) { + + final result = _ICU4XIsoDate_week_of_year(_underlying,calculator._underlying); + return result.isOk ? WeekOf._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_day_of_month = - _capi)>>( - 'ICU4XIsoDate_day_of_month') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDate_week_of_year= _capi, ffi.Pointer)>>('ICU4XIsoDate_week_of_year') + .asFunction<_ResultWeekOfFfiInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); - /// Returns the day in the week for this day - /// - /// See the [Rust documentation for `day_of_week`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_week) for more information. - IsoWeekday get dayOfWeek { - final result = _ICU4XIsoDate_day_of_week(_underlying); - return IsoWeekday.values.firstWhere((v) => v._underlying == result); - } + +/// Returns 1-indexed number of the month of this date in its year +/// +/// See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. +int get month { + + final result = _ICU4XIsoDate_month(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_day_of_week = - _capi)>>( - 'ICU4XIsoDate_day_of_week') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDate_month= _capi)>>('ICU4XIsoDate_month') + .asFunction)>(isLeaf: true); - /// Returns the week number in this month, 1-indexed, based on what - /// is considered the first day of the week (often a locale preference). - /// - /// `first_weekday` can be obtained via `first_weekday()` on [`ICU4XWeekCalculator`] - /// - /// See the [Rust documentation for `week_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_month) for more information. - int weekOfMonth(IsoWeekday firstWeekday) { - final result = - _ICU4XIsoDate_week_of_month(_underlying, firstWeekday._underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_week_of_month = _capi< - ffi.NativeFunction< - ffi.Uint32 Function(ffi.Pointer, - ffi.Int32)>>('ICU4XIsoDate_week_of_month') - .asFunction, int)>(isLeaf: true); - - /// Returns the week number in this year, using week data - /// - /// See the [Rust documentation for `week_of_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_year) for more information. - WeekOf weekOfYear(WeekCalculator calculator) { - final result = - _ICU4XIsoDate_week_of_year(_underlying, calculator._underlying); - return result.isOk - ? WeekOf._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_week_of_year = _capi< - ffi.NativeFunction< - _ResultWeekOfFfiInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XIsoDate_week_of_year') - .asFunction< - _ResultWeekOfFfiInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Returns 1-indexed number of the month of this date in its year - /// - /// See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. - int get month { - final result = _ICU4XIsoDate_month(_underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_month = - _capi)>>( - 'ICU4XIsoDate_month') - .asFunction)>(isLeaf: true); - /// Returns the year number for this date - /// - /// See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) for more information. - int get year { - final result = _ICU4XIsoDate_year(_underlying); - return result; + +/// Returns the year number for this date +/// +/// See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) for more information. +int get year { + + final result = _ICU4XIsoDate_year(_underlying); + return result; } - // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_year = - _capi)>>( - 'ICU4XIsoDate_year') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDate_year= _capi)>>('ICU4XIsoDate_year') + .asFunction)>(isLeaf: true); - /// Returns if the year is a leap year for this date - /// - /// See the [Rust documentation for `is_in_leap_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.is_in_leap_year) for more information. - bool get isInLeapYear { - final result = _ICU4XIsoDate_is_in_leap_year(_underlying); - return result; - } + +/// Returns if the year is a leap year for this date +/// +/// See the [Rust documentation for `is_in_leap_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.is_in_leap_year) for more information. +bool get isInLeapYear { + + final result = _ICU4XIsoDate_is_in_leap_year(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_is_in_leap_year = - _capi)>>( - 'ICU4XIsoDate_is_in_leap_year') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDate_is_in_leap_year= _capi)>>('ICU4XIsoDate_is_in_leap_year') + .asFunction)>(isLeaf: true); - /// Returns the number of months in the year represented by this date - /// - /// See the [Rust documentation for `months_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.months_in_year) for more information. - int get monthsInYear { - final result = _ICU4XIsoDate_months_in_year(_underlying); - return result; - } + +/// Returns the number of months in the year represented by this date +/// +/// See the [Rust documentation for `months_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.months_in_year) for more information. +int get monthsInYear { + + final result = _ICU4XIsoDate_months_in_year(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_months_in_year = - _capi)>>( - 'ICU4XIsoDate_months_in_year') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDate_months_in_year= _capi)>>('ICU4XIsoDate_months_in_year') + .asFunction)>(isLeaf: true); - /// Returns the number of days in the month represented by this date - /// - /// See the [Rust documentation for `days_in_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_month) for more information. - int get daysInMonth { - final result = _ICU4XIsoDate_days_in_month(_underlying); - return result; - } + +/// Returns the number of days in the month represented by this date +/// +/// See the [Rust documentation for `days_in_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_month) for more information. +int get daysInMonth { + + final result = _ICU4XIsoDate_days_in_month(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_days_in_month = - _capi)>>( - 'ICU4XIsoDate_days_in_month') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDate_days_in_month= _capi)>>('ICU4XIsoDate_days_in_month') + .asFunction)>(isLeaf: true); - /// Returns the number of days in the year represented by this date - /// - /// See the [Rust documentation for `days_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_year) for more information. - int get daysInYear { - final result = _ICU4XIsoDate_days_in_year(_underlying); - return result; - } + +/// Returns the number of days in the year represented by this date +/// +/// See the [Rust documentation for `days_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_year) for more information. +int get daysInYear { + + final result = _ICU4XIsoDate_days_in_year(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDate_days_in_year = - _capi)>>( - 'ICU4XIsoDate_days_in_year') - .asFunction)>(isLeaf: true); -} + static final _ICU4XIsoDate_days_in_year= _capi)>>('ICU4XIsoDate_days_in_year') + .asFunction)>(isLeaf: true); + + + } + /// An ICU4X DateTime object capable of containing a ISO-8601 date and time. -/// +/// /// See the [Rust documentation for `DateTime`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html) for more information. class IsoDateTime implements ffi.Finalizable { - final ffi.Pointer _underlying; - IsoDateTime._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XIsoDateTime_destroy')); - - /// Creates a new [`ICU4XIsoDateTime`] from the specified date and time. - /// - /// See the [Rust documentation for `try_new_iso_datetime`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.try_new_iso_datetime) for more information. - factory IsoDateTime(int year, int month, int day, int hour, int minute, - int second, int nanosecond) { - final result = _ICU4XIsoDateTime_create( - year, month, day, hour, minute, second, nanosecond); - return result.isOk - ? IsoDateTime._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Int32, - ffi.Uint8, - ffi.Uint8, - ffi.Uint8, - ffi.Uint8, - ffi.Uint8, - ffi.Uint32)>>('ICU4XIsoDateTime_create') - .asFunction< - _ResultOpaqueInt32 Function( - int, int, int, int, int, int, int)>(isLeaf: true); - - /// Creates a new [`ICU4XIsoDateTime`] from an [`ICU4XIsoDate`] and [`ICU4XTime`] object - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.new) for more information. - factory IsoDateTime.fromDateAndTime(IsoDate date, Time time) { - final result = _ICU4XIsoDateTime_crate_from_date_and_time( - date._underlying, time._underlying); - return IsoDateTime._(result); - } - // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_crate_from_date_and_time = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XIsoDateTime_crate_from_date_and_time') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Construct from the minutes since the local unix epoch for this date (Jan 1 1970, 00:00) - /// - /// See the [Rust documentation for `from_minutes_since_local_unix_epoch`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.from_minutes_since_local_unix_epoch) for more information. - factory IsoDateTime.fromMinutesSinceLocalUnixEpoch(int minutes) { - final result = - _ICU4XIsoDateTime_create_from_minutes_since_local_unix_epoch(minutes); - return IsoDateTime._(result); - } - // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_create_from_minutes_since_local_unix_epoch = - _capi Function(ffi.Int32)>>( - 'ICU4XIsoDateTime_create_from_minutes_since_local_unix_epoch') - .asFunction Function(int)>(isLeaf: true); - - /// Gets the date contained in this object - /// - /// See the [Rust documentation for `date`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#structfield.date) for more information. - IsoDate get date { - final result = _ICU4XIsoDateTime_date(_underlying); - return IsoDate._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_date = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XIsoDateTime_date') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); - - /// Gets the time contained in this object - /// - /// See the [Rust documentation for `time`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#structfield.time) for more information. - Time get time { - final result = _ICU4XIsoDateTime_time(_underlying); - return Time._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_time = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XIsoDateTime_time') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); - - /// Converts this to an [`ICU4XDateTime`] capable of being mixed with dates of - /// other calendars - /// - /// See the [Rust documentation for `to_any`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.to_any) for more information. - DateTime toAny() { - final result = _ICU4XIsoDateTime_to_any(_underlying); - return DateTime._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_to_any = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XIsoDateTime_to_any') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); - - /// Gets the minutes since the local unix epoch for this date (Jan 1 1970, 00:00) - /// - /// See the [Rust documentation for `minutes_since_local_unix_epoch`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.minutes_since_local_unix_epoch) for more information. - int get minutesSinceLocalUnixEpoch { - final result = - _ICU4XIsoDateTime_minutes_since_local_unix_epoch(_underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_minutes_since_local_unix_epoch = - _capi)>>( - 'ICU4XIsoDateTime_minutes_since_local_unix_epoch') - .asFunction)>(isLeaf: true); + final ffi.Pointer _underlying; - /// Convert this datetime to one in a different calendar - /// - /// See the [Rust documentation for `to_calendar`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.to_calendar) for more information. - DateTime toCalendar(Calendar calendar) { - final result = - _ICU4XIsoDateTime_to_calendar(_underlying, calendar._underlying); - return DateTime._(result); - } + IsoDateTime._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_to_calendar = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XIsoDateTime_to_calendar') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XIsoDateTime_destroy')); - /// Returns the hour in this time - /// - /// See the [Rust documentation for `hour`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.hour) for more information. - int get hour { - final result = _ICU4XIsoDateTime_hour(_underlying); - return result; + +/// Creates a new [`ICU4XIsoDateTime`] from the specified date and time. +/// +/// See the [Rust documentation for `try_new_iso_datetime`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.try_new_iso_datetime) for more information. +factory IsoDateTime(int year, int month, int day, int hour, int minute, int second, int nanosecond) { + + final result = _ICU4XIsoDateTime_create(year,month,day,hour,minute,second,nanosecond); + return result.isOk ? IsoDateTime._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDateTime_create= _capi>('ICU4XIsoDateTime_create') + .asFunction<_ResultOpaqueInt32 Function(int, int, int, int, int, int, int)>(isLeaf: true); + + +/// Creates a new [`ICU4XIsoDateTime`] from an [`ICU4XIsoDate`] and [`ICU4XTime`] object +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.new) for more information. +factory IsoDateTime.fromDateAndTime(IsoDate date, Time time) { + + final result = _ICU4XIsoDateTime_crate_from_date_and_time(date._underlying,time._underlying); + return IsoDateTime._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_hour = - _capi)>>( - 'ICU4XIsoDateTime_hour') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDateTime_crate_from_date_and_time= _capi Function(ffi.Pointer, ffi.Pointer)>>('ICU4XIsoDateTime_crate_from_date_and_time') + .asFunction Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); - /// Returns the minute in this time - /// - /// See the [Rust documentation for `minute`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.minute) for more information. - int get minute { - final result = _ICU4XIsoDateTime_minute(_underlying); - return result; + + +/// Construct from the minutes since the local unix epoch for this date (Jan 1 1970, 00:00) +/// +/// See the [Rust documentation for `from_minutes_since_local_unix_epoch`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.from_minutes_since_local_unix_epoch) for more information. +factory IsoDateTime.fromMinutesSinceLocalUnixEpoch(int minutes) { + + final result = _ICU4XIsoDateTime_create_from_minutes_since_local_unix_epoch(minutes); + return IsoDateTime._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDateTime_create_from_minutes_since_local_unix_epoch= _capi Function(ffi.Int32)>>('ICU4XIsoDateTime_create_from_minutes_since_local_unix_epoch') + .asFunction Function(int)>(isLeaf: true); + + +/// Gets the date contained in this object +/// +/// See the [Rust documentation for `date`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#structfield.date) for more information. +IsoDate get date { + + final result = _ICU4XIsoDateTime_date(_underlying); + return IsoDate._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_minute = - _capi)>>( - 'ICU4XIsoDateTime_minute') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDateTime_date= _capi Function(ffi.Pointer)>>('ICU4XIsoDateTime_date') + .asFunction Function(ffi.Pointer)>(isLeaf: true); + - /// Returns the second in this time - /// - /// See the [Rust documentation for `second`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.second) for more information. - int get second { - final result = _ICU4XIsoDateTime_second(_underlying); - return result; + +/// Gets the time contained in this object +/// +/// See the [Rust documentation for `time`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#structfield.time) for more information. +Time get time { + + final result = _ICU4XIsoDateTime_time(_underlying); + return Time._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDateTime_time= _capi Function(ffi.Pointer)>>('ICU4XIsoDateTime_time') + .asFunction Function(ffi.Pointer)>(isLeaf: true); + + +/// Converts this to an [`ICU4XDateTime`] capable of being mixed with dates of +/// other calendars +/// +/// See the [Rust documentation for `to_any`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.to_any) for more information. +DateTime toAny() { + + final result = _ICU4XIsoDateTime_to_any(_underlying); + return DateTime._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_second = - _capi)>>( - 'ICU4XIsoDateTime_second') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDateTime_to_any= _capi Function(ffi.Pointer)>>('ICU4XIsoDateTime_to_any') + .asFunction Function(ffi.Pointer)>(isLeaf: true); - /// Returns the nanosecond in this time - /// - /// See the [Rust documentation for `nanosecond`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.nanosecond) for more information. - int get nanosecond { - final result = _ICU4XIsoDateTime_nanosecond(_underlying); - return result; + + +/// Gets the minutes since the local unix epoch for this date (Jan 1 1970, 00:00) +/// +/// See the [Rust documentation for `minutes_since_local_unix_epoch`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.minutes_since_local_unix_epoch) for more information. +int get minutesSinceLocalUnixEpoch { + + final result = _ICU4XIsoDateTime_minutes_since_local_unix_epoch(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDateTime_minutes_since_local_unix_epoch= _capi)>>('ICU4XIsoDateTime_minutes_since_local_unix_epoch') + .asFunction)>(isLeaf: true); + + +/// Convert this datetime to one in a different calendar +/// +/// See the [Rust documentation for `to_calendar`](https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.to_calendar) for more information. +DateTime toCalendar(Calendar calendar) { + + final result = _ICU4XIsoDateTime_to_calendar(_underlying,calendar._underlying); + return DateTime._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_nanosecond = - _capi)>>( - 'ICU4XIsoDateTime_nanosecond') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDateTime_to_calendar= _capi Function(ffi.Pointer, ffi.Pointer)>>('ICU4XIsoDateTime_to_calendar') + .asFunction Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + - /// Returns the 1-indexed day in the month for this date - /// - /// See the [Rust documentation for `day_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_month) for more information. - int get dayOfMonth { - final result = _ICU4XIsoDateTime_day_of_month(_underlying); - return result; + +/// Returns the hour in this time +/// +/// See the [Rust documentation for `hour`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.hour) for more information. +int get hour { + + final result = _ICU4XIsoDateTime_hour(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDateTime_hour= _capi)>>('ICU4XIsoDateTime_hour') + .asFunction)>(isLeaf: true); + + +/// Returns the minute in this time +/// +/// See the [Rust documentation for `minute`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.minute) for more information. +int get minute { + + final result = _ICU4XIsoDateTime_minute(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_day_of_month = - _capi)>>( - 'ICU4XIsoDateTime_day_of_month') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDateTime_minute= _capi)>>('ICU4XIsoDateTime_minute') + .asFunction)>(isLeaf: true); - /// Returns the day in the week for this day - /// - /// See the [Rust documentation for `day_of_week`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_week) for more information. - IsoWeekday get dayOfWeek { - final result = _ICU4XIsoDateTime_day_of_week(_underlying); - return IsoWeekday.values.firstWhere((v) => v._underlying == result); + + +/// Returns the second in this time +/// +/// See the [Rust documentation for `second`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.second) for more information. +int get second { + + final result = _ICU4XIsoDateTime_second(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDateTime_second= _capi)>>('ICU4XIsoDateTime_second') + .asFunction)>(isLeaf: true); + + +/// Returns the nanosecond in this time +/// +/// See the [Rust documentation for `nanosecond`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.nanosecond) for more information. +int get nanosecond { + + final result = _ICU4XIsoDateTime_nanosecond(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_day_of_week = - _capi)>>( - 'ICU4XIsoDateTime_day_of_week') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDateTime_nanosecond= _capi)>>('ICU4XIsoDateTime_nanosecond') + .asFunction)>(isLeaf: true); - /// Returns the week number in this month, 1-indexed, based on what - /// is considered the first day of the week (often a locale preference). - /// - /// `first_weekday` can be obtained via `first_weekday()` on [`ICU4XWeekCalculator`] - /// - /// See the [Rust documentation for `week_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_month) for more information. - int weekOfMonth(IsoWeekday firstWeekday) { - final result = - _ICU4XIsoDateTime_week_of_month(_underlying, firstWeekday._underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_week_of_month = _capi< - ffi.NativeFunction< - ffi.Uint32 Function(ffi.Pointer, - ffi.Int32)>>('ICU4XIsoDateTime_week_of_month') - .asFunction, int)>(isLeaf: true); - - /// Returns the week number in this year, using week data - /// - /// See the [Rust documentation for `week_of_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_year) for more information. - WeekOf weekOfYear(WeekCalculator calculator) { - final result = - _ICU4XIsoDateTime_week_of_year(_underlying, calculator._underlying); - return result.isOk - ? WeekOf._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_week_of_year = _capi< - ffi.NativeFunction< - _ResultWeekOfFfiInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XIsoDateTime_week_of_year') - .asFunction< - _ResultWeekOfFfiInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Returns 1-indexed number of the month of this date in its year - /// - /// See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. - int get month { - final result = _ICU4XIsoDateTime_month(_underlying); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_month = - _capi)>>( - 'ICU4XIsoDateTime_month') - .asFunction)>(isLeaf: true); - /// Returns the year number for this date - /// - /// See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) for more information. - int get year { - final result = _ICU4XIsoDateTime_year(_underlying); - return result; + +/// Returns the 1-indexed day in the month for this date +/// +/// See the [Rust documentation for `day_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_month) for more information. +int get dayOfMonth { + + final result = _ICU4XIsoDateTime_day_of_month(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDateTime_day_of_month= _capi)>>('ICU4XIsoDateTime_day_of_month') + .asFunction)>(isLeaf: true); + + +/// Returns the day in the week for this day +/// +/// See the [Rust documentation for `day_of_week`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_week) for more information. +IsoWeekday get dayOfWeek { + + final result = _ICU4XIsoDateTime_day_of_week(_underlying); + return IsoWeekday.values.firstWhere((v) => v._underlying == result); + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_year = - _capi)>>( - 'ICU4XIsoDateTime_year') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDateTime_day_of_week= _capi)>>('ICU4XIsoDateTime_day_of_week') + .asFunction)>(isLeaf: true); - /// Returns whether this date is in a leap year - /// - /// See the [Rust documentation for `is_in_leap_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.is_in_leap_year) for more information. - bool get isInLeapYear { - final result = _ICU4XIsoDateTime_is_in_leap_year(_underlying); - return result; + + +/// Returns the week number in this month, 1-indexed, based on what +/// is considered the first day of the week (often a locale preference). +/// +/// `first_weekday` can be obtained via `first_weekday()` on [`ICU4XWeekCalculator`] +/// +/// See the [Rust documentation for `week_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_month) for more information. +int weekOfMonth(IsoWeekday firstWeekday) { + + final result = _ICU4XIsoDateTime_week_of_month(_underlying,firstWeekday._underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDateTime_week_of_month= _capi, ffi.Int32)>>('ICU4XIsoDateTime_week_of_month') + .asFunction, int)>(isLeaf: true); + + +/// Returns the week number in this year, using week data +/// +/// See the [Rust documentation for `week_of_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_year) for more information. +WeekOf weekOfYear(WeekCalculator calculator) { + + final result = _ICU4XIsoDateTime_week_of_year(_underlying,calculator._underlying); + return result.isOk ? WeekOf._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_is_in_leap_year = - _capi)>>( - 'ICU4XIsoDateTime_is_in_leap_year') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDateTime_week_of_year= _capi, ffi.Pointer)>>('ICU4XIsoDateTime_week_of_year') + .asFunction<_ResultWeekOfFfiInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); - /// Returns the number of months in the year represented by this date - /// - /// See the [Rust documentation for `months_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.months_in_year) for more information. - int get monthsInYear { - final result = _ICU4XIsoDateTime_months_in_year(_underlying); - return result; + + +/// Returns 1-indexed number of the month of this date in its year +/// +/// See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. +int get month { + + final result = _ICU4XIsoDateTime_month(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDateTime_month= _capi)>>('ICU4XIsoDateTime_month') + .asFunction)>(isLeaf: true); + + +/// Returns the year number for this date +/// +/// See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) for more information. +int get year { + + final result = _ICU4XIsoDateTime_year(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_months_in_year = - _capi)>>( - 'ICU4XIsoDateTime_months_in_year') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDateTime_year= _capi)>>('ICU4XIsoDateTime_year') + .asFunction)>(isLeaf: true); + - /// Returns the number of days in the month represented by this date - /// - /// See the [Rust documentation for `days_in_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_month) for more information. - int get daysInMonth { - final result = _ICU4XIsoDateTime_days_in_month(_underlying); - return result; + +/// Returns whether this date is in a leap year +/// +/// See the [Rust documentation for `is_in_leap_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.is_in_leap_year) for more information. +bool get isInLeapYear { + + final result = _ICU4XIsoDateTime_is_in_leap_year(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDateTime_is_in_leap_year= _capi)>>('ICU4XIsoDateTime_is_in_leap_year') + .asFunction)>(isLeaf: true); + + +/// Returns the number of months in the year represented by this date +/// +/// See the [Rust documentation for `months_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.months_in_year) for more information. +int get monthsInYear { + + final result = _ICU4XIsoDateTime_months_in_year(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_days_in_month = - _capi)>>( - 'ICU4XIsoDateTime_days_in_month') - .asFunction)>(isLeaf: true); + static final _ICU4XIsoDateTime_months_in_year= _capi)>>('ICU4XIsoDateTime_months_in_year') + .asFunction)>(isLeaf: true); - /// Returns the number of days in the year represented by this date - /// - /// See the [Rust documentation for `days_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_year) for more information. - int get daysInYear { - final result = _ICU4XIsoDateTime_days_in_year(_underlying); - return result; + + +/// Returns the number of days in the month represented by this date +/// +/// See the [Rust documentation for `days_in_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_month) for more information. +int get daysInMonth { + + final result = _ICU4XIsoDateTime_days_in_month(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XIsoDateTime_days_in_month= _capi)>>('ICU4XIsoDateTime_days_in_month') + .asFunction)>(isLeaf: true); + + +/// Returns the number of days in the year represented by this date +/// +/// See the [Rust documentation for `days_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_year) for more information. +int get daysInYear { + + final result = _ICU4XIsoDateTime_days_in_year(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XIsoDateTime_days_in_year = - _capi)>>( - 'ICU4XIsoDateTime_days_in_year') - .asFunction)>(isLeaf: true); -} + static final _ICU4XIsoDateTime_days_in_year= _capi)>>('ICU4XIsoDateTime_days_in_year') + .asFunction)>(isLeaf: true); + + + } + /// See the [Rust documentation for `IsoFormat`](https://docs.rs/icu/latest/icu/datetime/time_zone/enum.IsoFormat.html) for more information. enum IsoTimeZoneFormat { @@ -7316,72 +6045,69 @@ enum IsoTimeZoneFormat { utcExtended; } + /// See the [Rust documentation for `IsoMinutes`](https://docs.rs/icu/latest/icu/datetime/time_zone/enum.IsoMinutes.html) for more information. enum IsoTimeZoneMinuteDisplay { required, optional; } + class _IsoTimeZoneOptionsFfi extends ffi.Struct { - @ffi.Int32() - external int format; - @ffi.Int32() - external int minutes; - @ffi.Int32() - external int seconds; + @ffi.Int32() + external int format; + @ffi.Int32() + external int minutes; + @ffi.Int32() + external int seconds; } class IsoTimeZoneOptions { - final _IsoTimeZoneOptionsFfi _underlying; - - // ignore: unused_element - IsoTimeZoneOptions._(this._underlying); + final _IsoTimeZoneOptionsFfi _underlying; - factory IsoTimeZoneOptions() { - final pointer = ffi2.calloc<_IsoTimeZoneOptionsFfi>(); - final result = IsoTimeZoneOptions._(pointer.ref); - _callocFree.attach(result, pointer.cast()); - return result; - } + // ignore: unused_element + IsoTimeZoneOptions._(this._underlying); - IsoTimeZoneFormat get format => IsoTimeZoneFormat.values[_underlying.format]; - set format(IsoTimeZoneFormat format) { - _underlying.format = format.index; - } + factory IsoTimeZoneOptions() { + final pointer = ffi2.calloc<_IsoTimeZoneOptionsFfi>(); + final result = IsoTimeZoneOptions._(pointer.ref); + _callocFree.attach(result, pointer.cast()); + return result; + } - IsoTimeZoneMinuteDisplay get minutes => - IsoTimeZoneMinuteDisplay.values[_underlying.minutes]; - set minutes(IsoTimeZoneMinuteDisplay minutes) { - _underlying.minutes = minutes.index; - } + IsoTimeZoneFormat get format => IsoTimeZoneFormat.values[_underlying.format]; + set format(IsoTimeZoneFormat format) { + _underlying.format = format.index; + } +IsoTimeZoneMinuteDisplay get minutes => IsoTimeZoneMinuteDisplay.values[_underlying.minutes]; + set minutes(IsoTimeZoneMinuteDisplay minutes) { + _underlying.minutes = minutes.index; + } +IsoTimeZoneSecondDisplay get seconds => IsoTimeZoneSecondDisplay.values[_underlying.seconds]; + set seconds(IsoTimeZoneSecondDisplay seconds) { + _underlying.seconds = seconds.index; + } - IsoTimeZoneSecondDisplay get seconds => - IsoTimeZoneSecondDisplay.values[_underlying.seconds]; - set seconds(IsoTimeZoneSecondDisplay seconds) { - _underlying.seconds = seconds.index; - } - @override - bool operator ==(Object other) => - other is IsoTimeZoneOptions && - other._underlying.format == _underlying.format && - other._underlying.minutes == _underlying.minutes && - other._underlying.seconds == _underlying.seconds; + @override + bool operator ==(Object other) => + other is IsoTimeZoneOptions + && other._underlying.format == _underlying.format + && other._underlying.minutes == _underlying.minutes + && other._underlying.seconds == _underlying.seconds; - @override - int get hashCode => Object.hashAll([ - _underlying.format, - _underlying.minutes, - _underlying.seconds, - ]); + @override + int get hashCode => Object.hashAll([_underlying.format,_underlying.minutes,_underlying.seconds,]); } + /// See the [Rust documentation for `IsoSeconds`](https://docs.rs/icu/latest/icu/datetime/time_zone/enum.IsoSeconds.html) for more information. enum IsoTimeZoneSecondDisplay { optional, never; } + enum IsoWeekday { monday, tuesday, @@ -7393,30 +6119,33 @@ enum IsoWeekday { int get _underlying { switch (this) { - case monday: - return 1; - case tuesday: - return 2; - case wednesday: - return 3; - case thursday: - return 4; - case friday: - return 5; - case saturday: - return 6; - case sunday: - return 7; + case monday: + return 1; + case tuesday: + return 2; + case wednesday: + return 3; + case thursday: + return 4; + case friday: + return 5; + case saturday: + return 6; + case sunday: + return 7; } } + } + /// See the [Rust documentation for `LanguageDisplay`](https://docs.rs/icu/latest/icu/displaynames/options/enum.LanguageDisplay.html) for more information. enum LanguageDisplay { dialect, standard; } + /// See the [Rust documentation for `LeadingAdjustment`](https://docs.rs/icu/latest/icu/casemap/titlecase/enum.LeadingAdjustment.html) for more information. enum LeadingAdjustment { auto, @@ -7424,148 +6153,149 @@ enum LeadingAdjustment { toCased; } + /// See the [Rust documentation for `LineBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.LineBreakIterator.html) for more information. -/// +/// /// Additional information: [1](https://docs.rs/icu/latest/icu/segmenter/type.LineBreakIteratorLatin1.html) class LineBreakIteratorLatin1 implements ffi.Finalizable { - final ffi.Pointer _underlying; - LineBreakIteratorLatin1._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XLineBreakIteratorLatin1_destroy')); + LineBreakIteratorLatin1._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is - /// out of range of a 32-bit signed integer. - /// - /// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.LineBreakIterator.html#method.next) for more information. - int next() { - final result = _ICU4XLineBreakIteratorLatin1_next(_underlying); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLineBreakIteratorLatin1_destroy')); + +/// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is +/// out of range of a 32-bit signed integer. +/// +/// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.LineBreakIterator.html#method.next) for more information. +int next() { + + final result = _ICU4XLineBreakIteratorLatin1_next(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XLineBreakIteratorLatin1_next = - _capi)>>( - 'ICU4XLineBreakIteratorLatin1_next') - .asFunction)>(isLeaf: true); -} + static final _ICU4XLineBreakIteratorLatin1_next= _capi)>>('ICU4XLineBreakIteratorLatin1_next') + .asFunction)>(isLeaf: true); + + + } + /// See the [Rust documentation for `LineBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.LineBreakIterator.html) for more information. -/// +/// /// Additional information: [1](https://docs.rs/icu/latest/icu/segmenter/type.LineBreakIteratorUtf16.html) class LineBreakIteratorUtf16 implements ffi.Finalizable { - final ffi.Pointer _underlying; - LineBreakIteratorUtf16._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XLineBreakIteratorUtf16_destroy')); + LineBreakIteratorUtf16._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is - /// out of range of a 32-bit signed integer. - /// - /// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.LineBreakIterator.html#method.next) for more information. - int next() { - final result = _ICU4XLineBreakIteratorUtf16_next(_underlying); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLineBreakIteratorUtf16_destroy')); + +/// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is +/// out of range of a 32-bit signed integer. +/// +/// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.LineBreakIterator.html#method.next) for more information. +int next() { + + final result = _ICU4XLineBreakIteratorUtf16_next(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XLineBreakIteratorUtf16_next = - _capi)>>( - 'ICU4XLineBreakIteratorUtf16_next') - .asFunction)>(isLeaf: true); -} + static final _ICU4XLineBreakIteratorUtf16_next= _capi)>>('ICU4XLineBreakIteratorUtf16_next') + .asFunction)>(isLeaf: true); + + + } + /// See the [Rust documentation for `LineBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.LineBreakIterator.html) for more information. -/// +/// /// Additional information: [1](https://docs.rs/icu/latest/icu/segmenter/type.LineBreakIteratorPotentiallyIllFormedUtf8.html) class LineBreakIteratorUtf8 implements ffi.Finalizable { - final ffi.Pointer _underlying; - LineBreakIteratorUtf8._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XLineBreakIteratorUtf8_destroy')); + LineBreakIteratorUtf8._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is - /// out of range of a 32-bit signed integer. - /// - /// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.LineBreakIterator.html#method.next) for more information. - int next() { - final result = _ICU4XLineBreakIteratorUtf8_next(_underlying); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLineBreakIteratorUtf8_destroy')); + +/// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is +/// out of range of a 32-bit signed integer. +/// +/// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.LineBreakIterator.html#method.next) for more information. +int next() { + + final result = _ICU4XLineBreakIteratorUtf8_next(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XLineBreakIteratorUtf8_next = - _capi)>>( - 'ICU4XLineBreakIteratorUtf8_next') - .asFunction)>(isLeaf: true); -} + static final _ICU4XLineBreakIteratorUtf8_next= _capi)>>('ICU4XLineBreakIteratorUtf8_next') + .asFunction)>(isLeaf: true); + + + } + /// See the [Rust documentation for `LineBreakOptions`](https://docs.rs/icu/latest/icu/segmenter/struct.LineBreakOptions.html) for more information. class _LineBreakOptionsV1Ffi extends ffi.Struct { - @ffi.Int32() - external int strictness; - @ffi.Int32() - external int wordOption; - @ffi.Bool() - external bool jaZh; + @ffi.Int32() + external int strictness; + @ffi.Int32() + external int wordOption; + @ffi.Bool() + external bool jaZh; } class LineBreakOptionsV1 { - final _LineBreakOptionsV1Ffi _underlying; - - // ignore: unused_element - LineBreakOptionsV1._(this._underlying); + final _LineBreakOptionsV1Ffi _underlying; - factory LineBreakOptionsV1() { - final pointer = ffi2.calloc<_LineBreakOptionsV1Ffi>(); - final result = LineBreakOptionsV1._(pointer.ref); - _callocFree.attach(result, pointer.cast()); - return result; - } + // ignore: unused_element + LineBreakOptionsV1._(this._underlying); - LineBreakStrictness get strictness => - LineBreakStrictness.values[_underlying.strictness]; - set strictness(LineBreakStrictness strictness) { - _underlying.strictness = strictness.index; - } + factory LineBreakOptionsV1() { + final pointer = ffi2.calloc<_LineBreakOptionsV1Ffi>(); + final result = LineBreakOptionsV1._(pointer.ref); + _callocFree.attach(result, pointer.cast()); + return result; + } - LineBreakWordOption get wordOption => - LineBreakWordOption.values[_underlying.wordOption]; - set wordOption(LineBreakWordOption wordOption) { - _underlying.wordOption = wordOption.index; - } + LineBreakStrictness get strictness => LineBreakStrictness.values[_underlying.strictness]; + set strictness(LineBreakStrictness strictness) { + _underlying.strictness = strictness.index; + } +LineBreakWordOption get wordOption => LineBreakWordOption.values[_underlying.wordOption]; + set wordOption(LineBreakWordOption wordOption) { + _underlying.wordOption = wordOption.index; + } +bool get jaZh => _underlying.jaZh; + set jaZh(bool jaZh) { + _underlying.jaZh = jaZh; + } - bool get jaZh => _underlying.jaZh; - set jaZh(bool jaZh) { - _underlying.jaZh = jaZh; - } - @override - bool operator ==(Object other) => - other is LineBreakOptionsV1 && - other._underlying.strictness == _underlying.strictness && - other._underlying.wordOption == _underlying.wordOption && - other._underlying.jaZh == _underlying.jaZh; + @override + bool operator ==(Object other) => + other is LineBreakOptionsV1 + && other._underlying.strictness == _underlying.strictness + && other._underlying.wordOption == _underlying.wordOption + && other._underlying.jaZh == _underlying.jaZh; - @override - int get hashCode => Object.hashAll([ - _underlying.strictness, - _underlying.wordOption, - _underlying.jaZh, - ]); + @override + int get hashCode => Object.hashAll([_underlying.strictness,_underlying.wordOption,_underlying.jaZh,]); } + /// See the [Rust documentation for `LineBreakStrictness`](https://docs.rs/icu/latest/icu/segmenter/enum.LineBreakStrictness.html) for more information. enum LineBreakStrictness { loose, @@ -7574,6 +6304,7 @@ enum LineBreakStrictness { anywhere; } + /// See the [Rust documentation for `LineBreakWordOption`](https://docs.rs/icu/latest/icu/segmenter/enum.LineBreakWordOption.html) for more information. enum LineBreakWordOption { normal, @@ -7581,815 +6312,615 @@ enum LineBreakWordOption { keepAll; } + /// An ICU4X line-break segmenter, capable of finding breakpoints in strings. -/// +/// /// See the [Rust documentation for `LineSegmenter`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html) for more information. class LineSegmenter implements ffi.Finalizable { - final ffi.Pointer _underlying; - LineSegmenter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XLineSegmenter_destroy')); - - /// Construct a [`ICU4XLineSegmenter`] with default options. It automatically loads the best - /// available payload data for Burmese, Khmer, Lao, and Thai. - /// - /// See the [Rust documentation for `new_auto`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.new_auto) for more information. - factory LineSegmenter.auto(DataProvider provider) { - final result = _ICU4XLineSegmenter_create_auto(provider._underlying); - return result.isOk - ? LineSegmenter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XLineSegmenter_create_auto = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XLineSegmenter_create_auto') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Construct a [`ICU4XLineSegmenter`] with default options and LSTM payload data for - /// Burmese, Khmer, Lao, and Thai. - /// - /// See the [Rust documentation for `new_lstm`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.new_lstm) for more information. - factory LineSegmenter.lstm(DataProvider provider) { - final result = _ICU4XLineSegmenter_create_lstm(provider._underlying); - return result.isOk - ? LineSegmenter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XLineSegmenter_create_lstm = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XLineSegmenter_create_lstm') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Construct a [`ICU4XLineSegmenter`] with default options and dictionary payload data for - /// Burmese, Khmer, Lao, and Thai.. - /// - /// See the [Rust documentation for `new_dictionary`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.new_dictionary) for more information. - factory LineSegmenter.dictionary(DataProvider provider) { - final result = _ICU4XLineSegmenter_create_dictionary(provider._underlying); - return result.isOk - ? LineSegmenter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XLineSegmenter_create_dictionary = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XLineSegmenter_create_dictionary') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Construct a [`ICU4XLineSegmenter`] with custom options. It automatically loads the best - /// available payload data for Burmese, Khmer, Lao, and Thai. - /// - /// See the [Rust documentation for `new_auto_with_options`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.new_auto_with_options) for more information. - factory LineSegmenter.autoWithOptionsV1( - DataProvider provider, LineBreakOptionsV1 options) { - final result = _ICU4XLineSegmenter_create_auto_with_options_v1( - provider._underlying, options._underlying); - return result.isOk - ? LineSegmenter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XLineSegmenter_create_auto_with_options_v1 = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, _LineBreakOptionsV1Ffi)>>( - 'ICU4XLineSegmenter_create_auto_with_options_v1') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, _LineBreakOptionsV1Ffi)>(isLeaf: true); - - /// Construct a [`ICU4XLineSegmenter`] with custom options and LSTM payload data for - /// Burmese, Khmer, Lao, and Thai. - /// - /// See the [Rust documentation for `new_lstm_with_options`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.new_lstm_with_options) for more information. - factory LineSegmenter.lstmWithOptionsV1( - DataProvider provider, LineBreakOptionsV1 options) { - final result = _ICU4XLineSegmenter_create_lstm_with_options_v1( - provider._underlying, options._underlying); - return result.isOk - ? LineSegmenter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XLineSegmenter_create_lstm_with_options_v1 = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, _LineBreakOptionsV1Ffi)>>( - 'ICU4XLineSegmenter_create_lstm_with_options_v1') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, _LineBreakOptionsV1Ffi)>(isLeaf: true); - - /// Construct a [`ICU4XLineSegmenter`] with custom options and dictionary payload data for - /// Burmese, Khmer, Lao, and Thai. - /// - /// See the [Rust documentation for `new_dictionary_with_options`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.new_dictionary_with_options) for more information. - factory LineSegmenter.dictionaryWithOptionsV1( - DataProvider provider, LineBreakOptionsV1 options) { - final result = _ICU4XLineSegmenter_create_dictionary_with_options_v1( - provider._underlying, options._underlying); - return result.isOk - ? LineSegmenter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XLineSegmenter_create_dictionary_with_options_v1 = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, _LineBreakOptionsV1Ffi)>>( - 'ICU4XLineSegmenter_create_dictionary_with_options_v1') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, _LineBreakOptionsV1Ffi)>(isLeaf: true); - - /// Segments a (potentially ill-formed) UTF-8 string. - /// - /// See the [Rust documentation for `segment_utf8`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.segment_utf8) for more information. - LineBreakIteratorUtf8 segmentUtf8(String input) { - final alloc = ffi2.Arena(); - final inputSlice = _SliceFfi2Utf8._fromDart(input, alloc); - - final result = _ICU4XLineSegmenter_segment_utf8( - _underlying, inputSlice._bytes, inputSlice._length); - alloc.releaseAll(); - return LineBreakIteratorUtf8._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLineSegmenter_segment_utf8 = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XLineSegmenter_segment_utf8') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Segments a UTF-16 string. - /// - /// See the [Rust documentation for `segment_utf16`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.segment_utf16) for more information. - LineBreakIteratorUtf16 segmentUtf16(Uint16List input) { - final alloc = ffi2.Arena(); - final inputSlice = _SliceFfiUint16._fromDart(input, alloc); - - final result = _ICU4XLineSegmenter_segment_utf16( - _underlying, inputSlice._bytes, inputSlice._length); - alloc.releaseAll(); - return LineBreakIteratorUtf16._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLineSegmenter_segment_utf16 = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XLineSegmenter_segment_utf16') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Segments a Latin-1 string. - /// - /// See the [Rust documentation for `segment_latin1`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.segment_latin1) for more information. - LineBreakIteratorLatin1 segmentLatin1(Uint8List input) { - final alloc = ffi2.Arena(); - final inputSlice = _SliceFfiUint8._fromDart(input, alloc); - - final result = _ICU4XLineSegmenter_segment_latin1( - _underlying, inputSlice._bytes, inputSlice._length); - alloc.releaseAll(); - return LineBreakIteratorLatin1._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLineSegmenter_segment_latin1 = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XLineSegmenter_segment_latin1') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); + final ffi.Pointer _underlying; + + LineSegmenter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLineSegmenter_destroy')); + + +/// Construct a [`ICU4XLineSegmenter`] with default options. It automatically loads the best +/// available payload data for Burmese, Khmer, Lao, and Thai. +/// +/// See the [Rust documentation for `new_auto`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.new_auto) for more information. +factory LineSegmenter.auto(DataProvider provider) { + + final result = _ICU4XLineSegmenter_create_auto(provider._underlying); + return result.isOk ? LineSegmenter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XLineSegmenter_create_auto= _capi)>>('ICU4XLineSegmenter_create_auto') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Construct a [`ICU4XLineSegmenter`] with default options and LSTM payload data for +/// Burmese, Khmer, Lao, and Thai. +/// +/// See the [Rust documentation for `new_lstm`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.new_lstm) for more information. +factory LineSegmenter.lstm(DataProvider provider) { + + final result = _ICU4XLineSegmenter_create_lstm(provider._underlying); + return result.isOk ? LineSegmenter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XLineSegmenter_create_lstm= _capi)>>('ICU4XLineSegmenter_create_lstm') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Construct a [`ICU4XLineSegmenter`] with default options and dictionary payload data for +/// Burmese, Khmer, Lao, and Thai.. +/// +/// See the [Rust documentation for `new_dictionary`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.new_dictionary) for more information. +factory LineSegmenter.dictionary(DataProvider provider) { + + final result = _ICU4XLineSegmenter_create_dictionary(provider._underlying); + return result.isOk ? LineSegmenter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XLineSegmenter_create_dictionary= _capi)>>('ICU4XLineSegmenter_create_dictionary') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Construct a [`ICU4XLineSegmenter`] with custom options. It automatically loads the best +/// available payload data for Burmese, Khmer, Lao, and Thai. +/// +/// See the [Rust documentation for `new_auto_with_options`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.new_auto_with_options) for more information. +factory LineSegmenter.autoWithOptionsV1(DataProvider provider, LineBreakOptionsV1 options) { + + final result = _ICU4XLineSegmenter_create_auto_with_options_v1(provider._underlying,options._underlying); + return result.isOk ? LineSegmenter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XLineSegmenter_create_auto_with_options_v1= _capi, _LineBreakOptionsV1Ffi)>>('ICU4XLineSegmenter_create_auto_with_options_v1') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, _LineBreakOptionsV1Ffi)>(isLeaf: true); + + + +/// Construct a [`ICU4XLineSegmenter`] with custom options and LSTM payload data for +/// Burmese, Khmer, Lao, and Thai. +/// +/// See the [Rust documentation for `new_lstm_with_options`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.new_lstm_with_options) for more information. +factory LineSegmenter.lstmWithOptionsV1(DataProvider provider, LineBreakOptionsV1 options) { + + final result = _ICU4XLineSegmenter_create_lstm_with_options_v1(provider._underlying,options._underlying); + return result.isOk ? LineSegmenter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XLineSegmenter_create_lstm_with_options_v1= _capi, _LineBreakOptionsV1Ffi)>>('ICU4XLineSegmenter_create_lstm_with_options_v1') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, _LineBreakOptionsV1Ffi)>(isLeaf: true); + + + +/// Construct a [`ICU4XLineSegmenter`] with custom options and dictionary payload data for +/// Burmese, Khmer, Lao, and Thai. +/// +/// See the [Rust documentation for `new_dictionary_with_options`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.new_dictionary_with_options) for more information. +factory LineSegmenter.dictionaryWithOptionsV1(DataProvider provider, LineBreakOptionsV1 options) { + + final result = _ICU4XLineSegmenter_create_dictionary_with_options_v1(provider._underlying,options._underlying); + return result.isOk ? LineSegmenter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XLineSegmenter_create_dictionary_with_options_v1= _capi, _LineBreakOptionsV1Ffi)>>('ICU4XLineSegmenter_create_dictionary_with_options_v1') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, _LineBreakOptionsV1Ffi)>(isLeaf: true); + + + +/// Segments a (potentially ill-formed) UTF-8 string. +/// +/// See the [Rust documentation for `segment_utf8`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.segment_utf8) for more information. +LineBreakIteratorUtf8 segmentUtf8(String input) { + final alloc = ffi2.Arena(); + final inputSlice = _SliceFfi2Utf8._fromDart(input, alloc); + + final result = _ICU4XLineSegmenter_segment_utf8(_underlying,inputSlice._bytes,inputSlice._length);alloc.releaseAll(); + return LineBreakIteratorUtf8._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XLineSegmenter_segment_utf8= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XLineSegmenter_segment_utf8') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Segments a UTF-16 string. +/// +/// See the [Rust documentation for `segment_utf16`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.segment_utf16) for more information. +LineBreakIteratorUtf16 segmentUtf16(Uint16List input) { + final alloc = ffi2.Arena(); + final inputSlice = _SliceFfiUint16._fromDart(input, alloc); + + final result = _ICU4XLineSegmenter_segment_utf16(_underlying,inputSlice._bytes,inputSlice._length);alloc.releaseAll(); + return LineBreakIteratorUtf16._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XLineSegmenter_segment_utf16= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XLineSegmenter_segment_utf16') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Segments a Latin-1 string. +/// +/// See the [Rust documentation for `segment_latin1`](https://docs.rs/icu/latest/icu/segmenter/struct.LineSegmenter.html#method.segment_latin1) for more information. +LineBreakIteratorLatin1 segmentLatin1(Uint8List input) { + final alloc = ffi2.Arena(); + final inputSlice = _SliceFfiUint8._fromDart(input, alloc); + + final result = _ICU4XLineSegmenter_segment_latin1(_underlying,inputSlice._bytes,inputSlice._length);alloc.releaseAll(); + return LineBreakIteratorLatin1._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XLineSegmenter_segment_latin1= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XLineSegmenter_segment_latin1') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + } + + +/// A list of strings +class List implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + List._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XList_destroy')); + + +/// Create a new list of strings +factory List() { + + final result = _ICU4XList_create(); + return List._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XList_create= _capi Function()>>('ICU4XList_create') + .asFunction Function()>(isLeaf: true); + + + +/// Create a new list of strings with preallocated space to hold +/// at least `capacity` elements +factory List.withCapacity(int capacity) { + + final result = _ICU4XList_create_with_capacity(capacity); + return List._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XList_create_with_capacity= _capi Function(ffi.Size)>>('ICU4XList_create_with_capacity') + .asFunction Function(int)>(isLeaf: true); + + + +/// Push a string to the list +/// +/// For C++ users, potentially invalid UTF8 will be handled via +/// REPLACEMENT CHARACTERs +void push(String val) { + final alloc = ffi2.Arena(); + final valSlice = _SliceFfi2Utf8._fromDart(val, alloc); + + _ICU4XList_push(_underlying,valSlice._bytes,valSlice._length);alloc.releaseAll(); + } + // ignore: non_constant_identifier_names + static final _ICU4XList_push= _capi, ffi.Pointer, ffi.Size)>>('ICU4XList_push') + .asFunction, ffi.Pointer, int)>(isLeaf: true); + + + +/// The number of elements in this list +int get length { + + final result = _ICU4XList_len(_underlying); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XList_len= _capi)>>('ICU4XList_len') + .asFunction)>(isLeaf: true); + + + } + + +/// See the [Rust documentation for `ListFormatter`](https://docs.rs/icu/latest/icu/list/struct.ListFormatter.html) for more information. +class ListFormatter implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + ListFormatter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XListFormatter_destroy')); + + +/// Construct a new ICU4XListFormatter instance for And patterns +/// +/// See the [Rust documentation for `try_new_and_with_length`](https://docs.rs/icu/latest/icu/list/struct.ListFormatter.html#method.try_new_and_with_length) for more information. +factory ListFormatter.andWithLength(DataProvider provider, Locale locale, ListLength length) { + + final result = _ICU4XListFormatter_create_and_with_length(provider._underlying,locale._underlying,length.index); + return result.isOk ? ListFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XListFormatter_create_and_with_length= _capi, ffi.Pointer, ffi.Int32)>>('ICU4XListFormatter_create_and_with_length') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Construct a new ICU4XListFormatter instance for And patterns +/// +/// See the [Rust documentation for `try_new_or_with_length`](https://docs.rs/icu/latest/icu/list/struct.ListFormatter.html#method.try_new_or_with_length) for more information. +factory ListFormatter.orWithLength(DataProvider provider, Locale locale, ListLength length) { + + final result = _ICU4XListFormatter_create_or_with_length(provider._underlying,locale._underlying,length.index); + return result.isOk ? ListFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XListFormatter_create_or_with_length= _capi, ffi.Pointer, ffi.Int32)>>('ICU4XListFormatter_create_or_with_length') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Construct a new ICU4XListFormatter instance for And patterns +/// +/// See the [Rust documentation for `try_new_unit_with_length`](https://docs.rs/icu/latest/icu/list/struct.ListFormatter.html#method.try_new_unit_with_length) for more information. +factory ListFormatter.unitWithLength(DataProvider provider, Locale locale, ListLength length) { + + final result = _ICU4XListFormatter_create_unit_with_length(provider._underlying,locale._underlying,length.index); + return result.isOk ? ListFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XListFormatter_create_unit_with_length= _capi, ffi.Pointer, ffi.Int32)>>('ICU4XListFormatter_create_unit_with_length') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/list/struct.ListFormatter.html#method.format) for more information. +String format(List list) { + + final writeable = _Writeable(); + final result = _ICU4XListFormatter_format(_underlying,list._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XListFormatter_format= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XListFormatter_format') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + } + + +/// See the [Rust documentation for `ListLength`](https://docs.rs/icu/latest/icu/list/enum.ListLength.html) for more information. +enum ListLength { + wide, + short, + narrow; } -/// A list of strings -class List implements ffi.Finalizable { - final ffi.Pointer _underlying; - List._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); +/// An ICU4X Locale, capable of representing strings like `"en-US"`. +/// +/// See the [Rust documentation for `Locale`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html) for more information. +class Locale implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + Locale._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLocale_destroy')); + + +/// Construct an [`ICU4XLocale`] from an locale identifier. +/// +/// This will run the complete locale parsing algorithm. If code size and +/// performance are critical and the locale is of a known shape (such as +/// `aa-BB`) use `create_und`, `set_language`, `set_script`, and `set_region`. +/// +/// See the [Rust documentation for `try_from_bytes`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes) for more information. +factory Locale.fromString(String name) { + final alloc = ffi2.Arena(); + final nameSlice = _SliceFfi2Utf8._fromDart(name, alloc); + + final result = _ICU4XLocale_create_from_string(nameSlice._bytes,nameSlice._length);alloc.releaseAll(); + return result.isOk ? Locale._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XLocale_create_from_string= _capi, ffi.Size)>>('ICU4XLocale_create_from_string') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>(isLeaf: true); - static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XList_destroy')); - /// Create a new list of strings - factory List() { - final result = _ICU4XList_create(); - return List._(result); + +/// Construct a default undefined [`ICU4XLocale`] "und". +/// +/// See the [Rust documentation for `UND`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#associatedconstant.UND) for more information. +factory Locale.und() { + + final result = _ICU4XLocale_create_und(); + return Locale._(result); } // ignore: non_constant_identifier_names - static final _ICU4XList_create = - _capi Function()>>( - 'ICU4XList_create') - .asFunction Function()>(isLeaf: true); + static final _ICU4XLocale_create_und= _capi Function()>>('ICU4XLocale_create_und') + .asFunction Function()>(isLeaf: true); - /// Create a new list of strings with preallocated space to hold - /// at least `capacity` elements - factory List.withCapacity(int capacity) { - final result = _ICU4XList_create_with_capacity(capacity); - return List._(result); + + +/// Clones the [`ICU4XLocale`]. +/// +/// See the [Rust documentation for `Locale`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html) for more information. +Locale clone() { + + final result = _ICU4XLocale_clone(_underlying); + return Locale._(result); } // ignore: non_constant_identifier_names - static final _ICU4XList_create_with_capacity = - _capi Function(ffi.Size)>>( - 'ICU4XList_create_with_capacity') - .asFunction Function(int)>(isLeaf: true); + static final _ICU4XLocale_clone= _capi Function(ffi.Pointer)>>('ICU4XLocale_clone') + .asFunction Function(ffi.Pointer)>(isLeaf: true); - /// Push a string to the list - /// - /// For C++ users, potentially invalid UTF8 will be handled via - /// REPLACEMENT CHARACTERs - void push(String val) { - final alloc = ffi2.Arena(); - final valSlice = _SliceFfi2Utf8._fromDart(val, alloc); - _ICU4XList_push(_underlying, valSlice._bytes, valSlice._length); - alloc.releaseAll(); + +/// Write a string representation of the `LanguageIdentifier` part of +/// [`ICU4XLocale`] to `write`. +/// +/// See the [Rust documentation for `id`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id) for more information. +String get basename { + + final writeable = _Writeable(); + final result = _ICU4XLocale_basename(_underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XLocale_basename= _capi, ffi.Pointer)>>('ICU4XLocale_basename') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + +/// Write a string representation of the unicode extension to `write` +/// +/// See the [Rust documentation for `extensions`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.extensions) for more information. +String getUnicodeExtension(String bytes) { + final alloc = ffi2.Arena(); + final bytesSlice = _SliceFfi2Utf8._fromDart(bytes, alloc); + + final writeable = _Writeable(); + final result = _ICU4XLocale_get_unicode_extension(_underlying,bytesSlice._bytes,bytesSlice._length,writeable._underlying);alloc.releaseAll(); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XList_push = _capi< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, ffi.Pointer, - ffi.Size)>>('ICU4XList_push') - .asFunction< - void Function(ffi.Pointer, ffi.Pointer, - int)>(isLeaf: true); + static final _ICU4XLocale_get_unicode_extension= _capi, ffi.Pointer, ffi.Size, ffi.Pointer)>>('ICU4XLocale_get_unicode_extension') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int, ffi.Pointer)>(isLeaf: true); - /// The number of elements in this list - int get length { - final result = _ICU4XList_len(_underlying); - return result; + + +/// Write a string representation of [`ICU4XLocale`] language to `write` +/// +/// See the [Rust documentation for `id`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id) for more information. +String get language { + + final writeable = _Writeable(); + final result = _ICU4XLocale_language(_underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XLocale_language= _capi, ffi.Pointer)>>('ICU4XLocale_language') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + +/// Set the language part of the [`ICU4XLocale`]. +/// +/// See the [Rust documentation for `try_from_bytes`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes) for more information. +set language(String bytes) { + final alloc = ffi2.Arena(); + final bytesSlice = _SliceFfi2Utf8._fromDart(bytes, alloc); + + final result = _ICU4XLocale_set_language(_underlying,bytesSlice._bytes,bytesSlice._length);alloc.releaseAll(); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } // ignore: non_constant_identifier_names - static final _ICU4XList_len = - _capi)>>( - 'ICU4XList_len') - .asFunction)>(isLeaf: true); -} + static final _ICU4XLocale_set_language= _capi, ffi.Pointer, ffi.Size)>>('ICU4XLocale_set_language') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); -/// See the [Rust documentation for `ListFormatter`](https://docs.rs/icu/latest/icu/list/struct.ListFormatter.html) for more information. -class ListFormatter implements ffi.Finalizable { - final ffi.Pointer _underlying; - ListFormatter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XListFormatter_destroy')); - - /// Construct a new ICU4XListFormatter instance for And patterns - /// - /// See the [Rust documentation for `try_new_and_with_length`](https://docs.rs/icu/latest/icu/list/struct.ListFormatter.html#method.try_new_and_with_length) for more information. - factory ListFormatter.andWithLength( - DataProvider provider, Locale locale, ListLength length) { - final result = _ICU4XListFormatter_create_and_with_length( - provider._underlying, locale._underlying, length.index); - return result.isOk - ? ListFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XListFormatter_create_and_with_length = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int32)>>('ICU4XListFormatter_create_and_with_length') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Construct a new ICU4XListFormatter instance for And patterns - /// - /// See the [Rust documentation for `try_new_or_with_length`](https://docs.rs/icu/latest/icu/list/struct.ListFormatter.html#method.try_new_or_with_length) for more information. - factory ListFormatter.orWithLength( - DataProvider provider, Locale locale, ListLength length) { - final result = _ICU4XListFormatter_create_or_with_length( - provider._underlying, locale._underlying, length.index); - return result.isOk - ? ListFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XListFormatter_create_or_with_length = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int32)>>('ICU4XListFormatter_create_or_with_length') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Construct a new ICU4XListFormatter instance for And patterns - /// - /// See the [Rust documentation for `try_new_unit_with_length`](https://docs.rs/icu/latest/icu/list/struct.ListFormatter.html#method.try_new_unit_with_length) for more information. - factory ListFormatter.unitWithLength( - DataProvider provider, Locale locale, ListLength length) { - final result = _ICU4XListFormatter_create_unit_with_length( - provider._underlying, locale._underlying, length.index); - return result.isOk - ? ListFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XListFormatter_create_unit_with_length = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int32)>>('ICU4XListFormatter_create_unit_with_length') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/list/struct.ListFormatter.html#method.format) for more information. - String format(List list) { - final writeable = _Writeable(); - final result = _ICU4XListFormatter_format( - _underlying, list._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XListFormatter_format = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('ICU4XListFormatter_format') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + +/// Write a string representation of [`ICU4XLocale`] region to `write` +/// +/// See the [Rust documentation for `id`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id) for more information. +String get region { + + final writeable = _Writeable(); + final result = _ICU4XLocale_region(_underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XLocale_region= _capi, ffi.Pointer)>>('ICU4XLocale_region') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); -/// See the [Rust documentation for `ListLength`](https://docs.rs/icu/latest/icu/list/enum.ListLength.html) for more information. -enum ListLength { - wide, - short, - narrow; -} -/// An ICU4X Locale, capable of representing strings like `"en-US"`. -/// -/// See the [Rust documentation for `Locale`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html) for more information. -class Locale implements ffi.Finalizable { - final ffi.Pointer _underlying; + +/// Set the region part of the [`ICU4XLocale`]. +/// +/// See the [Rust documentation for `try_from_bytes`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes) for more information. +set region(String bytes) { + final alloc = ffi2.Arena(); + final bytesSlice = _SliceFfi2Utf8._fromDart(bytes, alloc); + + final result = _ICU4XLocale_set_region(_underlying,bytesSlice._bytes,bytesSlice._length);alloc.releaseAll(); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } + // ignore: non_constant_identifier_names + static final _ICU4XLocale_set_region= _capi, ffi.Pointer, ffi.Size)>>('ICU4XLocale_set_region') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); - Locale._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLocale_destroy')); - - /// Construct an [`ICU4XLocale`] from an locale identifier. - /// - /// This will run the complete locale parsing algorithm. If code size and - /// performance are critical and the locale is of a known shape (such as - /// `aa-BB`) use `create_und`, `set_language`, `set_script`, and `set_region`. - /// - /// See the [Rust documentation for `try_from_bytes`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes) for more information. - factory Locale.fromString(String name) { - final alloc = ffi2.Arena(); - final nameSlice = _SliceFfi2Utf8._fromDart(name, alloc); - - final result = - _ICU4XLocale_create_from_string(nameSlice._bytes, nameSlice._length); - alloc.releaseAll(); - return result.isOk - ? Locale._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XLocale_create_from_string = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Size)>>('ICU4XLocale_create_from_string') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>( - isLeaf: true); - - /// Construct a default undefined [`ICU4XLocale`] "und". - /// - /// See the [Rust documentation for `UND`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#associatedconstant.UND) for more information. - factory Locale.und() { - final result = _ICU4XLocale_create_und(); - return Locale._(result); - } - // ignore: non_constant_identifier_names - static final _ICU4XLocale_create_und = - _capi Function()>>( - 'ICU4XLocale_create_und') - .asFunction Function()>(isLeaf: true); - - /// Clones the [`ICU4XLocale`]. - /// - /// See the [Rust documentation for `Locale`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html) for more information. - Locale clone() { - final result = _ICU4XLocale_clone(_underlying); - return Locale._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocale_clone = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XLocale_clone') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); - - /// Write a string representation of the `LanguageIdentifier` part of - /// [`ICU4XLocale`] to `write`. - /// - /// See the [Rust documentation for `id`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id) for more information. - String get basename { - final writeable = _Writeable(); - final result = _ICU4XLocale_basename(_underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocale_basename = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XLocale_basename') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Write a string representation of the unicode extension to `write` - /// - /// See the [Rust documentation for `extensions`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.extensions) for more information. - String getUnicodeExtension(String bytes) { - final alloc = ffi2.Arena(); - final bytesSlice = _SliceFfi2Utf8._fromDart(bytes, alloc); - - final writeable = _Writeable(); - final result = _ICU4XLocale_get_unicode_extension(_underlying, - bytesSlice._bytes, bytesSlice._length, writeable._underlying); - alloc.releaseAll(); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocale_get_unicode_extension = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer)>>( - 'ICU4XLocale_get_unicode_extension') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(isLeaf: true); - - /// Write a string representation of [`ICU4XLocale`] language to `write` - /// - /// See the [Rust documentation for `id`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id) for more information. - String get language { - final writeable = _Writeable(); - final result = _ICU4XLocale_language(_underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocale_language = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XLocale_language') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Set the language part of the [`ICU4XLocale`]. - /// - /// See the [Rust documentation for `try_from_bytes`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes) for more information. - set language(String bytes) { - final alloc = ffi2.Arena(); - final bytesSlice = _SliceFfi2Utf8._fromDart(bytes, alloc); - - final result = _ICU4XLocale_set_language( - _underlying, bytesSlice._bytes, bytesSlice._length); - alloc.releaseAll(); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } + + +/// Write a string representation of [`ICU4XLocale`] script to `write` +/// +/// See the [Rust documentation for `id`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id) for more information. +String get script { + + final writeable = _Writeable(); + final result = _ICU4XLocale_script(_underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XLocale_script= _capi, ffi.Pointer)>>('ICU4XLocale_script') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + +/// Set the script part of the [`ICU4XLocale`]. Pass an empty string to remove the script. +/// +/// See the [Rust documentation for `try_from_bytes`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes) for more information. +set script(String bytes) { + final alloc = ffi2.Arena(); + final bytesSlice = _SliceFfi2Utf8._fromDart(bytes, alloc); + + final result = _ICU4XLocale_set_script(_underlying,bytesSlice._bytes,bytesSlice._length);alloc.releaseAll(); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } // ignore: non_constant_identifier_names - static final _ICU4XLocale_set_language = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XLocale_set_language') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Write a string representation of [`ICU4XLocale`] region to `write` - /// - /// See the [Rust documentation for `id`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id) for more information. - String get region { - final writeable = _Writeable(); - final result = _ICU4XLocale_region(_underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocale_region = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XLocale_region') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Set the region part of the [`ICU4XLocale`]. - /// - /// See the [Rust documentation for `try_from_bytes`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes) for more information. - set region(String bytes) { - final alloc = ffi2.Arena(); - final bytesSlice = _SliceFfi2Utf8._fromDart(bytes, alloc); - - final result = _ICU4XLocale_set_region( - _underlying, bytesSlice._bytes, bytesSlice._length); - alloc.releaseAll(); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } + static final _ICU4XLocale_set_script= _capi, ffi.Pointer, ffi.Size)>>('ICU4XLocale_set_script') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Best effort locale canonicalizer that doesn't need any data +/// +/// Use ICU4XLocaleCanonicalizer for better control and functionality +/// +/// See the [Rust documentation for `canonicalize`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.canonicalize) for more information. +static String canonicalize(String bytes) { + final alloc = ffi2.Arena(); + final bytesSlice = _SliceFfi2Utf8._fromDart(bytes, alloc); + + final writeable = _Writeable(); + final result = _ICU4XLocale_canonicalize(bytesSlice._bytes,bytesSlice._length,writeable._underlying);alloc.releaseAll(); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XLocale_canonicalize= _capi, ffi.Size, ffi.Pointer)>>('ICU4XLocale_canonicalize') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, int, ffi.Pointer)>(isLeaf: true); + + +/// Write a string representation of [`ICU4XLocale`] to `write` +/// +/// See the [Rust documentation for `write_to`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.write_to) for more information. +@override + String toString() { + + final writeable = _Writeable(); + final result = _ICU4XLocale_to_string(_underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XLocale_set_region = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Size)>>('ICU4XLocale_set_region') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Write a string representation of [`ICU4XLocale`] script to `write` - /// - /// See the [Rust documentation for `id`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id) for more information. - String get script { - final writeable = _Writeable(); - final result = _ICU4XLocale_script(_underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocale_script = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XLocale_script') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Set the script part of the [`ICU4XLocale`]. Pass an empty string to remove the script. - /// - /// See the [Rust documentation for `try_from_bytes`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes) for more information. - set script(String bytes) { - final alloc = ffi2.Arena(); - final bytesSlice = _SliceFfi2Utf8._fromDart(bytes, alloc); - - final result = _ICU4XLocale_set_script( - _underlying, bytesSlice._bytes, bytesSlice._length); - alloc.releaseAll(); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } + static final _ICU4XLocale_to_string= _capi, ffi.Pointer)>>('ICU4XLocale_to_string') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `normalizing_eq`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.normalizing_eq) for more information. +bool normalizingEq(String other) { + final alloc = ffi2.Arena(); + final otherSlice = _SliceFfi2Utf8._fromDart(other, alloc); + + final result = _ICU4XLocale_normalizing_eq(_underlying,otherSlice._bytes,otherSlice._length);alloc.releaseAll(); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XLocale_normalizing_eq= _capi, ffi.Pointer, ffi.Size)>>('ICU4XLocale_normalizing_eq') + .asFunction, ffi.Pointer, int)>(isLeaf: true); + + +/// See the [Rust documentation for `strict_cmp`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.strict_cmp) for more information. +Ordering strictCmp(String other) { + final alloc = ffi2.Arena(); + final otherSlice = _SliceFfi2Utf8._fromDart(other, alloc); + + final result = _ICU4XLocale_strict_cmp(_underlying,otherSlice._bytes,otherSlice._length);alloc.releaseAll(); + return Ordering.values.firstWhere((v) => v._underlying == result); + } // ignore: non_constant_identifier_names - static final _ICU4XLocale_set_script = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Size)>>('ICU4XLocale_set_script') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Best effort locale canonicalizer that doesn't need any data - /// - /// Use ICU4XLocaleCanonicalizer for better control and functionality - /// - /// See the [Rust documentation for `canonicalize`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.canonicalize) for more information. - static String canonicalize(String bytes) { - final alloc = ffi2.Arena(); - final bytesSlice = _SliceFfi2Utf8._fromDart(bytes, alloc); - - final writeable = _Writeable(); - final result = _ICU4XLocale_canonicalize( - bytesSlice._bytes, bytesSlice._length, writeable._underlying); - alloc.releaseAll(); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocale_canonicalize = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, ffi.Size, - ffi.Pointer)>>('ICU4XLocale_canonicalize') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, int, - ffi.Pointer)>(isLeaf: true); - - /// Write a string representation of [`ICU4XLocale`] to `write` - /// - /// See the [Rust documentation for `write_to`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.write_to) for more information. - @override - String toString() { - final writeable = _Writeable(); - final result = _ICU4XLocale_to_string(_underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocale_to_string = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XLocale_to_string') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// See the [Rust documentation for `normalizing_eq`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.normalizing_eq) for more information. - bool normalizingEq(String other) { - final alloc = ffi2.Arena(); - final otherSlice = _SliceFfi2Utf8._fromDart(other, alloc); - - final result = _ICU4XLocale_normalizing_eq( - _underlying, otherSlice._bytes, otherSlice._length); - alloc.releaseAll(); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocale_normalizing_eq = _capi< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, ffi.Pointer, - ffi.Size)>>('ICU4XLocale_normalizing_eq') - .asFunction< - bool Function(ffi.Pointer, ffi.Pointer, - int)>(isLeaf: true); - - /// See the [Rust documentation for `strict_cmp`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.strict_cmp) for more information. - Ordering strictCmp(String other) { - final alloc = ffi2.Arena(); - final otherSlice = _SliceFfi2Utf8._fromDart(other, alloc); - - final result = _ICU4XLocale_strict_cmp( - _underlying, otherSlice._bytes, otherSlice._length); - alloc.releaseAll(); - return Ordering.values.firstWhere((v) => v._underlying == result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocale_strict_cmp = _capi< - ffi.NativeFunction< - ffi.Int32 Function(ffi.Pointer, - ffi.Pointer, ffi.Size)>>('ICU4XLocale_strict_cmp') - .asFunction< - int Function(ffi.Pointer, ffi.Pointer, - int)>(isLeaf: true); -} + static final _ICU4XLocale_strict_cmp= _capi, ffi.Pointer, ffi.Size)>>('ICU4XLocale_strict_cmp') + .asFunction, ffi.Pointer, int)>(isLeaf: true); + + + } + /// A locale canonicalizer. -/// +/// /// See the [Rust documentation for `LocaleCanonicalizer`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleCanonicalizer.html) for more information. class LocaleCanonicalizer implements ffi.Finalizable { - final ffi.Pointer _underlying; - LocaleCanonicalizer._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XLocaleCanonicalizer_destroy')); + LocaleCanonicalizer._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Create a new [`ICU4XLocaleCanonicalizer`]. - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleCanonicalizer.html#method.new) for more information. - factory LocaleCanonicalizer(DataProvider provider) { - final result = _ICU4XLocaleCanonicalizer_create(provider._underlying); - return result.isOk - ? LocaleCanonicalizer._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLocaleCanonicalizer_destroy')); + + +/// Create a new [`ICU4XLocaleCanonicalizer`]. +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleCanonicalizer.html#method.new) for more information. +factory LocaleCanonicalizer(DataProvider provider) { + + final result = _ICU4XLocaleCanonicalizer_create(provider._underlying); + return result.isOk ? LocaleCanonicalizer._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XLocaleCanonicalizer_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XLocaleCanonicalizer_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XLocaleCanonicalizer_create= _capi)>>('ICU4XLocaleCanonicalizer_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + - /// Create a new [`ICU4XLocaleCanonicalizer`] with extended data. - /// - /// See the [Rust documentation for `new_with_expander`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleCanonicalizer.html#method.new_with_expander) for more information. - factory LocaleCanonicalizer.extended(DataProvider provider) { - final result = - _ICU4XLocaleCanonicalizer_create_extended(provider._underlying); - return result.isOk - ? LocaleCanonicalizer._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Create a new [`ICU4XLocaleCanonicalizer`] with extended data. +/// +/// See the [Rust documentation for `new_with_expander`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleCanonicalizer.html#method.new_with_expander) for more information. +factory LocaleCanonicalizer.extended(DataProvider provider) { + + final result = _ICU4XLocaleCanonicalizer_create_extended(provider._underlying); + return result.isOk ? LocaleCanonicalizer._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XLocaleCanonicalizer_create_extended = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XLocaleCanonicalizer_create_extended') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XLocaleCanonicalizer_create_extended= _capi)>>('ICU4XLocaleCanonicalizer_create_extended') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// FFI version of `LocaleCanonicalizer::canonicalize()`. - /// - /// See the [Rust documentation for `canonicalize`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleCanonicalizer.html#method.canonicalize) for more information. - TransformResult canonicalize(Locale locale) { - final result = - _ICU4XLocaleCanonicalizer_canonicalize(_underlying, locale._underlying); - return TransformResult.values[result]; - } + +/// FFI version of `LocaleCanonicalizer::canonicalize()`. +/// +/// See the [Rust documentation for `canonicalize`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleCanonicalizer.html#method.canonicalize) for more information. +TransformResult canonicalize(Locale locale) { + + final result = _ICU4XLocaleCanonicalizer_canonicalize(_underlying,locale._underlying); + return TransformResult.values[result]; + } // ignore: non_constant_identifier_names - static final _ICU4XLocaleCanonicalizer_canonicalize = _capi< - ffi.NativeFunction< - ffi.Int32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XLocaleCanonicalizer_canonicalize') - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XLocaleCanonicalizer_canonicalize= _capi, ffi.Pointer)>>('ICU4XLocaleCanonicalizer_canonicalize') + .asFunction, ffi.Pointer)>(isLeaf: true); + + + } + /// See the [Rust documentation for `Direction`](https://docs.rs/icu/latest/icu/locid_transform/enum.Direction.html) for more information. enum LocaleDirection { @@ -8398,357 +6929,298 @@ enum LocaleDirection { unknown; } + /// See the [Rust documentation for `LocaleDirectionality`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleDirectionality.html) for more information. class LocaleDirectionality implements ffi.Finalizable { - final ffi.Pointer _underlying; - LocaleDirectionality._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XLocaleDirectionality_destroy')); - - /// Construct a new ICU4XLocaleDirectionality instance - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleDirectionality.html#method.new) for more information. - factory LocaleDirectionality(DataProvider provider) { - final result = _ICU4XLocaleDirectionality_create(provider._underlying); - return result.isOk - ? LocaleDirectionality._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XLocaleDirectionality_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XLocaleDirectionality_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Construct a new ICU4XLocaleDirectionality instance with a custom expander - /// - /// See the [Rust documentation for `new_with_expander`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleDirectionality.html#method.new_with_expander) for more information. - factory LocaleDirectionality.withExpander( - DataProvider provider, LocaleExpander expander) { - final result = _ICU4XLocaleDirectionality_create_with_expander( - provider._underlying, expander._underlying); - return result.isOk - ? LocaleDirectionality._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XLocaleDirectionality_create_with_expander = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XLocaleDirectionality_create_with_expander') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); + final ffi.Pointer _underlying; - /// See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleDirectionality.html#method.get) for more information. - LocaleDirection operator [](Locale locale) { - final result = - _ICU4XLocaleDirectionality_get(_underlying, locale._underlying); - return LocaleDirection.values[result]; - } + LocaleDirectionality._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLocaleDirectionality_destroy')); + + +/// Construct a new ICU4XLocaleDirectionality instance +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleDirectionality.html#method.new) for more information. +factory LocaleDirectionality(DataProvider provider) { + + final result = _ICU4XLocaleDirectionality_create(provider._underlying); + return result.isOk ? LocaleDirectionality._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XLocaleDirectionality_get = _capi< - ffi.NativeFunction< - ffi.Int32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XLocaleDirectionality_get') - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); + static final _ICU4XLocaleDirectionality_create= _capi)>>('ICU4XLocaleDirectionality_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// See the [Rust documentation for `is_left_to_right`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleDirectionality.html#method.is_left_to_right) for more information. - bool isLeftToRight(Locale locale) { - final result = _ICU4XLocaleDirectionality_is_left_to_right( - _underlying, locale._underlying); - return result; + + +/// Construct a new ICU4XLocaleDirectionality instance with a custom expander +/// +/// See the [Rust documentation for `new_with_expander`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleDirectionality.html#method.new_with_expander) for more information. +factory LocaleDirectionality.withExpander(DataProvider provider, LocaleExpander expander) { + + final result = _ICU4XLocaleDirectionality_create_with_expander(provider._underlying,expander._underlying); + return result.isOk ? LocaleDirectionality._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XLocaleDirectionality_create_with_expander= _capi, ffi.Pointer)>>('ICU4XLocaleDirectionality_create_with_expander') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + +/// See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleDirectionality.html#method.get) for more information. +LocaleDirection operator [](Locale locale) { + + final result = _ICU4XLocaleDirectionality_get(_underlying,locale._underlying); + return LocaleDirection.values[result]; + } // ignore: non_constant_identifier_names - static final _ICU4XLocaleDirectionality_is_left_to_right = _capi< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XLocaleDirectionality_is_left_to_right') - .asFunction< - bool Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); + static final _ICU4XLocaleDirectionality_get= _capi, ffi.Pointer)>>('ICU4XLocaleDirectionality_get') + .asFunction, ffi.Pointer)>(isLeaf: true); + - /// See the [Rust documentation for `is_right_to_left`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleDirectionality.html#method.is_right_to_left) for more information. - bool isRightToLeft(Locale locale) { - final result = _ICU4XLocaleDirectionality_is_right_to_left( - _underlying, locale._underlying); - return result; + +/// See the [Rust documentation for `is_left_to_right`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleDirectionality.html#method.is_left_to_right) for more information. +bool isLeftToRight(Locale locale) { + + final result = _ICU4XLocaleDirectionality_is_left_to_right(_underlying,locale._underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XLocaleDirectionality_is_left_to_right= _capi, ffi.Pointer)>>('ICU4XLocaleDirectionality_is_left_to_right') + .asFunction, ffi.Pointer)>(isLeaf: true); + + +/// See the [Rust documentation for `is_right_to_left`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleDirectionality.html#method.is_right_to_left) for more information. +bool isRightToLeft(Locale locale) { + + final result = _ICU4XLocaleDirectionality_is_right_to_left(_underlying,locale._underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XLocaleDirectionality_is_right_to_left = _capi< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XLocaleDirectionality_is_right_to_left') - .asFunction< - bool Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XLocaleDirectionality_is_right_to_left= _capi, ffi.Pointer)>>('ICU4XLocaleDirectionality_is_right_to_left') + .asFunction, ffi.Pointer)>(isLeaf: true); + + + } + /// See the [Rust documentation for `LocaleDisplayNamesFormatter`](https://docs.rs/icu/latest/icu/displaynames/struct.LocaleDisplayNamesFormatter.html) for more information. class LocaleDisplayNamesFormatter implements ffi.Finalizable { - final ffi.Pointer _underlying; - LocaleDisplayNamesFormatter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + final ffi.Pointer _underlying; + + LocaleDisplayNamesFormatter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLocaleDisplayNamesFormatter_destroy')); + + +/// Creates a new `LocaleDisplayNamesFormatter` from locale data and an options bag. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/displaynames/struct.LocaleDisplayNamesFormatter.html#method.try_new) for more information. +factory LocaleDisplayNamesFormatter(DataProvider provider, Locale locale, DisplayNamesOptionsV1 options) { + + final result = _ICU4XLocaleDisplayNamesFormatter_create(provider._underlying,locale._underlying,options._underlying); + return result.isOk ? LocaleDisplayNamesFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XLocaleDisplayNamesFormatter_create= _capi, ffi.Pointer, _DisplayNamesOptionsV1Ffi)>>('ICU4XLocaleDisplayNamesFormatter_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, _DisplayNamesOptionsV1Ffi)>(isLeaf: true); - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XLocaleDisplayNamesFormatter_destroy')); - /// Creates a new `LocaleDisplayNamesFormatter` from locale data and an options bag. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/displaynames/struct.LocaleDisplayNamesFormatter.html#method.try_new) for more information. - factory LocaleDisplayNamesFormatter( - DataProvider provider, Locale locale, DisplayNamesOptionsV1 options) { - final result = _ICU4XLocaleDisplayNamesFormatter_create( - provider._underlying, locale._underlying, options._underlying); - return result.isOk - ? LocaleDisplayNamesFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Returns the locale-specific display name of a locale. +/// +/// See the [Rust documentation for `of`](https://docs.rs/icu/latest/icu/displaynames/struct.LocaleDisplayNamesFormatter.html#method.of) for more information. +String of(Locale locale) { + + final writeable = _Writeable(); + final result = _ICU4XLocaleDisplayNamesFormatter_of(_underlying,locale._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XLocaleDisplayNamesFormatter_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, _DisplayNamesOptionsV1Ffi)>>( - 'ICU4XLocaleDisplayNamesFormatter_create') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - _DisplayNamesOptionsV1Ffi)>(isLeaf: true); - - /// Returns the locale-specific display name of a locale. - /// - /// See the [Rust documentation for `of`](https://docs.rs/icu/latest/icu/displaynames/struct.LocaleDisplayNamesFormatter.html#method.of) for more information. - String of(Locale locale) { - final writeable = _Writeable(); - final result = _ICU4XLocaleDisplayNamesFormatter_of( - _underlying, locale._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocaleDisplayNamesFormatter_of = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XLocaleDisplayNamesFormatter_of') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XLocaleDisplayNamesFormatter_of= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XLocaleDisplayNamesFormatter_of') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + } + /// A locale expander. -/// +/// /// See the [Rust documentation for `LocaleExpander`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleExpander.html) for more information. class LocaleExpander implements ffi.Finalizable { - final ffi.Pointer _underlying; - LocaleExpander._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; + + LocaleExpander._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XLocaleExpander_destroy')); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLocaleExpander_destroy')); - /// Create a new [`ICU4XLocaleExpander`]. - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleExpander.html#method.new) for more information. - factory LocaleExpander(DataProvider provider) { - final result = _ICU4XLocaleExpander_create(provider._underlying); - return result.isOk - ? LocaleExpander._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Create a new [`ICU4XLocaleExpander`]. +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleExpander.html#method.new) for more information. +factory LocaleExpander(DataProvider provider) { + + final result = _ICU4XLocaleExpander_create(provider._underlying); + return result.isOk ? LocaleExpander._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XLocaleExpander_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XLocaleExpander_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XLocaleExpander_create= _capi)>>('ICU4XLocaleExpander_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// Create a new [`ICU4XLocaleExpander`] with extended data. - /// - /// See the [Rust documentation for `new_extended`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleExpander.html#method.new_extended) for more information. - factory LocaleExpander.extended(DataProvider provider) { - final result = _ICU4XLocaleExpander_create_extended(provider._underlying); - return result.isOk - ? LocaleExpander._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + + +/// Create a new [`ICU4XLocaleExpander`] with extended data. +/// +/// See the [Rust documentation for `new_extended`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleExpander.html#method.new_extended) for more information. +factory LocaleExpander.extended(DataProvider provider) { + + final result = _ICU4XLocaleExpander_create_extended(provider._underlying); + return result.isOk ? LocaleExpander._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XLocaleExpander_create_extended = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XLocaleExpander_create_extended') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// FFI version of `LocaleExpander::maximize()`. - /// - /// See the [Rust documentation for `maximize`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleExpander.html#method.maximize) for more information. - TransformResult maximize(Locale locale) { - final result = - _ICU4XLocaleExpander_maximize(_underlying, locale._underlying); - return TransformResult.values[result]; - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocaleExpander_maximize = _capi< - ffi.NativeFunction< - ffi.Int32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XLocaleExpander_maximize') - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// FFI version of `LocaleExpander::minimize()`. - /// - /// See the [Rust documentation for `minimize`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleExpander.html#method.minimize) for more information. - TransformResult minimize(Locale locale) { - final result = - _ICU4XLocaleExpander_minimize(_underlying, locale._underlying); - return TransformResult.values[result]; - } - - // ignore: non_constant_identifier_names - static final _ICU4XLocaleExpander_minimize = _capi< - ffi.NativeFunction< - ffi.Int32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XLocaleExpander_minimize') - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XLocaleExpander_create_extended= _capi)>>('ICU4XLocaleExpander_create_extended') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); -/// Collection of configurations for the ICU4X fallback algorithm. -/// -/// See the [Rust documentation for `LocaleFallbackConfig`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbackConfig.html) for more information. -class _LocaleFallbackConfigFfi extends ffi.Struct { - @ffi.Int32() - external int priority; - external _SliceFfi2Utf8 extensionKey; - @ffi.Int32() - external int fallbackSupplement; -} -class LocaleFallbackConfig { - final _LocaleFallbackConfigFfi _underlying; + +/// FFI version of `LocaleExpander::maximize()`. +/// +/// See the [Rust documentation for `maximize`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleExpander.html#method.maximize) for more information. +TransformResult maximize(Locale locale) { + + final result = _ICU4XLocaleExpander_maximize(_underlying,locale._underlying); + return TransformResult.values[result]; + } + // ignore: non_constant_identifier_names + static final _ICU4XLocaleExpander_maximize= _capi, ffi.Pointer)>>('ICU4XLocaleExpander_maximize') + .asFunction, ffi.Pointer)>(isLeaf: true); - // ignore: unused_element - LocaleFallbackConfig._(this._underlying); - factory LocaleFallbackConfig() { - final pointer = ffi2.calloc<_LocaleFallbackConfigFfi>(); - final result = LocaleFallbackConfig._(pointer.ref); - _callocFree.attach(result, pointer.cast()); - return result; + +/// FFI version of `LocaleExpander::minimize()`. +/// +/// See the [Rust documentation for `minimize`](https://docs.rs/icu/latest/icu/locid_transform/struct.LocaleExpander.html#method.minimize) for more information. +TransformResult minimize(Locale locale) { + + final result = _ICU4XLocaleExpander_minimize(_underlying,locale._underlying); + return TransformResult.values[result]; } + // ignore: non_constant_identifier_names + static final _ICU4XLocaleExpander_minimize= _capi, ffi.Pointer)>>('ICU4XLocaleExpander_minimize') + .asFunction, ffi.Pointer)>(isLeaf: true); - LocaleFallbackPriority get priority => - LocaleFallbackPriority.values[_underlying.priority]; - set priority(LocaleFallbackPriority priority) { - _underlying.priority = priority.index; - } - String get extensionKey => _underlying.extensionKey._asDart; - set extensionKey(String extensionKey) { - final alloc = ffi2.calloc; - alloc.free(_underlying.extensionKey._bytes); - final extensionKeySlice = _SliceFfi2Utf8._fromDart(extensionKey, alloc); - _underlying.extensionKey = extensionKeySlice; - } + } - LocaleFallbackSupplement get fallbackSupplement => - LocaleFallbackSupplement.values[_underlying.fallbackSupplement]; - set fallbackSupplement(LocaleFallbackSupplement fallbackSupplement) { - _underlying.fallbackSupplement = fallbackSupplement.index; - } - @override - bool operator ==(Object other) => - other is LocaleFallbackConfig && - other._underlying.priority == _underlying.priority && - other._underlying.extensionKey == _underlying.extensionKey && - other._underlying.fallbackSupplement == _underlying.fallbackSupplement; +/// Collection of configurations for the ICU4X fallback algorithm. +/// +/// See the [Rust documentation for `LocaleFallbackConfig`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbackConfig.html) for more information. +class _LocaleFallbackConfigFfi extends ffi.Struct { + @ffi.Int32() + external int priority; + external _SliceFfi2Utf8 extensionKey; + @ffi.Int32() + external int fallbackSupplement; +} - @override - int get hashCode => Object.hashAll([ - _underlying.priority, - _underlying.extensionKey, - _underlying.fallbackSupplement, - ]); +class LocaleFallbackConfig { + final _LocaleFallbackConfigFfi _underlying; + + // ignore: unused_element + LocaleFallbackConfig._(this._underlying); + + factory LocaleFallbackConfig() { + final pointer = ffi2.calloc<_LocaleFallbackConfigFfi>(); + final result = LocaleFallbackConfig._(pointer.ref); + _callocFree.attach(result, pointer.cast()); + return result; + } + + LocaleFallbackPriority get priority => LocaleFallbackPriority.values[_underlying.priority]; + set priority(LocaleFallbackPriority priority) { + _underlying.priority = priority.index; + } +String get extensionKey => _underlying.extensionKey._asDart; + set extensionKey(String extensionKey) { + final alloc = ffi2.calloc; + alloc.free(_underlying.extensionKey._bytes); + final extensionKeySlice = _SliceFfi2Utf8._fromDart(extensionKey, alloc); + _underlying.extensionKey = extensionKeySlice; + } +LocaleFallbackSupplement get fallbackSupplement => LocaleFallbackSupplement.values[_underlying.fallbackSupplement]; + set fallbackSupplement(LocaleFallbackSupplement fallbackSupplement) { + _underlying.fallbackSupplement = fallbackSupplement.index; + } + + + @override + bool operator ==(Object other) => + other is LocaleFallbackConfig + && other._underlying.priority == _underlying.priority + && other._underlying.extensionKey == _underlying.extensionKey + && other._underlying.fallbackSupplement == _underlying.fallbackSupplement; + + @override + int get hashCode => Object.hashAll([_underlying.priority,_underlying.extensionKey,_underlying.fallbackSupplement,]); } + /// An iterator over the locale under fallback. -/// +/// /// See the [Rust documentation for `LocaleFallbackIterator`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbackIterator.html) for more information. class LocaleFallbackIterator implements ffi.Finalizable { - final ffi.Pointer _underlying; - LocaleFallbackIterator._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XLocaleFallbackIterator_destroy')); + LocaleFallbackIterator._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Gets a snapshot of the current state of the locale. - /// - /// See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbackIterator.html#method.get) for more information. - Locale get get { - final result = _ICU4XLocaleFallbackIterator_get(_underlying); - return Locale._(result); - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLocaleFallbackIterator_destroy')); + +/// Gets a snapshot of the current state of the locale. +/// +/// See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbackIterator.html#method.get) for more information. +Locale get get { + + final result = _ICU4XLocaleFallbackIterator_get(_underlying); + return Locale._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XLocaleFallbackIterator_get = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('ICU4XLocaleFallbackIterator_get') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XLocaleFallbackIterator_get= _capi Function(ffi.Pointer)>>('ICU4XLocaleFallbackIterator_get') + .asFunction Function(ffi.Pointer)>(isLeaf: true); - /// Performs one step of the fallback algorithm, mutating the locale. - /// - /// See the [Rust documentation for `step`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbackIterator.html#method.step) for more information. - void step() { - _ICU4XLocaleFallbackIterator_step(_underlying); - } + +/// Performs one step of the fallback algorithm, mutating the locale. +/// +/// See the [Rust documentation for `step`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbackIterator.html#method.step) for more information. +void step() { + + _ICU4XLocaleFallbackIterator_step(_underlying); + } // ignore: non_constant_identifier_names - static final _ICU4XLocaleFallbackIterator_step = - _capi)>>( - 'ICU4XLocaleFallbackIterator_step') - .asFunction)>(isLeaf: true); -} + static final _ICU4XLocaleFallbackIterator_step= _capi)>>('ICU4XLocaleFallbackIterator_step') + .asFunction)>(isLeaf: true); + + + } + /// Priority mode for the ICU4X fallback algorithm. -/// +/// /// See the [Rust documentation for `LocaleFallbackPriority`](https://docs.rs/icu/latest/icu/locid_transform/fallback/enum.LocaleFallbackPriority.html) for more information. enum LocaleFallbackPriority { language, @@ -8756,149 +7228,137 @@ enum LocaleFallbackPriority { collation; } + /// What additional data is required to load when performing fallback. -/// +/// /// See the [Rust documentation for `LocaleFallbackSupplement`](https://docs.rs/icu/latest/icu/locid_transform/fallback/enum.LocaleFallbackSupplement.html) for more information. enum LocaleFallbackSupplement { none, collation; } + /// An object that runs the ICU4X locale fallback algorithm. -/// +/// /// See the [Rust documentation for `LocaleFallbacker`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbacker.html) for more information. class LocaleFallbacker implements ffi.Finalizable { - final ffi.Pointer _underlying; - LocaleFallbacker._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; + + LocaleFallbacker._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XLocaleFallbacker_destroy')); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLocaleFallbacker_destroy')); - /// Creates a new `ICU4XLocaleFallbacker` from a data provider. - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbacker.html#method.new) for more information. - factory LocaleFallbacker(DataProvider provider) { - final result = _ICU4XLocaleFallbacker_create(provider._underlying); - return result.isOk - ? LocaleFallbacker._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Creates a new `ICU4XLocaleFallbacker` from a data provider. +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbacker.html#method.new) for more information. +factory LocaleFallbacker(DataProvider provider) { + + final result = _ICU4XLocaleFallbacker_create(provider._underlying); + return result.isOk ? LocaleFallbacker._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XLocaleFallbacker_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XLocaleFallbacker_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XLocaleFallbacker_create= _capi)>>('ICU4XLocaleFallbacker_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// Creates a new `ICU4XLocaleFallbacker` without data for limited functionality. - /// - /// See the [Rust documentation for `new_without_data`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbacker.html#method.new_without_data) for more information. - factory LocaleFallbacker.withoutData() { - final result = _ICU4XLocaleFallbacker_create_without_data(); - return LocaleFallbacker._(result); + + +/// Creates a new `ICU4XLocaleFallbacker` without data for limited functionality. +/// +/// See the [Rust documentation for `new_without_data`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbacker.html#method.new_without_data) for more information. +factory LocaleFallbacker.withoutData() { + + final result = _ICU4XLocaleFallbacker_create_without_data(); + return LocaleFallbacker._(result); } // ignore: non_constant_identifier_names - static final _ICU4XLocaleFallbacker_create_without_data = - _capi Function()>>( - 'ICU4XLocaleFallbacker_create_without_data') - .asFunction Function()>(isLeaf: true); + static final _ICU4XLocaleFallbacker_create_without_data= _capi Function()>>('ICU4XLocaleFallbacker_create_without_data') + .asFunction Function()>(isLeaf: true); - /// Associates this `ICU4XLocaleFallbacker` with configuration options. - /// - /// See the [Rust documentation for `for_config`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbacker.html#method.for_config) for more information. - LocaleFallbackerWithConfig forConfig(LocaleFallbackConfig config) { - final result = - _ICU4XLocaleFallbacker_for_config(_underlying, config._underlying); - return result.isOk - ? LocaleFallbackerWithConfig._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } + +/// Associates this `ICU4XLocaleFallbacker` with configuration options. +/// +/// See the [Rust documentation for `for_config`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbacker.html#method.for_config) for more information. +LocaleFallbackerWithConfig forConfig(LocaleFallbackConfig config) { + + final result = _ICU4XLocaleFallbacker_for_config(_underlying,config._underlying); + return result.isOk ? LocaleFallbackerWithConfig._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XLocaleFallbacker_for_config = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, _LocaleFallbackConfigFfi)>>( - 'ICU4XLocaleFallbacker_for_config') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, _LocaleFallbackConfigFfi)>(isLeaf: true); -} + static final _ICU4XLocaleFallbacker_for_config= _capi, _LocaleFallbackConfigFfi)>>('ICU4XLocaleFallbacker_for_config') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, _LocaleFallbackConfigFfi)>(isLeaf: true); + + + } + /// An object that runs the ICU4X locale fallback algorithm with specific configurations. -/// +/// /// See the [Rust documentation for `LocaleFallbacker`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbacker.html) for more information. -/// +/// /// See the [Rust documentation for `LocaleFallbackerWithConfig`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbackerWithConfig.html) for more information. class LocaleFallbackerWithConfig implements ffi.Finalizable { - final ffi.Pointer _underlying; - LocaleFallbackerWithConfig._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XLocaleFallbackerWithConfig_destroy')); + LocaleFallbackerWithConfig._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Creates an iterator from a locale with each step of fallback. - /// - /// See the [Rust documentation for `fallback_for`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbacker.html#method.fallback_for) for more information. - LocaleFallbackIterator fallbackForLocale(Locale locale) { - final result = _ICU4XLocaleFallbackerWithConfig_fallback_for_locale( - _underlying, locale._underlying); - return LocaleFallbackIterator._(result); - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XLocaleFallbackerWithConfig_destroy')); + +/// Creates an iterator from a locale with each step of fallback. +/// +/// See the [Rust documentation for `fallback_for`](https://docs.rs/icu/latest/icu/locid_transform/fallback/struct.LocaleFallbacker.html#method.fallback_for) for more information. +LocaleFallbackIterator fallbackForLocale(Locale locale) { + + final result = _ICU4XLocaleFallbackerWithConfig_fallback_for_locale(_underlying,locale._underlying); + return LocaleFallbackIterator._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XLocaleFallbackerWithConfig_fallback_for_locale = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XLocaleFallbackerWithConfig_fallback_for_locale') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XLocaleFallbackerWithConfig_fallback_for_locale= _capi Function(ffi.Pointer, ffi.Pointer)>>('ICU4XLocaleFallbackerWithConfig_fallback_for_locale') + .asFunction Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + } + /// An object capable of computing the metazone from a timezone. -/// +/// /// This can be used via `maybe_calculate_metazone()` on [`ICU4XCustomTimeZone`]. -/// +/// /// [`ICU4XCustomTimeZone`]: crate::timezone::ffi::ICU4XCustomTimeZone -/// +/// /// See the [Rust documentation for `MetazoneCalculator`](https://docs.rs/icu/latest/icu/timezone/struct.MetazoneCalculator.html) for more information. class MetazoneCalculator implements ffi.Finalizable { - final ffi.Pointer _underlying; - MetazoneCalculator._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; + + MetazoneCalculator._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XMetazoneCalculator_destroy')); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XMetazoneCalculator_destroy')); - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/timezone/struct.MetazoneCalculator.html#method.new) for more information. - factory MetazoneCalculator(DataProvider provider) { - final result = _ICU4XMetazoneCalculator_create(provider._underlying); - return result.isOk - ? MetazoneCalculator._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/timezone/struct.MetazoneCalculator.html#method.new) for more information. +factory MetazoneCalculator(DataProvider provider) { + + final result = _ICU4XMetazoneCalculator_create(provider._underlying); + return result.isOk ? MetazoneCalculator._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XMetazoneCalculator_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XMetazoneCalculator_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); -} + static final _ICU4XMetazoneCalculator_create= _capi)>>('ICU4XMetazoneCalculator_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + } + /// See the [Rust documentation for `Ordering`](https://docs.rs/core/latest/core/cmp/enum.Ordering.html) for more information. enum Ordering { @@ -8908,612 +7368,492 @@ enum Ordering { int get _underlying { switch (this) { - case less: - return -1; - case equal: - return 0; - case greater: - return 1; + case less: + return -1; + case equal: + return 0; + case greater: + return 1; } } + } + /// FFI version of `PluralRules::categories()` data. class _PluralCategoriesFfi extends ffi.Struct { - @ffi.Bool() - external bool zero; - @ffi.Bool() - external bool one; - @ffi.Bool() - external bool two; - @ffi.Bool() - external bool few; - @ffi.Bool() - external bool many; - @ffi.Bool() - external bool other; + @ffi.Bool() + external bool zero; + @ffi.Bool() + external bool one; + @ffi.Bool() + external bool two; + @ffi.Bool() + external bool few; + @ffi.Bool() + external bool many; + @ffi.Bool() + external bool other; } class PluralCategories { - final _PluralCategoriesFfi _underlying; + final _PluralCategoriesFfi _underlying; + + // ignore: unused_element + PluralCategories._(this._underlying); + + factory PluralCategories() { + final pointer = ffi2.calloc<_PluralCategoriesFfi>(); + final result = PluralCategories._(pointer.ref); + _callocFree.attach(result, pointer.cast()); + return result; + } + + bool get zero => _underlying.zero; + set zero(bool zero) { + _underlying.zero = zero; + } +bool get one => _underlying.one; + set one(bool one) { + _underlying.one = one; + } +bool get two => _underlying.two; + set two(bool two) { + _underlying.two = two; + } +bool get few => _underlying.few; + set few(bool few) { + _underlying.few = few; + } +bool get many => _underlying.many; + set many(bool many) { + _underlying.many = many; + } +bool get other => _underlying.other; + set other(bool other) { + _underlying.other = other; + } + + + @override + bool operator ==(Object other) => + other is PluralCategories + && other._underlying.zero == _underlying.zero + && other._underlying.one == _underlying.one + && other._underlying.two == _underlying.two + && other._underlying.few == _underlying.few + && other._underlying.many == _underlying.many + && other._underlying.other == _underlying.other; + + @override + int get hashCode => Object.hashAll([_underlying.zero,_underlying.one,_underlying.two,_underlying.few,_underlying.many,_underlying.other,]); +} + + +/// FFI version of `PluralCategory`. +/// +/// See the [Rust documentation for `PluralCategory`](https://docs.rs/icu/latest/icu/plurals/enum.PluralCategory.html) for more information. +enum PluralCategory { + zero, + one, + two, + few, + many, + other; + + +/// Construct from a string in the format +/// [specified in TR35](https://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules) +/// +/// See the [Rust documentation for `get_for_cldr_string`](https://docs.rs/icu/latest/icu/plurals/enum.PluralCategory.html#method.get_for_cldr_string) for more information. +/// +/// See the [Rust documentation for `get_for_cldr_bytes`](https://docs.rs/icu/latest/icu/plurals/enum.PluralCategory.html#method.get_for_cldr_bytes) for more information. +factory PluralCategory.forCldrString(String s) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final result = _ICU4XPluralCategory_get_for_cldr_string(sSlice._bytes,sSlice._length);alloc.releaseAll(); + return result.isOk ? PluralCategory.values[result.union.ok] : throw VoidError(); + } + // ignore: non_constant_identifier_names + static final _ICU4XPluralCategory_get_for_cldr_string= _capi, ffi.Size)>>('ICU4XPluralCategory_get_for_cldr_string') + .asFunction<_ResultInt32Void Function(ffi.Pointer, int)>(isLeaf: true); + + +} + + +/// FFI version of `PluralOperands`. +/// +/// See the [Rust documentation for `PluralOperands`](https://docs.rs/icu/latest/icu/plurals/struct.PluralOperands.html) for more information. +class PluralOperands implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + PluralOperands._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XPluralOperands_destroy')); + + +/// Construct for a given string representing a number +/// +/// See the [Rust documentation for `from_str`](https://docs.rs/icu/latest/icu/plurals/struct.PluralOperands.html#method.from_str) for more information. +factory PluralOperands.fromString(String s) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final result = _ICU4XPluralOperands_create_from_string(sSlice._bytes,sSlice._length);alloc.releaseAll(); + return result.isOk ? PluralOperands._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XPluralOperands_create_from_string= _capi, ffi.Size)>>('ICU4XPluralOperands_create_from_string') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>(isLeaf: true); + + + } + + +/// FFI version of `PluralRules`. +/// +/// See the [Rust documentation for `PluralRules`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html) for more information. +class PluralRules implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + PluralRules._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XPluralRules_destroy')); + + +/// Construct an [`ICU4XPluralRules`] for the given locale, for cardinal numbers +/// +/// See the [Rust documentation for `try_new_cardinal`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.try_new_cardinal) for more information. +factory PluralRules.cardinal(DataProvider provider, Locale locale) { + + final result = _ICU4XPluralRules_create_cardinal(provider._underlying,locale._underlying); + return result.isOk ? PluralRules._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XPluralRules_create_cardinal= _capi, ffi.Pointer)>>('ICU4XPluralRules_create_cardinal') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Construct an [`ICU4XPluralRules`] for the given locale, for ordinal numbers +/// +/// See the [Rust documentation for `try_new_ordinal`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.try_new_ordinal) for more information. +factory PluralRules.ordinal(DataProvider provider, Locale locale) { + + final result = _ICU4XPluralRules_create_ordinal(provider._underlying,locale._underlying); + return result.isOk ? PluralRules._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XPluralRules_create_ordinal= _capi, ffi.Pointer)>>('ICU4XPluralRules_create_ordinal') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Get the category for a given number represented as operands +/// +/// See the [Rust documentation for `category_for`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.category_for) for more information. +PluralCategory categoryFor(PluralOperands op) { + + final result = _ICU4XPluralRules_category_for(_underlying,op._underlying); + return PluralCategory.values[result]; + } + // ignore: non_constant_identifier_names + static final _ICU4XPluralRules_category_for= _capi, ffi.Pointer)>>('ICU4XPluralRules_category_for') + .asFunction, ffi.Pointer)>(isLeaf: true); + + + +/// Get all of the categories needed in the current locale +/// +/// See the [Rust documentation for `categories`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.categories) for more information. +PluralCategories get categories { + + final result = _ICU4XPluralRules_categories(_underlying); + return PluralCategories._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XPluralRules_categories= _capi)>>('ICU4XPluralRules_categories') + .asFunction<_PluralCategoriesFfi Function(ffi.Pointer)>(isLeaf: true); + + + } + + +/// A type capable of looking up a property value from a string name. +/// +/// See the [Rust documentation for `PropertyValueNameToEnumMapper`](https://docs.rs/icu/latest/icu/properties/names/struct.PropertyValueNameToEnumMapper.html) for more information. +/// +/// See the [Rust documentation for `PropertyValueNameToEnumMapperBorrowed`](https://docs.rs/icu/latest/icu/properties/names/struct.PropertyValueNameToEnumMapperBorrowed.html) for more information. +class PropertyValueNameToEnumMapper implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + PropertyValueNameToEnumMapper._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XPropertyValueNameToEnumMapper_destroy')); + + +/// Get the property value matching the given name, using strict matching +/// +/// Returns -1 if the name is unknown for this property +/// +/// See the [Rust documentation for `get_strict`](https://docs.rs/icu/latest/icu/properties/names/struct.PropertyValueNameToEnumMapperBorrowed.html#method.get_strict) for more information. +int getStrict(String name) { + final alloc = ffi2.Arena(); + final nameSlice = _SliceFfi2Utf8._fromDart(name, alloc); + + final result = _ICU4XPropertyValueNameToEnumMapper_get_strict(_underlying,nameSlice._bytes,nameSlice._length);alloc.releaseAll(); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XPropertyValueNameToEnumMapper_get_strict= _capi, ffi.Pointer, ffi.Size)>>('ICU4XPropertyValueNameToEnumMapper_get_strict') + .asFunction, ffi.Pointer, int)>(isLeaf: true); + + + +/// Get the property value matching the given name, using loose matching +/// +/// Returns -1 if the name is unknown for this property +/// +/// See the [Rust documentation for `get_loose`](https://docs.rs/icu/latest/icu/properties/names/struct.PropertyValueNameToEnumMapperBorrowed.html#method.get_loose) for more information. +int getLoose(String name) { + final alloc = ffi2.Arena(); + final nameSlice = _SliceFfi2Utf8._fromDart(name, alloc); + + final result = _ICU4XPropertyValueNameToEnumMapper_get_loose(_underlying,nameSlice._bytes,nameSlice._length);alloc.releaseAll(); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XPropertyValueNameToEnumMapper_get_loose= _capi, ffi.Pointer, ffi.Size)>>('ICU4XPropertyValueNameToEnumMapper_get_loose') + .asFunction, ffi.Pointer, int)>(isLeaf: true); + + + +/// See the [Rust documentation for `get_name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.GeneralCategory.html#method.get_name_to_enum_mapper) for more information. +factory PropertyValueNameToEnumMapper.loadGeneralCategory(DataProvider provider) { + + final result = _ICU4XPropertyValueNameToEnumMapper_load_general_category(provider._underlying); + return result.isOk ? PropertyValueNameToEnumMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XPropertyValueNameToEnumMapper_load_general_category= _capi)>>('ICU4XPropertyValueNameToEnumMapper_load_general_category') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.BidiClass.html#method.name_to_enum_mapper) for more information. +factory PropertyValueNameToEnumMapper.loadBidiClass(DataProvider provider) { + + final result = _ICU4XPropertyValueNameToEnumMapper_load_bidi_class(provider._underlying); + return result.isOk ? PropertyValueNameToEnumMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XPropertyValueNameToEnumMapper_load_bidi_class= _capi)>>('ICU4XPropertyValueNameToEnumMapper_load_bidi_class') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.EastAsianWidth.html#method.name_to_enum_mapper) for more information. +factory PropertyValueNameToEnumMapper.loadEastAsianWidth(DataProvider provider) { + + final result = _ICU4XPropertyValueNameToEnumMapper_load_east_asian_width(provider._underlying); + return result.isOk ? PropertyValueNameToEnumMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XPropertyValueNameToEnumMapper_load_east_asian_width= _capi)>>('ICU4XPropertyValueNameToEnumMapper_load_east_asian_width') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - // ignore: unused_element - PluralCategories._(this._underlying); - factory PluralCategories() { - final pointer = ffi2.calloc<_PluralCategoriesFfi>(); - final result = PluralCategories._(pointer.ref); - _callocFree.attach(result, pointer.cast()); - return result; + +/// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.IndicSyllabicCategory.html#method.name_to_enum_mapper) for more information. +factory PropertyValueNameToEnumMapper.loadIndicSyllabicCategory(DataProvider provider) { + + final result = _ICU4XPropertyValueNameToEnumMapper_load_indic_syllabic_category(provider._underlying); + return result.isOk ? PropertyValueNameToEnumMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XPropertyValueNameToEnumMapper_load_indic_syllabic_category= _capi)>>('ICU4XPropertyValueNameToEnumMapper_load_indic_syllabic_category') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - bool get zero => _underlying.zero; - set zero(bool zero) { - _underlying.zero = zero; - } - bool get one => _underlying.one; - set one(bool one) { - _underlying.one = one; + +/// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.LineBreak.html#method.name_to_enum_mapper) for more information. +factory PropertyValueNameToEnumMapper.loadLineBreak(DataProvider provider) { + + final result = _ICU4XPropertyValueNameToEnumMapper_load_line_break(provider._underlying); + return result.isOk ? PropertyValueNameToEnumMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XPropertyValueNameToEnumMapper_load_line_break= _capi)>>('ICU4XPropertyValueNameToEnumMapper_load_line_break') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - bool get two => _underlying.two; - set two(bool two) { - _underlying.two = two; - } - bool get few => _underlying.few; - set few(bool few) { - _underlying.few = few; + +/// See the [Rust documentation for `get_name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.GraphemeClusterBreak.html#method.get_name_to_enum_mapper) for more information. +factory PropertyValueNameToEnumMapper.loadGraphemeClusterBreak(DataProvider provider) { + + final result = _ICU4XPropertyValueNameToEnumMapper_load_grapheme_cluster_break(provider._underlying); + return result.isOk ? PropertyValueNameToEnumMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XPropertyValueNameToEnumMapper_load_grapheme_cluster_break= _capi)>>('ICU4XPropertyValueNameToEnumMapper_load_grapheme_cluster_break') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - bool get many => _underlying.many; - set many(bool many) { - _underlying.many = many; + + +/// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.WordBreak.html#method.name_to_enum_mapper) for more information. +factory PropertyValueNameToEnumMapper.loadWordBreak(DataProvider provider) { + + final result = _ICU4XPropertyValueNameToEnumMapper_load_word_break(provider._underlying); + return result.isOk ? PropertyValueNameToEnumMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XPropertyValueNameToEnumMapper_load_word_break= _capi)>>('ICU4XPropertyValueNameToEnumMapper_load_word_break') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - bool get other => _underlying.other; - set other(bool other) { - _underlying.other = other; + + +/// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.SentenceBreak.html#method.name_to_enum_mapper) for more information. +factory PropertyValueNameToEnumMapper.loadSentenceBreak(DataProvider provider) { + + final result = _ICU4XPropertyValueNameToEnumMapper_load_sentence_break(provider._underlying); + return result.isOk ? PropertyValueNameToEnumMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XPropertyValueNameToEnumMapper_load_sentence_break= _capi)>>('ICU4XPropertyValueNameToEnumMapper_load_sentence_break') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - @override - bool operator ==(Object other) => - other is PluralCategories && - other._underlying.zero == _underlying.zero && - other._underlying.one == _underlying.one && - other._underlying.two == _underlying.two && - other._underlying.few == _underlying.few && - other._underlying.many == _underlying.many && - other._underlying.other == _underlying.other; - @override - int get hashCode => Object.hashAll([ - _underlying.zero, - _underlying.one, - _underlying.two, - _underlying.few, - _underlying.many, - _underlying.other, - ]); -} + +/// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.Script.html#method.name_to_enum_mapper) for more information. +factory PropertyValueNameToEnumMapper.loadScript(DataProvider provider) { + + final result = _ICU4XPropertyValueNameToEnumMapper_load_script(provider._underlying); + return result.isOk ? PropertyValueNameToEnumMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XPropertyValueNameToEnumMapper_load_script= _capi)>>('ICU4XPropertyValueNameToEnumMapper_load_script') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); -/// FFI version of `PluralCategory`. -/// -/// See the [Rust documentation for `PluralCategory`](https://docs.rs/icu/latest/icu/plurals/enum.PluralCategory.html) for more information. -enum PluralCategory { - zero, - one, - two, - few, - many, - other; - /// Construct from a string in the format - /// [specified in TR35](https://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules) - /// - /// See the [Rust documentation for `get_for_cldr_string`](https://docs.rs/icu/latest/icu/plurals/enum.PluralCategory.html#method.get_for_cldr_string) for more information. - /// - /// See the [Rust documentation for `get_for_cldr_bytes`](https://docs.rs/icu/latest/icu/plurals/enum.PluralCategory.html#method.get_for_cldr_bytes) for more information. - factory PluralCategory.forCldrString(String s) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final result = - _ICU4XPluralCategory_get_for_cldr_string(sSlice._bytes, sSlice._length); - alloc.releaseAll(); - return result.isOk - ? PluralCategory.values[result.union.ok] - : throw VoidError(); - } - // ignore: non_constant_identifier_names - static final _ICU4XPluralCategory_get_for_cldr_string = _capi< - ffi.NativeFunction< - _ResultInt32Void Function(ffi.Pointer, - ffi.Size)>>('ICU4XPluralCategory_get_for_cldr_string') - .asFunction<_ResultInt32Void Function(ffi.Pointer, int)>( - isLeaf: true); -} + } -/// FFI version of `PluralOperands`. -/// -/// See the [Rust documentation for `PluralOperands`](https://docs.rs/icu/latest/icu/plurals/struct.PluralOperands.html) for more information. -class PluralOperands implements ffi.Finalizable { - final ffi.Pointer _underlying; - PluralOperands._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } +/// See the [Rust documentation for `RegionDisplayNames`](https://docs.rs/icu/latest/icu/displaynames/struct.RegionDisplayNames.html) for more information. +class RegionDisplayNames implements ffi.Finalizable { - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XPluralOperands_destroy')); + final ffi.Pointer _underlying; - /// Construct for a given string representing a number - /// - /// See the [Rust documentation for `from_str`](https://docs.rs/icu/latest/icu/plurals/struct.PluralOperands.html#method.from_str) for more information. - factory PluralOperands.fromString(String s) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + RegionDisplayNames._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - final result = - _ICU4XPluralOperands_create_from_string(sSlice._bytes, sSlice._length); - alloc.releaseAll(); - return result.isOk - ? PluralOperands._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XRegionDisplayNames_destroy')); + + +/// Creates a new `RegionDisplayNames` from locale data and an options bag. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/displaynames/struct.RegionDisplayNames.html#method.try_new) for more information. +factory RegionDisplayNames(DataProvider provider, Locale locale) { + + final result = _ICU4XRegionDisplayNames_create(provider._underlying,locale._underlying); + return result.isOk ? RegionDisplayNames._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XPluralOperands_create_from_string = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Size)>>('ICU4XPluralOperands_create_from_string') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, int)>( - isLeaf: true); -} - -/// FFI version of `PluralRules`. -/// -/// See the [Rust documentation for `PluralRules`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html) for more information. -class PluralRules implements ffi.Finalizable { - final ffi.Pointer _underlying; + static final _ICU4XRegionDisplayNames_create= _capi, ffi.Pointer)>>('ICU4XRegionDisplayNames_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); - PluralRules._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XPluralRules_destroy')); - - /// Construct an [`ICU4XPluralRules`] for the given locale, for cardinal numbers - /// - /// See the [Rust documentation for `try_new_cardinal`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.try_new_cardinal) for more information. - factory PluralRules.cardinal(DataProvider provider, Locale locale) { - final result = _ICU4XPluralRules_create_cardinal( - provider._underlying, locale._underlying); - return result.isOk - ? PluralRules._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XPluralRules_create_cardinal = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XPluralRules_create_cardinal') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Construct an [`ICU4XPluralRules`] for the given locale, for ordinal numbers - /// - /// See the [Rust documentation for `try_new_ordinal`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.try_new_ordinal) for more information. - factory PluralRules.ordinal(DataProvider provider, Locale locale) { - final result = _ICU4XPluralRules_create_ordinal( - provider._underlying, locale._underlying); - return result.isOk - ? PluralRules._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XPluralRules_create_ordinal = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XPluralRules_create_ordinal') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Get the category for a given number represented as operands - /// - /// See the [Rust documentation for `category_for`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.category_for) for more information. - PluralCategory categoryFor(PluralOperands op) { - final result = _ICU4XPluralRules_category_for(_underlying, op._underlying); - return PluralCategory.values[result]; - } - - // ignore: non_constant_identifier_names - static final _ICU4XPluralRules_category_for = _capi< - ffi.NativeFunction< - ffi.Int32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XPluralRules_category_for') - .asFunction< - int Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Get all of the categories needed in the current locale - /// - /// See the [Rust documentation for `categories`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.categories) for more information. - PluralCategories get categories { - final result = _ICU4XPluralRules_categories(_underlying); - return PluralCategories._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XPluralRules_categories = _capi< - ffi.NativeFunction< - _PluralCategoriesFfi Function( - ffi.Pointer)>>('ICU4XPluralRules_categories') - .asFunction<_PluralCategoriesFfi Function(ffi.Pointer)>( - isLeaf: true); -} -/// A type capable of looking up a property value from a string name. -/// -/// See the [Rust documentation for `PropertyValueNameToEnumMapper`](https://docs.rs/icu/latest/icu/properties/names/struct.PropertyValueNameToEnumMapper.html) for more information. -/// -/// See the [Rust documentation for `PropertyValueNameToEnumMapperBorrowed`](https://docs.rs/icu/latest/icu/properties/names/struct.PropertyValueNameToEnumMapperBorrowed.html) for more information. -class PropertyValueNameToEnumMapper implements ffi.Finalizable { - final ffi.Pointer _underlying; + +/// Returns the locale specific display name of a region. +/// Note that the funtion returns an empty string in case the display name for a given +/// region code is not found. +/// +/// See the [Rust documentation for `of`](https://docs.rs/icu/latest/icu/displaynames/struct.RegionDisplayNames.html#method.of) for more information. +String of(String region) { + final alloc = ffi2.Arena(); + final regionSlice = _SliceFfi2Utf8._fromDart(region, alloc); + + final writeable = _Writeable(); + final result = _ICU4XRegionDisplayNames_of(_underlying,regionSlice._bytes,regionSlice._length,writeable._underlying);alloc.releaseAll(); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XRegionDisplayNames_of= _capi, ffi.Pointer, ffi.Size, ffi.Pointer)>>('ICU4XRegionDisplayNames_of') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int, ffi.Pointer)>(isLeaf: true); - PropertyValueNameToEnumMapper._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XPropertyValueNameToEnumMapper_destroy')); - - /// Get the property value matching the given name, using strict matching - /// - /// Returns -1 if the name is unknown for this property - /// - /// See the [Rust documentation for `get_strict`](https://docs.rs/icu/latest/icu/properties/names/struct.PropertyValueNameToEnumMapperBorrowed.html#method.get_strict) for more information. - int getStrict(String name) { - final alloc = ffi2.Arena(); - final nameSlice = _SliceFfi2Utf8._fromDart(name, alloc); - - final result = _ICU4XPropertyValueNameToEnumMapper_get_strict( - _underlying, nameSlice._bytes, nameSlice._length); - alloc.releaseAll(); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XPropertyValueNameToEnumMapper_get_strict = _capi< - ffi.NativeFunction< - ffi.Int16 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XPropertyValueNameToEnumMapper_get_strict') - .asFunction< - int Function(ffi.Pointer, ffi.Pointer, - int)>(isLeaf: true); - - /// Get the property value matching the given name, using loose matching - /// - /// Returns -1 if the name is unknown for this property - /// - /// See the [Rust documentation for `get_loose`](https://docs.rs/icu/latest/icu/properties/names/struct.PropertyValueNameToEnumMapperBorrowed.html#method.get_loose) for more information. - int getLoose(String name) { - final alloc = ffi2.Arena(); - final nameSlice = _SliceFfi2Utf8._fromDart(name, alloc); - - final result = _ICU4XPropertyValueNameToEnumMapper_get_loose( - _underlying, nameSlice._bytes, nameSlice._length); - alloc.releaseAll(); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XPropertyValueNameToEnumMapper_get_loose = _capi< - ffi.NativeFunction< - ffi.Int16 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XPropertyValueNameToEnumMapper_get_loose') - .asFunction< - int Function(ffi.Pointer, ffi.Pointer, - int)>(isLeaf: true); - - /// See the [Rust documentation for `get_name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.GeneralCategory.html#method.get_name_to_enum_mapper) for more information. - factory PropertyValueNameToEnumMapper.loadGeneralCategory( - DataProvider provider) { - final result = _ICU4XPropertyValueNameToEnumMapper_load_general_category( - provider._underlying); - return result.isOk - ? PropertyValueNameToEnumMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XPropertyValueNameToEnumMapper_load_general_category = - _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XPropertyValueNameToEnumMapper_load_general_category') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.BidiClass.html#method.name_to_enum_mapper) for more information. - factory PropertyValueNameToEnumMapper.loadBidiClass(DataProvider provider) { - final result = _ICU4XPropertyValueNameToEnumMapper_load_bidi_class( - provider._underlying); - return result.isOk - ? PropertyValueNameToEnumMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XPropertyValueNameToEnumMapper_load_bidi_class = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XPropertyValueNameToEnumMapper_load_bidi_class') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.EastAsianWidth.html#method.name_to_enum_mapper) for more information. - factory PropertyValueNameToEnumMapper.loadEastAsianWidth( - DataProvider provider) { - final result = _ICU4XPropertyValueNameToEnumMapper_load_east_asian_width( - provider._underlying); - return result.isOk - ? PropertyValueNameToEnumMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XPropertyValueNameToEnumMapper_load_east_asian_width = - _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XPropertyValueNameToEnumMapper_load_east_asian_width') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.IndicSyllabicCategory.html#method.name_to_enum_mapper) for more information. - factory PropertyValueNameToEnumMapper.loadIndicSyllabicCategory( - DataProvider provider) { - final result = - _ICU4XPropertyValueNameToEnumMapper_load_indic_syllabic_category( - provider._underlying); - return result.isOk - ? PropertyValueNameToEnumMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XPropertyValueNameToEnumMapper_load_indic_syllabic_category = - _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XPropertyValueNameToEnumMapper_load_indic_syllabic_category') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.LineBreak.html#method.name_to_enum_mapper) for more information. - factory PropertyValueNameToEnumMapper.loadLineBreak(DataProvider provider) { - final result = _ICU4XPropertyValueNameToEnumMapper_load_line_break( - provider._underlying); - return result.isOk - ? PropertyValueNameToEnumMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XPropertyValueNameToEnumMapper_load_line_break = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XPropertyValueNameToEnumMapper_load_line_break') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `get_name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.GraphemeClusterBreak.html#method.get_name_to_enum_mapper) for more information. - factory PropertyValueNameToEnumMapper.loadGraphemeClusterBreak( - DataProvider provider) { - final result = - _ICU4XPropertyValueNameToEnumMapper_load_grapheme_cluster_break( - provider._underlying); - return result.isOk - ? PropertyValueNameToEnumMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XPropertyValueNameToEnumMapper_load_grapheme_cluster_break = - _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XPropertyValueNameToEnumMapper_load_grapheme_cluster_break') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.WordBreak.html#method.name_to_enum_mapper) for more information. - factory PropertyValueNameToEnumMapper.loadWordBreak(DataProvider provider) { - final result = _ICU4XPropertyValueNameToEnumMapper_load_word_break( - provider._underlying); - return result.isOk - ? PropertyValueNameToEnumMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XPropertyValueNameToEnumMapper_load_word_break = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XPropertyValueNameToEnumMapper_load_word_break') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.SentenceBreak.html#method.name_to_enum_mapper) for more information. - factory PropertyValueNameToEnumMapper.loadSentenceBreak( - DataProvider provider) { - final result = _ICU4XPropertyValueNameToEnumMapper_load_sentence_break( - provider._underlying); - return result.isOk - ? PropertyValueNameToEnumMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XPropertyValueNameToEnumMapper_load_sentence_break = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XPropertyValueNameToEnumMapper_load_sentence_break') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.Script.html#method.name_to_enum_mapper) for more information. - factory PropertyValueNameToEnumMapper.loadScript(DataProvider provider) { - final result = - _ICU4XPropertyValueNameToEnumMapper_load_script(provider._underlying); - return result.isOk - ? PropertyValueNameToEnumMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XPropertyValueNameToEnumMapper_load_script = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XPropertyValueNameToEnumMapper_load_script') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); -} -/// See the [Rust documentation for `RegionDisplayNames`](https://docs.rs/icu/latest/icu/displaynames/struct.RegionDisplayNames.html) for more information. -class RegionDisplayNames implements ffi.Finalizable { - final ffi.Pointer _underlying; + } - RegionDisplayNames._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XRegionDisplayNames_destroy')); - - /// Creates a new `RegionDisplayNames` from locale data and an options bag. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/displaynames/struct.RegionDisplayNames.html#method.try_new) for more information. - factory RegionDisplayNames(DataProvider provider, Locale locale) { - final result = _ICU4XRegionDisplayNames_create( - provider._underlying, locale._underlying); - return result.isOk - ? RegionDisplayNames._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XRegionDisplayNames_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XRegionDisplayNames_create') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Returns the locale specific display name of a region. - /// Note that the funtion returns an empty string in case the display name for a given - /// region code is not found. - /// - /// See the [Rust documentation for `of`](https://docs.rs/icu/latest/icu/displaynames/struct.RegionDisplayNames.html#method.of) for more information. - String of(String region) { - final alloc = ffi2.Arena(); - final regionSlice = _SliceFfi2Utf8._fromDart(region, alloc); - - final writeable = _Writeable(); - final result = _ICU4XRegionDisplayNames_of(_underlying, regionSlice._bytes, - regionSlice._length, writeable._underlying); - alloc.releaseAll(); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XRegionDisplayNames_of = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer)>>('ICU4XRegionDisplayNames_of') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer)>(isLeaf: true); -} /// Thin wrapper around a vector that maps visual indices to source indices -/// +/// /// `map[visualIndex] = sourceIndex` -/// +/// /// Produced by `reorder_visual()` on [`ICU4XBidi`]. class ReorderedIndexMap implements ffi.Finalizable { - final ffi.Pointer _underlying; - ReorderedIndexMap._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XReorderedIndexMap_destroy')); + ReorderedIndexMap._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Get this as a slice/array of indices - SizeList get asSlice { - final result = _ICU4XReorderedIndexMap_as_slice(_underlying); - return result._asDart; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XReorderedIndexMap_destroy')); + +/// Get this as a slice/array of indices +SizeList get asSlice { + + final result = _ICU4XReorderedIndexMap_as_slice(_underlying); + return result._asDart; + } // ignore: non_constant_identifier_names - static final _ICU4XReorderedIndexMap_as_slice = - _capi)>>( - 'ICU4XReorderedIndexMap_as_slice') - .asFunction)>(isLeaf: true); + static final _ICU4XReorderedIndexMap_as_slice= _capi)>>('ICU4XReorderedIndexMap_as_slice') + .asFunction)>(isLeaf: true); - /// The length of this map - int get length { - final result = _ICU4XReorderedIndexMap_len(_underlying); - return result; - } + +/// The length of this map +int get length { + + final result = _ICU4XReorderedIndexMap_len(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XReorderedIndexMap_len = - _capi)>>( - 'ICU4XReorderedIndexMap_len') - .asFunction)>(isLeaf: true); + static final _ICU4XReorderedIndexMap_len= _capi)>>('ICU4XReorderedIndexMap_len') + .asFunction)>(isLeaf: true); - /// Get element at `index`. Returns 0 when out of bounds - /// (note that 0 is also a valid in-bounds value, please use `len()` - /// to avoid out-of-bounds) - int operator [](int index) { - final result = _ICU4XReorderedIndexMap_get(_underlying, index); - return result; - } + +/// Get element at `index`. Returns 0 when out of bounds +/// (note that 0 is also a valid in-bounds value, please use `len()` +/// to avoid out-of-bounds) +int operator [](int index) { + + final result = _ICU4XReorderedIndexMap_get(_underlying,index); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XReorderedIndexMap_get = _capi< - ffi.NativeFunction< - ffi.Size Function(ffi.Pointer, - ffi.Size)>>('ICU4XReorderedIndexMap_get') - .asFunction, int)>(isLeaf: true); -} + static final _ICU4XReorderedIndexMap_get= _capi, ffi.Size)>>('ICU4XReorderedIndexMap_get') + .asFunction, int)>(isLeaf: true); + + + } + /// Increment used in a rounding operation. -/// +/// /// See the [Rust documentation for `RoundingIncrement`](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.RoundingIncrement.html) for more information. enum RoundingIncrement { multiplesOf1, @@ -9522,256 +7862,221 @@ enum RoundingIncrement { multiplesOf25; } + /// An object that represents the Script_Extensions property for a single character -/// +/// /// See the [Rust documentation for `ScriptExtensionsSet`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptExtensionsSet.html) for more information. class ScriptExtensionsSet implements ffi.Finalizable { - final ffi.Pointer _underlying; - ScriptExtensionsSet._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XScriptExtensionsSet_destroy')); + ScriptExtensionsSet._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Check if the Script_Extensions property of the given code point covers the given script - /// - /// See the [Rust documentation for `contains`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptExtensionsSet.html#method.contains) for more information. - bool contains(int script) { - final result = _ICU4XScriptExtensionsSet_contains(_underlying, script); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XScriptExtensionsSet_destroy')); + +/// Check if the Script_Extensions property of the given code point covers the given script +/// +/// See the [Rust documentation for `contains`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptExtensionsSet.html#method.contains) for more information. +bool contains(int script) { + + final result = _ICU4XScriptExtensionsSet_contains(_underlying,script); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XScriptExtensionsSet_contains = _capi< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Uint16)>>('ICU4XScriptExtensionsSet_contains') - .asFunction, int)>(isLeaf: true); + static final _ICU4XScriptExtensionsSet_contains= _capi, ffi.Uint16)>>('ICU4XScriptExtensionsSet_contains') + .asFunction, int)>(isLeaf: true); - /// Get the number of scripts contained in here - /// - /// See the [Rust documentation for `iter`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptExtensionsSet.html#method.iter) for more information. - int get count { - final result = _ICU4XScriptExtensionsSet_count(_underlying); - return result; - } + +/// Get the number of scripts contained in here +/// +/// See the [Rust documentation for `iter`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptExtensionsSet.html#method.iter) for more information. +int get count { + + final result = _ICU4XScriptExtensionsSet_count(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XScriptExtensionsSet_count = - _capi)>>( - 'ICU4XScriptExtensionsSet_count') - .asFunction)>(isLeaf: true); + static final _ICU4XScriptExtensionsSet_count= _capi)>>('ICU4XScriptExtensionsSet_count') + .asFunction)>(isLeaf: true); - /// Get script at index, returning an error if out of bounds - /// - /// See the [Rust documentation for `iter`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptExtensionsSet.html#method.iter) for more information. - int scriptAt(int index) { - final result = _ICU4XScriptExtensionsSet_script_at(_underlying, index); - return result.isOk ? result.union.ok : throw VoidError(); - } + +/// Get script at index, returning an error if out of bounds +/// +/// See the [Rust documentation for `iter`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptExtensionsSet.html#method.iter) for more information. +int scriptAt(int index) { + + final result = _ICU4XScriptExtensionsSet_script_at(_underlying,index); + return result.isOk ? result.union.ok : throw VoidError(); + } // ignore: non_constant_identifier_names - static final _ICU4XScriptExtensionsSet_script_at = _capi< - ffi.NativeFunction< - _ResultUint16Void Function(ffi.Pointer, - ffi.Size)>>('ICU4XScriptExtensionsSet_script_at') - .asFunction<_ResultUint16Void Function(ffi.Pointer, int)>( - isLeaf: true); -} + static final _ICU4XScriptExtensionsSet_script_at= _capi, ffi.Size)>>('ICU4XScriptExtensionsSet_script_at') + .asFunction<_ResultUint16Void Function(ffi.Pointer, int)>(isLeaf: true); + + + } + /// An ICU4X ScriptWithExtensions map object, capable of holding a map of codepoints to scriptextensions values -/// +/// /// See the [Rust documentation for `ScriptWithExtensions`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensions.html) for more information. class ScriptWithExtensions implements ffi.Finalizable { - final ffi.Pointer _underlying; - ScriptWithExtensions._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XScriptWithExtensions_destroy')); + ScriptWithExtensions._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// See the [Rust documentation for `script_with_extensions`](https://docs.rs/icu/latest/icu/properties/script/fn.script_with_extensions.html) for more information. - factory ScriptWithExtensions(DataProvider provider) { - final result = _ICU4XScriptWithExtensions_create(provider._underlying); - return result.isOk - ? ScriptWithExtensions._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XScriptWithExtensions_destroy')); + + +/// See the [Rust documentation for `script_with_extensions`](https://docs.rs/icu/latest/icu/properties/script/fn.script_with_extensions.html) for more information. +factory ScriptWithExtensions(DataProvider provider) { + + final result = _ICU4XScriptWithExtensions_create(provider._underlying); + return result.isOk ? ScriptWithExtensions._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XScriptWithExtensions_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XScriptWithExtensions_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XScriptWithExtensions_create= _capi)>>('ICU4XScriptWithExtensions_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - /// Get the Script property value for a code point - /// - /// See the [Rust documentation for `get_script_val`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_val) for more information. - int getScriptVal(int codePoint) { - final result = - _ICU4XScriptWithExtensions_get_script_val(_underlying, codePoint); - return result; - } + +/// Get the Script property value for a code point +/// +/// See the [Rust documentation for `get_script_val`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_val) for more information. +int getScriptVal(int codePoint) { + + final result = _ICU4XScriptWithExtensions_get_script_val(_underlying,codePoint); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XScriptWithExtensions_get_script_val = _capi< - ffi.NativeFunction< - ffi.Uint16 Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XScriptWithExtensions_get_script_val') - .asFunction, int)>(isLeaf: true); + static final _ICU4XScriptWithExtensions_get_script_val= _capi, ffi.Uint32)>>('ICU4XScriptWithExtensions_get_script_val') + .asFunction, int)>(isLeaf: true); - /// Check if the Script_Extensions property of the given code point covers the given script - /// - /// See the [Rust documentation for `has_script`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.has_script) for more information. - bool hasScript(int codePoint, int script) { - final result = - _ICU4XScriptWithExtensions_has_script(_underlying, codePoint, script); - return result; - } + +/// Check if the Script_Extensions property of the given code point covers the given script +/// +/// See the [Rust documentation for `has_script`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.has_script) for more information. +bool hasScript(int codePoint, int script) { + + final result = _ICU4XScriptWithExtensions_has_script(_underlying,codePoint,script); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XScriptWithExtensions_has_script = _capi< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, ffi.Uint32, - ffi.Uint16)>>('ICU4XScriptWithExtensions_has_script') - .asFunction, int, int)>( - isLeaf: true); + static final _ICU4XScriptWithExtensions_has_script= _capi, ffi.Uint32, ffi.Uint16)>>('ICU4XScriptWithExtensions_has_script') + .asFunction, int, int)>(isLeaf: true); - /// Borrow this object for a slightly faster variant with more operations - /// - /// See the [Rust documentation for `as_borrowed`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensions.html#method.as_borrowed) for more information. - ScriptWithExtensionsBorrowed get asBorrowed { - final result = _ICU4XScriptWithExtensions_as_borrowed(_underlying); - return ScriptWithExtensionsBorrowed._(result); - } + +/// Borrow this object for a slightly faster variant with more operations +/// +/// See the [Rust documentation for `as_borrowed`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensions.html#method.as_borrowed) for more information. +ScriptWithExtensionsBorrowed get asBorrowed { + + final result = _ICU4XScriptWithExtensions_as_borrowed(_underlying); + return ScriptWithExtensionsBorrowed._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XScriptWithExtensions_as_borrowed = _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>>( - 'ICU4XScriptWithExtensions_as_borrowed') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); + static final _ICU4XScriptWithExtensions_as_borrowed= _capi Function(ffi.Pointer)>>('ICU4XScriptWithExtensions_as_borrowed') + .asFunction Function(ffi.Pointer)>(isLeaf: true); - /// Get a list of ranges of code points that contain this script in their Script_Extensions values - /// - /// See the [Rust documentation for `get_script_extensions_ranges`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_extensions_ranges) for more information. - CodePointRangeIterator iterRangesForScript(int script) { - final result = - _ICU4XScriptWithExtensions_iter_ranges_for_script(_underlying, script); - return CodePointRangeIterator._(result); - } + +/// Get a list of ranges of code points that contain this script in their Script_Extensions values +/// +/// See the [Rust documentation for `get_script_extensions_ranges`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_extensions_ranges) for more information. +CodePointRangeIterator iterRangesForScript(int script) { + + final result = _ICU4XScriptWithExtensions_iter_ranges_for_script(_underlying,script); + return CodePointRangeIterator._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XScriptWithExtensions_iter_ranges_for_script = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Uint16)>>( - 'ICU4XScriptWithExtensions_iter_ranges_for_script') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, int)>(isLeaf: true); -} + static final _ICU4XScriptWithExtensions_iter_ranges_for_script= _capi Function(ffi.Pointer, ffi.Uint16)>>('ICU4XScriptWithExtensions_iter_ranges_for_script') + .asFunction Function(ffi.Pointer, int)>(isLeaf: true); + + + } + /// A slightly faster ICU4XScriptWithExtensions object -/// +/// /// See the [Rust documentation for `ScriptWithExtensionsBorrowed`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html) for more information. class ScriptWithExtensionsBorrowed implements ffi.Finalizable { - final ffi.Pointer _underlying; - ScriptWithExtensionsBorrowed._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + final ffi.Pointer _underlying; + + ScriptWithExtensionsBorrowed._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XScriptWithExtensionsBorrowed_destroy')); + + +/// Get the Script property value for a code point +/// +/// See the [Rust documentation for `get_script_val`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_val) for more information. +int getScriptVal(int codePoint) { + + final result = _ICU4XScriptWithExtensionsBorrowed_get_script_val(_underlying,codePoint); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XScriptWithExtensionsBorrowed_get_script_val= _capi, ffi.Uint32)>>('ICU4XScriptWithExtensionsBorrowed_get_script_val') + .asFunction, int)>(isLeaf: true); - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XScriptWithExtensionsBorrowed_destroy')); - /// Get the Script property value for a code point - /// - /// See the [Rust documentation for `get_script_val`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_val) for more information. - int getScriptVal(int codePoint) { - final result = _ICU4XScriptWithExtensionsBorrowed_get_script_val( - _underlying, codePoint); - return result; + +/// Get the Script property value for a code point +/// +/// See the [Rust documentation for `get_script_extensions_val`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_extensions_val) for more information. +ScriptExtensionsSet getScriptExtensionsVal(int codePoint) { + + final result = _ICU4XScriptWithExtensionsBorrowed_get_script_extensions_val(_underlying,codePoint); + return ScriptExtensionsSet._(result); } + // ignore: non_constant_identifier_names + static final _ICU4XScriptWithExtensionsBorrowed_get_script_extensions_val= _capi Function(ffi.Pointer, ffi.Uint32)>>('ICU4XScriptWithExtensionsBorrowed_get_script_extensions_val') + .asFunction Function(ffi.Pointer, int)>(isLeaf: true); + + +/// Check if the Script_Extensions property of the given code point covers the given script +/// +/// See the [Rust documentation for `has_script`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.has_script) for more information. +bool hasScript(int codePoint, int script) { + + final result = _ICU4XScriptWithExtensionsBorrowed_has_script(_underlying,codePoint,script); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XScriptWithExtensionsBorrowed_get_script_val = _capi< - ffi.NativeFunction< - ffi.Uint16 Function(ffi.Pointer, ffi.Uint32)>>( - 'ICU4XScriptWithExtensionsBorrowed_get_script_val') - .asFunction, int)>(isLeaf: true); - - /// Get the Script property value for a code point - /// - /// See the [Rust documentation for `get_script_extensions_val`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_extensions_val) for more information. - ScriptExtensionsSet getScriptExtensionsVal(int codePoint) { - final result = _ICU4XScriptWithExtensionsBorrowed_get_script_extensions_val( - _underlying, codePoint); - return ScriptExtensionsSet._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XScriptWithExtensionsBorrowed_get_script_extensions_val = - _capi< - ffi - .NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi - .Uint32)>>( - 'ICU4XScriptWithExtensionsBorrowed_get_script_extensions_val') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, int)>(isLeaf: true); - - /// Check if the Script_Extensions property of the given code point covers the given script - /// - /// See the [Rust documentation for `has_script`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.has_script) for more information. - bool hasScript(int codePoint, int script) { - final result = _ICU4XScriptWithExtensionsBorrowed_has_script( - _underlying, codePoint, script); - return result; - } - - // ignore: non_constant_identifier_names - static final _ICU4XScriptWithExtensionsBorrowed_has_script = _capi< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, ffi.Uint32, - ffi.Uint16)>>('ICU4XScriptWithExtensionsBorrowed_has_script') - .asFunction, int, int)>( - isLeaf: true); - - /// Build the CodePointSetData corresponding to a codepoints matching a particular script - /// in their Script_Extensions - /// - /// See the [Rust documentation for `get_script_extensions_set`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_extensions_set) for more information. - CodePointSetData getScriptExtensionsSet(int script) { - final result = _ICU4XScriptWithExtensionsBorrowed_get_script_extensions_set( - _underlying, script); - return CodePointSetData._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XScriptWithExtensionsBorrowed_get_script_extensions_set = - _capi< - ffi - .NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi - .Uint16)>>( - 'ICU4XScriptWithExtensionsBorrowed_get_script_extensions_set') - .asFunction< - ffi.Pointer Function( - ffi.Pointer, int)>(isLeaf: true); -} + static final _ICU4XScriptWithExtensionsBorrowed_has_script= _capi, ffi.Uint32, ffi.Uint16)>>('ICU4XScriptWithExtensionsBorrowed_has_script') + .asFunction, int, int)>(isLeaf: true); + + + +/// Build the CodePointSetData corresponding to a codepoints matching a particular script +/// in their Script_Extensions +/// +/// See the [Rust documentation for `get_script_extensions_set`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_extensions_set) for more information. +CodePointSetData getScriptExtensionsSet(int script) { + + final result = _ICU4XScriptWithExtensionsBorrowed_get_script_extensions_set(_underlying,script); + return CodePointSetData._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XScriptWithExtensionsBorrowed_get_script_extensions_set= _capi Function(ffi.Pointer, ffi.Uint16)>>('ICU4XScriptWithExtensionsBorrowed_get_script_extensions_set') + .asFunction Function(ffi.Pointer, int)>(isLeaf: true); + + + } + /// See the [Rust documentation for `WordType`](https://docs.rs/icu/latest/icu/segmenter/enum.WordType.html) for more information. enum SegmenterWordType { @@ -9780,1086 +8085,873 @@ enum SegmenterWordType { letter; } + /// See the [Rust documentation for `SentenceBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceBreakIterator.html) for more information. class SentenceBreakIteratorLatin1 implements ffi.Finalizable { - final ffi.Pointer _underlying; - SentenceBreakIteratorLatin1._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XSentenceBreakIteratorLatin1_destroy')); + SentenceBreakIteratorLatin1._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is - /// out of range of a 32-bit signed integer. - /// - /// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceBreakIterator.html#method.next) for more information. - int next() { - final result = _ICU4XSentenceBreakIteratorLatin1_next(_underlying); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XSentenceBreakIteratorLatin1_destroy')); + +/// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is +/// out of range of a 32-bit signed integer. +/// +/// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceBreakIterator.html#method.next) for more information. +int next() { + + final result = _ICU4XSentenceBreakIteratorLatin1_next(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XSentenceBreakIteratorLatin1_next = - _capi)>>( - 'ICU4XSentenceBreakIteratorLatin1_next') - .asFunction)>(isLeaf: true); -} + static final _ICU4XSentenceBreakIteratorLatin1_next= _capi)>>('ICU4XSentenceBreakIteratorLatin1_next') + .asFunction)>(isLeaf: true); + + + } + /// See the [Rust documentation for `SentenceBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceBreakIterator.html) for more information. class SentenceBreakIteratorUtf16 implements ffi.Finalizable { - final ffi.Pointer _underlying; - SentenceBreakIteratorUtf16._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XSentenceBreakIteratorUtf16_destroy')); + SentenceBreakIteratorUtf16._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is - /// out of range of a 32-bit signed integer. - /// - /// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceBreakIterator.html#method.next) for more information. - int next() { - final result = _ICU4XSentenceBreakIteratorUtf16_next(_underlying); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XSentenceBreakIteratorUtf16_destroy')); + +/// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is +/// out of range of a 32-bit signed integer. +/// +/// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceBreakIterator.html#method.next) for more information. +int next() { + + final result = _ICU4XSentenceBreakIteratorUtf16_next(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XSentenceBreakIteratorUtf16_next = - _capi)>>( - 'ICU4XSentenceBreakIteratorUtf16_next') - .asFunction)>(isLeaf: true); -} + static final _ICU4XSentenceBreakIteratorUtf16_next= _capi)>>('ICU4XSentenceBreakIteratorUtf16_next') + .asFunction)>(isLeaf: true); + + + } + /// See the [Rust documentation for `SentenceBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceBreakIterator.html) for more information. class SentenceBreakIteratorUtf8 implements ffi.Finalizable { - final ffi.Pointer _underlying; - SentenceBreakIteratorUtf8._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XSentenceBreakIteratorUtf8_destroy')); + SentenceBreakIteratorUtf8._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is - /// out of range of a 32-bit signed integer. - /// - /// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceBreakIterator.html#method.next) for more information. - int next() { - final result = _ICU4XSentenceBreakIteratorUtf8_next(_underlying); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XSentenceBreakIteratorUtf8_destroy')); + +/// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is +/// out of range of a 32-bit signed integer. +/// +/// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceBreakIterator.html#method.next) for more information. +int next() { + + final result = _ICU4XSentenceBreakIteratorUtf8_next(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XSentenceBreakIteratorUtf8_next = - _capi)>>( - 'ICU4XSentenceBreakIteratorUtf8_next') - .asFunction)>(isLeaf: true); -} + static final _ICU4XSentenceBreakIteratorUtf8_next= _capi)>>('ICU4XSentenceBreakIteratorUtf8_next') + .asFunction)>(isLeaf: true); + + + } + /// An ICU4X sentence-break segmenter, capable of finding sentence breakpoints in strings. -/// +/// /// See the [Rust documentation for `SentenceSegmenter`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceSegmenter.html) for more information. class SentenceSegmenter implements ffi.Finalizable { - final ffi.Pointer _underlying; - SentenceSegmenter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XSentenceSegmenter_destroy')); - - /// Construct an [`ICU4XSentenceSegmenter`]. - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceSegmenter.html#method.new) for more information. - factory SentenceSegmenter(DataProvider provider) { - final result = _ICU4XSentenceSegmenter_create(provider._underlying); - return result.isOk - ? SentenceSegmenter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XSentenceSegmenter_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XSentenceSegmenter_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Segments a (potentially ill-formed) UTF-8 string. - /// - /// See the [Rust documentation for `segment_utf8`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceSegmenter.html#method.segment_utf8) for more information. - SentenceBreakIteratorUtf8 segmentUtf8(String input) { - final alloc = ffi2.Arena(); - final inputSlice = _SliceFfi2Utf8._fromDart(input, alloc); - - final result = _ICU4XSentenceSegmenter_segment_utf8( - _underlying, inputSlice._bytes, inputSlice._length); - alloc.releaseAll(); - return SentenceBreakIteratorUtf8._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XSentenceSegmenter_segment_utf8 = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XSentenceSegmenter_segment_utf8') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Segments a UTF-16 string. - /// - /// See the [Rust documentation for `segment_utf16`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceSegmenter.html#method.segment_utf16) for more information. - SentenceBreakIteratorUtf16 segmentUtf16(Uint16List input) { - final alloc = ffi2.Arena(); - final inputSlice = _SliceFfiUint16._fromDart(input, alloc); - - final result = _ICU4XSentenceSegmenter_segment_utf16( - _underlying, inputSlice._bytes, inputSlice._length); - alloc.releaseAll(); - return SentenceBreakIteratorUtf16._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XSentenceSegmenter_segment_utf16 = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XSentenceSegmenter_segment_utf16') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Segments a Latin-1 string. - /// - /// See the [Rust documentation for `segment_latin1`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceSegmenter.html#method.segment_latin1) for more information. - SentenceBreakIteratorLatin1 segmentLatin1(Uint8List input) { - final alloc = ffi2.Arena(); - final inputSlice = _SliceFfiUint8._fromDart(input, alloc); - - final result = _ICU4XSentenceSegmenter_segment_latin1( - _underlying, inputSlice._bytes, inputSlice._length); - alloc.releaseAll(); - return SentenceBreakIteratorLatin1._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XSentenceSegmenter_segment_latin1 = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XSentenceSegmenter_segment_latin1') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); -} + final ffi.Pointer _underlying; + + SentenceSegmenter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XSentenceSegmenter_destroy')); + + +/// Construct an [`ICU4XSentenceSegmenter`]. +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceSegmenter.html#method.new) for more information. +factory SentenceSegmenter(DataProvider provider) { + + final result = _ICU4XSentenceSegmenter_create(provider._underlying); + return result.isOk ? SentenceSegmenter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XSentenceSegmenter_create= _capi)>>('ICU4XSentenceSegmenter_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + + +/// Segments a (potentially ill-formed) UTF-8 string. +/// +/// See the [Rust documentation for `segment_utf8`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceSegmenter.html#method.segment_utf8) for more information. +SentenceBreakIteratorUtf8 segmentUtf8(String input) { + final alloc = ffi2.Arena(); + final inputSlice = _SliceFfi2Utf8._fromDart(input, alloc); + + final result = _ICU4XSentenceSegmenter_segment_utf8(_underlying,inputSlice._bytes,inputSlice._length);alloc.releaseAll(); + return SentenceBreakIteratorUtf8._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XSentenceSegmenter_segment_utf8= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XSentenceSegmenter_segment_utf8') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Segments a UTF-16 string. +/// +/// See the [Rust documentation for `segment_utf16`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceSegmenter.html#method.segment_utf16) for more information. +SentenceBreakIteratorUtf16 segmentUtf16(Uint16List input) { + final alloc = ffi2.Arena(); + final inputSlice = _SliceFfiUint16._fromDart(input, alloc); + + final result = _ICU4XSentenceSegmenter_segment_utf16(_underlying,inputSlice._bytes,inputSlice._length);alloc.releaseAll(); + return SentenceBreakIteratorUtf16._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XSentenceSegmenter_segment_utf16= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XSentenceSegmenter_segment_utf16') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Segments a Latin-1 string. +/// +/// See the [Rust documentation for `segment_latin1`](https://docs.rs/icu/latest/icu/segmenter/struct.SentenceSegmenter.html#method.segment_latin1) for more information. +SentenceBreakIteratorLatin1 segmentLatin1(Uint8List input) { + final alloc = ffi2.Arena(); + final inputSlice = _SliceFfiUint8._fromDart(input, alloc); + + final result = _ICU4XSentenceSegmenter_segment_latin1(_underlying,inputSlice._bytes,inputSlice._length);alloc.releaseAll(); + return SentenceBreakIteratorLatin1._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XSentenceSegmenter_segment_latin1= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XSentenceSegmenter_segment_latin1') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + } + /// An ICU4X Time object representing a time in terms of hour, minute, second, nanosecond -/// +/// /// See the [Rust documentation for `Time`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html) for more information. class Time implements ffi.Finalizable { - final ffi.Pointer _underlying; - Time._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + final ffi.Pointer _underlying; + + Time._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XTime_destroy')); + + +/// Creates a new [`ICU4XTime`] given field values +/// +/// See the [Rust documentation for `Time`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html) for more information. +factory Time(int hour, int minute, int second, int nanosecond) { + + final result = _ICU4XTime_create(hour,minute,second,nanosecond); + return result.isOk ? Time._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XTime_create= _capi>('ICU4XTime_create') + .asFunction<_ResultOpaqueInt32 Function(int, int, int, int)>(isLeaf: true); + + + +/// Creates a new [`ICU4XTime`] representing midnight (00:00.000). +/// +/// See the [Rust documentation for `Time`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html) for more information. +factory Time.midnight() { + + final result = _ICU4XTime_create_midnight(); + return result.isOk ? Time._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XTime_create_midnight= _capi>('ICU4XTime_create_midnight') + .asFunction<_ResultOpaqueInt32 Function()>(isLeaf: true); - static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XTime_destroy')); - /// Creates a new [`ICU4XTime`] given field values - /// - /// See the [Rust documentation for `Time`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html) for more information. - factory Time(int hour, int minute, int second, int nanosecond) { - final result = _ICU4XTime_create(hour, minute, second, nanosecond); - return result.isOk - ? Time._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Returns the hour in this time +/// +/// See the [Rust documentation for `hour`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.hour) for more information. +int get hour { + + final result = _ICU4XTime_hour(_underlying); + return result; } // ignore: non_constant_identifier_names - static final _ICU4XTime_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Uint8, ffi.Uint8, ffi.Uint8, - ffi.Uint32)>>('ICU4XTime_create') - .asFunction<_ResultOpaqueInt32 Function(int, int, int, int)>( - isLeaf: true); + static final _ICU4XTime_hour= _capi)>>('ICU4XTime_hour') + .asFunction)>(isLeaf: true); + - /// Creates a new [`ICU4XTime`] representing midnight (00:00.000). - /// - /// See the [Rust documentation for `Time`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html) for more information. - factory Time.midnight() { - final result = _ICU4XTime_create_midnight(); - return result.isOk - ? Time._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// Returns the minute in this time +/// +/// See the [Rust documentation for `minute`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.minute) for more information. +int get minute { + + final result = _ICU4XTime_minute(_underlying); + return result; } // ignore: non_constant_identifier_names - static final _ICU4XTime_create_midnight = - _capi>( - 'ICU4XTime_create_midnight') - .asFunction<_ResultOpaqueInt32 Function()>(isLeaf: true); + static final _ICU4XTime_minute= _capi)>>('ICU4XTime_minute') + .asFunction)>(isLeaf: true); - /// Returns the hour in this time - /// - /// See the [Rust documentation for `hour`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.hour) for more information. - int get hour { - final result = _ICU4XTime_hour(_underlying); - return result; + + +/// Returns the second in this time +/// +/// See the [Rust documentation for `second`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.second) for more information. +int get second { + + final result = _ICU4XTime_second(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XTime_second= _capi)>>('ICU4XTime_second') + .asFunction)>(isLeaf: true); + + +/// Returns the nanosecond in this time +/// +/// See the [Rust documentation for `nanosecond`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.nanosecond) for more information. +int get nanosecond { + + final result = _ICU4XTime_nanosecond(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XTime_hour = - _capi)>>( - 'ICU4XTime_hour') - .asFunction)>(isLeaf: true); + static final _ICU4XTime_nanosecond= _capi)>>('ICU4XTime_nanosecond') + .asFunction)>(isLeaf: true); + + + } + + +/// An ICU4X TimeFormatter object capable of formatting an [`ICU4XTime`] type (and others) as a string +/// +/// See the [Rust documentation for `TimeFormatter`](https://docs.rs/icu/latest/icu/datetime/struct.TimeFormatter.html) for more information. +class TimeFormatter implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + TimeFormatter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XTimeFormatter_destroy')); + + +/// Creates a new [`ICU4XTimeFormatter`] from locale data. +/// +/// See the [Rust documentation for `try_new_with_length`](https://docs.rs/icu/latest/icu/datetime/struct.TimeFormatter.html#method.try_new_with_length) for more information. +factory TimeFormatter.withLength(DataProvider provider, Locale locale, TimeLength length) { + + final result = _ICU4XTimeFormatter_create_with_length(provider._underlying,locale._underlying,length.index); + return result.isOk ? TimeFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XTimeFormatter_create_with_length= _capi, ffi.Pointer, ffi.Int32)>>('ICU4XTimeFormatter_create_with_length') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); - /// Returns the minute in this time - /// - /// See the [Rust documentation for `minute`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.minute) for more information. - int get minute { - final result = _ICU4XTime_minute(_underlying); - return result; + + +/// Formats a [`ICU4XTime`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TimeFormatter.html#method.format) for more information. +String formatTime(Time value) { + + final writeable = _Writeable(); + final result = _ICU4XTimeFormatter_format_time(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XTimeFormatter_format_time= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XTimeFormatter_format_time') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + +/// Formats a [`ICU4XDateTime`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TimeFormatter.html#method.format) for more information. +String formatDatetime(DateTime value) { + + final writeable = _Writeable(); + final result = _ICU4XTimeFormatter_format_datetime(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XTime_minute = - _capi)>>( - 'ICU4XTime_minute') - .asFunction)>(isLeaf: true); + static final _ICU4XTimeFormatter_format_datetime= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XTimeFormatter_format_datetime') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Formats a [`ICU4XIsoDateTime`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TimeFormatter.html#method.format) for more information. +String formatIsoDatetime(IsoDateTime value) { + + final writeable = _Writeable(); + final result = _ICU4XTimeFormatter_format_iso_datetime(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XTimeFormatter_format_iso_datetime= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XTimeFormatter_format_iso_datetime') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + } + + +/// See the [Rust documentation for `Time`](https://docs.rs/icu/latest/icu/datetime/options/length/enum.Time.html) for more information. +enum TimeLength { + full, + long, + medium, + short; +} + + +/// An ICU4X TimeZoneFormatter object capable of formatting an [`ICU4XCustomTimeZone`] type (and others) as a string +/// +/// See the [Rust documentation for `TimeZoneFormatter`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html) for more information. +class TimeZoneFormatter implements ffi.Finalizable { + + final ffi.Pointer _underlying; + + TimeZoneFormatter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XTimeZoneFormatter_destroy')); + + +/// Creates a new [`ICU4XTimeZoneFormatter`] from locale data. +/// +/// Uses localized GMT as the fallback format. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.try_new) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/datetime/time_zone/enum.FallbackFormat.html) +factory TimeZoneFormatter.withLocalizedGmtFallback(DataProvider provider, Locale locale) { + + final result = _ICU4XTimeZoneFormatter_create_with_localized_gmt_fallback(provider._underlying,locale._underlying); + return result.isOk ? TimeZoneFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XTimeZoneFormatter_create_with_localized_gmt_fallback= _capi, ffi.Pointer)>>('ICU4XTimeZoneFormatter_create_with_localized_gmt_fallback') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Creates a new [`ICU4XTimeZoneFormatter`] from locale data. +/// +/// Uses ISO-8601 as the fallback format. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.try_new) for more information. +/// +/// Additional information: [1](https://docs.rs/icu/latest/icu/datetime/time_zone/enum.FallbackFormat.html) +factory TimeZoneFormatter.withIso8601Fallback(DataProvider provider, Locale locale, IsoTimeZoneOptions options) { + + final result = _ICU4XTimeZoneFormatter_create_with_iso_8601_fallback(provider._underlying,locale._underlying,options._underlying); + return result.isOk ? TimeZoneFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XTimeZoneFormatter_create_with_iso_8601_fallback= _capi, ffi.Pointer, _IsoTimeZoneOptionsFfi)>>('ICU4XTimeZoneFormatter_create_with_iso_8601_fallback') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, _IsoTimeZoneOptionsFfi)>(isLeaf: true); + + + +/// Loads generic non-location long format. Example: "Pacific Time" +/// +/// See the [Rust documentation for `include_generic_non_location_long`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_generic_non_location_long) for more information. +void loadGenericNonLocationLong(DataProvider provider) { + + final result = _ICU4XTimeZoneFormatter_load_generic_non_location_long(_underlying,provider._underlying); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } + // ignore: non_constant_identifier_names + static final _ICU4XTimeZoneFormatter_load_generic_non_location_long= _capi, ffi.Pointer)>>('ICU4XTimeZoneFormatter_load_generic_non_location_long') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Loads generic non-location short format. Example: "PT" +/// +/// See the [Rust documentation for `include_generic_non_location_short`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_generic_non_location_short) for more information. +void loadGenericNonLocationShort(DataProvider provider) { + + final result = _ICU4XTimeZoneFormatter_load_generic_non_location_short(_underlying,provider._underlying); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } + // ignore: non_constant_identifier_names + static final _ICU4XTimeZoneFormatter_load_generic_non_location_short= _capi, ffi.Pointer)>>('ICU4XTimeZoneFormatter_load_generic_non_location_short') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Loads specific non-location long format. Example: "Pacific Standard Time" +/// +/// See the [Rust documentation for `include_specific_non_location_long`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_specific_non_location_long) for more information. +void loadSpecificNonLocationLong(DataProvider provider) { + + final result = _ICU4XTimeZoneFormatter_load_specific_non_location_long(_underlying,provider._underlying); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } + // ignore: non_constant_identifier_names + static final _ICU4XTimeZoneFormatter_load_specific_non_location_long= _capi, ffi.Pointer)>>('ICU4XTimeZoneFormatter_load_specific_non_location_long') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Loads specific non-location short format. Example: "PST" +/// +/// See the [Rust documentation for `include_specific_non_location_short`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_specific_non_location_short) for more information. +void loadSpecificNonLocationShort(DataProvider provider) { + + final result = _ICU4XTimeZoneFormatter_load_specific_non_location_short(_underlying,provider._underlying); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } + // ignore: non_constant_identifier_names + static final _ICU4XTimeZoneFormatter_load_specific_non_location_short= _capi, ffi.Pointer)>>('ICU4XTimeZoneFormatter_load_specific_non_location_short') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Loads generic location format. Example: "Los Angeles Time" +/// +/// See the [Rust documentation for `include_generic_location_format`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_generic_location_format) for more information. +void loadGenericLocationFormat(DataProvider provider) { + + final result = _ICU4XTimeZoneFormatter_load_generic_location_format(_underlying,provider._underlying); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + } + // ignore: non_constant_identifier_names + static final _ICU4XTimeZoneFormatter_load_generic_location_format= _capi, ffi.Pointer)>>('ICU4XTimeZoneFormatter_load_generic_location_format') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + - /// Returns the second in this time - /// - /// See the [Rust documentation for `second`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.second) for more information. - int get second { - final result = _ICU4XTime_second(_underlying); - return result; + +/// Loads localized GMT format. Example: "GMT-07:00" +/// +/// See the [Rust documentation for `include_localized_gmt_format`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_localized_gmt_format) for more information. +void includeLocalizedGmtFormat() { + + final result = _ICU4XTimeZoneFormatter_include_localized_gmt_format(_underlying); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } } - // ignore: non_constant_identifier_names - static final _ICU4XTime_second = - _capi)>>( - 'ICU4XTime_second') - .asFunction)>(isLeaf: true); + static final _ICU4XTimeZoneFormatter_include_localized_gmt_format= _capi)>>('ICU4XTimeZoneFormatter_include_localized_gmt_format') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer)>(isLeaf: true); - /// Returns the nanosecond in this time - /// - /// See the [Rust documentation for `nanosecond`](https://docs.rs/icu/latest/icu/calendar/types/struct.Time.html#structfield.nanosecond) for more information. - int get nanosecond { - final result = _ICU4XTime_nanosecond(_underlying); - return result; + + +/// Loads ISO-8601 format. Example: "-07:00" +/// +/// See the [Rust documentation for `include_iso_8601_format`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_iso_8601_format) for more information. +void loadIso8601Format(IsoTimeZoneOptions options) { + + final result = _ICU4XTimeZoneFormatter_load_iso_8601_format(_underlying,options._underlying); + if (!result.isOk) { throw Error.values.firstWhere((v) => v._underlying == result.union.err); } } + // ignore: non_constant_identifier_names + static final _ICU4XTimeZoneFormatter_load_iso_8601_format= _capi, _IsoTimeZoneOptionsFfi)>>('ICU4XTimeZoneFormatter_load_iso_8601_format') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, _IsoTimeZoneOptionsFfi)>(isLeaf: true); + + +/// Formats a [`ICU4XCustomTimeZone`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.format) for more information. +/// +/// See the [Rust documentation for `format_to_string`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.format_to_string) for more information. +String formatCustomTimeZone(CustomTimeZone value) { + + final writeable = _Writeable(); + final result = _ICU4XTimeZoneFormatter_format_custom_time_zone(_underlying,value._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XTime_nanosecond = - _capi)>>( - 'ICU4XTime_nanosecond') - .asFunction)>(isLeaf: true); -} + static final _ICU4XTimeZoneFormatter_format_custom_time_zone= _capi, ffi.Pointer, ffi.Pointer)>>('ICU4XTimeZoneFormatter_format_custom_time_zone') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); -/// An ICU4X TimeFormatter object capable of formatting an [`ICU4XTime`] type (and others) as a string -/// -/// See the [Rust documentation for `TimeFormatter`](https://docs.rs/icu/latest/icu/datetime/struct.TimeFormatter.html) for more information. -class TimeFormatter implements ffi.Finalizable { - final ffi.Pointer _underlying; - TimeFormatter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XTimeFormatter_destroy')); - - /// Creates a new [`ICU4XTimeFormatter`] from locale data. - /// - /// See the [Rust documentation for `try_new_with_length`](https://docs.rs/icu/latest/icu/datetime/struct.TimeFormatter.html#method.try_new_with_length) for more information. - factory TimeFormatter.withLength( - DataProvider provider, Locale locale, TimeLength length) { - final result = _ICU4XTimeFormatter_create_with_length( - provider._underlying, locale._underlying, length.index); - return result.isOk - ? TimeFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XTimeFormatter_create_with_length = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int32)>>('ICU4XTimeFormatter_create_with_length') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Formats a [`ICU4XTime`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TimeFormatter.html#method.format) for more information. - String formatTime(Time value) { - final writeable = _Writeable(); - final result = _ICU4XTimeFormatter_format_time( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XTimeFormatter_format_time = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('ICU4XTimeFormatter_format_time') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Formats a [`ICU4XDateTime`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TimeFormatter.html#method.format) for more information. - String formatDatetime(DateTime value) { - final writeable = _Writeable(); - final result = _ICU4XTimeFormatter_format_datetime( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XTimeFormatter_format_datetime = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XTimeFormatter_format_datetime') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Formats a [`ICU4XIsoDateTime`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.TimeFormatter.html#method.format) for more information. - String formatIsoDatetime(IsoDateTime value) { - final writeable = _Writeable(); - final result = _ICU4XTimeFormatter_format_iso_datetime( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XTimeFormatter_format_iso_datetime = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XTimeFormatter_format_iso_datetime') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + } -/// See the [Rust documentation for `Time`](https://docs.rs/icu/latest/icu/datetime/options/length/enum.Time.html) for more information. -enum TimeLength { - full, - long, - medium, - short; -} -/// An ICU4X TimeZoneFormatter object capable of formatting an [`ICU4XCustomTimeZone`] type (and others) as a string -/// -/// See the [Rust documentation for `TimeZoneFormatter`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html) for more information. -class TimeZoneFormatter implements ffi.Finalizable { - final ffi.Pointer _underlying; +/// See the [Rust documentation for `TitlecaseMapper`](https://docs.rs/icu/latest/icu/casemap/struct.TitlecaseMapper.html) for more information. +class TitlecaseMapper implements ffi.Finalizable { - TimeZoneFormatter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XTimeZoneFormatter_destroy')); - - /// Creates a new [`ICU4XTimeZoneFormatter`] from locale data. - /// - /// Uses localized GMT as the fallback format. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.try_new) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/datetime/time_zone/enum.FallbackFormat.html) - factory TimeZoneFormatter.withLocalizedGmtFallback( - DataProvider provider, Locale locale) { - final result = _ICU4XTimeZoneFormatter_create_with_localized_gmt_fallback( - provider._underlying, locale._underlying); - return result.isOk - ? TimeZoneFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XTimeZoneFormatter_create_with_localized_gmt_fallback = - _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XTimeZoneFormatter_create_with_localized_gmt_fallback') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer)>(isLeaf: true); - - /// Creates a new [`ICU4XTimeZoneFormatter`] from locale data. - /// - /// Uses ISO-8601 as the fallback format. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.try_new) for more information. - /// - /// Additional information: [1](https://docs.rs/icu/latest/icu/datetime/time_zone/enum.FallbackFormat.html) - factory TimeZoneFormatter.withIso8601Fallback( - DataProvider provider, Locale locale, IsoTimeZoneOptions options) { - final result = _ICU4XTimeZoneFormatter_create_with_iso_8601_fallback( - provider._underlying, locale._underlying, options._underlying); - return result.isOk - ? TimeZoneFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XTimeZoneFormatter_create_with_iso_8601_fallback = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, _IsoTimeZoneOptionsFfi)>>( - 'ICU4XTimeZoneFormatter_create_with_iso_8601_fallback') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, _IsoTimeZoneOptionsFfi)>(isLeaf: true); - - /// Loads generic non-location long format. Example: "Pacific Time" - /// - /// See the [Rust documentation for `include_generic_non_location_long`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_generic_non_location_long) for more information. - void loadGenericNonLocationLong(DataProvider provider) { - final result = _ICU4XTimeZoneFormatter_load_generic_non_location_long( - _underlying, provider._underlying); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } - } + final ffi.Pointer _underlying; - // ignore: non_constant_identifier_names - static final _ICU4XTimeZoneFormatter_load_generic_non_location_long = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XTimeZoneFormatter_load_generic_non_location_long') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Loads generic non-location short format. Example: "PT" - /// - /// See the [Rust documentation for `include_generic_non_location_short`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_generic_non_location_short) for more information. - void loadGenericNonLocationShort(DataProvider provider) { - final result = _ICU4XTimeZoneFormatter_load_generic_non_location_short( - _underlying, provider._underlying); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } - } + TitlecaseMapper._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - // ignore: non_constant_identifier_names - static final _ICU4XTimeZoneFormatter_load_generic_non_location_short = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XTimeZoneFormatter_load_generic_non_location_short') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Loads specific non-location long format. Example: "Pacific Standard Time" - /// - /// See the [Rust documentation for `include_specific_non_location_long`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_specific_non_location_long) for more information. - void loadSpecificNonLocationLong(DataProvider provider) { - final result = _ICU4XTimeZoneFormatter_load_specific_non_location_long( - _underlying, provider._underlying); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XTitlecaseMapper_destroy')); - // ignore: non_constant_identifier_names - static final _ICU4XTimeZoneFormatter_load_specific_non_location_long = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XTimeZoneFormatter_load_specific_non_location_long') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Loads specific non-location short format. Example: "PST" - /// - /// See the [Rust documentation for `include_specific_non_location_short`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_specific_non_location_short) for more information. - void loadSpecificNonLocationShort(DataProvider provider) { - final result = _ICU4XTimeZoneFormatter_load_specific_non_location_short( - _underlying, provider._underlying); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } + +/// Construct a new `ICU4XTitlecaseMapper` instance +/// +/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/casemap/struct.TitlecaseMapper.html#method.new) for more information. +factory TitlecaseMapper(DataProvider provider) { + + final result = _ICU4XTitlecaseMapper_create(provider._underlying); + return result.isOk ? TitlecaseMapper._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } - // ignore: non_constant_identifier_names - static final _ICU4XTimeZoneFormatter_load_specific_non_location_short = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XTimeZoneFormatter_load_specific_non_location_short') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Loads generic location format. Example: "Los Angeles Time" - /// - /// See the [Rust documentation for `include_generic_location_format`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_generic_location_format) for more information. - void loadGenericLocationFormat(DataProvider provider) { - final result = _ICU4XTimeZoneFormatter_load_generic_location_format( - _underlying, provider._underlying); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } - } + static final _ICU4XTitlecaseMapper_create= _capi)>>('ICU4XTitlecaseMapper_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); - // ignore: non_constant_identifier_names - static final _ICU4XTimeZoneFormatter_load_generic_location_format = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XTimeZoneFormatter_load_generic_location_format') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Loads localized GMT format. Example: "GMT-07:00" - /// - /// See the [Rust documentation for `include_localized_gmt_format`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_localized_gmt_format) for more information. - void includeLocalizedGmtFormat() { - final result = - _ICU4XTimeZoneFormatter_include_localized_gmt_format(_underlying); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } - } - // ignore: non_constant_identifier_names - static final _ICU4XTimeZoneFormatter_include_localized_gmt_format = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer)>>( - 'ICU4XTimeZoneFormatter_include_localized_gmt_format') - .asFunction<_ResultVoidInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Loads ISO-8601 format. Example: "-07:00" - /// - /// See the [Rust documentation for `include_iso_8601_format`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.include_iso_8601_format) for more information. - void loadIso8601Format(IsoTimeZoneOptions options) { - final result = _ICU4XTimeZoneFormatter_load_iso_8601_format( - _underlying, options._underlying); - if (!result.isOk) { - throw Error.values.firstWhere((v) => v._underlying == result.union.err); - } + +/// Returns the full titlecase mapping of the given string +/// +/// The `v1` refers to the version of the options struct, which may change as we add more options +/// +/// See the [Rust documentation for `titlecase_segment`](https://docs.rs/icu/latest/icu/casemap/struct.TitlecaseMapper.html#method.titlecase_segment) for more information. +String titlecaseSegmentV1(String s, Locale locale, TitlecaseOptionsV1 options) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final writeable = _Writeable(); + final result = _ICU4XTitlecaseMapper_titlecase_segment_v1(_underlying,sSlice._bytes,sSlice._length,locale._underlying,options._underlying,writeable._underlying);alloc.releaseAll(); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } - // ignore: non_constant_identifier_names - static final _ICU4XTimeZoneFormatter_load_iso_8601_format = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, _IsoTimeZoneOptionsFfi)>>( - 'ICU4XTimeZoneFormatter_load_iso_8601_format') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, _IsoTimeZoneOptionsFfi)>(isLeaf: true); - - /// Formats a [`ICU4XCustomTimeZone`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.format) for more information. - /// - /// See the [Rust documentation for `format_to_string`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html#method.format_to_string) for more information. - String formatCustomTimeZone(CustomTimeZone value) { - final writeable = _Writeable(); - final result = _ICU4XTimeZoneFormatter_format_custom_time_zone( - _underlying, value._underlying, writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XTimeZoneFormatter_format_custom_time_zone = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XTimeZoneFormatter_format_custom_time_zone') - .asFunction< - _ResultVoidInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XTitlecaseMapper_titlecase_segment_v1= _capi, ffi.Pointer, ffi.Size, ffi.Pointer, _TitlecaseOptionsV1Ffi, ffi.Pointer)>>('ICU4XTitlecaseMapper_titlecase_segment_v1') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, int, ffi.Pointer, _TitlecaseOptionsV1Ffi, ffi.Pointer)>(isLeaf: true); -/// See the [Rust documentation for `TitlecaseMapper`](https://docs.rs/icu/latest/icu/casemap/struct.TitlecaseMapper.html) for more information. -class TitlecaseMapper implements ffi.Finalizable { - final ffi.Pointer _underlying; - TitlecaseMapper._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XTitlecaseMapper_destroy')); - - /// Construct a new `ICU4XTitlecaseMapper` instance - /// - /// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/casemap/struct.TitlecaseMapper.html#method.new) for more information. - factory TitlecaseMapper(DataProvider provider) { - final result = _ICU4XTitlecaseMapper_create(provider._underlying); - return result.isOk - ? TitlecaseMapper._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XTitlecaseMapper_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XTitlecaseMapper_create') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Returns the full titlecase mapping of the given string - /// - /// The `v1` refers to the version of the options struct, which may change as we add more options - /// - /// See the [Rust documentation for `titlecase_segment`](https://docs.rs/icu/latest/icu/casemap/struct.TitlecaseMapper.html#method.titlecase_segment) for more information. - String titlecaseSegmentV1( - String s, Locale locale, TitlecaseOptionsV1 options) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - - final writeable = _Writeable(); - final result = _ICU4XTitlecaseMapper_titlecase_segment_v1( - _underlying, - sSlice._bytes, - sSlice._length, - locale._underlying, - options._underlying, - writeable._underlying); - alloc.releaseAll(); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XTitlecaseMapper_titlecase_segment_v1 = _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Pointer, - _TitlecaseOptionsV1Ffi, - ffi.Pointer)>>( - 'ICU4XTitlecaseMapper_titlecase_segment_v1') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - ffi.Pointer, - _TitlecaseOptionsV1Ffi, - ffi.Pointer)>(isLeaf: true); -} + } + /// See the [Rust documentation for `TitlecaseOptions`](https://docs.rs/icu/latest/icu/casemap/titlecase/struct.TitlecaseOptions.html) for more information. class _TitlecaseOptionsV1Ffi extends ffi.Struct { - @ffi.Int32() - external int leadingAdjustment; - @ffi.Int32() - external int trailingCase; + @ffi.Int32() + external int leadingAdjustment; + @ffi.Int32() + external int trailingCase; } class TitlecaseOptionsV1 { - final _TitlecaseOptionsV1Ffi _underlying; - - // ignore: unused_element - TitlecaseOptionsV1._(this._underlying); + final _TitlecaseOptionsV1Ffi _underlying; - factory TitlecaseOptionsV1() { - final pointer = ffi2.calloc<_TitlecaseOptionsV1Ffi>(); - final result = TitlecaseOptionsV1._(pointer.ref); - _callocFree.attach(result, pointer.cast()); - return result; - } + // ignore: unused_element + TitlecaseOptionsV1._(this._underlying); - LeadingAdjustment get leadingAdjustment => - LeadingAdjustment.values[_underlying.leadingAdjustment]; - set leadingAdjustment(LeadingAdjustment leadingAdjustment) { - _underlying.leadingAdjustment = leadingAdjustment.index; - } + factory TitlecaseOptionsV1() { + final pointer = ffi2.calloc<_TitlecaseOptionsV1Ffi>(); + final result = TitlecaseOptionsV1._(pointer.ref); + _callocFree.attach(result, pointer.cast()); + return result; + } - TrailingCase get trailingCase => - TrailingCase.values[_underlying.trailingCase]; - set trailingCase(TrailingCase trailingCase) { - _underlying.trailingCase = trailingCase.index; - } + LeadingAdjustment get leadingAdjustment => LeadingAdjustment.values[_underlying.leadingAdjustment]; + set leadingAdjustment(LeadingAdjustment leadingAdjustment) { + _underlying.leadingAdjustment = leadingAdjustment.index; + } +TrailingCase get trailingCase => TrailingCase.values[_underlying.trailingCase]; + set trailingCase(TrailingCase trailingCase) { + _underlying.trailingCase = trailingCase.index; + } - /// See the [Rust documentation for `default`](https://docs.rs/icu/latest/icu/casemap/titlecase/struct.TitlecaseOptions.html#method.default) for more information. - factory TitlecaseOptionsV1.options() { - final result = _ICU4XTitlecaseOptionsV1_default_options(); - return TitlecaseOptionsV1._(result); +/// See the [Rust documentation for `default`](https://docs.rs/icu/latest/icu/casemap/titlecase/struct.TitlecaseOptions.html#method.default) for more information. +factory TitlecaseOptionsV1.options() { + + final result = _ICU4XTitlecaseOptionsV1_default_options(); + return TitlecaseOptionsV1._(result); } // ignore: non_constant_identifier_names - static final _ICU4XTitlecaseOptionsV1_default_options = - _capi>( - 'ICU4XTitlecaseOptionsV1_default_options') - .asFunction<_TitlecaseOptionsV1Ffi Function()>(isLeaf: true); + static final _ICU4XTitlecaseOptionsV1_default_options= _capi>('ICU4XTitlecaseOptionsV1_default_options') + .asFunction<_TitlecaseOptionsV1Ffi Function()>(isLeaf: true); - @override - bool operator ==(Object other) => - other is TitlecaseOptionsV1 && - other._underlying.leadingAdjustment == _underlying.leadingAdjustment && - other._underlying.trailingCase == _underlying.trailingCase; - @override - int get hashCode => Object.hashAll([ - _underlying.leadingAdjustment, - _underlying.trailingCase, - ]); + @override + bool operator ==(Object other) => + other is TitlecaseOptionsV1 + && other._underlying.leadingAdjustment == _underlying.leadingAdjustment + && other._underlying.trailingCase == _underlying.trailingCase; + + @override + int get hashCode => Object.hashAll([_underlying.leadingAdjustment,_underlying.trailingCase,]); } + /// See the [Rust documentation for `TrailingCase`](https://docs.rs/icu/latest/icu/casemap/titlecase/enum.TrailingCase.html) for more information. enum TrailingCase { lower, unchanged; } + /// FFI version of `TransformResult`. -/// +/// /// See the [Rust documentation for `TransformResult`](https://docs.rs/icu/latest/icu/locid_transform/enum.TransformResult.html) for more information. enum TransformResult { modified, unmodified; } + /// An ICU4X Unicode Set Property object, capable of querying whether a code point is contained in a set based on a Unicode property. -/// +/// /// See the [Rust documentation for `properties`](https://docs.rs/icu/latest/icu/properties/index.html) for more information. -/// +/// /// See the [Rust documentation for `UnicodeSetData`](https://docs.rs/icu/latest/icu/properties/sets/struct.UnicodeSetData.html) for more information. -/// +/// /// See the [Rust documentation for `UnicodeSetDataBorrowed`](https://docs.rs/icu/latest/icu/properties/sets/struct.UnicodeSetDataBorrowed.html) for more information. class UnicodeSetData implements ffi.Finalizable { - final ffi.Pointer _underlying; - UnicodeSetData._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + final ffi.Pointer _underlying; + + UnicodeSetData._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XUnicodeSetData_destroy')); + + +/// Checks whether the string is in the set. +/// +/// See the [Rust documentation for `contains`](https://docs.rs/icu/latest/icu/properties/sets/struct.UnicodeSetDataBorrowed.html#method.contains) for more information. +bool contains(String s) { + final alloc = ffi2.Arena(); + final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); + + final result = _ICU4XUnicodeSetData_contains(_underlying,sSlice._bytes,sSlice._length);alloc.releaseAll(); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XUnicodeSetData_contains= _capi, ffi.Pointer, ffi.Size)>>('ICU4XUnicodeSetData_contains') + .asFunction, ffi.Pointer, int)>(isLeaf: true); + - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XUnicodeSetData_destroy')); + +/// Checks whether the code point is in the set. +/// +/// See the [Rust documentation for `contains_char`](https://docs.rs/icu/latest/icu/properties/sets/struct.UnicodeSetDataBorrowed.html#method.contains_char) for more information. +bool containsChar(int cp) { + + final result = _ICU4XUnicodeSetData_contains_char(_underlying,cp); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XUnicodeSetData_contains_char= _capi, ffi.Uint32)>>('ICU4XUnicodeSetData_contains_char') + .asFunction, int)>(isLeaf: true); - /// Checks whether the string is in the set. - /// - /// See the [Rust documentation for `contains`](https://docs.rs/icu/latest/icu/properties/sets/struct.UnicodeSetDataBorrowed.html#method.contains) for more information. - bool contains(String s) { - final alloc = ffi2.Arena(); - final sSlice = _SliceFfi2Utf8._fromDart(s, alloc); - final result = _ICU4XUnicodeSetData_contains( - _underlying, sSlice._bytes, sSlice._length); - alloc.releaseAll(); - return result; + +/// See the [Rust documentation for `basic_emoji`](https://docs.rs/icu/latest/icu/properties/sets/fn.basic_emoji.html) for more information. +factory UnicodeSetData.loadBasicEmoji(DataProvider provider) { + + final result = _ICU4XUnicodeSetData_load_basic_emoji(provider._underlying); + return result.isOk ? UnicodeSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XUnicodeSetData_load_basic_emoji= _capi)>>('ICU4XUnicodeSetData_load_basic_emoji') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + +/// See the [Rust documentation for `exemplars_main`](https://docs.rs/icu/latest/icu/properties/exemplar_chars/fn.exemplars_main.html) for more information. +factory UnicodeSetData.loadExemplarsMain(DataProvider provider, Locale locale) { + + final result = _ICU4XUnicodeSetData_load_exemplars_main(provider._underlying,locale._underlying); + return result.isOk ? UnicodeSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XUnicodeSetData_contains = _capi< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, ffi.Pointer, - ffi.Size)>>('ICU4XUnicodeSetData_contains') - .asFunction< - bool Function(ffi.Pointer, ffi.Pointer, - int)>(isLeaf: true); + static final _ICU4XUnicodeSetData_load_exemplars_main= _capi, ffi.Pointer)>>('ICU4XUnicodeSetData_load_exemplars_main') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + - /// Checks whether the code point is in the set. - /// - /// See the [Rust documentation for `contains_char`](https://docs.rs/icu/latest/icu/properties/sets/struct.UnicodeSetDataBorrowed.html#method.contains_char) for more information. - bool containsChar(int cp) { - final result = _ICU4XUnicodeSetData_contains_char(_underlying, cp); - return result; + +/// See the [Rust documentation for `exemplars_auxiliary`](https://docs.rs/icu/latest/icu/properties/exemplar_chars/fn.exemplars_auxiliary.html) for more information. +factory UnicodeSetData.loadExemplarsAuxiliary(DataProvider provider, Locale locale) { + + final result = _ICU4XUnicodeSetData_load_exemplars_auxiliary(provider._underlying,locale._underlying); + return result.isOk ? UnicodeSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XUnicodeSetData_load_exemplars_auxiliary= _capi, ffi.Pointer)>>('ICU4XUnicodeSetData_load_exemplars_auxiliary') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + +/// See the [Rust documentation for `exemplars_punctuation`](https://docs.rs/icu/latest/icu/properties/exemplar_chars/fn.exemplars_punctuation.html) for more information. +factory UnicodeSetData.loadExemplarsPunctuation(DataProvider provider, Locale locale) { + + final result = _ICU4XUnicodeSetData_load_exemplars_punctuation(provider._underlying,locale._underlying); + return result.isOk ? UnicodeSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XUnicodeSetData_contains_char = _capi< - ffi.NativeFunction< - ffi.Bool Function(ffi.Pointer, - ffi.Uint32)>>('ICU4XUnicodeSetData_contains_char') - .asFunction, int)>(isLeaf: true); + static final _ICU4XUnicodeSetData_load_exemplars_punctuation= _capi, ffi.Pointer)>>('ICU4XUnicodeSetData_load_exemplars_punctuation') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + - /// See the [Rust documentation for `basic_emoji`](https://docs.rs/icu/latest/icu/properties/sets/fn.basic_emoji.html) for more information. - factory UnicodeSetData.loadBasicEmoji(DataProvider provider) { - final result = _ICU4XUnicodeSetData_load_basic_emoji(provider._underlying); - return result.isOk - ? UnicodeSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); + +/// See the [Rust documentation for `exemplars_numbers`](https://docs.rs/icu/latest/icu/properties/exemplar_chars/fn.exemplars_numbers.html) for more information. +factory UnicodeSetData.loadExemplarsNumbers(DataProvider provider, Locale locale) { + + final result = _ICU4XUnicodeSetData_load_exemplars_numbers(provider._underlying,locale._underlying); + return result.isOk ? UnicodeSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } // ignore: non_constant_identifier_names - static final _ICU4XUnicodeSetData_load_basic_emoji = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XUnicodeSetData_load_basic_emoji') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// See the [Rust documentation for `exemplars_main`](https://docs.rs/icu/latest/icu/properties/exemplar_chars/fn.exemplars_main.html) for more information. - factory UnicodeSetData.loadExemplarsMain( - DataProvider provider, Locale locale) { - final result = _ICU4XUnicodeSetData_load_exemplars_main( - provider._underlying, locale._underlying); - return result.isOk - ? UnicodeSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XUnicodeSetData_load_exemplars_main = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XUnicodeSetData_load_exemplars_main') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// See the [Rust documentation for `exemplars_auxiliary`](https://docs.rs/icu/latest/icu/properties/exemplar_chars/fn.exemplars_auxiliary.html) for more information. - factory UnicodeSetData.loadExemplarsAuxiliary( - DataProvider provider, Locale locale) { - final result = _ICU4XUnicodeSetData_load_exemplars_auxiliary( - provider._underlying, locale._underlying); - return result.isOk - ? UnicodeSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XUnicodeSetData_load_exemplars_auxiliary = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XUnicodeSetData_load_exemplars_auxiliary') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// See the [Rust documentation for `exemplars_punctuation`](https://docs.rs/icu/latest/icu/properties/exemplar_chars/fn.exemplars_punctuation.html) for more information. - factory UnicodeSetData.loadExemplarsPunctuation( - DataProvider provider, Locale locale) { - final result = _ICU4XUnicodeSetData_load_exemplars_punctuation( - provider._underlying, locale._underlying); - return result.isOk - ? UnicodeSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XUnicodeSetData_load_exemplars_punctuation = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XUnicodeSetData_load_exemplars_punctuation') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// See the [Rust documentation for `exemplars_numbers`](https://docs.rs/icu/latest/icu/properties/exemplar_chars/fn.exemplars_numbers.html) for more information. - factory UnicodeSetData.loadExemplarsNumbers( - DataProvider provider, Locale locale) { - final result = _ICU4XUnicodeSetData_load_exemplars_numbers( - provider._underlying, locale._underlying); - return result.isOk - ? UnicodeSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XUnicodeSetData_load_exemplars_numbers = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XUnicodeSetData_load_exemplars_numbers') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// See the [Rust documentation for `exemplars_index`](https://docs.rs/icu/latest/icu/properties/exemplar_chars/fn.exemplars_index.html) for more information. - factory UnicodeSetData.loadExemplarsIndex( - DataProvider provider, Locale locale) { - final result = _ICU4XUnicodeSetData_load_exemplars_index( - provider._underlying, locale._underlying); - return result.isOk - ? UnicodeSetData._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XUnicodeSetData_load_exemplars_index = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>>( - 'ICU4XUnicodeSetData_load_exemplars_index') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); -} + static final _ICU4XUnicodeSetData_load_exemplars_numbers= _capi, ffi.Pointer)>>('ICU4XUnicodeSetData_load_exemplars_numbers') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// See the [Rust documentation for `exemplars_index`](https://docs.rs/icu/latest/icu/properties/exemplar_chars/fn.exemplars_index.html) for more information. +factory UnicodeSetData.loadExemplarsIndex(DataProvider provider, Locale locale) { + + final result = _ICU4XUnicodeSetData_load_exemplars_index(provider._underlying,locale._underlying); + return result.isOk ? UnicodeSetData._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XUnicodeSetData_load_exemplars_index= _capi, ffi.Pointer)>>('ICU4XUnicodeSetData_load_exemplars_index') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + } + /// A Week calculator, useful to be passed in to `week_of_year()` on Date and DateTime types -/// +/// /// See the [Rust documentation for `WeekCalculator`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekCalculator.html) for more information. class WeekCalculator implements ffi.Finalizable { - final ffi.Pointer _underlying; - WeekCalculator._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XWeekCalculator_destroy')); - - /// Creates a new [`ICU4XWeekCalculator`] from locale data. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekCalculator.html#method.try_new) for more information. - factory WeekCalculator(DataProvider provider, Locale locale) { - final result = - _ICU4XWeekCalculator_create(provider._underlying, locale._underlying); - return result.isOk - ? WeekCalculator._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XWeekCalculator_create = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer)>>('ICU4XWeekCalculator_create') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, ffi.Pointer)>(isLeaf: true); - - /// Additional information: [1](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekCalculator.html#structfield.first_weekday), [2](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekCalculator.html#structfield.min_week_days) - factory WeekCalculator.fromFirstDayOfWeekAndMinWeekDays( - IsoWeekday firstWeekday, int minWeekDays) { - final result = - _ICU4XWeekCalculator_create_from_first_day_of_week_and_min_week_days( - firstWeekday._underlying, minWeekDays); - return WeekCalculator._(result); - } - // ignore: non_constant_identifier_names - static final _ICU4XWeekCalculator_create_from_first_day_of_week_and_min_week_days = - _capi< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Int32, ffi.Uint8)>>( - 'ICU4XWeekCalculator_create_from_first_day_of_week_and_min_week_days') - .asFunction Function(int, int)>(isLeaf: true); - - /// Returns the weekday that starts the week for this object's locale - /// - /// See the [Rust documentation for `first_weekday`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekCalculator.html#structfield.first_weekday) for more information. - IsoWeekday get firstWeekday { - final result = _ICU4XWeekCalculator_first_weekday(_underlying); - return IsoWeekday.values.firstWhere((v) => v._underlying == result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XWeekCalculator_first_weekday = - _capi)>>( - 'ICU4XWeekCalculator_first_weekday') - .asFunction)>(isLeaf: true); + final ffi.Pointer _underlying; + + WeekCalculator._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XWeekCalculator_destroy')); - /// The minimum number of days overlapping a year required for a week to be - /// considered part of that year - /// - /// See the [Rust documentation for `min_week_days`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekCalculator.html#structfield.min_week_days) for more information. - int get minWeekDays { - final result = _ICU4XWeekCalculator_min_week_days(_underlying); - return result; + +/// Creates a new [`ICU4XWeekCalculator`] from locale data. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekCalculator.html#method.try_new) for more information. +factory WeekCalculator(DataProvider provider, Locale locale) { + + final result = _ICU4XWeekCalculator_create(provider._underlying,locale._underlying); + return result.isOk ? WeekCalculator._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XWeekCalculator_create= _capi, ffi.Pointer)>>('ICU4XWeekCalculator_create') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + +/// Additional information: [1](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekCalculator.html#structfield.first_weekday), [2](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekCalculator.html#structfield.min_week_days) +factory WeekCalculator.fromFirstDayOfWeekAndMinWeekDays(IsoWeekday firstWeekday, int minWeekDays) { + + final result = _ICU4XWeekCalculator_create_from_first_day_of_week_and_min_week_days(firstWeekday._underlying,minWeekDays); + return WeekCalculator._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XWeekCalculator_min_week_days = - _capi)>>( - 'ICU4XWeekCalculator_min_week_days') - .asFunction)>(isLeaf: true); -} + static final _ICU4XWeekCalculator_create_from_first_day_of_week_and_min_week_days= _capi Function(ffi.Int32, ffi.Uint8)>>('ICU4XWeekCalculator_create_from_first_day_of_week_and_min_week_days') + .asFunction Function(int, int)>(isLeaf: true); + + + +/// Returns the weekday that starts the week for this object's locale +/// +/// See the [Rust documentation for `first_weekday`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekCalculator.html#structfield.first_weekday) for more information. +IsoWeekday get firstWeekday { + + final result = _ICU4XWeekCalculator_first_weekday(_underlying); + return IsoWeekday.values.firstWhere((v) => v._underlying == result); + } + // ignore: non_constant_identifier_names + static final _ICU4XWeekCalculator_first_weekday= _capi)>>('ICU4XWeekCalculator_first_weekday') + .asFunction)>(isLeaf: true); + + + +/// The minimum number of days overlapping a year required for a week to be +/// considered part of that year +/// +/// See the [Rust documentation for `min_week_days`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekCalculator.html#structfield.min_week_days) for more information. +int get minWeekDays { + + final result = _ICU4XWeekCalculator_min_week_days(_underlying); + return result; + } + // ignore: non_constant_identifier_names + static final _ICU4XWeekCalculator_min_week_days= _capi)>>('ICU4XWeekCalculator_min_week_days') + .asFunction)>(isLeaf: true); + + + } + /// See the [Rust documentation for `WeekOf`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekOf.html) for more information. class _WeekOfFfi extends ffi.Struct { - @ffi.Uint16() - external int week; - @ffi.Int32() - external int unit; + @ffi.Uint16() + external int week; + @ffi.Int32() + external int unit; } class WeekOf { - final _WeekOfFfi _underlying; + final _WeekOfFfi _underlying; - // ignore: unused_element - WeekOf._(this._underlying); + // ignore: unused_element + WeekOf._(this._underlying); - factory WeekOf() { - final pointer = ffi2.calloc<_WeekOfFfi>(); - final result = WeekOf._(pointer.ref); - _callocFree.attach(result, pointer.cast()); - return result; - } + factory WeekOf() { + final pointer = ffi2.calloc<_WeekOfFfi>(); + final result = WeekOf._(pointer.ref); + _callocFree.attach(result, pointer.cast()); + return result; + } - int get week => _underlying.week; - set week(int week) { - _underlying.week = week; - } + int get week => _underlying.week; + set week(int week) { + _underlying.week = week; + } +WeekRelativeUnit get unit => WeekRelativeUnit.values[_underlying.unit]; + set unit(WeekRelativeUnit unit) { + _underlying.unit = unit.index; + } - WeekRelativeUnit get unit => WeekRelativeUnit.values[_underlying.unit]; - set unit(WeekRelativeUnit unit) { - _underlying.unit = unit.index; - } - @override - bool operator ==(Object other) => - other is WeekOf && - other._underlying.week == _underlying.week && - other._underlying.unit == _underlying.unit; + @override + bool operator ==(Object other) => + other is WeekOf + && other._underlying.week == _underlying.week + && other._underlying.unit == _underlying.unit; - @override - int get hashCode => Object.hashAll([ - _underlying.week, - _underlying.unit, - ]); + @override + int get hashCode => Object.hashAll([_underlying.week,_underlying.unit,]); } + /// See the [Rust documentation for `RelativeUnit`](https://docs.rs/icu/latest/icu/calendar/week/enum.RelativeUnit.html) for more information. enum WeekRelativeUnit { previous, @@ -10867,474 +8959,371 @@ enum WeekRelativeUnit { next; } + /// See the [Rust documentation for `WordBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html) for more information. class WordBreakIteratorLatin1 implements ffi.Finalizable { - final ffi.Pointer _underlying; - WordBreakIteratorLatin1._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XWordBreakIteratorLatin1_destroy')); + WordBreakIteratorLatin1._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is - /// out of range of a 32-bit signed integer. - /// - /// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.next) for more information. - int next() { - final result = _ICU4XWordBreakIteratorLatin1_next(_underlying); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XWordBreakIteratorLatin1_destroy')); + +/// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is +/// out of range of a 32-bit signed integer. +/// +/// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.next) for more information. +int next() { + + final result = _ICU4XWordBreakIteratorLatin1_next(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XWordBreakIteratorLatin1_next = - _capi)>>( - 'ICU4XWordBreakIteratorLatin1_next') - .asFunction)>(isLeaf: true); + static final _ICU4XWordBreakIteratorLatin1_next= _capi)>>('ICU4XWordBreakIteratorLatin1_next') + .asFunction)>(isLeaf: true); - /// Return the status value of break boundary. - /// - /// See the [Rust documentation for `word_type`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.word_type) for more information. - SegmenterWordType get wordType { - final result = _ICU4XWordBreakIteratorLatin1_word_type(_underlying); - return SegmenterWordType.values[result]; - } + +/// Return the status value of break boundary. +/// +/// See the [Rust documentation for `word_type`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.word_type) for more information. +SegmenterWordType get wordType { + + final result = _ICU4XWordBreakIteratorLatin1_word_type(_underlying); + return SegmenterWordType.values[result]; + } // ignore: non_constant_identifier_names - static final _ICU4XWordBreakIteratorLatin1_word_type = - _capi)>>( - 'ICU4XWordBreakIteratorLatin1_word_type') - .asFunction)>(isLeaf: true); + static final _ICU4XWordBreakIteratorLatin1_word_type= _capi)>>('ICU4XWordBreakIteratorLatin1_word_type') + .asFunction)>(isLeaf: true); - /// Return true when break boundary is word-like such as letter/number/CJK - /// - /// See the [Rust documentation for `is_word_like`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.is_word_like) for more information. - bool get isWordLike { - final result = _ICU4XWordBreakIteratorLatin1_is_word_like(_underlying); - return result; - } + +/// Return true when break boundary is word-like such as letter/number/CJK +/// +/// See the [Rust documentation for `is_word_like`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.is_word_like) for more information. +bool get isWordLike { + + final result = _ICU4XWordBreakIteratorLatin1_is_word_like(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XWordBreakIteratorLatin1_is_word_like = - _capi)>>( - 'ICU4XWordBreakIteratorLatin1_is_word_like') - .asFunction)>(isLeaf: true); -} + static final _ICU4XWordBreakIteratorLatin1_is_word_like= _capi)>>('ICU4XWordBreakIteratorLatin1_is_word_like') + .asFunction)>(isLeaf: true); + + + } + /// See the [Rust documentation for `WordBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html) for more information. class WordBreakIteratorUtf16 implements ffi.Finalizable { - final ffi.Pointer _underlying; - WordBreakIteratorUtf16._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } + final ffi.Pointer _underlying; - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XWordBreakIteratorUtf16_destroy')); + WordBreakIteratorUtf16._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } - /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is - /// out of range of a 32-bit signed integer. - /// - /// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.next) for more information. - int next() { - final result = _ICU4XWordBreakIteratorUtf16_next(_underlying); - return result; - } + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XWordBreakIteratorUtf16_destroy')); + +/// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is +/// out of range of a 32-bit signed integer. +/// +/// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.next) for more information. +int next() { + + final result = _ICU4XWordBreakIteratorUtf16_next(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XWordBreakIteratorUtf16_next = - _capi)>>( - 'ICU4XWordBreakIteratorUtf16_next') - .asFunction)>(isLeaf: true); + static final _ICU4XWordBreakIteratorUtf16_next= _capi)>>('ICU4XWordBreakIteratorUtf16_next') + .asFunction)>(isLeaf: true); - /// Return the status value of break boundary. - /// - /// See the [Rust documentation for `word_type`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.word_type) for more information. - SegmenterWordType get wordType { - final result = _ICU4XWordBreakIteratorUtf16_word_type(_underlying); - return SegmenterWordType.values[result]; - } + +/// Return the status value of break boundary. +/// +/// See the [Rust documentation for `word_type`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.word_type) for more information. +SegmenterWordType get wordType { + + final result = _ICU4XWordBreakIteratorUtf16_word_type(_underlying); + return SegmenterWordType.values[result]; + } // ignore: non_constant_identifier_names - static final _ICU4XWordBreakIteratorUtf16_word_type = - _capi)>>( - 'ICU4XWordBreakIteratorUtf16_word_type') - .asFunction)>(isLeaf: true); + static final _ICU4XWordBreakIteratorUtf16_word_type= _capi)>>('ICU4XWordBreakIteratorUtf16_word_type') + .asFunction)>(isLeaf: true); - /// Return true when break boundary is word-like such as letter/number/CJK - /// - /// See the [Rust documentation for `is_word_like`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.is_word_like) for more information. - bool get isWordLike { - final result = _ICU4XWordBreakIteratorUtf16_is_word_like(_underlying); - return result; - } + +/// Return true when break boundary is word-like such as letter/number/CJK +/// +/// See the [Rust documentation for `is_word_like`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.is_word_like) for more information. +bool get isWordLike { + + final result = _ICU4XWordBreakIteratorUtf16_is_word_like(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XWordBreakIteratorUtf16_is_word_like = - _capi)>>( - 'ICU4XWordBreakIteratorUtf16_is_word_like') - .asFunction)>(isLeaf: true); -} + static final _ICU4XWordBreakIteratorUtf16_is_word_like= _capi)>>('ICU4XWordBreakIteratorUtf16_is_word_like') + .asFunction)>(isLeaf: true); + + + } + /// See the [Rust documentation for `WordBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html) for more information. class WordBreakIteratorUtf8 implements ffi.Finalizable { - final ffi.Pointer _underlying; - WordBreakIteratorUtf8._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); + final ffi.Pointer _underlying; + + WordBreakIteratorUtf8._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XWordBreakIteratorUtf8_destroy')); + + +/// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is +/// out of range of a 32-bit signed integer. +/// +/// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.next) for more information. +int next() { + + final result = _ICU4XWordBreakIteratorUtf8_next(_underlying); + return result; } + // ignore: non_constant_identifier_names + static final _ICU4XWordBreakIteratorUtf8_next= _capi)>>('ICU4XWordBreakIteratorUtf8_next') + .asFunction)>(isLeaf: true); - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XWordBreakIteratorUtf8_destroy')); - /// Finds the next breakpoint. Returns -1 if at the end of the string or if the index is - /// out of range of a 32-bit signed integer. - /// - /// See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.next) for more information. - int next() { - final result = _ICU4XWordBreakIteratorUtf8_next(_underlying); - return result; + +/// Return the status value of break boundary. +/// +/// See the [Rust documentation for `word_type`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.word_type) for more information. +SegmenterWordType get wordType { + + final result = _ICU4XWordBreakIteratorUtf8_word_type(_underlying); + return SegmenterWordType.values[result]; } + // ignore: non_constant_identifier_names + static final _ICU4XWordBreakIteratorUtf8_word_type= _capi)>>('ICU4XWordBreakIteratorUtf8_word_type') + .asFunction)>(isLeaf: true); + + +/// Return true when break boundary is word-like such as letter/number/CJK +/// +/// See the [Rust documentation for `is_word_like`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.is_word_like) for more information. +bool get isWordLike { + + final result = _ICU4XWordBreakIteratorUtf8_is_word_like(_underlying); + return result; + } // ignore: non_constant_identifier_names - static final _ICU4XWordBreakIteratorUtf8_next = - _capi)>>( - 'ICU4XWordBreakIteratorUtf8_next') - .asFunction)>(isLeaf: true); + static final _ICU4XWordBreakIteratorUtf8_is_word_like= _capi)>>('ICU4XWordBreakIteratorUtf8_is_word_like') + .asFunction)>(isLeaf: true); + + + } + + +/// An ICU4X word-break segmenter, capable of finding word breakpoints in strings. +/// +/// See the [Rust documentation for `WordSegmenter`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html) for more information. +class WordSegmenter implements ffi.Finalizable { - /// Return the status value of break boundary. - /// - /// See the [Rust documentation for `word_type`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.word_type) for more information. - SegmenterWordType get wordType { - final result = _ICU4XWordBreakIteratorUtf8_word_type(_underlying); - return SegmenterWordType.values[result]; + final ffi.Pointer _underlying; + + WordSegmenter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XWordSegmenter_destroy')); + + +/// Construct an [`ICU4XWordSegmenter`] with automatically selecting the best available LSTM +/// or dictionary payload data. +/// +/// Note: currently, it uses dictionary for Chinese and Japanese, and LSTM for Burmese, +/// Khmer, Lao, and Thai. +/// +/// See the [Rust documentation for `new_auto`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html#method.new_auto) for more information. +factory WordSegmenter.auto(DataProvider provider) { + + final result = _ICU4XWordSegmenter_create_auto(provider._underlying); + return result.isOk ? WordSegmenter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XWordSegmenter_create_auto= _capi)>>('ICU4XWordSegmenter_create_auto') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + +/// Construct an [`ICU4XWordSegmenter`] with LSTM payload data for Burmese, Khmer, Lao, and +/// Thai. +/// +/// Warning: [`ICU4XWordSegmenter`] created by this function doesn't handle Chinese or +/// Japanese. +/// +/// See the [Rust documentation for `new_lstm`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html#method.new_lstm) for more information. +factory WordSegmenter.lstm(DataProvider provider) { + + final result = _ICU4XWordSegmenter_create_lstm(provider._underlying); + return result.isOk ? WordSegmenter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } // ignore: non_constant_identifier_names - static final _ICU4XWordBreakIteratorUtf8_word_type = - _capi)>>( - 'ICU4XWordBreakIteratorUtf8_word_type') - .asFunction)>(isLeaf: true); + static final _ICU4XWordSegmenter_create_lstm= _capi)>>('ICU4XWordSegmenter_create_lstm') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + - /// Return true when break boundary is word-like such as letter/number/CJK - /// - /// See the [Rust documentation for `is_word_like`](https://docs.rs/icu/latest/icu/segmenter/struct.WordBreakIterator.html#method.is_word_like) for more information. - bool get isWordLike { - final result = _ICU4XWordBreakIteratorUtf8_is_word_like(_underlying); - return result; + +/// Construct an [`ICU4XWordSegmenter`] with dictionary payload data for Chinese, Japanese, +/// Burmese, Khmer, Lao, and Thai. +/// +/// See the [Rust documentation for `new_dictionary`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html#method.new_dictionary) for more information. +factory WordSegmenter.dictionary(DataProvider provider) { + + final result = _ICU4XWordSegmenter_create_dictionary(provider._underlying); + return result.isOk ? WordSegmenter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); } + // ignore: non_constant_identifier_names + static final _ICU4XWordSegmenter_create_dictionary= _capi)>>('ICU4XWordSegmenter_create_dictionary') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>(isLeaf: true); + + +/// Segments a (potentially ill-formed) UTF-8 string. +/// +/// See the [Rust documentation for `segment_utf8`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html#method.segment_utf8) for more information. +WordBreakIteratorUtf8 segmentUtf8(String input) { + final alloc = ffi2.Arena(); + final inputSlice = _SliceFfi2Utf8._fromDart(input, alloc); + + final result = _ICU4XWordSegmenter_segment_utf8(_underlying,inputSlice._bytes,inputSlice._length);alloc.releaseAll(); + return WordBreakIteratorUtf8._(result); + } // ignore: non_constant_identifier_names - static final _ICU4XWordBreakIteratorUtf8_is_word_like = - _capi)>>( - 'ICU4XWordBreakIteratorUtf8_is_word_like') - .asFunction)>(isLeaf: true); -} + static final _ICU4XWordSegmenter_segment_utf8= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XWordSegmenter_segment_utf8') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); -/// An ICU4X word-break segmenter, capable of finding word breakpoints in strings. -/// -/// See the [Rust documentation for `WordSegmenter`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html) for more information. -class WordSegmenter implements ffi.Finalizable { - final ffi.Pointer _underlying; - WordSegmenter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XWordSegmenter_destroy')); - - /// Construct an [`ICU4XWordSegmenter`] with automatically selecting the best available LSTM - /// or dictionary payload data. - /// - /// Note: currently, it uses dictionary for Chinese and Japanese, and LSTM for Burmese, - /// Khmer, Lao, and Thai. - /// - /// See the [Rust documentation for `new_auto`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html#method.new_auto) for more information. - factory WordSegmenter.auto(DataProvider provider) { - final result = _ICU4XWordSegmenter_create_auto(provider._underlying); - return result.isOk - ? WordSegmenter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XWordSegmenter_create_auto = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XWordSegmenter_create_auto') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Construct an [`ICU4XWordSegmenter`] with LSTM payload data for Burmese, Khmer, Lao, and - /// Thai. - /// - /// Warning: [`ICU4XWordSegmenter`] created by this function doesn't handle Chinese or - /// Japanese. - /// - /// See the [Rust documentation for `new_lstm`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html#method.new_lstm) for more information. - factory WordSegmenter.lstm(DataProvider provider) { - final result = _ICU4XWordSegmenter_create_lstm(provider._underlying); - return result.isOk - ? WordSegmenter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XWordSegmenter_create_lstm = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer)>>('ICU4XWordSegmenter_create_lstm') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Construct an [`ICU4XWordSegmenter`] with dictionary payload data for Chinese, Japanese, - /// Burmese, Khmer, Lao, and Thai. - /// - /// See the [Rust documentation for `new_dictionary`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html#method.new_dictionary) for more information. - factory WordSegmenter.dictionary(DataProvider provider) { - final result = _ICU4XWordSegmenter_create_dictionary(provider._underlying); - return result.isOk - ? WordSegmenter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XWordSegmenter_create_dictionary = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer)>>( - 'ICU4XWordSegmenter_create_dictionary') - .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer)>( - isLeaf: true); - - /// Segments a (potentially ill-formed) UTF-8 string. - /// - /// See the [Rust documentation for `segment_utf8`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html#method.segment_utf8) for more information. - WordBreakIteratorUtf8 segmentUtf8(String input) { - final alloc = ffi2.Arena(); - final inputSlice = _SliceFfi2Utf8._fromDart(input, alloc); - - final result = _ICU4XWordSegmenter_segment_utf8( - _underlying, inputSlice._bytes, inputSlice._length); - alloc.releaseAll(); - return WordBreakIteratorUtf8._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XWordSegmenter_segment_utf8 = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XWordSegmenter_segment_utf8') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Segments a UTF-16 string. - /// - /// See the [Rust documentation for `segment_utf16`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html#method.segment_utf16) for more information. - WordBreakIteratorUtf16 segmentUtf16(Uint16List input) { - final alloc = ffi2.Arena(); - final inputSlice = _SliceFfiUint16._fromDart(input, alloc); - - final result = _ICU4XWordSegmenter_segment_utf16( - _underlying, inputSlice._bytes, inputSlice._length); - alloc.releaseAll(); - return WordBreakIteratorUtf16._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XWordSegmenter_segment_utf16 = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XWordSegmenter_segment_utf16') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); - - /// Segments a Latin-1 string. - /// - /// See the [Rust documentation for `segment_latin1`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html#method.segment_latin1) for more information. - WordBreakIteratorLatin1 segmentLatin1(Uint8List input) { - final alloc = ffi2.Arena(); - final inputSlice = _SliceFfiUint8._fromDart(input, alloc); - - final result = _ICU4XWordSegmenter_segment_latin1( - _underlying, inputSlice._bytes, inputSlice._length); - alloc.releaseAll(); - return WordBreakIteratorLatin1._(result); - } - - // ignore: non_constant_identifier_names - static final _ICU4XWordSegmenter_segment_latin1 = _capi< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size)>>('ICU4XWordSegmenter_segment_latin1') - .asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, int)>(isLeaf: true); -} + +/// Segments a UTF-16 string. +/// +/// See the [Rust documentation for `segment_utf16`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html#method.segment_utf16) for more information. +WordBreakIteratorUtf16 segmentUtf16(Uint16List input) { + final alloc = ffi2.Arena(); + final inputSlice = _SliceFfiUint16._fromDart(input, alloc); + + final result = _ICU4XWordSegmenter_segment_utf16(_underlying,inputSlice._bytes,inputSlice._length);alloc.releaseAll(); + return WordBreakIteratorUtf16._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XWordSegmenter_segment_utf16= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XWordSegmenter_segment_utf16') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + +/// Segments a Latin-1 string. +/// +/// See the [Rust documentation for `segment_latin1`](https://docs.rs/icu/latest/icu/segmenter/struct.WordSegmenter.html#method.segment_latin1) for more information. +WordBreakIteratorLatin1 segmentLatin1(Uint8List input) { + final alloc = ffi2.Arena(); + final inputSlice = _SliceFfiUint8._fromDart(input, alloc); + + final result = _ICU4XWordSegmenter_segment_latin1(_underlying,inputSlice._bytes,inputSlice._length);alloc.releaseAll(); + return WordBreakIteratorLatin1._(result); + } + // ignore: non_constant_identifier_names + static final _ICU4XWordSegmenter_segment_latin1= _capi Function(ffi.Pointer, ffi.Pointer, ffi.Size)>>('ICU4XWordSegmenter_segment_latin1') + .asFunction Function(ffi.Pointer, ffi.Pointer, int)>(isLeaf: true); + + + } + /// An object capable of formatting a date time with time zone to a string. -/// +/// /// See the [Rust documentation for `ZonedDateTimeFormatter`](https://docs.rs/icu/latest/icu/datetime/struct.ZonedDateTimeFormatter.html) for more information. class ZonedDateTimeFormatter implements ffi.Finalizable { - final ffi.Pointer _underlying; - ZonedDateTimeFormatter._(this._underlying) { - _finalizer.attach(this, _underlying.cast()); - } - - static final _finalizer = - ffi.NativeFinalizer(_capi('ICU4XZonedDateTimeFormatter_destroy')); - - /// Creates a new [`ICU4XZonedDateTimeFormatter`] from locale data. - /// - /// This function has `date_length` and `time_length` arguments and uses default options - /// for the time zone. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/struct.ZonedDateTimeFormatter.html#method.try_new) for more information. - factory ZonedDateTimeFormatter.withLengths(DataProvider provider, - Locale locale, DateLength dateLength, TimeLength timeLength) { - final result = _ICU4XZonedDateTimeFormatter_create_with_lengths( - provider._underlying, - locale._underlying, - dateLength.index, - timeLength.index); - return result.isOk - ? ZonedDateTimeFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XZonedDateTimeFormatter_create_with_lengths = _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, ffi.Int32, ffi.Int32)>>( - 'ICU4XZonedDateTimeFormatter_create_with_lengths') - .asFunction< - _ResultOpaqueInt32 Function(ffi.Pointer, - ffi.Pointer, int, int)>(isLeaf: true); - - /// Creates a new [`ICU4XZonedDateTimeFormatter`] from locale data. - /// - /// This function has `date_length` and `time_length` arguments and uses an ISO-8601 style - /// fallback for the time zone with the given configurations. - /// - /// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/struct.ZonedDateTimeFormatter.html#method.try_new) for more information. - factory ZonedDateTimeFormatter.withLengthsAndIso8601TimeZoneFallback( - DataProvider provider, - Locale locale, - DateLength dateLength, - TimeLength timeLength, - IsoTimeZoneOptions zoneOptions) { - final result = - _ICU4XZonedDateTimeFormatter_create_with_lengths_and_iso_8601_time_zone_fallback( - provider._underlying, - locale._underlying, - dateLength.index, - timeLength.index, - zoneOptions._underlying); - return result.isOk - ? ZonedDateTimeFormatter._(result.union.ok) - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - // ignore: non_constant_identifier_names - static final _ICU4XZonedDateTimeFormatter_create_with_lengths_and_iso_8601_time_zone_fallback = - _capi< - ffi.NativeFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Int32, - ffi.Int32, - _IsoTimeZoneOptionsFfi)>>( - 'ICU4XZonedDateTimeFormatter_create_with_lengths_and_iso_8601_time_zone_fallback') - .asFunction< - _ResultOpaqueInt32 Function( - ffi.Pointer, - ffi.Pointer, - int, - int, - _IsoTimeZoneOptionsFfi)>(isLeaf: true); - - /// Formats a [`ICU4XDateTime`] and [`ICU4XCustomTimeZone`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.ZonedDateTimeFormatter.html#method.format) for more information. - String formatDatetimeWithCustomTimeZone( - DateTime datetime, CustomTimeZone timeZone) { - final writeable = _Writeable(); - final result = - _ICU4XZonedDateTimeFormatter_format_datetime_with_custom_time_zone( - _underlying, - datetime._underlying, - timeZone._underlying, - writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XZonedDateTimeFormatter_format_datetime_with_custom_time_zone = - _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>( - 'ICU4XZonedDateTimeFormatter_format_datetime_with_custom_time_zone') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(isLeaf: true); - - /// Formats a [`ICU4XIsoDateTime`] and [`ICU4XCustomTimeZone`] to a string. - /// - /// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.ZonedDateTimeFormatter.html#method.format) for more information. - String formatIsoDatetimeWithCustomTimeZone( - IsoDateTime datetime, CustomTimeZone timeZone) { - final writeable = _Writeable(); - final result = - _ICU4XZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone( - _underlying, - datetime._underlying, - timeZone._underlying, - writeable._underlying); - return result.isOk - ? writeable.finalize() - : throw Error.values - .firstWhere((v) => v._underlying == result.union.err); - } - - // ignore: non_constant_identifier_names - static final _ICU4XZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone = - _capi< - ffi.NativeFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>( - 'ICU4XZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone') - .asFunction< - _ResultVoidInt32 Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(isLeaf: true); -} + final ffi.Pointer _underlying; + + ZonedDateTimeFormatter._(this._underlying) { + _finalizer.attach(this, _underlying.cast()); + } + + static final _finalizer = ffi.NativeFinalizer(_capi('ICU4XZonedDateTimeFormatter_destroy')); + + +/// Creates a new [`ICU4XZonedDateTimeFormatter`] from locale data. +/// +/// This function has `date_length` and `time_length` arguments and uses default options +/// for the time zone. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/struct.ZonedDateTimeFormatter.html#method.try_new) for more information. +factory ZonedDateTimeFormatter.withLengths(DataProvider provider, Locale locale, DateLength dateLength, TimeLength timeLength) { + + final result = _ICU4XZonedDateTimeFormatter_create_with_lengths(provider._underlying,locale._underlying,dateLength.index,timeLength.index); + return result.isOk ? ZonedDateTimeFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XZonedDateTimeFormatter_create_with_lengths= _capi, ffi.Pointer, ffi.Int32, ffi.Int32)>>('ICU4XZonedDateTimeFormatter_create_with_lengths') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int, int)>(isLeaf: true); + + + +/// Creates a new [`ICU4XZonedDateTimeFormatter`] from locale data. +/// +/// This function has `date_length` and `time_length` arguments and uses an ISO-8601 style +/// fallback for the time zone with the given configurations. +/// +/// See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/datetime/struct.ZonedDateTimeFormatter.html#method.try_new) for more information. +factory ZonedDateTimeFormatter.withLengthsAndIso8601TimeZoneFallback(DataProvider provider, Locale locale, DateLength dateLength, TimeLength timeLength, IsoTimeZoneOptions zoneOptions) { + + final result = _ICU4XZonedDateTimeFormatter_create_with_lengths_and_iso_8601_time_zone_fallback(provider._underlying,locale._underlying,dateLength.index,timeLength.index,zoneOptions._underlying); + return result.isOk ? ZonedDateTimeFormatter._(result.union.ok) : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XZonedDateTimeFormatter_create_with_lengths_and_iso_8601_time_zone_fallback= _capi, ffi.Pointer, ffi.Int32, ffi.Int32, _IsoTimeZoneOptionsFfi)>>('ICU4XZonedDateTimeFormatter_create_with_lengths_and_iso_8601_time_zone_fallback') + .asFunction<_ResultOpaqueInt32 Function(ffi.Pointer, ffi.Pointer, int, int, _IsoTimeZoneOptionsFfi)>(isLeaf: true); + + + +/// Formats a [`ICU4XDateTime`] and [`ICU4XCustomTimeZone`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.ZonedDateTimeFormatter.html#method.format) for more information. +String formatDatetimeWithCustomTimeZone(DateTime datetime, CustomTimeZone timeZone) { + + final writeable = _Writeable(); + final result = _ICU4XZonedDateTimeFormatter_format_datetime_with_custom_time_zone(_underlying,datetime._underlying,timeZone._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XZonedDateTimeFormatter_format_datetime_with_custom_time_zone= _capi, ffi.Pointer, ffi.Pointer, ffi.Pointer)>>('ICU4XZonedDateTimeFormatter_format_datetime_with_custom_time_zone') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + +/// Formats a [`ICU4XIsoDateTime`] and [`ICU4XCustomTimeZone`] to a string. +/// +/// See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.ZonedDateTimeFormatter.html#method.format) for more information. +String formatIsoDatetimeWithCustomTimeZone(IsoDateTime datetime, CustomTimeZone timeZone) { + + final writeable = _Writeable(); + final result = _ICU4XZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone(_underlying,datetime._underlying,timeZone._underlying,writeable._underlying); + return result.isOk ? writeable.finalize() : throw Error.values.firstWhere((v) => v._underlying == result.union.err); + } + // ignore: non_constant_identifier_names + static final _ICU4XZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone= _capi, ffi.Pointer, ffi.Pointer, ffi.Pointer)>>('ICU4XZonedDateTimeFormatter_format_iso_datetime_with_custom_time_zone') + .asFunction<_ResultVoidInt32 Function(ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)>(isLeaf: true); + + + } class SizeList extends ffi.Struct { external ffi.Pointer _bytes; @@ -11352,9 +9341,8 @@ class SizeList extends ffi.Struct { return false; } - for (var i = 0; i < _length; i++) { - if (other._bytes[i] != _bytes[i]) { - return false; + for (var i = 0; i < _length; i++) {if (other._bytes[i] != _bytes[i]) { + return false; } } return true; @@ -11365,103 +9353,106 @@ class SizeList extends ffi.Struct { int get hashCode => _length.hashCode; } + class _ResultBoolInt32Union extends ffi.Union { - @ffi.Bool() - external bool ok; + @ffi.Bool() + external bool ok; - @ffi.Int32() - external int err; -} + @ffi.Int32() + external int err; +} class _ResultBoolInt32 extends ffi.Struct { - external _ResultBoolInt32Union union; + external _ResultBoolInt32Union union; - @ffi.Bool() - external bool isOk; + @ffi.Bool() + external bool isOk; } class _ResultInt32Int32Union extends ffi.Union { - @ffi.Int32() - external int ok; + @ffi.Int32() + external int ok; - @ffi.Int32() - external int err; -} + @ffi.Int32() + external int err; +} class _ResultInt32Int32 extends ffi.Struct { - external _ResultInt32Int32Union union; + external _ResultInt32Int32Union union; - @ffi.Bool() - external bool isOk; + @ffi.Bool() + external bool isOk; } class _ResultInt32VoidUnion extends ffi.Union { - @ffi.Int32() - external int ok; -} + @ffi.Int32() + external int ok; +} class _ResultInt32Void extends ffi.Struct { - external _ResultInt32VoidUnion union; + external _ResultInt32VoidUnion union; - @ffi.Bool() - external bool isOk; + @ffi.Bool() + external bool isOk; } class _ResultOpaqueInt32Union extends ffi.Union { - external ffi.Pointer ok; + external ffi.Pointer ok; - @ffi.Int32() - external int err; -} + @ffi.Int32() + external int err; +} class _ResultOpaqueInt32 extends ffi.Struct { - external _ResultOpaqueInt32Union union; + external _ResultOpaqueInt32Union union; - @ffi.Bool() - external bool isOk; + @ffi.Bool() + external bool isOk; } class _ResultUint16VoidUnion extends ffi.Union { - @ffi.Uint16() - external int ok; -} + @ffi.Uint16() + external int ok; +} class _ResultUint16Void extends ffi.Struct { - external _ResultUint16VoidUnion union; + external _ResultUint16VoidUnion union; - @ffi.Bool() - external bool isOk; + @ffi.Bool() + external bool isOk; } class _ResultVoidInt32Union extends ffi.Union { - @ffi.Int32() - external int err; -} + @ffi.Int32() + external int err; +} class _ResultVoidInt32 extends ffi.Struct { - external _ResultVoidInt32Union union; + external _ResultVoidInt32Union union; - @ffi.Bool() - external bool isOk; + @ffi.Bool() + external bool isOk; } class _ResultVoidVoid extends ffi.Struct { - @ffi.Bool() - external bool isOk; + + + @ffi.Bool() + external bool isOk; } class _ResultWeekOfFfiInt32Union extends ffi.Union { - external _WeekOfFfi ok; + external _WeekOfFfi ok; - @ffi.Int32() - external int err; -} + @ffi.Int32() + external int err; +} class _ResultWeekOfFfiInt32 extends ffi.Struct { - external _ResultWeekOfFfiInt32Union union; + external _ResultWeekOfFfiInt32Union union; - @ffi.Bool() - external bool isOk; + @ffi.Bool() + external bool isOk; } class _SliceFfi2Utf8 extends ffi.Struct { @@ -11469,14 +9460,13 @@ class _SliceFfi2Utf8 extends ffi.Struct { @ffi.Size() external int _length; - /// Produces a slice from a Dart object. The Dart object's data is copied into the given allocator /// as it cannot be borrowed directly, and gets freed with the slice object. // ignore: unused_element static _SliceFfi2Utf8 _fromDart(String value, ffi.Allocator allocator) { final pointer = allocator<_SliceFfi2Utf8>(); - final slice = pointer.ref; - final units = Utf8Encoder().convert(value); + final slice = pointer.ref; + final units = Utf8Encoder().convert(value); slice._length = units.length; slice._bytes = allocator(slice._length).cast(); slice._bytes.cast().asTypedList(slice._length).setAll(0, units); @@ -11485,8 +9475,7 @@ class _SliceFfi2Utf8 extends ffi.Struct { } // ignore: unused_element - String get _asDart => - Utf8Decoder().convert(_bytes.cast().asTypedList(_length)); + String get _asDart => Utf8Decoder().convert(_bytes.cast().asTypedList(_length)); // This is expensive @override @@ -11496,8 +9485,7 @@ class _SliceFfi2Utf8 extends ffi.Struct { } for (var i = 0; i < _length; i++) { - if (other._bytes.cast()[i] != _bytes.cast()[i]) { - return false; + if (other._bytes.cast()[i] != _bytes.cast()[i]) {return false; } } return true; @@ -11508,19 +9496,19 @@ class _SliceFfi2Utf8 extends ffi.Struct { int get hashCode => _length.hashCode; } + class _SliceFfiUint16 extends ffi.Struct { external ffi.Pointer _bytes; @ffi.Size() external int _length; - /// Produces a slice from a Dart object. The Dart object's data is copied into the given allocator /// as it cannot be borrowed directly, and gets freed with the slice object. // ignore: unused_element static _SliceFfiUint16 _fromDart(Uint16List value, ffi.Allocator allocator) { final pointer = allocator<_SliceFfiUint16>(); - final slice = pointer.ref; - slice._length = value.length; + final slice = pointer.ref; + slice._length = value.length; slice._bytes = allocator(slice._length); slice._bytes.asTypedList(slice._length).setAll(0, value); @@ -11537,9 +9525,8 @@ class _SliceFfiUint16 extends ffi.Struct { return false; } - for (var i = 0; i < _length; i++) { - if (other._bytes[i] != _bytes[i]) { - return false; + for (var i = 0; i < _length; i++) {if (other._bytes[i] != _bytes[i]) { + return false; } } return true; @@ -11550,19 +9537,19 @@ class _SliceFfiUint16 extends ffi.Struct { int get hashCode => _length.hashCode; } + class _SliceFfiUint8 extends ffi.Struct { external ffi.Pointer _bytes; @ffi.Size() external int _length; - /// Produces a slice from a Dart object. The Dart object's data is copied into the given allocator /// as it cannot be borrowed directly, and gets freed with the slice object. // ignore: unused_element static _SliceFfiUint8 _fromDart(Uint8List value, ffi.Allocator allocator) { final pointer = allocator<_SliceFfiUint8>(); - final slice = pointer.ref; - slice._length = value.length; + final slice = pointer.ref; + slice._length = value.length; slice._bytes = allocator(slice._length); slice._bytes.asTypedList(slice._length).setAll(0, value); @@ -11579,9 +9566,8 @@ class _SliceFfiUint8 extends ffi.Struct { return false; } - for (var i = 0; i < _length; i++) { - if (other._bytes[i] != _bytes[i]) { - return false; + for (var i = 0; i < _length; i++) {if (other._bytes[i] != _bytes[i]) { + return false; } } return true; @@ -11592,6 +9578,7 @@ class _SliceFfiUint8 extends ffi.Struct { int get hashCode => _length.hashCode; } + /// An unspecified error value class VoidError {} @@ -11605,12 +9592,10 @@ class _Writeable { .asFunction Function(int)>(); String finalize() { - final string = - _getBytes(_underlying).toDartString(length: _len(_underlying)); + final string = _getBytes(_underlying).toDartString(length: _len(_underlying)); _destroy(_underlying); return string; } - static final _len = _capi)>>( 'diplomat_buffer_writeable_len') @@ -11619,10 +9604,11 @@ class _Writeable { ffi.NativeFunction< ffi.Pointer Function(ffi.Pointer)>>( 'diplomat_buffer_writeable_get_bytes') - .asFunction Function(ffi.Pointer)>( - isLeaf: true); + .asFunction Function(ffi.Pointer)>(isLeaf: true); static final _destroy = _capi)>>( 'diplomat_buffer_writeable_destroy') .asFunction)>(isLeaf: true); } + + diff --git a/ffi/capi/js/package/docs/source/collator_ffi.rst b/ffi/capi/js/package/docs/source/collator_ffi.rst index 2127d2713d6..99b5753e92e 100644 --- a/ffi/capi/js/package/docs/source/collator_ffi.rst +++ b/ffi/capi/js/package/docs/source/collator_ffi.rst @@ -42,6 +42,13 @@ - Note: ``right`` should be an ArrayBuffer or TypedArray corresponding to the slice type expected by Rust. + .. js:method:: resolved_options() + + The resolved options showing how the default options, the requested options, and the options from locale data were combined. None of the struct fields will have ``Auto`` as the value. + + See the `Rust documentation for resolved_options `__ for more information. + + .. js:class:: ICU4XCollatorAlternateHandling See the `Rust documentation for AlternateHandling `__ for more information. @@ -77,6 +84,25 @@ See the `Rust documentation for CollatorOptions `__ for more information. + .. js:attribute:: strength + + .. js:attribute:: alternate_handling + + .. js:attribute:: case_first + + .. js:attribute:: max_variable + + .. js:attribute:: case_level + + .. js:attribute:: numeric + + .. js:attribute:: backward_second_level + +.. js:class:: ICU4XCollatorResolvedOptionsV1 + + See the `Rust documentation for ResolvedCollatorOptions `__ for more information. + + .. js:attribute:: strength .. js:attribute:: alternate_handling diff --git a/ffi/capi/js/package/lib/ICU4XCollator.d.ts b/ffi/capi/js/package/lib/ICU4XCollator.d.ts index 92e572493c8..a09c4da4113 100644 --- a/ffi/capi/js/package/lib/ICU4XCollator.d.ts +++ b/ffi/capi/js/package/lib/ICU4XCollator.d.ts @@ -1,5 +1,6 @@ import { FFIError } from "./diplomat-runtime" import { ICU4XCollatorOptionsV1 } from "./ICU4XCollatorOptionsV1"; +import { ICU4XCollatorResolvedOptionsV1 } from "./ICU4XCollatorResolvedOptionsV1"; import { ICU4XDataProvider } from "./ICU4XDataProvider"; import { ICU4XError } from "./ICU4XError"; import { ICU4XLocale } from "./ICU4XLocale"; @@ -47,4 +48,12 @@ export class ICU4XCollator { * See the {@link https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.compare_utf16 Rust documentation for `compare_utf16`} for more information. */ compare_utf16(left: Uint16Array, right: Uint16Array): ICU4XOrdering; + + /** + + * The resolved options showing how the default options, the requested options, and the options from locale data were combined. None of the struct fields will have `Auto` as the value. + + * See the {@link https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.resolved_options Rust documentation for `resolved_options`} for more information. + */ + resolved_options(): ICU4XCollatorResolvedOptionsV1; } diff --git a/ffi/capi/js/package/lib/ICU4XCollator.js b/ffi/capi/js/package/lib/ICU4XCollator.js index 5fc796cbd24..79896cafe66 100644 --- a/ffi/capi/js/package/lib/ICU4XCollator.js +++ b/ffi/capi/js/package/lib/ICU4XCollator.js @@ -6,6 +6,7 @@ import { ICU4XCollatorCaseFirst_js_to_rust, ICU4XCollatorCaseFirst_rust_to_js } import { ICU4XCollatorCaseLevel_js_to_rust, ICU4XCollatorCaseLevel_rust_to_js } from "./ICU4XCollatorCaseLevel.js" import { ICU4XCollatorMaxVariable_js_to_rust, ICU4XCollatorMaxVariable_rust_to_js } from "./ICU4XCollatorMaxVariable.js" import { ICU4XCollatorNumeric_js_to_rust, ICU4XCollatorNumeric_rust_to_js } from "./ICU4XCollatorNumeric.js" +import { ICU4XCollatorResolvedOptionsV1 } from "./ICU4XCollatorResolvedOptionsV1.js" import { ICU4XCollatorStrength_js_to_rust, ICU4XCollatorStrength_rust_to_js } from "./ICU4XCollatorStrength.js" import { ICU4XError_js_to_rust, ICU4XError_rust_to_js } from "./ICU4XError.js" import { ICU4XOrdering_js_to_rust, ICU4XOrdering_rust_to_js } from "./ICU4XOrdering.js" @@ -74,4 +75,14 @@ export class ICU4XCollator { buf_arg_right.free(); return diplomat_out; } + + resolved_options() { + return (() => { + const diplomat_receive_buffer = wasm.diplomat_alloc(28, 4); + wasm.ICU4XCollator_resolved_options(diplomat_receive_buffer, this.underlying); + const out = new ICU4XCollatorResolvedOptionsV1(diplomat_receive_buffer); + wasm.diplomat_free(diplomat_receive_buffer, 28, 4); + return out; + })(); + } } diff --git a/ffi/capi/js/package/lib/ICU4XCollatorResolvedOptionsV1.d.ts b/ffi/capi/js/package/lib/ICU4XCollatorResolvedOptionsV1.d.ts new file mode 100644 index 00000000000..28dcba8b375 --- /dev/null +++ b/ffi/capi/js/package/lib/ICU4XCollatorResolvedOptionsV1.d.ts @@ -0,0 +1,21 @@ +import { ICU4XCollatorAlternateHandling } from "./ICU4XCollatorAlternateHandling"; +import { ICU4XCollatorBackwardSecondLevel } from "./ICU4XCollatorBackwardSecondLevel"; +import { ICU4XCollatorCaseFirst } from "./ICU4XCollatorCaseFirst"; +import { ICU4XCollatorCaseLevel } from "./ICU4XCollatorCaseLevel"; +import { ICU4XCollatorMaxVariable } from "./ICU4XCollatorMaxVariable"; +import { ICU4XCollatorNumeric } from "./ICU4XCollatorNumeric"; +import { ICU4XCollatorStrength } from "./ICU4XCollatorStrength"; + +/** + + * See the {@link https://docs.rs/icu/latest/icu/collator/struct.ResolvedCollatorOptions.html Rust documentation for `ResolvedCollatorOptions`} for more information. + */ +export class ICU4XCollatorResolvedOptionsV1 { + strength: ICU4XCollatorStrength; + alternate_handling: ICU4XCollatorAlternateHandling; + case_first: ICU4XCollatorCaseFirst; + max_variable: ICU4XCollatorMaxVariable; + case_level: ICU4XCollatorCaseLevel; + numeric: ICU4XCollatorNumeric; + backward_second_level: ICU4XCollatorBackwardSecondLevel; +} diff --git a/ffi/capi/js/package/lib/ICU4XCollatorResolvedOptionsV1.js b/ffi/capi/js/package/lib/ICU4XCollatorResolvedOptionsV1.js new file mode 100644 index 00000000000..daa80274f36 --- /dev/null +++ b/ffi/capi/js/package/lib/ICU4XCollatorResolvedOptionsV1.js @@ -0,0 +1,21 @@ +import wasm from "./diplomat-wasm.mjs" +import * as diplomatRuntime from "./diplomat-runtime.js" +import { ICU4XCollatorAlternateHandling_js_to_rust, ICU4XCollatorAlternateHandling_rust_to_js } from "./ICU4XCollatorAlternateHandling.js" +import { ICU4XCollatorBackwardSecondLevel_js_to_rust, ICU4XCollatorBackwardSecondLevel_rust_to_js } from "./ICU4XCollatorBackwardSecondLevel.js" +import { ICU4XCollatorCaseFirst_js_to_rust, ICU4XCollatorCaseFirst_rust_to_js } from "./ICU4XCollatorCaseFirst.js" +import { ICU4XCollatorCaseLevel_js_to_rust, ICU4XCollatorCaseLevel_rust_to_js } from "./ICU4XCollatorCaseLevel.js" +import { ICU4XCollatorMaxVariable_js_to_rust, ICU4XCollatorMaxVariable_rust_to_js } from "./ICU4XCollatorMaxVariable.js" +import { ICU4XCollatorNumeric_js_to_rust, ICU4XCollatorNumeric_rust_to_js } from "./ICU4XCollatorNumeric.js" +import { ICU4XCollatorStrength_js_to_rust, ICU4XCollatorStrength_rust_to_js } from "./ICU4XCollatorStrength.js" + +export class ICU4XCollatorResolvedOptionsV1 { + constructor(underlying) { + this.strength = ICU4XCollatorStrength_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, underlying)]; + this.alternate_handling = ICU4XCollatorAlternateHandling_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, underlying + 4)]; + this.case_first = ICU4XCollatorCaseFirst_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, underlying + 8)]; + this.max_variable = ICU4XCollatorMaxVariable_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, underlying + 12)]; + this.case_level = ICU4XCollatorCaseLevel_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, underlying + 16)]; + this.numeric = ICU4XCollatorNumeric_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, underlying + 20)]; + this.backward_second_level = ICU4XCollatorBackwardSecondLevel_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, underlying + 24)]; + } +} diff --git a/ffi/capi/js/package/lib/index.d.ts b/ffi/capi/js/package/lib/index.d.ts index b8c013da3ac..5afb5fd4e9a 100644 --- a/ffi/capi/js/package/lib/index.d.ts +++ b/ffi/capi/js/package/lib/index.d.ts @@ -25,6 +25,7 @@ export { ICU4XCollatorCaseLevel } from './ICU4XCollatorCaseLevel.js'; export { ICU4XCollatorMaxVariable } from './ICU4XCollatorMaxVariable.js'; export { ICU4XCollatorNumeric } from './ICU4XCollatorNumeric.js'; export { ICU4XCollatorOptionsV1 } from './ICU4XCollatorOptionsV1.js'; +export { ICU4XCollatorResolvedOptionsV1 } from './ICU4XCollatorResolvedOptionsV1.js'; export { ICU4XCollatorStrength } from './ICU4XCollatorStrength.js'; export { ICU4XComposingNormalizer } from './ICU4XComposingNormalizer.js'; export { ICU4XCustomTimeZone } from './ICU4XCustomTimeZone.js'; diff --git a/ffi/capi/js/package/lib/index.js b/ffi/capi/js/package/lib/index.js index 52509139e4f..7a5a92aa872 100644 --- a/ffi/capi/js/package/lib/index.js +++ b/ffi/capi/js/package/lib/index.js @@ -25,6 +25,7 @@ export { ICU4XCollatorCaseLevel } from './ICU4XCollatorCaseLevel.js'; export { ICU4XCollatorMaxVariable } from './ICU4XCollatorMaxVariable.js'; export { ICU4XCollatorNumeric } from './ICU4XCollatorNumeric.js'; export { ICU4XCollatorOptionsV1 } from './ICU4XCollatorOptionsV1.js'; +export { ICU4XCollatorResolvedOptionsV1 } from './ICU4XCollatorResolvedOptionsV1.js'; export { ICU4XCollatorStrength } from './ICU4XCollatorStrength.js'; export { ICU4XComposingNormalizer } from './ICU4XComposingNormalizer.js'; export { ICU4XCustomTimeZone } from './ICU4XCustomTimeZone.js'; From 1a135d9b4a5c5994dcd7250968d5f8c4252db2c4 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Tue, 9 Jan 2024 14:00:49 +0200 Subject: [PATCH 7/7] Delete generated files from old locations --- ffi/capi/cpp/docs/source/collator_ffi.rst | 173 ------------------ .../js/package/docs/source/collator_ffi.rst | 119 ------------ 2 files changed, 292 deletions(-) delete mode 100644 ffi/capi/cpp/docs/source/collator_ffi.rst delete mode 100644 ffi/capi/js/package/docs/source/collator_ffi.rst diff --git a/ffi/capi/cpp/docs/source/collator_ffi.rst b/ffi/capi/cpp/docs/source/collator_ffi.rst deleted file mode 100644 index 34d4a34d8c0..00000000000 --- a/ffi/capi/cpp/docs/source/collator_ffi.rst +++ /dev/null @@ -1,173 +0,0 @@ -``collator::ffi`` -================= - -.. cpp:class:: ICU4XCollator - - See the `Rust documentation for Collator `__ for more information. - - - .. cpp:function:: static diplomat::result create_v1(const ICU4XDataProvider& provider, const ICU4XLocale& locale, ICU4XCollatorOptionsV1 options) - - Construct a new Collator instance. - - See the `Rust documentation for try_new `__ for more information. - - - .. cpp:function:: ICU4XOrdering compare(const std::string_view left, const std::string_view right) const - - Compare potentially ill-formed UTF-8 strings. - - Ill-formed input is compared as if errors had been replaced with REPLACEMENT CHARACTERs according to the WHATWG Encoding Standard. - - See the `Rust documentation for compare_utf8 `__ for more information. - - - .. cpp:function:: ICU4XOrdering compare_valid_utf8(const std::string_view left, const std::string_view right) const - - Compare guaranteed well-formed UTF-8 strings. - - Note: In C++, passing ill-formed UTF-8 strings is undefined behavior (and may be memory-unsafe to do so, too). - - See the `Rust documentation for compare `__ for more information. - - - .. cpp:function:: ICU4XOrdering compare_utf16(const diplomat::span left, const diplomat::span right) const - - Compare potentially ill-formed UTF-16 strings, with unpaired surrogates compared as REPLACEMENT CHARACTER. - - See the `Rust documentation for compare_utf16 `__ for more information. - - - .. cpp:function:: ICU4XCollatorResolvedOptionsV1 resolved_options() const - - The resolved options showing how the default options, the requested options, and the options from locale data were combined. None of the struct fields will have ``Auto`` as the value. - - See the `Rust documentation for resolved_options `__ for more information. - - -.. cpp:enum-struct:: ICU4XCollatorAlternateHandling - - See the `Rust documentation for AlternateHandling `__ for more information. - - - .. cpp:enumerator:: Auto - - .. cpp:enumerator:: NonIgnorable - - .. cpp:enumerator:: Shifted - -.. cpp:enum-struct:: ICU4XCollatorBackwardSecondLevel - - See the `Rust documentation for BackwardSecondLevel `__ for more information. - - - .. cpp:enumerator:: Auto - - .. cpp:enumerator:: Off - - .. cpp:enumerator:: On - -.. cpp:enum-struct:: ICU4XCollatorCaseFirst - - See the `Rust documentation for CaseFirst `__ for more information. - - - .. cpp:enumerator:: Auto - - .. cpp:enumerator:: Off - - .. cpp:enumerator:: LowerFirst - - .. cpp:enumerator:: UpperFirst - -.. cpp:enum-struct:: ICU4XCollatorCaseLevel - - See the `Rust documentation for CaseLevel `__ for more information. - - - .. cpp:enumerator:: Auto - - .. cpp:enumerator:: Off - - .. cpp:enumerator:: On - -.. cpp:enum-struct:: ICU4XCollatorMaxVariable - - See the `Rust documentation for MaxVariable `__ for more information. - - - .. cpp:enumerator:: Auto - - .. cpp:enumerator:: Space - - .. cpp:enumerator:: Punctuation - - .. cpp:enumerator:: Symbol - - .. cpp:enumerator:: Currency - -.. cpp:enum-struct:: ICU4XCollatorNumeric - - See the `Rust documentation for Numeric `__ for more information. - - - .. cpp:enumerator:: Auto - - .. cpp:enumerator:: Off - - .. cpp:enumerator:: On - -.. cpp:struct:: ICU4XCollatorOptionsV1 - - See the `Rust documentation for CollatorOptions `__ for more information. - - - .. cpp:member:: ICU4XCollatorStrength strength - - .. cpp:member:: ICU4XCollatorAlternateHandling alternate_handling - - .. cpp:member:: ICU4XCollatorCaseFirst case_first - - .. cpp:member:: ICU4XCollatorMaxVariable max_variable - - .. cpp:member:: ICU4XCollatorCaseLevel case_level - - .. cpp:member:: ICU4XCollatorNumeric numeric - - .. cpp:member:: ICU4XCollatorBackwardSecondLevel backward_second_level - -.. cpp:struct:: ICU4XCollatorResolvedOptionsV1 - - See the `Rust documentation for ResolvedCollatorOptions `__ for more information. - - - .. cpp:member:: ICU4XCollatorStrength strength - - .. cpp:member:: ICU4XCollatorAlternateHandling alternate_handling - - .. cpp:member:: ICU4XCollatorCaseFirst case_first - - .. cpp:member:: ICU4XCollatorMaxVariable max_variable - - .. cpp:member:: ICU4XCollatorCaseLevel case_level - - .. cpp:member:: ICU4XCollatorNumeric numeric - - .. cpp:member:: ICU4XCollatorBackwardSecondLevel backward_second_level - -.. cpp:enum-struct:: ICU4XCollatorStrength - - See the `Rust documentation for Strength `__ for more information. - - - .. cpp:enumerator:: Auto - - .. cpp:enumerator:: Primary - - .. cpp:enumerator:: Secondary - - .. cpp:enumerator:: Tertiary - - .. cpp:enumerator:: Quaternary - - .. cpp:enumerator:: Identical diff --git a/ffi/capi/js/package/docs/source/collator_ffi.rst b/ffi/capi/js/package/docs/source/collator_ffi.rst deleted file mode 100644 index 91fac41d787..00000000000 --- a/ffi/capi/js/package/docs/source/collator_ffi.rst +++ /dev/null @@ -1,119 +0,0 @@ -``collator::ffi`` -================= - -.. js:class:: ICU4XCollator - - See the `Rust documentation for Collator `__ for more information. - - - .. js:function:: create_v1(provider, locale, options) - - Construct a new Collator instance. - - See the `Rust documentation for try_new `__ for more information. - - - .. js:method:: compare(left, right) - - Compare potentially ill-formed UTF-8 strings. - - Ill-formed input is compared as if errors had been replaced with REPLACEMENT CHARACTERs according to the WHATWG Encoding Standard. - - See the `Rust documentation for compare_utf8 `__ for more information. - - - .. js:method:: compare_valid_utf8(left, right) - - Compare guaranteed well-formed UTF-8 strings. - - Note: In C++, passing ill-formed UTF-8 strings is undefined behavior (and may be memory-unsafe to do so, too). - - See the `Rust documentation for compare `__ for more information. - - - .. js:method:: compare_utf16(left, right) - - Compare potentially ill-formed UTF-16 strings, with unpaired surrogates compared as REPLACEMENT CHARACTER. - - See the `Rust documentation for compare_utf16 `__ for more information. - - - .. js:method:: resolved_options() - - The resolved options showing how the default options, the requested options, and the options from locale data were combined. None of the struct fields will have ``Auto`` as the value. - - See the `Rust documentation for resolved_options `__ for more information. - - -.. js:class:: ICU4XCollatorAlternateHandling - - See the `Rust documentation for AlternateHandling `__ for more information. - - -.. js:class:: ICU4XCollatorBackwardSecondLevel - - See the `Rust documentation for BackwardSecondLevel `__ for more information. - - -.. js:class:: ICU4XCollatorCaseFirst - - See the `Rust documentation for CaseFirst `__ for more information. - - -.. js:class:: ICU4XCollatorCaseLevel - - See the `Rust documentation for CaseLevel `__ for more information. - - -.. js:class:: ICU4XCollatorMaxVariable - - See the `Rust documentation for MaxVariable `__ for more information. - - -.. js:class:: ICU4XCollatorNumeric - - See the `Rust documentation for Numeric `__ for more information. - - -.. js:class:: ICU4XCollatorOptionsV1 - - See the `Rust documentation for CollatorOptions `__ for more information. - - - .. js:attribute:: strength - - .. js:attribute:: alternate_handling - - .. js:attribute:: case_first - - .. js:attribute:: max_variable - - .. js:attribute:: case_level - - .. js:attribute:: numeric - - .. js:attribute:: backward_second_level - -.. js:class:: ICU4XCollatorResolvedOptionsV1 - - See the `Rust documentation for ResolvedCollatorOptions `__ for more information. - - - .. js:attribute:: strength - - .. js:attribute:: alternate_handling - - .. js:attribute:: case_first - - .. js:attribute:: max_variable - - .. js:attribute:: case_level - - .. js:attribute:: numeric - - .. js:attribute:: backward_second_level - -.. js:class:: ICU4XCollatorStrength - - See the `Rust documentation for Strength `__ for more information. -