Class YGValue

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class YGValue extends Struct<YGValue> implements NativeResource

Layout


 struct YGValue {
     float value;
     YGUnit unit;
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • VALUE

      public static final int VALUE
      The struct member offsets.
    • UNIT

      public static final int UNIT
      The struct member offsets.
  • Constructor Details

    • YGValue

      public YGValue(ByteBuffer container)
      Creates a YGValue instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<YGValue>
    • value

      public float value()
      Returns:
      the value of the value field.
    • unit

      public int unit()
      Returns:
      the value of the unit field.
    • value

      public YGValue value(float value)
      Sets the specified value to the value field.
    • unit

      public YGValue unit(int value)
      Sets the specified value to the unit field.
    • set

      public YGValue set(float value, int unit)
      Initializes this struct with the specified values.
    • set

      public YGValue set(YGValue src)
      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static YGValue malloc()
      Returns a new YGValue instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static YGValue calloc()
      Returns a new YGValue instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static YGValue create()
      Returns a new YGValue instance allocated with BufferUtils.
    • create

      public static YGValue create(long address)
      Returns a new YGValue instance for the specified memory address.
    • createSafe

      @Nullable public static YGValue createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static YGValue.Buffer malloc(int capacity)
      Returns a new YGValue.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static YGValue.Buffer calloc(int capacity)
      Returns a new YGValue.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static YGValue.Buffer create(int capacity)
      Returns a new YGValue.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static YGValue.Buffer create(long address, int capacity)
      Create a YGValue.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      @Nullable public static YGValue.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • mallocStack

      @Deprecated public static YGValue mallocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static YGValue callocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static YGValue mallocStack(MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static YGValue callocStack(MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static YGValue.Buffer mallocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static YGValue.Buffer callocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • mallocStack

      @Deprecated public static YGValue.Buffer mallocStack(int capacity, MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static YGValue.Buffer callocStack(int capacity, MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • malloc

      public static YGValue malloc(MemoryStack stack)
      Returns a new YGValue instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static YGValue calloc(MemoryStack stack)
      Returns a new YGValue instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static YGValue.Buffer malloc(int capacity, MemoryStack stack)
      Returns a new YGValue.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static YGValue.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new YGValue.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nvalue

      public static float nvalue(long struct)
      Unsafe version of value().
    • nunit

      public static int nunit(long struct)
      Unsafe version of unit().
    • nvalue

      public static void nvalue(long struct, float value)
      Unsafe version of value.
    • nunit

      public static void nunit(long struct, int value)
      Unsafe version of unit.