All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.humbleui.skija.shaper.ManagedRunIterator Maven / Gradle / Ivy

package io.github.humbleui.skija.shaper;

import java.lang.ref.*;
import java.util.*;
import org.jetbrains.annotations.*;
import io.github.humbleui.skija.*;
import io.github.humbleui.skija.impl.*;

public abstract class ManagedRunIterator extends Managed implements Iterator {
    static { Library.staticLoad(); }

    @ApiStatus.Internal
    public final ManagedString _text;

    @ApiStatus.Internal
    public ManagedRunIterator(long ptr, ManagedString text, boolean manageText) {
        super(ptr, _FinalizerHolder.PTR);
        _text = manageText ? text : null;
    }

    @Override
    public void close() {
        super.close();
        if (_text != null)
            _text.close();
    }

    @ApiStatus.Internal
    public int _getEndOfCurrentRun() {
        try {
            return _nGetEndOfCurrentRun(_ptr, Native.getPtr(_text));
        } finally {
            Reference.reachabilityFence(this);
            Reference.reachabilityFence(_text);
        }
    }

    @Override
    public boolean hasNext() {
        try {
            return !_nIsAtEnd(_ptr);
        } finally {
            Reference.reachabilityFence(this);
        }
    }

    @ApiStatus.Internal
    public static class _FinalizerHolder {
        public static final long PTR = _nGetFinalizer();
    }

    @ApiStatus.Internal public static native long _nGetFinalizer();
    @ApiStatus.Internal public static native void _nConsume(long ptr);
    @ApiStatus.Internal public static native int  _nGetEndOfCurrentRun(long ptr, long textPtr);
    @ApiStatus.Internal public static native boolean _nIsAtEnd(long ptr);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy