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

org.purejava.appindicator._GtkBindingArg 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 _GtkBindingArg {
 *     GType arg_type;
 *     union {
 *         glong long_data;
 *         gdouble double_data;
 *         gchar *string_data;
 *     } d;
 * }
 * }
 */
public class _GtkBindingArg {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        app_indicator_h.C_LONG.withName("arg_type"),
        _GtkBindingArg.d.layout().withName("d")
    ).withName("_GtkBindingArg");

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

    private static final OfLong arg_type$LAYOUT = (OfLong)$LAYOUT.select(groupElement("arg_type"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GType arg_type
     * }
     */
    public static final OfLong arg_type$layout() {
        return arg_type$LAYOUT;
    }

    private static final long arg_type$OFFSET = 0;

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

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

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

    /**
     * {@snippet lang=c :
     * union {
     *     glong long_data;
     *     gdouble double_data;
     *     gchar *string_data;
     * }
     * }
     */
    public static class d {

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

        private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout(
            app_indicator_h.C_LONG.withName("long_data"),
            app_indicator_h.C_DOUBLE.withName("double_data"),
            app_indicator_h.C_POINTER.withName("string_data")
        ).withName("$anon$117:3");

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

        private static final OfLong long_data$LAYOUT = (OfLong)$LAYOUT.select(groupElement("long_data"));

        /**
         * Layout for field:
         * {@snippet lang=c :
         * glong long_data
         * }
         */
        public static final OfLong long_data$layout() {
            return long_data$LAYOUT;
        }

        private static final long long_data$OFFSET = 0;

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

        /**
         * Getter for field:
         * {@snippet lang=c :
         * glong long_data
         * }
         */
        public static long long_data(MemorySegment union) {
            return union.get(long_data$LAYOUT, long_data$OFFSET);
        }

        /**
         * Setter for field:
         * {@snippet lang=c :
         * glong long_data
         * }
         */
        public static void long_data(MemorySegment union, long fieldValue) {
            union.set(long_data$LAYOUT, long_data$OFFSET, fieldValue);
        }

        private static final OfDouble double_data$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("double_data"));

        /**
         * Layout for field:
         * {@snippet lang=c :
         * gdouble double_data
         * }
         */
        public static final OfDouble double_data$layout() {
            return double_data$LAYOUT;
        }

        private static final long double_data$OFFSET = 0;

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

        /**
         * Getter for field:
         * {@snippet lang=c :
         * gdouble double_data
         * }
         */
        public static double double_data(MemorySegment union) {
            return union.get(double_data$LAYOUT, double_data$OFFSET);
        }

        /**
         * Setter for field:
         * {@snippet lang=c :
         * gdouble double_data
         * }
         */
        public static void double_data(MemorySegment union, double fieldValue) {
            union.set(double_data$LAYOUT, double_data$OFFSET, fieldValue);
        }

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

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

        private static final long string_data$OFFSET = 0;

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

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

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

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * union {
     *     glong long_data;
     *     gdouble double_data;
     *     gchar *string_data;
     * } d
     * }
     */
    public static final GroupLayout d$layout() {
        return d$LAYOUT;
    }

    private static final long d$OFFSET = 8;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * union {
     *     glong long_data;
     *     gdouble double_data;
     *     gchar *string_data;
     * } d
     * }
     */
    public static final long d$offset() {
        return d$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * union {
     *     glong long_data;
     *     gdouble double_data;
     *     gchar *string_data;
     * } d
     * }
     */
    public static MemorySegment d(MemorySegment struct) {
        return struct.asSlice(d$OFFSET, d$LAYOUT.byteSize());
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * union {
     *     glong long_data;
     *     gdouble double_data;
     *     gchar *string_data;
     * } d
     * }
     */
    public static void d(MemorySegment struct, MemorySegment fieldValue) {
        MemorySegment.copy(fieldValue, 0L, struct, d$OFFSET, d$LAYOUT.byteSize());
    }

    /**
     * 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