Class YGNode

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class YGNode extends Struct<YGNode> implements NativeResource
Unstable/private API.

Layout


 struct YGNode {
     void * context;
     YGNodeFlags flags;
     union {
         YGMeasureFunc noContext;
         MeasureWithContextFn withContext;
     } measure;
     union {
         YGBaselineFunc noContext;
         BaselineWithContextFn withContext;
     } baseline;
     union {
         YGPrintFunc noContext;
         PrintWithContextFn withContext;
     } print;
     YGDirtiedFunc dirtied;
     YGStyle style;
     YGLayout layout;
     uint32_t lineIndex;
     YGNodeRef owner;
     YGVector children;
     YGConfigRef config;
     YGValue resolvedDimensions[2];
 }
  • Field Details

    • SIZEOF

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

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

      public static final int CONTEXT
      The struct member offsets.
    • FLAGS

      public static final int FLAGS
      The struct member offsets.
    • MEASURE

      public static final int MEASURE
      The struct member offsets.
    • MEASURE_NOCONTEXT

      public static final int MEASURE_NOCONTEXT
      The struct member offsets.
    • MEASURE_WITHCONTEXT

      public static final int MEASURE_WITHCONTEXT
      The struct member offsets.
    • BASELINE

      public static final int BASELINE
      The struct member offsets.
    • BASELINE_NOCONTEXT

      public static final int BASELINE_NOCONTEXT
      The struct member offsets.
    • BASELINE_WITHCONTEXT

      public static final int BASELINE_WITHCONTEXT
      The struct member offsets.
    • PRINT

      public static final int PRINT
      The struct member offsets.
    • DIRTIED

      public static final int DIRTIED
      The struct member offsets.
    • STYLE

      public static final int STYLE
      The struct member offsets.
    • LAYOUT

      public static final int LAYOUT
      The struct member offsets.
    • LINEINDEX

      public static final int LINEINDEX
      The struct member offsets.
    • OWNER

      public static final int OWNER
      The struct member offsets.
    • CHILDREN

      public static final int CHILDREN
      The struct member offsets.
    • CONFIG

      public static final int CONFIG
      The struct member offsets.
    • RESOLVEDDIMENSIONS

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

    • YGNode

      public YGNode(ByteBuffer container)
      Creates a YGNode 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<YGNode>
    • context

      public long context()
      Returns:
      the value of the context field.
    • flags

      public YGNodeFlags flags()
      Returns:
      a YGNodeFlags view of the flags field.
    • measure_noContext

      @Nullable public YGMeasureFunc measure_noContext()
      Returns:
      the value of the measure.noContext field.
    • measure_withContext

      public long measure_withContext()
      Returns:
      the value of the measure.withContext field.
    • baseline_noContext

      @Nullable public YGBaselineFunc baseline_noContext()
      Returns:
      the value of the baseline.noContext field.
    • baseline_withContext

      public long baseline_withContext()
      Returns:
      the value of the baseline.withContext field.
    • dirtied

      @Nullable public YGDirtiedFunc dirtied()
      Returns:
      the value of the dirtied field.
    • style

      public YGStyle style()
      Returns:
      a YGStyle view of the style field.
    • layout

      public YGLayout layout()
      Returns:
      a YGLayout view of the layout field.
    • lineIndex

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

      public long owner()
      Returns:
      the value of the owner field.
    • config

      public long config()
      Returns:
      the value of the config field.
    • resolvedDimensions

      public YGValue.Buffer resolvedDimensions()
      Returns:
      a YGValue.Buffer view of the resolvedDimensions field.
    • resolvedDimensions

      public YGValue resolvedDimensions(int index)
      Returns:
      a YGValue view of the struct at the specified index of the resolvedDimensions field.
    • context

      public YGNode context(long value)
      Sets the specified value to the context field.
    • flags

      public YGNode flags(YGNodeFlags value)
      Copies the specified YGNodeFlags to the flags field.
    • flags

      public YGNode flags(Consumer<YGNodeFlags> consumer)
      Passes the flags field to the specified Consumer.
    • measure_noContext

      public YGNode measure_noContext(@Nullable YGMeasureFuncI value)
      Sets the specified value to the noContext field.
    • measure_withContext

      public YGNode measure_withContext(long value)
      Sets the specified value to the withContext field.
    • baseline_noContext

      public YGNode baseline_noContext(@Nullable YGBaselineFuncI value)
      Sets the specified value to the noContext field.
    • baseline_withContext

      public YGNode baseline_withContext(long value)
      Sets the specified value to the withContext field.
    • dirtied

      public YGNode dirtied(@Nullable YGDirtiedFuncI value)
      Sets the specified value to the dirtied field.
    • style

      public YGNode style(YGStyle value)
      Copies the specified YGStyle to the style field.
    • layout

      public YGNode layout(YGLayout value)
      Copies the specified YGLayout to the layout field.
    • lineIndex

      public YGNode lineIndex(int value)
      Sets the specified value to the lineIndex field.
    • owner

      public YGNode owner(long value)
      Sets the specified value to the owner field.
    • config

      public YGNode config(long value)
      Sets the specified value to the config field.
    • resolvedDimensions

      public YGNode resolvedDimensions(YGValue.Buffer value)
      Copies the specified YGValue.Buffer to the resolvedDimensions field.
    • resolvedDimensions

      public YGNode resolvedDimensions(int index, YGValue value)
      Copies the specified YGValue at the specified index of the resolvedDimensions field.
    • resolvedDimensions

      public YGNode resolvedDimensions(Consumer<YGValue.Buffer> consumer)
      Passes the resolvedDimensions field to the specified Consumer.
    • resolvedDimensions

      public YGNode resolvedDimensions(int index, Consumer<YGValue> consumer)
      Passes the element at index of the resolvedDimensions field to the specified Consumer.
    • set

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static YGNode.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new YGNode.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
    • ncontext

      public static long ncontext(long struct)
      Unsafe version of context().
    • nflags

      public static YGNodeFlags nflags(long struct)
      Unsafe version of flags().
    • nmeasure_noContext

      @Nullable public static YGMeasureFunc nmeasure_noContext(long struct)
      Unsafe version of measure_noContext().
    • nmeasure_withContext

      public static long nmeasure_withContext(long struct)
      Unsafe version of measure_withContext().
    • nbaseline_noContext

      @Nullable public static YGBaselineFunc nbaseline_noContext(long struct)
      Unsafe version of baseline_noContext().
    • nbaseline_withContext

      public static long nbaseline_withContext(long struct)
      Unsafe version of baseline_withContext().
    • nprint_noContext

      @Nullable public static YGPrintFunc nprint_noContext(long struct)
      Unsafe version of print_noContext().
    • nprint_withContext

      public static long nprint_withContext(long struct)
      Unsafe version of print_withContext().
    • ndirtied

      @Nullable public static YGDirtiedFunc ndirtied(long struct)
      Unsafe version of dirtied().
    • nstyle

      public static YGStyle nstyle(long struct)
      Unsafe version of style().
    • nlayout

      public static YGLayout nlayout(long struct)
      Unsafe version of layout().
    • nlineIndex

      public static int nlineIndex(long struct)
      Unsafe version of lineIndex().
    • nowner

      public static long nowner(long struct)
      Unsafe version of owner().
    • nchildren

      public static long nchildren(long struct)
    • nconfig

      public static long nconfig(long struct)
      Unsafe version of config().
    • nresolvedDimensions

      public static YGValue.Buffer nresolvedDimensions(long struct)
      Unsafe version of resolvedDimensions().
    • nresolvedDimensions

      public static YGValue nresolvedDimensions(long struct, int index)
      Unsafe version of resolvedDimensions.
    • ncontext

      public static void ncontext(long struct, long value)
      Unsafe version of context.
    • nflags

      public static void nflags(long struct, YGNodeFlags value)
      Unsafe version of flags.
    • nmeasure_noContext

      public static void nmeasure_noContext(long struct, @Nullable YGMeasureFuncI value)
      Unsafe version of measure_noContext.
    • nmeasure_withContext

      public static void nmeasure_withContext(long struct, long value)
      Unsafe version of measure_withContext.
    • nbaseline_noContext

      public static void nbaseline_noContext(long struct, @Nullable YGBaselineFuncI value)
      Unsafe version of baseline_noContext.
    • nbaseline_withContext

      public static void nbaseline_withContext(long struct, long value)
      Unsafe version of baseline_withContext.
    • nprint_noContext

      public static void nprint_noContext(long struct, @Nullable YGPrintFuncI value)
      Unsafe version of print_noContext.
    • nprint_withContext

      public static void nprint_withContext(long struct, long value)
      Unsafe version of print_withContext.
    • ndirtied

      public static void ndirtied(long struct, @Nullable YGDirtiedFuncI value)
      Unsafe version of dirtied.
    • nstyle

      public static void nstyle(long struct, YGStyle value)
      Unsafe version of style.
    • nlayout

      public static void nlayout(long struct, YGLayout value)
      Unsafe version of layout.
    • nlineIndex

      public static void nlineIndex(long struct, int value)
      Unsafe version of lineIndex.
    • nowner

      public static void nowner(long struct, long value)
      Unsafe version of owner.
    • nchildren

      public static void nchildren(long struct, long value)
    • nconfig

      public static void nconfig(long struct, long value)
      Unsafe version of config.
    • nresolvedDimensions

      public static void nresolvedDimensions(long struct, YGValue.Buffer value)
      Unsafe version of resolvedDimensions.
    • nresolvedDimensions

      public static void nresolvedDimensions(long struct, int index, YGValue value)
      Unsafe version of resolvedDimensions.