| // generated by diplomat-tool |
| |
| part of 'lib.g.dart'; |
| |
| /// A type capable of looking up General Category mask values from a string name. |
| /// |
| /// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.GeneralCategoryGroup.html#method.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. |
| final class GeneralCategoryNameToMaskMapper 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. |
| GeneralCategoryNameToMaskMapper._fromFfi(this._ffi, this._selfEdge) { |
| if (_selfEdge.isEmpty) { |
| _finalizer.attach(this, _ffi.cast()); |
| } |
| } |
| |
| @_DiplomatFfiUse('ICU4XGeneralCategoryNameToMaskMapper_destroy') |
| static final _finalizer = ffi.NativeFinalizer( |
| ffi.Native.addressOf(_ICU4XGeneralCategoryNameToMaskMapper_destroy), |
| ); |
| |
| /// 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 temp = ffi2.Arena(); |
| final nameView = name.utf8View; |
| final result = _ICU4XGeneralCategoryNameToMaskMapper_get_strict( |
| _ffi, |
| nameView.allocIn(temp), |
| nameView.length, |
| ); |
| temp.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 temp = ffi2.Arena(); |
| final nameView = name.utf8View; |
| final result = _ICU4XGeneralCategoryNameToMaskMapper_get_loose( |
| _ffi, |
| nameView.allocIn(temp), |
| nameView.length, |
| ); |
| temp.releaseAll(); |
| return result; |
| } |
| |
| /// See the [Rust documentation for `name_to_enum_mapper`](https://docs.rs/icu/latest/icu/properties/struct.GeneralCategoryGroup.html#method.name_to_enum_mapper) for more information. |
| /// |
| /// Throws [Error] on failure. |
| factory GeneralCategoryNameToMaskMapper(DataProvider provider) { |
| final result = _ICU4XGeneralCategoryNameToMaskMapper_load(provider._ffi); |
| if (!result.isOk) { |
| throw Error.values.firstWhere((v) => v._ffi == result.union.err); |
| } |
| return GeneralCategoryNameToMaskMapper._fromFfi(result.union.ok, []); |
| } |
| } |
| |
| @_DiplomatFfiUse('ICU4XGeneralCategoryNameToMaskMapper_destroy') |
| @ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>( |
| isLeaf: true, |
| symbol: 'ICU4XGeneralCategoryNameToMaskMapper_destroy', |
| ) |
| // ignore: non_constant_identifier_names |
| external void _ICU4XGeneralCategoryNameToMaskMapper_destroy( |
| ffi.Pointer<ffi.Void> self, |
| ); |
| |
| @_DiplomatFfiUse('ICU4XGeneralCategoryNameToMaskMapper_get_strict') |
| @ffi.Native< |
| ffi.Uint32 Function(ffi.Pointer<ffi.Opaque>, ffi.Pointer<ffi.Uint8>, ffi.Size) |
| >(isLeaf: true, symbol: 'ICU4XGeneralCategoryNameToMaskMapper_get_strict') |
| // ignore: non_constant_identifier_names |
| external int _ICU4XGeneralCategoryNameToMaskMapper_get_strict( |
| ffi.Pointer<ffi.Opaque> self, |
| ffi.Pointer<ffi.Uint8> nameData, |
| int nameLength, |
| ); |
| |
| @_DiplomatFfiUse('ICU4XGeneralCategoryNameToMaskMapper_get_loose') |
| @ffi.Native< |
| ffi.Uint32 Function(ffi.Pointer<ffi.Opaque>, ffi.Pointer<ffi.Uint8>, ffi.Size) |
| >(isLeaf: true, symbol: 'ICU4XGeneralCategoryNameToMaskMapper_get_loose') |
| // ignore: non_constant_identifier_names |
| external int _ICU4XGeneralCategoryNameToMaskMapper_get_loose( |
| ffi.Pointer<ffi.Opaque> self, |
| ffi.Pointer<ffi.Uint8> nameData, |
| int nameLength, |
| ); |
| |
| @_DiplomatFfiUse('ICU4XGeneralCategoryNameToMaskMapper_load') |
| @ffi.Native<_ResultOpaqueInt32 Function(ffi.Pointer<ffi.Opaque>)>( |
| isLeaf: true, |
| symbol: 'ICU4XGeneralCategoryNameToMaskMapper_load', |
| ) |
| // ignore: non_constant_identifier_names |
| external _ResultOpaqueInt32 _ICU4XGeneralCategoryNameToMaskMapper_load( |
| ffi.Pointer<ffi.Opaque> provider, |
| ); |