org.purejava.appindicator._GActionEntry 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 _GActionEntry {
* const gchar *name;
* void (*activate)(GSimpleAction *, GVariant *, gpointer);
* const gchar *parameter_type;
* const gchar *state;
* void (*change_state)(GSimpleAction *, GVariant *, gpointer);
* gsize padding[3];
* }
* }
*/
public class _GActionEntry {
_GActionEntry() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
app_indicator_h.C_POINTER.withName("name"),
app_indicator_h.C_POINTER.withName("activate"),
app_indicator_h.C_POINTER.withName("parameter_type"),
app_indicator_h.C_POINTER.withName("state"),
app_indicator_h.C_POINTER.withName("change_state"),
MemoryLayout.sequenceLayout(3, app_indicator_h.C_LONG).withName("padding")
).withName("_GActionEntry");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final AddressLayout name$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("name"));
/**
* Layout for field:
* {@snippet lang=c :
* const gchar *name
* }
*/
public static final AddressLayout name$layout() {
return name$LAYOUT;
}
private static final long name$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* const gchar *name
* }
*/
public static final long name$offset() {
return name$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const gchar *name
* }
*/
public static MemorySegment name(MemorySegment struct) {
return struct.get(name$LAYOUT, name$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const gchar *name
* }
*/
public static void name(MemorySegment struct, MemorySegment fieldValue) {
struct.set(name$LAYOUT, name$OFFSET, fieldValue);
}
/**
* {@snippet lang=c :
* void (*activate)(GSimpleAction *, GVariant *, gpointer)
* }
*/
public class activate {
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
void apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
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(activate.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(activate.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, MemorySegment _x2) {
try {
DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}
private static final AddressLayout activate$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("activate"));
/**
* Layout for field:
* {@snippet lang=c :
* void (*activate)(GSimpleAction *, GVariant *, gpointer)
* }
*/
public static final AddressLayout activate$layout() {
return activate$LAYOUT;
}
private static final long activate$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* void (*activate)(GSimpleAction *, GVariant *, gpointer)
* }
*/
public static final long activate$offset() {
return activate$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* void (*activate)(GSimpleAction *, GVariant *, gpointer)
* }
*/
public static MemorySegment activate(MemorySegment struct) {
return struct.get(activate$LAYOUT, activate$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* void (*activate)(GSimpleAction *, GVariant *, gpointer)
* }
*/
public static void activate(MemorySegment struct, MemorySegment fieldValue) {
struct.set(activate$LAYOUT, activate$OFFSET, fieldValue);
}
private static final AddressLayout parameter_type$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("parameter_type"));
/**
* Layout for field:
* {@snippet lang=c :
* const gchar *parameter_type
* }
*/
public static final AddressLayout parameter_type$layout() {
return parameter_type$LAYOUT;
}
private static final long parameter_type$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* const gchar *parameter_type
* }
*/
public static final long parameter_type$offset() {
return parameter_type$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const gchar *parameter_type
* }
*/
public static MemorySegment parameter_type(MemorySegment struct) {
return struct.get(parameter_type$LAYOUT, parameter_type$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const gchar *parameter_type
* }
*/
public static void parameter_type(MemorySegment struct, MemorySegment fieldValue) {
struct.set(parameter_type$LAYOUT, parameter_type$OFFSET, fieldValue);
}
private static final AddressLayout state$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("state"));
/**
* Layout for field:
* {@snippet lang=c :
* const gchar *state
* }
*/
public static final AddressLayout state$layout() {
return state$LAYOUT;
}
private static final long state$OFFSET = 24;
/**
* Offset for field:
* {@snippet lang=c :
* const gchar *state
* }
*/
public static final long state$offset() {
return state$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const gchar *state
* }
*/
public static MemorySegment state(MemorySegment struct) {
return struct.get(state$LAYOUT, state$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const gchar *state
* }
*/
public static void state(MemorySegment struct, MemorySegment fieldValue) {
struct.set(state$LAYOUT, state$OFFSET, fieldValue);
}
/**
* {@snippet lang=c :
* void (*change_state)(GSimpleAction *, GVariant *, gpointer)
* }
*/
public class change_state {
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
void apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
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(change_state.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(change_state.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, MemorySegment _x2) {
try {
DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}
private static final AddressLayout change_state$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("change_state"));
/**
* Layout for field:
* {@snippet lang=c :
* void (*change_state)(GSimpleAction *, GVariant *, gpointer)
* }
*/
public static final AddressLayout change_state$layout() {
return change_state$LAYOUT;
}
private static final long change_state$OFFSET = 32;
/**
* Offset for field:
* {@snippet lang=c :
* void (*change_state)(GSimpleAction *, GVariant *, gpointer)
* }
*/
public static final long change_state$offset() {
return change_state$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* void (*change_state)(GSimpleAction *, GVariant *, gpointer)
* }
*/
public static MemorySegment change_state(MemorySegment struct) {
return struct.get(change_state$LAYOUT, change_state$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* void (*change_state)(GSimpleAction *, GVariant *, gpointer)
* }
*/
public static void change_state(MemorySegment struct, MemorySegment fieldValue) {
struct.set(change_state$LAYOUT, change_state$OFFSET, fieldValue);
}
private static final SequenceLayout padding$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("padding"));
/**
* Layout for field:
* {@snippet lang=c :
* gsize padding[3]
* }
*/
public static final SequenceLayout padding$layout() {
return padding$LAYOUT;
}
private static final long padding$OFFSET = 40;
/**
* Offset for field:
* {@snippet lang=c :
* gsize padding[3]
* }
*/
public static final long padding$offset() {
return padding$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* gsize padding[3]
* }
*/
public static MemorySegment padding(MemorySegment struct) {
return struct.asSlice(padding$OFFSET, padding$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* gsize padding[3]
* }
*/
public static void padding(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, padding$OFFSET, padding$LAYOUT.byteSize());
}
private static long[] padding$DIMS = { 3 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* gsize padding[3]
* }
*/
public static long[] padding$dimensions() {
return padding$DIMS;
}
private static final VarHandle padding$ELEM_HANDLE = padding$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* gsize padding[3]
* }
*/
public static long padding(MemorySegment struct, long index0) {
return (long)padding$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* gsize padding[3]
* }
*/
public static void padding(MemorySegment struct, long index0, long fieldValue) {
padding$ELEM_HANDLE.set(struct, 0L, index0, 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);
}
}