Class PrettyTypeFormatter
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.type.PrettyTypeFormatter
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 Summary
ConstructorsConstructorDescriptionCreate a formatter with default options.PrettyTypeFormatter(int levelStructDepth, boolean fullDisplay) Create a formatter. -
Method Summary
Modifier and TypeMethodDescriptionFormat a native type.intGet the maximum structure nesting depth to expand.booleanDetermine whether aliased types are expanded.booleanDetermine whether field and type offsets are displayed.booleanDetermine whether padding and alignment information is displayed.booleanDetermine whether a trailing semicolon is appended.voidsetDisplayAliasedType(boolean displayAliasedType) Set whether aliased types should be expanded.voidsetDisplayOffsets(boolean displayOffsets) Set whether field and type offsets should be displayed.voidsetDisplayPaddingInfo(boolean displayPaddingInfo) Set whether padding and alignment information should be displayed.voidsetDisplayTrailingSemicolon(boolean displayTrailingSemicolon) Set whether a trailing semicolon should be appended.voidsetLevelStructDepth(int levelStructDepth) Set the maximum structure nesting depth to expand.
-
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 expandfullDisplay- 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
Format a native type.- Parameters:
t- native type to format- Returns:
- formatted type string
-