Path: blob/3.3.1/modules/lwjgl/nuklear/src/generated/java/org/lwjgl/nuklear/NkConfigStackStyleItem.java
2570 views
/*1* Copyright LWJGL. All rights reserved.2* License terms: https://www.lwjgl.org/license3* MACHINE GENERATED FILE, DO NOT EDIT4*/5package org.lwjgl.nuklear;67import javax.annotation.*;89import java.nio.*;1011import org.lwjgl.system.*;1213import static org.lwjgl.system.Checks.*;14import static org.lwjgl.system.MemoryUtil.*;1516/**17* <h3>Layout</h3>18*19* <pre><code>20* struct nk_config_stack_style_item {21* int head;22* {@link NkConfigStackStyleItemElement struct nk_config_stack_style_item_element} elements[16];23* }</code></pre>24*/25@NativeType("struct nk_config_stack_style_item")26class NkConfigStackStyleItem extends Struct {2728/** The struct size in bytes. */29public static final int SIZEOF;3031/** The struct alignment in bytes. */32public static final int ALIGNOF;3334/** The struct member offsets. */35public static final int36HEAD,37ELEMENTS;3839static {40Layout layout = __struct(41__member(4),42__array(NkConfigStackStyleItemElement.SIZEOF, NkConfigStackStyleItemElement.ALIGNOF, 16)43);4445SIZEOF = layout.getSize();46ALIGNOF = layout.getAlignment();4748HEAD = layout.offsetof(0);49ELEMENTS = layout.offsetof(1);50}5152/**53* Creates a {@code NkConfigStackStyleItem} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be54* visible to the struct instance and vice versa.55*56* <p>The created instance holds a strong reference to the container object.</p>57*/58NkConfigStackStyleItem(ByteBuffer container) {59super(memAddress(container), __checkContainer(container, SIZEOF));60}6162@Override63public int sizeof() { return SIZEOF; }6465/** @return the value of the {@code head} field. */66public int head() { return nhead(address()); }67/** @return a {@link NkConfigStackStyleItemElement}.Buffer view of the {@code elements} field. */68@NativeType("struct nk_config_stack_style_item_element[16]")69public NkConfigStackStyleItemElement.Buffer elements() { return nelements(address()); }70/** @return a {@link NkConfigStackStyleItemElement} view of the struct at the specified index of the {@code elements} field. */71@NativeType("struct nk_config_stack_style_item_element")72public NkConfigStackStyleItemElement elements(int index) { return nelements(address(), index); }7374// -----------------------------------7576/** Returns a new {@code NkConfigStackStyleItem} instance for the specified memory address. */77public static NkConfigStackStyleItem create(long address) {78return wrap(NkConfigStackStyleItem.class, address);79}8081/** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */82@Nullable83public static NkConfigStackStyleItem createSafe(long address) {84return address == NULL ? null : wrap(NkConfigStackStyleItem.class, address);85}8687/**88* Create a {@link NkConfigStackStyleItem.Buffer} instance at the specified memory.89*90* @param address the memory address91* @param capacity the buffer capacity92*/93public static NkConfigStackStyleItem.Buffer create(long address, int capacity) {94return wrap(Buffer.class, address, capacity);95}9697/** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */98@Nullable99public static NkConfigStackStyleItem.Buffer createSafe(long address, int capacity) {100return address == NULL ? null : wrap(Buffer.class, address, capacity);101}102103// -----------------------------------104105/** Unsafe version of {@link #head}. */106public static int nhead(long struct) { return UNSAFE.getInt(null, struct + NkConfigStackStyleItem.HEAD); }107/** Unsafe version of {@link #elements}. */108public static NkConfigStackStyleItemElement.Buffer nelements(long struct) { return NkConfigStackStyleItemElement.create(struct + NkConfigStackStyleItem.ELEMENTS, 16); }109/** Unsafe version of {@link #elements(int) elements}. */110public static NkConfigStackStyleItemElement nelements(long struct, int index) {111return NkConfigStackStyleItemElement.create(struct + NkConfigStackStyleItem.ELEMENTS + check(index, 16) * NkConfigStackStyleItemElement.SIZEOF);112}113114// -----------------------------------115116/** An array of {@link NkConfigStackStyleItem} structs. */117public static class Buffer extends StructBuffer<NkConfigStackStyleItem, Buffer> {118119private static final NkConfigStackStyleItem ELEMENT_FACTORY = NkConfigStackStyleItem.create(-1L);120121/**122* Creates a new {@code NkConfigStackStyleItem.Buffer} instance backed by the specified container.123*124* Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values125* will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided126* by {@link NkConfigStackStyleItem#SIZEOF}, and its mark will be undefined.127*128* <p>The created buffer instance holds a strong reference to the container object.</p>129*/130public Buffer(ByteBuffer container) {131super(container, container.remaining() / SIZEOF);132}133134public Buffer(long address, int cap) {135super(address, null, -1, 0, cap, cap);136}137138Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {139super(address, container, mark, pos, lim, cap);140}141142@Override143protected Buffer self() {144return this;145}146147@Override148protected NkConfigStackStyleItem getElementFactory() {149return ELEMENT_FACTORY;150}151152/** @return the value of the {@code head} field. */153public int head() { return NkConfigStackStyleItem.nhead(address()); }154/** @return a {@link NkConfigStackStyleItemElement}.Buffer view of the {@code elements} field. */155@NativeType("struct nk_config_stack_style_item_element[16]")156public NkConfigStackStyleItemElement.Buffer elements() { return NkConfigStackStyleItem.nelements(address()); }157/** @return a {@link NkConfigStackStyleItemElement} view of the struct at the specified index of the {@code elements} field. */158@NativeType("struct nk_config_stack_style_item_element")159public NkConfigStackStyleItemElement elements(int index) { return NkConfigStackStyleItem.nelements(address(), index); }160161}162163}164165