org.purejava.appindicator._GEnumClass Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of libayatana-appindicator-java-full Show documentation
Show all versions of libayatana-appindicator-java-full Show documentation
Java bindings for libayatana-appindicator in 100% pure Java
// 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 _GEnumClass {
* GTypeClass g_type_class;
* gint minimum;
* gint maximum;
* guint n_values;
* GEnumValue *values;
* }
* }
*/
public class _GEnumClass {
_GEnumClass() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
_GTypeClass.layout().withName("g_type_class"),
app_indicator_h.C_INT.withName("minimum"),
app_indicator_h.C_INT.withName("maximum"),
app_indicator_h.C_INT.withName("n_values"),
MemoryLayout.paddingLayout(4),
app_indicator_h.C_POINTER.withName("values")
).withName("_GEnumClass");
/**
* 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 minimum$LAYOUT = (OfInt)$LAYOUT.select(groupElement("minimum"));
/**
* Layout for field:
* {@snippet lang=c :
* gint minimum
* }
*/
public static final OfInt minimum$layout() {
return minimum$LAYOUT;
}
private static final long minimum$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* gint minimum
* }
*/
public static final long minimum$offset() {
return minimum$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* gint minimum
* }
*/
public static int minimum(MemorySegment struct) {
return struct.get(minimum$LAYOUT, minimum$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* gint minimum
* }
*/
public static void minimum(MemorySegment struct, int fieldValue) {
struct.set(minimum$LAYOUT, minimum$OFFSET, fieldValue);
}
private static final OfInt maximum$LAYOUT = (OfInt)$LAYOUT.select(groupElement("maximum"));
/**
* Layout for field:
* {@snippet lang=c :
* gint maximum
* }
*/
public static final OfInt maximum$layout() {
return maximum$LAYOUT;
}
private static final long maximum$OFFSET = 12;
/**
* Offset for field:
* {@snippet lang=c :
* gint maximum
* }
*/
public static final long maximum$offset() {
return maximum$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* gint maximum
* }
*/
public static int maximum(MemorySegment struct) {
return struct.get(maximum$LAYOUT, maximum$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* gint maximum
* }
*/
public static void maximum(MemorySegment struct, int fieldValue) {
struct.set(maximum$LAYOUT, maximum$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 = 16;
/**
* 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 :
* GEnumValue *values
* }
*/
public static final AddressLayout values$layout() {
return values$LAYOUT;
}
private static final long values$OFFSET = 24;
/**
* Offset for field:
* {@snippet lang=c :
* GEnumValue *values
* }
*/
public static final long values$offset() {
return values$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* GEnumValue *values
* }
*/
public static MemorySegment values(MemorySegment struct) {
return struct.get(values$LAYOUT, values$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* GEnumValue *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);
}
}