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

org.purejava.appindicator._PangoAttrShape 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 _PangoAttrShape {
 *     PangoAttribute attr;
 *     PangoRectangle ink_rect;
 *     PangoRectangle logical_rect;
 *     gpointer data;
 *     PangoAttrDataCopyFunc copy_func;
 *     GDestroyNotify destroy_func;
 * }
 * }
 */
public class _PangoAttrShape {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        _PangoAttribute.layout().withName("attr"),
        _PangoRectangle.layout().withName("ink_rect"),
        _PangoRectangle.layout().withName("logical_rect"),
        app_indicator_h.C_POINTER.withName("data"),
        app_indicator_h.C_POINTER.withName("copy_func"),
        app_indicator_h.C_POINTER.withName("destroy_func")
    ).withName("_PangoAttrShape");

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

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

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

    private static final long attr$OFFSET = 0;

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

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

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

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

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

    private static final long ink_rect$OFFSET = 16;

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

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

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

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

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

    private static final long logical_rect$OFFSET = 32;

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

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

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

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

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

    private static final long data$OFFSET = 48;

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

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

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

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

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

    private static final long copy_func$OFFSET = 56;

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

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

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

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

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

    private static final long destroy_func$OFFSET = 64;

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

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

    /**
     * Setter for field:
     * {@snippet lang=c :
     * GDestroyNotify destroy_func
     * }
     */
    public static void destroy_func(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(destroy_func$LAYOUT, destroy_func$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