Class PrettyTypeFormatter

java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.type.PrettyTypeFormatter

public class PrettyTypeFormatter extends Object
C-like formatting an INativeType to a string. Allows formatting of nested structures.

Note that array formatting does not respect C type notation: [dimension] is not after the identifier name, but instead, after the type name. The dimensions are reversed. Example:

 C variable:
   int a[6][4];    // an two-dimensional array of integers, first dim: 6, second dim: 4
 would have its type rendered as:
   int[4][6]       // note the dimension ordering
 
  • Constructor Details

    • PrettyTypeFormatter

      public PrettyTypeFormatter()
      Create a formatter with default options.
    • PrettyTypeFormatter

      public PrettyTypeFormatter(int levelStructDepth, boolean fullDisplay)
      Create a formatter.
      Parameters:
      levelStructDepth - maximum structure nesting depth to expand
      fullDisplay - true to display offsets, padding information, and aliased types
  • Method Details

    • setLevelStructDepth

      public void setLevelStructDepth(int levelStructDepth)
      Set the maximum structure nesting depth to expand.
      Parameters:
      levelStructDepth - maximum structure nesting depth
    • getLevelStructDepth

      public int getLevelStructDepth()
      Get the maximum structure nesting depth to expand.
      Returns:
      maximum structure nesting depth
    • setDisplayOffsets

      public void setDisplayOffsets(boolean displayOffsets)
      Set whether field and type offsets should be displayed.
      Parameters:
      displayOffsets - true to display offsets
    • isDisplayOffsets

      public boolean isDisplayOffsets()
      Determine whether field and type offsets are displayed.
      Returns:
      true if offsets are displayed
    • setDisplayPaddingInfo

      public void setDisplayPaddingInfo(boolean displayPaddingInfo)
      Set whether padding and alignment information should be displayed.
      Parameters:
      displayPaddingInfo - true to display padding and alignment information
    • isDisplayPaddingInfo

      public boolean isDisplayPaddingInfo()
      Determine whether padding and alignment information is displayed.
      Returns:
      true if padding and alignment information is displayed
    • setDisplayAliasedType

      public void setDisplayAliasedType(boolean displayAliasedType)
      Set whether aliased types should be expanded.
      Parameters:
      displayAliasedType - true to expand aliased types
    • isDisplayAliasedType

      public boolean isDisplayAliasedType()
      Determine whether aliased types are expanded.
      Returns:
      true if aliased types are expanded
    • setDisplayTrailingSemicolon

      public void setDisplayTrailingSemicolon(boolean displayTrailingSemicolon)
      Set whether a trailing semicolon should be appended.
      Parameters:
      displayTrailingSemicolon - true to append a trailing semicolon
    • isDisplayTrailingSemicolon

      public boolean isDisplayTrailingSemicolon()
      Determine whether a trailing semicolon is appended.
      Returns:
      true if a trailing semicolon is appended
    • format

      public String format(INativeType t)
      Format a native type.
      Parameters:
      t - native type to format
      Returns:
      formatted type string