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

org.purejava.appindicator._PangoFontClass Maven / Gradle / Ivy

There is a newer version: 1.4.1
Show newest version
// Generated by jextract

package org.purejava.appindicator;

import java.lang.invoke.*;
import java.lang.foreign.*;
import java.nio.ByteOrder;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

import static java.lang.foreign.ValueLayout.*;
import static java.lang.foreign.MemoryLayout.PathElement.*;

/**
 * {@snippet lang=c :
 * struct _PangoFontClass {
 *     GObjectClass parent_class;
 *     PangoFontDescription *(*describe)(PangoFont *);
 *     PangoCoverage *(*get_coverage)(PangoFont *, PangoLanguage *);
 *     void (*get_glyph_extents)(PangoFont *, PangoGlyph, PangoRectangle *, PangoRectangle *);
 *     PangoFontMetrics *(*get_metrics)(PangoFont *, PangoLanguage *);
 *     PangoFontMap *(*get_font_map)(PangoFont *);
 *     PangoFontDescription *(*describe_absolute)(PangoFont *);
 *     void (*get_features)(PangoFont *, hb_feature_t *, guint, guint *);
 *     hb_font_t *(*create_hb_font)(PangoFont *);
 * }
 * }
 */
public class _PangoFontClass {

    _PangoFontClass() {
        // Should not be called directly
    }

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        _GObjectClass.layout().withName("parent_class"),
        app_indicator_h.C_POINTER.withName("describe"),
        app_indicator_h.C_POINTER.withName("get_coverage"),
        app_indicator_h.C_POINTER.withName("get_glyph_extents"),
        app_indicator_h.C_POINTER.withName("get_metrics"),
        app_indicator_h.C_POINTER.withName("get_font_map"),
        app_indicator_h.C_POINTER.withName("describe_absolute"),
        app_indicator_h.C_POINTER.withName("get_features"),
        app_indicator_h.C_POINTER.withName("create_hb_font")
    ).withName("_PangoFontClass");

    /**
     * The layout of this struct
     */
    public static final GroupLayout layout() {
        return $LAYOUT;
    }

    private static final GroupLayout parent_class$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("parent_class"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GObjectClass parent_class
     * }
     */
    public static final GroupLayout parent_class$layout() {
        return parent_class$LAYOUT;
    }

    private static final long parent_class$OFFSET = 0;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GObjectClass parent_class
     * }
     */
    public static final long parent_class$offset() {
        return parent_class$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GObjectClass parent_class
     * }
     */
    public static MemorySegment parent_class(MemorySegment struct) {
        return struct.asSlice(parent_class$OFFSET, parent_class$LAYOUT.byteSize());
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * GObjectClass parent_class
     * }
     */
    public static void parent_class(MemorySegment struct, MemorySegment fieldValue) {
        MemorySegment.copy(fieldValue, 0L, struct, parent_class$OFFSET, parent_class$LAYOUT.byteSize());
    }

    /**
     * {@snippet lang=c :
     * PangoFontDescription *(*describe)(PangoFont *)
     * }
     */
    public class describe {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            MemorySegment apply(MemorySegment _x0);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(describe.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(describe.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0) {
            try {
                return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout describe$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("describe"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * PangoFontDescription *(*describe)(PangoFont *)
     * }
     */
    public static final AddressLayout describe$layout() {
        return describe$LAYOUT;
    }

    private static final long describe$OFFSET = 136;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * PangoFontDescription *(*describe)(PangoFont *)
     * }
     */
    public static final long describe$offset() {
        return describe$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * PangoFontDescription *(*describe)(PangoFont *)
     * }
     */
    public static MemorySegment describe(MemorySegment struct) {
        return struct.get(describe$LAYOUT, describe$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * PangoFontDescription *(*describe)(PangoFont *)
     * }
     */
    public static void describe(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(describe$LAYOUT, describe$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * PangoCoverage *(*get_coverage)(PangoFont *, PangoLanguage *)
     * }
     */
    public class get_coverage {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            MemorySegment apply(MemorySegment _x0, MemorySegment _x1);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_coverage.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(get_coverage.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) {
            try {
                return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout get_coverage$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_coverage"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * PangoCoverage *(*get_coverage)(PangoFont *, PangoLanguage *)
     * }
     */
    public static final AddressLayout get_coverage$layout() {
        return get_coverage$LAYOUT;
    }

    private static final long get_coverage$OFFSET = 144;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * PangoCoverage *(*get_coverage)(PangoFont *, PangoLanguage *)
     * }
     */
    public static final long get_coverage$offset() {
        return get_coverage$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * PangoCoverage *(*get_coverage)(PangoFont *, PangoLanguage *)
     * }
     */
    public static MemorySegment get_coverage(MemorySegment struct) {
        return struct.get(get_coverage$LAYOUT, get_coverage$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * PangoCoverage *(*get_coverage)(PangoFont *, PangoLanguage *)
     * }
     */
    public static void get_coverage(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_coverage$LAYOUT, get_coverage$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * void (*get_glyph_extents)(PangoFont *, PangoGlyph, PangoRectangle *, PangoRectangle *)
     * }
     */
    public class get_glyph_extents {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            void apply(MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_glyph_extents.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(get_glyph_extents.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static void invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3) {
            try {
                 DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout get_glyph_extents$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_glyph_extents"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * void (*get_glyph_extents)(PangoFont *, PangoGlyph, PangoRectangle *, PangoRectangle *)
     * }
     */
    public static final AddressLayout get_glyph_extents$layout() {
        return get_glyph_extents$LAYOUT;
    }

    private static final long get_glyph_extents$OFFSET = 152;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * void (*get_glyph_extents)(PangoFont *, PangoGlyph, PangoRectangle *, PangoRectangle *)
     * }
     */
    public static final long get_glyph_extents$offset() {
        return get_glyph_extents$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * void (*get_glyph_extents)(PangoFont *, PangoGlyph, PangoRectangle *, PangoRectangle *)
     * }
     */
    public static MemorySegment get_glyph_extents(MemorySegment struct) {
        return struct.get(get_glyph_extents$LAYOUT, get_glyph_extents$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * void (*get_glyph_extents)(PangoFont *, PangoGlyph, PangoRectangle *, PangoRectangle *)
     * }
     */
    public static void get_glyph_extents(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_glyph_extents$LAYOUT, get_glyph_extents$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * PangoFontMetrics *(*get_metrics)(PangoFont *, PangoLanguage *)
     * }
     */
    public class get_metrics {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            MemorySegment apply(MemorySegment _x0, MemorySegment _x1);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_metrics.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(get_metrics.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) {
            try {
                return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout get_metrics$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_metrics"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * PangoFontMetrics *(*get_metrics)(PangoFont *, PangoLanguage *)
     * }
     */
    public static final AddressLayout get_metrics$layout() {
        return get_metrics$LAYOUT;
    }

    private static final long get_metrics$OFFSET = 160;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * PangoFontMetrics *(*get_metrics)(PangoFont *, PangoLanguage *)
     * }
     */
    public static final long get_metrics$offset() {
        return get_metrics$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * PangoFontMetrics *(*get_metrics)(PangoFont *, PangoLanguage *)
     * }
     */
    public static MemorySegment get_metrics(MemorySegment struct) {
        return struct.get(get_metrics$LAYOUT, get_metrics$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * PangoFontMetrics *(*get_metrics)(PangoFont *, PangoLanguage *)
     * }
     */
    public static void get_metrics(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_metrics$LAYOUT, get_metrics$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * PangoFontMap *(*get_font_map)(PangoFont *)
     * }
     */
    public class get_font_map {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            MemorySegment apply(MemorySegment _x0);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_font_map.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(get_font_map.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0) {
            try {
                return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout get_font_map$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_font_map"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * PangoFontMap *(*get_font_map)(PangoFont *)
     * }
     */
    public static final AddressLayout get_font_map$layout() {
        return get_font_map$LAYOUT;
    }

    private static final long get_font_map$OFFSET = 168;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * PangoFontMap *(*get_font_map)(PangoFont *)
     * }
     */
    public static final long get_font_map$offset() {
        return get_font_map$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * PangoFontMap *(*get_font_map)(PangoFont *)
     * }
     */
    public static MemorySegment get_font_map(MemorySegment struct) {
        return struct.get(get_font_map$LAYOUT, get_font_map$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * PangoFontMap *(*get_font_map)(PangoFont *)
     * }
     */
    public static void get_font_map(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_font_map$LAYOUT, get_font_map$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * PangoFontDescription *(*describe_absolute)(PangoFont *)
     * }
     */
    public class describe_absolute {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            MemorySegment apply(MemorySegment _x0);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(describe_absolute.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(describe_absolute.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0) {
            try {
                return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout describe_absolute$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("describe_absolute"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * PangoFontDescription *(*describe_absolute)(PangoFont *)
     * }
     */
    public static final AddressLayout describe_absolute$layout() {
        return describe_absolute$LAYOUT;
    }

    private static final long describe_absolute$OFFSET = 176;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * PangoFontDescription *(*describe_absolute)(PangoFont *)
     * }
     */
    public static final long describe_absolute$offset() {
        return describe_absolute$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * PangoFontDescription *(*describe_absolute)(PangoFont *)
     * }
     */
    public static MemorySegment describe_absolute(MemorySegment struct) {
        return struct.get(describe_absolute$LAYOUT, describe_absolute$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * PangoFontDescription *(*describe_absolute)(PangoFont *)
     * }
     */
    public static void describe_absolute(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(describe_absolute$LAYOUT, describe_absolute$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * void (*get_features)(PangoFont *, hb_feature_t *, guint, guint *)
     * }
     */
    public class get_features {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            void apply(MemorySegment _x0, MemorySegment _x1, int _x2, MemorySegment _x3);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_features.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(get_features.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static void invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2, MemorySegment _x3) {
            try {
                 DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout get_features$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_features"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * void (*get_features)(PangoFont *, hb_feature_t *, guint, guint *)
     * }
     */
    public static final AddressLayout get_features$layout() {
        return get_features$LAYOUT;
    }

    private static final long get_features$OFFSET = 184;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * void (*get_features)(PangoFont *, hb_feature_t *, guint, guint *)
     * }
     */
    public static final long get_features$offset() {
        return get_features$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * void (*get_features)(PangoFont *, hb_feature_t *, guint, guint *)
     * }
     */
    public static MemorySegment get_features(MemorySegment struct) {
        return struct.get(get_features$LAYOUT, get_features$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * void (*get_features)(PangoFont *, hb_feature_t *, guint, guint *)
     * }
     */
    public static void get_features(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_features$LAYOUT, get_features$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * hb_font_t *(*create_hb_font)(PangoFont *)
     * }
     */
    public class create_hb_font {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            MemorySegment apply(MemorySegment _x0);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(create_hb_font.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(create_hb_font.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0) {
            try {
                return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout create_hb_font$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("create_hb_font"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * hb_font_t *(*create_hb_font)(PangoFont *)
     * }
     */
    public static final AddressLayout create_hb_font$layout() {
        return create_hb_font$LAYOUT;
    }

    private static final long create_hb_font$OFFSET = 192;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * hb_font_t *(*create_hb_font)(PangoFont *)
     * }
     */
    public static final long create_hb_font$offset() {
        return create_hb_font$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * hb_font_t *(*create_hb_font)(PangoFont *)
     * }
     */
    public static MemorySegment create_hb_font(MemorySegment struct) {
        return struct.get(create_hb_font$LAYOUT, create_hb_font$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * hb_font_t *(*create_hb_font)(PangoFont *)
     * }
     */
    public static void create_hb_font(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(create_hb_font$LAYOUT, create_hb_font$OFFSET, fieldValue);
    }

    /**
     * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
     * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
     */
    public static MemorySegment asSlice(MemorySegment array, long index) {
        return array.asSlice(layout().byteSize() * index);
    }

    /**
     * The size (in bytes) of this struct
     */
    public static long sizeof() { return layout().byteSize(); }

    /**
     * Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
     */
    public static MemorySegment allocate(SegmentAllocator allocator) {
        return allocator.allocate(layout());
    }

    /**
     * Allocate an array of size {@code elementCount} using {@code allocator}.
     * The returned segment has size {@code elementCount * layout().byteSize()}.
     */
    public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
        return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
    }

    /**
     * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any).
     * The returned segment has size {@code layout().byteSize()}
     */
    public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) {
        return reinterpret(addr, 1, arena, cleanup);
    }

    /**
     * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any).
     * The returned segment has size {@code elementCount * layout().byteSize()}
     */
    public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) {
        return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy