Class ReadOnlyDataTypeComponent
- java.lang.Object
- 
- ghidra.program.model.data.ReadOnlyDataTypeComponent
 
- 
- All Implemented Interfaces:
- DataTypeComponent,- java.io.Serializable
 
 public class ReadOnlyDataTypeComponent extends java.lang.Object implements DataTypeComponent, java.io.Serializable DataTypeComponents from dataTypes that can not be modified.- See Also:
- Serialized Form
 
- 
- 
Field Summary- 
Fields inherited from interface ghidra.program.model.data.DataTypeComponentDEFAULT_FIELD_NAME_PREFIX
 
- 
 - 
Constructor SummaryConstructors Constructor Description ReadOnlyDataTypeComponent(DataType dataType, DynamicDataType parent, int length, int ordinal, int offset)Create a new DataTypeComponentReadOnlyDataTypeComponent(DataType dataType, DynamicDataType parent, int length, int ordinal, int offset, java.lang.String fieldName, java.lang.String comment)Create a new DataTypeComponent
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.StringgetComment()Get the comment for this dataTypeComponent.DataTypegetDataType()Returns the dataType in this component.java.lang.StringgetDefaultFieldName()Returns a default Field name.SettingsgetDefaultSettings()Gets the default settings for this data type component.intgetEndOffset()Get the byte offset of where this component ends relative to the start of the parent data type.java.lang.StringgetFieldName()Get the name of the field name as a component of a Data Type.intgetLength()Get the length of this component.intgetOffset()Get the byte offset of where this component begins relative to the start of the parent data type.intgetOrdinal()Get the ordinal position within the parent dataType.DataTypegetParent()returns the dataType that contains this component.booleanisBitFieldComponent()Determine if the specified component corresponds to a bit-field.booleanisEquivalent(DataTypeComponent dtc)Returns true if the given dataTypeComponent is equivalent to this dataTypeComponent.booleanisFlexibleArrayComponent()Determine if this component corresponds to a unsized flexible array which is permitted as the trailing component within a structure.booleanisZeroBitFieldComponent()Determine if the specified component corresponds to a zero-length bit-field.voidsetComment(java.lang.String comment)Sets the comment for the component.voidsetDefaultSettings(Settings settings)Set default settings for this dataType.voidsetFieldName(java.lang.String fieldName)Sets the field name.
 
- 
- 
- 
Constructor Detail- 
ReadOnlyDataTypeComponentpublic ReadOnlyDataTypeComponent(DataType dataType, DynamicDataType parent, int length, int ordinal, int offset, java.lang.String fieldName, java.lang.String comment) Create a new DataTypeComponent- Parameters:
- dataType- the dataType for this component
- parent- the dataType that this component belongs to
- length- the length of the dataType in this component.
- offset- the byte offset within the parent
- ordinal- the index of this component in the parent.
- fieldName- the name associated with this component
- comment- the comment associated with ths component
 
 - 
ReadOnlyDataTypeComponentpublic ReadOnlyDataTypeComponent(DataType dataType, DynamicDataType parent, int length, int ordinal, int offset) Create a new DataTypeComponent- Parameters:
- dataType- the dataType for this component
- parent- the dataType that this component belongs to
- length- the length of the dataType in this component.
- ordinal- the index of this component in the parent.
- offset- the byte offset within the parent
 
 
- 
 - 
Method Detail- 
isFlexibleArrayComponentpublic boolean isFlexibleArrayComponent() Description copied from interface:DataTypeComponentDetermine if this component corresponds to a unsized flexible array which is permitted as the trailing component within a structure.- Specified by:
- isFlexibleArrayComponentin interface- DataTypeComponent
- Returns:
- true if component is a trailing flexible array component.
 
 - 
isBitFieldComponentpublic boolean isBitFieldComponent() Description copied from interface:DataTypeComponentDetermine if the specified component corresponds to a bit-field.- Specified by:
- isBitFieldComponentin interface- DataTypeComponent
- Returns:
- true if bit-field else false
 
 - 
isZeroBitFieldComponentpublic boolean isZeroBitFieldComponent() Description copied from interface:DataTypeComponentDetermine if the specified component corresponds to a zero-length bit-field.- Specified by:
- isZeroBitFieldComponentin interface- DataTypeComponent
- Returns:
- true if zer-length bit-field else false
 
 - 
getOffsetpublic int getOffset() Description copied from interface:DataTypeComponentGet the byte offset of where this component begins relative to the start of the parent data type.NOTE: The special case of a structure flexible array component returns an offset equal to the length of the parent structure since the flexible array component is not included in a structure's length. - Specified by:
- getOffsetin interface- DataTypeComponent
- Returns:
- offset of start of component relative to the start of the parent data type.
- See Also:
- DataTypeComponent.getOffset()
 
 - 
getEndOffsetpublic int getEndOffset() Description copied from interface:DataTypeComponentGet the byte offset of where this component ends relative to the start of the parent data type.NOTE: The special case of a structure flexible array component returns -1 since its length is undefined. - Specified by:
- getEndOffsetin interface- DataTypeComponent
- Returns:
- offset of end of component relative to the start of the parent data type.
- See Also:
- DataTypeComponent.getEndOffset()
 
 - 
getCommentpublic java.lang.String getComment() Description copied from interface:DataTypeComponentGet the comment for this dataTypeComponent.- Specified by:
- getCommentin interface- DataTypeComponent
- See Also:
- DataTypeComponent.getComment()
 
 - 
setCommentpublic void setComment(java.lang.String comment) Description copied from interface:DataTypeComponentSets the comment for the component.- Specified by:
- setCommentin interface- DataTypeComponent
- Parameters:
- comment- this components comment.
- See Also:
- DataTypeComponent.setComment(java.lang.String)
 
 - 
getFieldNamepublic java.lang.String getFieldName() Description copied from interface:DataTypeComponentGet the name of the field name as a component of a Data Type.- Specified by:
- getFieldNamein interface- DataTypeComponent
- Returns:
- the name as a component of another Data Type.
- See Also:
- DataTypeComponent.getFieldName()
 
 - 
getDefaultFieldNamepublic java.lang.String getDefaultFieldName() Description copied from interface:DataTypeComponentReturns a default Field name. Used only if a field name is not set.- Specified by:
- getDefaultFieldNamein interface- DataTypeComponent
- See Also:
- DataTypeComponent.getDefaultFieldName()
 
 - 
setFieldNamepublic void setFieldName(java.lang.String fieldName) throws DuplicateNameExceptionDescription copied from interface:DataTypeComponentSets the field name. If the field name is empty it will be set to null, which is the default field name. An exception is thrown if one of the parent's other components already has the specified field name.- Specified by:
- setFieldNamein interface- DataTypeComponent
- Parameters:
- fieldName- the new field name for this component.
- Throws:
- DuplicateNameException- if another component of the parent has the specified field name.
- See Also:
- DataTypeComponent.setFieldName(java.lang.String)
 
 - 
getDataTypepublic DataType getDataType() Description copied from interface:DataTypeComponentReturns the dataType in this component.NOTE: If this component corresponds to a structure flexible array the returned data type reflects the base type of the array (e.g., char is returned for a flexible char array). - Specified by:
- getDataTypein interface- DataTypeComponent
- Returns:
- the dataType in this component
- See Also:
- DataTypeComponent.getDataType()
 
 - 
getParentpublic DataType getParent() Description copied from interface:DataTypeComponentreturns the dataType that contains this component.- Specified by:
- getParentin interface- DataTypeComponent
- Returns:
- the dataType that contains this component.
- See Also:
- DataTypeComponent.getParent()
 
 - 
getLengthpublic int getLength() Description copied from interface:DataTypeComponentGet the length of this component.NOTE: The special case of a structure flexible array component returns 0 since its length is undefined. - Specified by:
- getLengthin interface- DataTypeComponent
- Returns:
- the length of this component or 0 for a structure flexible array.
- See Also:
- DataTypeComponent.getLength()
 
 - 
getOrdinalpublic int getOrdinal() Description copied from interface:DataTypeComponentGet the ordinal position within the parent dataType.NOTE: The special case of a structure flexible array component returns an ordinal equal to the parent structure's Structure.getNumComponents()since it is not included in the list of normal components (seeStructure.getFlexibleArrayComponent().- Specified by:
- getOrdinalin interface- DataTypeComponent
- Returns:
- ordinal of this component within the parent data type.
- See Also:
- DataTypeComponent.getOrdinal()
 
 - 
getDefaultSettingspublic Settings getDefaultSettings() Description copied from interface:DataTypeComponentGets the default settings for this data type component.- Specified by:
- getDefaultSettingsin interface- DataTypeComponent
- Returns:
- a Settings object that is the set of default values for this dataType component
- See Also:
- DataTypeComponent.getDefaultSettings()
 
 - 
setDefaultSettingspublic void setDefaultSettings(Settings settings) Description copied from interface:DataTypeComponentSet default settings for this dataType.- Specified by:
- setDefaultSettingsin interface- DataTypeComponent
- Parameters:
- settings- the new default settings.
- See Also:
- DataTypeComponent.setDefaultSettings(ghidra.docking.settings.Settings)
 
 - 
equalspublic boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
- See Also:
- Object.equals(java.lang.Object)
 
 - 
isEquivalentpublic boolean isEquivalent(DataTypeComponent dtc) Description copied from interface:DataTypeComponentReturns true if the given dataTypeComponent is equivalent to this dataTypeComponent. A dataTypeComponent is "equivalent" if the other component has a data type that is equivalent to this component's data type. The dataTypeComponents must also have the same offset, length, ordinal, field name, and comment.- Specified by:
- isEquivalentin interface- DataTypeComponent
- Parameters:
- dtc- the dataTypeComponent being tested for equivalence.
- Returns:
- true if the given dataTypeComponent is equivalent to this dataTypeComponent.
 
 
- 
 
-