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

org.purejava.appindicator._GFlagsClass 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 _GFlagsClass {
 *     GTypeClass g_type_class;
 *     guint mask;
 *     guint n_values;
 *     GFlagsValue *values;
 * }
 * }
 */
public class _GFlagsClass {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        _GTypeClass.layout().withName("g_type_class"),
        app_indicator_h.C_INT.withName("mask"),
        app_indicator_h.C_INT.withName("n_values"),
        app_indicator_h.C_POINTER.withName("values")
    ).withName("_GFlagsClass");

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

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

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

    private static final long g_type_class$OFFSET = 0;

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

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

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

    private static final OfInt mask$LAYOUT = (OfInt)$LAYOUT.select(groupElement("mask"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * guint mask
     * }
     */
    public static final OfInt mask$layout() {
        return mask$LAYOUT;
    }

    private static final long mask$OFFSET = 8;

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

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

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

    private static final OfInt n_values$LAYOUT = (OfInt)$LAYOUT.select(groupElement("n_values"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * guint n_values
     * }
     */
    public static final OfInt n_values$layout() {
        return n_values$LAYOUT;
    }

    private static final long n_values$OFFSET = 12;

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

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

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

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

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

    private static final long values$OFFSET = 16;

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

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

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