| // generated by diplomat-tool |
| |
| part of 'lib.g.dart'; |
| |
| /// 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. |
| final class CodePointMapData8 implements ffi.Finalizable { |
| final ffi.Pointer<ffi.Opaque> _ffi; |
| |
| // These are "used" in the sense that they keep dependencies alive |
| // ignore: unused_field |
| final core.List<Object> _selfEdge; |
| |
| // This takes in a list of lifetime edges (including for &self borrows) |
| // corresponding to data this may borrow from. These should be flat arrays containing |
| // references to objects, and this object will hold on to them to keep them alive and |
| // maintain borrow validity. |
| CodePointMapData8._fromFfi(this._ffi, this._selfEdge) { |
| if (_selfEdge.isEmpty) { |
| _finalizer.attach(this, _ffi.cast()); |
| } |
| } |
| |
| static final _finalizer = ffi.NativeFinalizer( |
| ffi.Native.addressOf(_ICU4XCodePointMapData8_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 [](Rune cp) { |
| final result = _ICU4XCodePointMapData8_get(_ffi, cp); |
| return result; |
| } |
| |
| /// Converts a general category to its corresponding mask value |
| /// |
| /// Nonexistent 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; |
| } |
| |
| /// 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) { |
| // This lifetime edge depends on lifetimes: 'a |
| core.List<Object> aEdges = [this]; |
| final result = _ICU4XCodePointMapData8_iter_ranges_for_value(_ffi, value); |
| return CodePointRangeIterator._fromFfi(result, [], aEdges); |
| } |
| |
| /// 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) { |
| // This lifetime edge depends on lifetimes: 'a |
| core.List<Object> aEdges = [this]; |
| final result = |
| _ICU4XCodePointMapData8_iter_ranges_for_value_complemented(_ffi, value); |
| return CodePointRangeIterator._fromFfi(result, [], aEdges); |
| } |
| |
| /// 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 `GeneralCategoryNameToMaskMapper` |
| /// |
| /// 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) { |
| // This lifetime edge depends on lifetimes: 'a |
| core.List<Object> aEdges = [this]; |
| final result = _ICU4XCodePointMapData8_iter_ranges_for_mask(_ffi, mask); |
| return CodePointRangeIterator._fromFfi(result, [], aEdges); |
| } |
| |
| /// Gets a [`CodePointSetData`] 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(_ffi, value); |
| return CodePointSetData._fromFfi(result, []); |
| } |
| |
| /// See the [Rust documentation for `general_category`](https://docs.rs/icu/latest/icu/properties/maps/fn.general_category.html) for more information. |
| /// |
| /// Throws [Error] on failure. |
| factory CodePointMapData8.generalCategory(DataProvider provider) { |
| final result = _ICU4XCodePointMapData8_load_general_category(provider._ffi); |
| if (!result.isOk) { |
| throw Error.values.firstWhere((v) => v._ffi == result.union.err); |
| } |
| return CodePointMapData8._fromFfi(result.union.ok, []); |
| } |
| |
| /// See the [Rust documentation for `bidi_class`](https://docs.rs/icu/latest/icu/properties/maps/fn.bidi_class.html) for more information. |
| /// |
| /// Throws [Error] on failure. |
| factory CodePointMapData8.bidiClass(DataProvider provider) { |
| final result = _ICU4XCodePointMapData8_load_bidi_class(provider._ffi); |
| if (!result.isOk) { |
| throw Error.values.firstWhere((v) => v._ffi == result.union.err); |
| } |
| return CodePointMapData8._fromFfi(result.union.ok, []); |
| } |
| |
| /// See the [Rust documentation for `east_asian_width`](https://docs.rs/icu/latest/icu/properties/maps/fn.east_asian_width.html) for more information. |
| /// |
| /// Throws [Error] on failure. |
| factory CodePointMapData8.eastAsianWidth(DataProvider provider) { |
| final result = _ICU4XCodePointMapData8_load_east_asian_width(provider._ffi); |
| if (!result.isOk) { |
| throw Error.values.firstWhere((v) => v._ffi == result.union.err); |
| } |
| return CodePointMapData8._fromFfi(result.union.ok, []); |
| } |
| |
| /// See the [Rust documentation for `hangul_syllable_type`](https://docs.rs/icu/latest/icu/properties/maps/fn.hangul_syllable_type.html) for more information. |
| /// |
| /// Throws [Error] on failure. |
| factory CodePointMapData8.hangulSyllableType(DataProvider provider) { |
| final result = |
| _ICU4XCodePointMapData8_load_hangul_syllable_type(provider._ffi); |
| if (!result.isOk) { |
| throw Error.values.firstWhere((v) => v._ffi == result.union.err); |
| } |
| return CodePointMapData8._fromFfi(result.union.ok, []); |
| } |
| |
| /// See the [Rust documentation for `indic_syllabic_category`](https://docs.rs/icu/latest/icu/properties/maps/fn.indic_syllabic_category.html) for more information. |
| /// |
| /// Throws [Error] on failure. |
| factory CodePointMapData8.indicSyllabicCategory(DataProvider provider) { |
| final result = |
| _ICU4XCodePointMapData8_load_indic_syllabic_category(provider._ffi); |
| if (!result.isOk) { |
| throw Error.values.firstWhere((v) => v._ffi == result.union.err); |
| } |
| return CodePointMapData8._fromFfi(result.union.ok, []); |
| } |
| |
| /// See the [Rust documentation for `line_break`](https://docs.rs/icu/latest/icu/properties/maps/fn.line_break.html) for more information. |
| /// |
| /// Throws [Error] on failure. |
| factory CodePointMapData8.lineBreak(DataProvider provider) { |
| final result = _ICU4XCodePointMapData8_load_line_break(provider._ffi); |
| if (!result.isOk) { |
| throw Error.values.firstWhere((v) => v._ffi == result.union.err); |
| } |
| return CodePointMapData8._fromFfi(result.union.ok, []); |
| } |
| |
| /// See the [Rust documentation for `grapheme_cluster_break`](https://docs.rs/icu/latest/icu/properties/maps/fn.grapheme_cluster_break.html) for more information. |
| /// |
| /// Throws [Error] on failure. |
| static CodePointMapData8 tryGraphemeClusterBreak(DataProvider provider) { |
| final result = |
| _ICU4XCodePointMapData8_try_grapheme_cluster_break(provider._ffi); |
| if (!result.isOk) { |
| throw Error.values.firstWhere((v) => v._ffi == result.union.err); |
| } |
| return CodePointMapData8._fromFfi(result.union.ok, []); |
| } |
| |
| /// See the [Rust documentation for `word_break`](https://docs.rs/icu/latest/icu/properties/maps/fn.word_break.html) for more information. |
| /// |
| /// Throws [Error] on failure. |
| factory CodePointMapData8.wordBreak(DataProvider provider) { |
| final result = _ICU4XCodePointMapData8_load_word_break(provider._ffi); |
| if (!result.isOk) { |
| throw Error.values.firstWhere((v) => v._ffi == result.union.err); |
| } |
| return CodePointMapData8._fromFfi(result.union.ok, []); |
| } |
| |
| /// See the [Rust documentation for `sentence_break`](https://docs.rs/icu/latest/icu/properties/maps/fn.sentence_break.html) for more information. |
| /// |
| /// Throws [Error] on failure. |
| factory CodePointMapData8.sentenceBreak(DataProvider provider) { |
| final result = _ICU4XCodePointMapData8_load_sentence_break(provider._ffi); |
| if (!result.isOk) { |
| throw Error.values.firstWhere((v) => v._ffi == result.union.err); |
| } |
| return CodePointMapData8._fromFfi(result.union.ok, []); |
| } |
| |
| /// See the [Rust documentation for `joining_type`](https://docs.rs/icu/latest/icu/properties/maps/fn.joining_type.html) for more information. |
| /// |
| /// Throws [Error] on failure. |
| factory CodePointMapData8.joiningType(DataProvider provider) { |
| final result = _ICU4XCodePointMapData8_load_joining_type(provider._ffi); |
| if (!result.isOk) { |
| throw Error.values.firstWhere((v) => v._ffi == result.union.err); |
| } |
| return CodePointMapData8._fromFfi(result.union.ok, []); |
| } |
| } |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_destroy') |
| @ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_destroy') |
| // ignore: non_constant_identifier_names |
| external void _ICU4XCodePointMapData8_destroy(ffi.Pointer<ffi.Void> self); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_get') |
| @ffi.Native<ffi.Uint8 Function(ffi.Pointer<ffi.Opaque>, ffi.Uint32)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_get') |
| // ignore: non_constant_identifier_names |
| external int _ICU4XCodePointMapData8_get(ffi.Pointer<ffi.Opaque> self, Rune cp); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_general_category_to_mask') |
| @ffi.Native<ffi.Uint32 Function(ffi.Uint8)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_general_category_to_mask') |
| // ignore: non_constant_identifier_names |
| external int _ICU4XCodePointMapData8_general_category_to_mask(int gc); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_iter_ranges_for_value') |
| @ffi.Native< |
| ffi.Pointer<ffi.Opaque> Function(ffi.Pointer<ffi.Opaque>, ffi.Uint8)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_iter_ranges_for_value') |
| // ignore: non_constant_identifier_names |
| external ffi.Pointer<ffi.Opaque> _ICU4XCodePointMapData8_iter_ranges_for_value( |
| ffi.Pointer<ffi.Opaque> self, int value); |
| |
| @meta.ResourceIdentifier( |
| 'ICU4XCodePointMapData8_iter_ranges_for_value_complemented') |
| @ffi.Native< |
| ffi.Pointer<ffi.Opaque> Function(ffi.Pointer<ffi.Opaque>, ffi.Uint8)>( |
| isLeaf: true, |
| symbol: 'ICU4XCodePointMapData8_iter_ranges_for_value_complemented') |
| // ignore: non_constant_identifier_names |
| external ffi.Pointer<ffi.Opaque> |
| _ICU4XCodePointMapData8_iter_ranges_for_value_complemented( |
| ffi.Pointer<ffi.Opaque> self, int value); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_iter_ranges_for_mask') |
| @ffi.Native< |
| ffi.Pointer<ffi.Opaque> Function(ffi.Pointer<ffi.Opaque>, ffi.Uint32)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_iter_ranges_for_mask') |
| // ignore: non_constant_identifier_names |
| external ffi.Pointer<ffi.Opaque> _ICU4XCodePointMapData8_iter_ranges_for_mask( |
| ffi.Pointer<ffi.Opaque> self, int mask); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_get_set_for_value') |
| @ffi.Native< |
| ffi.Pointer<ffi.Opaque> Function(ffi.Pointer<ffi.Opaque>, ffi.Uint8)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_get_set_for_value') |
| // ignore: non_constant_identifier_names |
| external ffi.Pointer<ffi.Opaque> _ICU4XCodePointMapData8_get_set_for_value( |
| ffi.Pointer<ffi.Opaque> self, int value); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_load_general_category') |
| @ffi.Native<_ResultOpaqueInt32 Function(ffi.Pointer<ffi.Opaque>)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_load_general_category') |
| // ignore: non_constant_identifier_names |
| external _ResultOpaqueInt32 _ICU4XCodePointMapData8_load_general_category( |
| ffi.Pointer<ffi.Opaque> provider); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_load_bidi_class') |
| @ffi.Native<_ResultOpaqueInt32 Function(ffi.Pointer<ffi.Opaque>)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_load_bidi_class') |
| // ignore: non_constant_identifier_names |
| external _ResultOpaqueInt32 _ICU4XCodePointMapData8_load_bidi_class( |
| ffi.Pointer<ffi.Opaque> provider); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_load_east_asian_width') |
| @ffi.Native<_ResultOpaqueInt32 Function(ffi.Pointer<ffi.Opaque>)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_load_east_asian_width') |
| // ignore: non_constant_identifier_names |
| external _ResultOpaqueInt32 _ICU4XCodePointMapData8_load_east_asian_width( |
| ffi.Pointer<ffi.Opaque> provider); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_load_hangul_syllable_type') |
| @ffi.Native<_ResultOpaqueInt32 Function(ffi.Pointer<ffi.Opaque>)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_load_hangul_syllable_type') |
| // ignore: non_constant_identifier_names |
| external _ResultOpaqueInt32 _ICU4XCodePointMapData8_load_hangul_syllable_type( |
| ffi.Pointer<ffi.Opaque> provider); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_load_indic_syllabic_category') |
| @ffi.Native<_ResultOpaqueInt32 Function(ffi.Pointer<ffi.Opaque>)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_load_indic_syllabic_category') |
| // ignore: non_constant_identifier_names |
| external _ResultOpaqueInt32 |
| _ICU4XCodePointMapData8_load_indic_syllabic_category( |
| ffi.Pointer<ffi.Opaque> provider); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_load_line_break') |
| @ffi.Native<_ResultOpaqueInt32 Function(ffi.Pointer<ffi.Opaque>)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_load_line_break') |
| // ignore: non_constant_identifier_names |
| external _ResultOpaqueInt32 _ICU4XCodePointMapData8_load_line_break( |
| ffi.Pointer<ffi.Opaque> provider); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_try_grapheme_cluster_break') |
| @ffi.Native<_ResultOpaqueInt32 Function(ffi.Pointer<ffi.Opaque>)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_try_grapheme_cluster_break') |
| // ignore: non_constant_identifier_names |
| external _ResultOpaqueInt32 _ICU4XCodePointMapData8_try_grapheme_cluster_break( |
| ffi.Pointer<ffi.Opaque> provider); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_load_word_break') |
| @ffi.Native<_ResultOpaqueInt32 Function(ffi.Pointer<ffi.Opaque>)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_load_word_break') |
| // ignore: non_constant_identifier_names |
| external _ResultOpaqueInt32 _ICU4XCodePointMapData8_load_word_break( |
| ffi.Pointer<ffi.Opaque> provider); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_load_sentence_break') |
| @ffi.Native<_ResultOpaqueInt32 Function(ffi.Pointer<ffi.Opaque>)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_load_sentence_break') |
| // ignore: non_constant_identifier_names |
| external _ResultOpaqueInt32 _ICU4XCodePointMapData8_load_sentence_break( |
| ffi.Pointer<ffi.Opaque> provider); |
| |
| @meta.ResourceIdentifier('ICU4XCodePointMapData8_load_joining_type') |
| @ffi.Native<_ResultOpaqueInt32 Function(ffi.Pointer<ffi.Opaque>)>( |
| isLeaf: true, symbol: 'ICU4XCodePointMapData8_load_joining_type') |
| // ignore: non_constant_identifier_names |
| external _ResultOpaqueInt32 _ICU4XCodePointMapData8_load_joining_type( |
| ffi.Pointer<ffi.Opaque> provider); |