blob: 7cde79d408c297638f16cec1292962b3f19a3726 [file] [log] [blame] [edit]
// generated by diplomat-tool
part of 'lib.g.dart';
/// An iterator over code point ranges, produced by `CodePointSetData` or
/// one of the `CodePointMapData` types
final class CodePointRangeIterator 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;
// ignore: unused_field
final core.List<Object> _aEdge;
// 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.
CodePointRangeIterator._fromFfi(this._ffi, this._selfEdge, this._aEdge) {
if (_selfEdge.isEmpty) {
_finalizer.attach(this, _ffi.cast());
}
}
static final _finalizer = ffi.NativeFinalizer(
ffi.Native.addressOf(_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(_ffi);
return CodePointRangeIteratorResult._fromFfi(result);
}
}
@meta.ResourceIdentifier('CodePointRangeIterator_destroy')
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(
isLeaf: true, symbol: 'CodePointRangeIterator_destroy')
// ignore: non_constant_identifier_names
external void _CodePointRangeIterator_destroy(ffi.Pointer<ffi.Void> self);
@meta.ResourceIdentifier('CodePointRangeIterator_next')
@ffi.Native<_CodePointRangeIteratorResultFfi Function(ffi.Pointer<ffi.Opaque>)>(
isLeaf: true, symbol: 'CodePointRangeIterator_next')
// ignore: non_constant_identifier_names
external _CodePointRangeIteratorResultFfi _CodePointRangeIterator_next(
ffi.Pointer<ffi.Opaque> self);