org.purejava.appindicator._AtkStreamableContentIface 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 _AtkStreamableContentIface {
* GTypeInterface parent;
* gint (*get_n_mime_types)(AtkStreamableContent *);
* const gchar *(*get_mime_type)(AtkStreamableContent *, gint);
* GIOChannel *(*get_stream)(AtkStreamableContent *, const gchar *);
* const gchar *(*get_uri)(AtkStreamableContent *, const gchar *);
* AtkFunction pad1;
* AtkFunction pad2;
* AtkFunction pad3;
* }
* }
*/
public class _AtkStreamableContentIface {
_AtkStreamableContentIface() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
_GTypeInterface.layout().withName("parent"),
app_indicator_h.C_POINTER.withName("get_n_mime_types"),
app_indicator_h.C_POINTER.withName("get_mime_type"),
app_indicator_h.C_POINTER.withName("get_stream"),
app_indicator_h.C_POINTER.withName("get_uri"),
app_indicator_h.C_POINTER.withName("pad1"),
app_indicator_h.C_POINTER.withName("pad2"),
app_indicator_h.C_POINTER.withName("pad3")
).withName("_AtkStreamableContentIface");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final GroupLayout parent$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("parent"));
/**
* Layout for field:
* {@snippet lang=c :
* GTypeInterface parent
* }
*/
public static final GroupLayout parent$layout() {
return parent$LAYOUT;
}
private static final long parent$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* GTypeInterface parent
* }
*/
public static final long parent$offset() {
return parent$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* GTypeInterface parent
* }
*/
public static MemorySegment parent(MemorySegment struct) {
return struct.asSlice(parent$OFFSET, parent$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* GTypeInterface parent
* }
*/
public static void parent(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, parent$OFFSET, parent$LAYOUT.byteSize());
}
/**
* {@snippet lang=c :
* gint (*get_n_mime_types)(AtkStreamableContent *)
* }
*/
public class get_n_mime_types {
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment _x0);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
app_indicator_h.C_INT,
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(get_n_mime_types.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(get_n_mime_types.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 int invoke(MemorySegment funcPtr,MemorySegment _x0) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, _x0);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}
private static final AddressLayout get_n_mime_types$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_n_mime_types"));
/**
* Layout for field:
* {@snippet lang=c :
* gint (*get_n_mime_types)(AtkStreamableContent *)
* }
*/
public static final AddressLayout get_n_mime_types$layout() {
return get_n_mime_types$LAYOUT;
}
private static final long get_n_mime_types$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* gint (*get_n_mime_types)(AtkStreamableContent *)
* }
*/
public static final long get_n_mime_types$offset() {
return get_n_mime_types$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* gint (*get_n_mime_types)(AtkStreamableContent *)
* }
*/
public static MemorySegment get_n_mime_types(MemorySegment struct) {
return struct.get(get_n_mime_types$LAYOUT, get_n_mime_types$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* gint (*get_n_mime_types)(AtkStreamableContent *)
* }
*/
public static void get_n_mime_types(MemorySegment struct, MemorySegment fieldValue) {
struct.set(get_n_mime_types$LAYOUT, get_n_mime_types$OFFSET, fieldValue);
}
/**
* {@snippet lang=c :
* const gchar *(*get_mime_type)(AtkStreamableContent *, gint)
* }
*/
public class get_mime_type {
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
MemorySegment apply(MemorySegment _x0, int _x1);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
app_indicator_h.C_POINTER,
app_indicator_h.C_POINTER,
app_indicator_h.C_INT
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_mime_type.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(get_mime_type.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 MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1) {
try {
return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}
private static final AddressLayout get_mime_type$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_mime_type"));
/**
* Layout for field:
* {@snippet lang=c :
* const gchar *(*get_mime_type)(AtkStreamableContent *, gint)
* }
*/
public static final AddressLayout get_mime_type$layout() {
return get_mime_type$LAYOUT;
}
private static final long get_mime_type$OFFSET = 24;
/**
* Offset for field:
* {@snippet lang=c :
* const gchar *(*get_mime_type)(AtkStreamableContent *, gint)
* }
*/
public static final long get_mime_type$offset() {
return get_mime_type$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const gchar *(*get_mime_type)(AtkStreamableContent *, gint)
* }
*/
public static MemorySegment get_mime_type(MemorySegment struct) {
return struct.get(get_mime_type$LAYOUT, get_mime_type$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const gchar *(*get_mime_type)(AtkStreamableContent *, gint)
* }
*/
public static void get_mime_type(MemorySegment struct, MemorySegment fieldValue) {
struct.set(get_mime_type$LAYOUT, get_mime_type$OFFSET, fieldValue);
}
/**
* {@snippet lang=c :
* GIOChannel *(*get_stream)(AtkStreamableContent *, const gchar *)
* }
*/
public class get_stream {
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
MemorySegment apply(MemorySegment _x0, MemorySegment _x1);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
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(get_stream.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(get_stream.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 MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) {
try {
return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}
private static final AddressLayout get_stream$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_stream"));
/**
* Layout for field:
* {@snippet lang=c :
* GIOChannel *(*get_stream)(AtkStreamableContent *, const gchar *)
* }
*/
public static final AddressLayout get_stream$layout() {
return get_stream$LAYOUT;
}
private static final long get_stream$OFFSET = 32;
/**
* Offset for field:
* {@snippet lang=c :
* GIOChannel *(*get_stream)(AtkStreamableContent *, const gchar *)
* }
*/
public static final long get_stream$offset() {
return get_stream$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* GIOChannel *(*get_stream)(AtkStreamableContent *, const gchar *)
* }
*/
public static MemorySegment get_stream(MemorySegment struct) {
return struct.get(get_stream$LAYOUT, get_stream$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* GIOChannel *(*get_stream)(AtkStreamableContent *, const gchar *)
* }
*/
public static void get_stream(MemorySegment struct, MemorySegment fieldValue) {
struct.set(get_stream$LAYOUT, get_stream$OFFSET, fieldValue);
}
/**
* {@snippet lang=c :
* const gchar *(*get_uri)(AtkStreamableContent *, const gchar *)
* }
*/
public class get_uri {
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
MemorySegment apply(MemorySegment _x0, MemorySegment _x1);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
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(get_uri.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(get_uri.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 MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) {
try {
return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}
private static final AddressLayout get_uri$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_uri"));
/**
* Layout for field:
* {@snippet lang=c :
* const gchar *(*get_uri)(AtkStreamableContent *, const gchar *)
* }
*/
public static final AddressLayout get_uri$layout() {
return get_uri$LAYOUT;
}
private static final long get_uri$OFFSET = 40;
/**
* Offset for field:
* {@snippet lang=c :
* const gchar *(*get_uri)(AtkStreamableContent *, const gchar *)
* }
*/
public static final long get_uri$offset() {
return get_uri$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const gchar *(*get_uri)(AtkStreamableContent *, const gchar *)
* }
*/
public static MemorySegment get_uri(MemorySegment struct) {
return struct.get(get_uri$LAYOUT, get_uri$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const gchar *(*get_uri)(AtkStreamableContent *, const gchar *)
* }
*/
public static void get_uri(MemorySegment struct, MemorySegment fieldValue) {
struct.set(get_uri$LAYOUT, get_uri$OFFSET, fieldValue);
}
private static final AddressLayout pad1$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("pad1"));
/**
* Layout for field:
* {@snippet lang=c :
* AtkFunction pad1
* }
*/
public static final AddressLayout pad1$layout() {
return pad1$LAYOUT;
}
private static final long pad1$OFFSET = 48;
/**
* Offset for field:
* {@snippet lang=c :
* AtkFunction pad1
* }
*/
public static final long pad1$offset() {
return pad1$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* AtkFunction pad1
* }
*/
public static MemorySegment pad1(MemorySegment struct) {
return struct.get(pad1$LAYOUT, pad1$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* AtkFunction pad1
* }
*/
public static void pad1(MemorySegment struct, MemorySegment fieldValue) {
struct.set(pad1$LAYOUT, pad1$OFFSET, fieldValue);
}
private static final AddressLayout pad2$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("pad2"));
/**
* Layout for field:
* {@snippet lang=c :
* AtkFunction pad2
* }
*/
public static final AddressLayout pad2$layout() {
return pad2$LAYOUT;
}
private static final long pad2$OFFSET = 56;
/**
* Offset for field:
* {@snippet lang=c :
* AtkFunction pad2
* }
*/
public static final long pad2$offset() {
return pad2$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* AtkFunction pad2
* }
*/
public static MemorySegment pad2(MemorySegment struct) {
return struct.get(pad2$LAYOUT, pad2$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* AtkFunction pad2
* }
*/
public static void pad2(MemorySegment struct, MemorySegment fieldValue) {
struct.set(pad2$LAYOUT, pad2$OFFSET, fieldValue);
}
private static final AddressLayout pad3$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("pad3"));
/**
* Layout for field:
* {@snippet lang=c :
* AtkFunction pad3
* }
*/
public static final AddressLayout pad3$layout() {
return pad3$LAYOUT;
}
private static final long pad3$OFFSET = 64;
/**
* Offset for field:
* {@snippet lang=c :
* AtkFunction pad3
* }
*/
public static final long pad3$offset() {
return pad3$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* AtkFunction pad3
* }
*/
public static MemorySegment pad3(MemorySegment struct) {
return struct.get(pad3$LAYOUT, pad3$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* AtkFunction pad3
* }
*/
public static void pad3(MemorySegment struct, MemorySegment fieldValue) {
struct.set(pad3$LAYOUT, pad3$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);
}
}