Package ghidra.app.util

# Class CodeUnitInfo

java.lang.Object
ghidra.app.util.CodeUnitInfo

public class CodeUnitInfo extends Object
Container object to keep a relative index, label, and comments. Used in a list for copying/pasting labels and comments from one program to another.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CodeUnitInfo(int index)`
  Constructor a new CodeUnitInfo.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String[]`
  `getEOLComment()`
  Get the EOL comment.
  `String[]`
  `getFunctionComments()`
  Get the function comments.
  `String`
  `getFunctionName()`
  Get the function name.
  `String[]`
  `getFunctionScopeSymbolNames()`
  Get the names of the function scope symbols.
  `SourceType[]`
  `getFunctionScopeSymbolSources()`
  Get the sources of the function scope symbols.
  `int`
  `getIndex()`
  Get the relative index for this CodeUnitInfo to add to a base address.
  `String[]`
  `getOtherSymbolNames()`
  Get the names of the other symbols not in a function scope.
  `SourceType[]`
  `getOtherSymbolSources()`
  Get the sources of the other symbols not in a function scope.
  `String[]`
  `getPlateComment()`
  Get the plate comment.
  `String[]`
  `getPostComment()`
  Get the post comment.
  `String[]`
  `getPreComment()`
  Get the pre comment.
  `String`
  `getPrimarySymbolName()`
  Get the label; may be null.
  `SourceType`
  `getPrimarySymbolSource()`
  Get the label source
  `String[]`
  `getRepeatableComment()`
  Get the repeatable comment.
  `int[]`
  `getStackOffsets()`
  Get the stack offsets.
  `int[]`
  `getStackVarFirstUseOffsets()`
  Get the stack variable "First Use Offsets"
  `String[]`
  `getStackVariableComments()`
  Get the stack variable comments.
  `String[]`
  `getStackVariableNames()`
  Get the stack variable names.
  `SourceType[]`
  `getStackVariableSources()`
  Get the stack variable sources.
  `Address[]`
  `getVarAddresses()`
  Get the storage addresses corresponding to each non-stack variable.
  `int[]`
  `getVarFirstUseOffsets()`
  Get the non-stack variable "First Use Offsets"
  `String[]`
  `getVariableComments()`
  Get the non-stack variable comments.
  `String[]`
  `getVariableNames()`
  Get the non-stack variable names.
  `SourceType[]`
  `getVariableSources()`
  Get the non-stack variable sources.
  `boolean`
  `hasDynamicSymbol()`
  Return whether this CodeUnitInfo has a dynamic symbol.
  `boolean`
  `hasSymbols()`
  Return whether this CodeUnitInfo has symbols to copy.
  `boolean`
  `isPrimarySymbolInFunctionScope()`
  Is primary symbol in a function scope
  `void`
  `setComment(int commentType, String[] comment)`
  Set the comment to be transferred.
  `void`
  `setFunction(Function function)`
  Set the function info.
  `void`
  `setSymbols(Symbol[] symbols)`
  Set the symbols to be transferred.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CodeUnitInfo

    public CodeUnitInfo(int index)
    Constructor a new CodeUnitInfo.
    Parameters:
      `index` - relative index added to a base address for where this information will be placed

- ## Method Details

  - ### setSymbols

    public void setSymbols(Symbol[] symbols)
    Set the symbols to be transferred.

  - ### setComment

    public void setComment(int commentType, String[] comment)
    Set the comment to be transferred.
    Parameters:
      `commentType` - CodeUnit.PRE_COMMENT, POST_COMMENT, PLATE_COMMENT, EOL_COMMENT, or REPEATABLE.
      `comment` - comment

  - ### setFunction

    public void setFunction(Function function)
    Set the function info.
    Parameters:
      `function` - function used to get function info to transfer

  - ### getIndex

    public int getIndex()
    Get the relative index for this CodeUnitInfo to add to a base address.

  - ### hasSymbols

    public boolean hasSymbols()
    Return whether this CodeUnitInfo has symbols to copy.

  - ### hasDynamicSymbol

    public boolean hasDynamicSymbol()
    Return whether this CodeUnitInfo has a dynamic symbol.

  - ### getPrimarySymbolName

    public String getPrimarySymbolName()
    Get the label; may be null.

  - ### getPrimarySymbolSource

    public SourceType getPrimarySymbolSource()
    Get the label source

  - ### isPrimarySymbolInFunctionScope

    public boolean isPrimarySymbolInFunctionScope()
    Is primary symbol in a function scope

  - ### getFunctionScopeSymbolNames

    public String[] getFunctionScopeSymbolNames()
    Get the names of the function scope symbols.

  - ### getFunctionScopeSymbolSources

    public SourceType[] getFunctionScopeSymbolSources()
    Get the sources of the function scope symbols.

  - ### getOtherSymbolNames

    public String[] getOtherSymbolNames()
    Get the names of the other symbols not in a function scope.

  - ### getOtherSymbolSources

    public SourceType[] getOtherSymbolSources()
    Get the sources of the other symbols not in a function scope.

  - ### getPlateComment

    public String[] getPlateComment()
    Get the plate comment.

  - ### getPreComment

    public String[] getPreComment()
    Get the pre comment.

  - ### getPostComment

    public String[] getPostComment()
    Get the post comment.

  - ### getEOLComment

    public String[] getEOLComment()
    Get the EOL comment.

  - ### getRepeatableComment

    public String[] getRepeatableComment()
    Get the repeatable comment.

  - ### getFunctionName

    public String getFunctionName()
    Get the function name.

  - ### getFunctionComments

    public String[] getFunctionComments()
    Get the function comments.

  - ### getStackVariableNames

    public String[] getStackVariableNames()
    Get the stack variable names.

  - ### getStackVariableSources

    public SourceType[] getStackVariableSources()
    Get the stack variable sources.

  - ### getStackOffsets

    public int[] getStackOffsets()
    Get the stack offsets.

  - ### getStackVarFirstUseOffsets

    public int[] getStackVarFirstUseOffsets()
    Get the stack variable "First Use Offsets"

  - ### getStackVariableComments

    public String[] getStackVariableComments()
    Get the stack variable comments.

  - ### getVariableNames

    public String[] getVariableNames()
    Get the non-stack variable names.

  - ### getVariableSources

    public SourceType[] getVariableSources()
    Get the non-stack variable sources.

  - ### getVarAddresses

    public Address[] getVarAddresses()
    Get the storage addresses corresponding to each non-stack variable.

  - ### getVarFirstUseOffsets

    public int[] getVarFirstUseOffsets()
    Get the non-stack variable "First Use Offsets"

  - ### getVariableComments

    public String[] getVariableComments()
    Get the non-stack variable comments.