Class YGValue

    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • VALUE, UNIT

        The struct member offsets.
    • Constructor Detail

      • YGValue

        public YGValue​(java.nio.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 Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • 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​(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​(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

        public static YGValue mallocStack()
        Returns a new YGValue instance allocated on the thread-local MemoryStack.
      • callocStack

        public static YGValue callocStack()
        Returns a new YGValue instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

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

        public static YGValue callocStack​(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
      • mallocStack

        public static YGValue.Buffer mallocStack​(int capacity)
        Returns a new YGValue.Buffer instance allocated on the thread-local MemoryStack.
        Parameters:
        capacity - the buffer capacity
      • callocStack

        public static YGValue.Buffer callocStack​(int capacity)
        Returns a new YGValue.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
        Parameters:
        capacity - the buffer capacity
      • mallocStack

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

        public static YGValue.Buffer callocStack​(int capacity,
                                                 MemoryStack stack)
        Returns a new YGValue.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • 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.