Package ghidra.program.model.data
Class DefaultDataType
- java.lang.Object
-
- ghidra.program.model.data.AbstractDataType
-
- ghidra.program.model.data.DataTypeImpl
-
- ghidra.program.model.data.DefaultDataType
-
- All Implemented Interfaces:
DataType
,java.util.EventListener
,javax.swing.event.ChangeListener
public class DefaultDataType extends DataTypeImpl
Provides an implementation of a byte that has not been defined yet as a particular type of data in the program.
-
-
Field Summary
Fields Modifier and Type Field Description static DefaultDataType
dataType
A statically defined DefaultDataType used when an Undefined byte is needed.-
Fields inherited from class ghidra.program.model.data.DataTypeImpl
defaultSettings
-
Fields inherited from class ghidra.program.model.data.AbstractDataType
categoryPath, dataMgr, name
-
Fields inherited from interface ghidra.program.model.data.DataType
CONFLICT_SUFFIX, DEFAULT, NO_LAST_CHANGE_TIME, NO_SOURCE_SYNC_TIME, VOID
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addParent(DataType dt)
Inform this data type that it has the given parent
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!DataType
clone(DataTypeManager dtm)
Returns a new instance of this DataType with its universalID and SourceArchive identity retained.DataType
copy(DataTypeManager dtm)
Returns a new instance of this DataType with a new identity.void
dataTypeDeleted(DataType dt)
Informs this dataType that the given dataType has been deleted.void
dataTypeNameChanged(DataType dt, java.lang.String oldName)
Informs this data type that its name has changed from the indicated old name.void
dataTypeReplaced(DataType oldDt, DataType newDt)
Informs this data type that the given oldDT has been replaced with newDT
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!void
dataTypeSizeChanged(DataType dt)
Notification that the given dataType's size has changed.boolean
dependsOn(DataType dt)
Returns true if this dataType depends on the existence of the given dataType.java.lang.String
getDescription()
Get a String briefly describing this DataType.long
getLastChangeTime()
Get the timestamp corresponding to the last time this type was changed within its data type managerint
getLength()
Get the length (number of 8-bit bytes) of this DataType.java.lang.String
getMnemonic(Settings settings)
Get the mnemonic for this DataType.java.lang.String
getRepresentation(MemBuffer buf, Settings settings, int length)
Get bytes from memory in a printable format for this type.java.lang.Object
getValue(MemBuffer buf, Settings settings, int length)
Get the Undefined byte as a Scalar.boolean
isDynamicallySized()
Indicates if this data-type is dynamically sized based upon DataOrganization.boolean
isEquivalent(DataType dt)
Returns true if the given dataType is equivalent to this dataType.void
removeParent(DataType dt)
Remove a parent data type
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!void
setCategoryPath(CategoryPath path)
void
setName(java.lang.String name)
Sets the name of the dataTypevoid
setNameAndCategory(CategoryPath path, java.lang.String name)
Sets the name and category of a dataType at the same time.-
Methods inherited from class ghidra.program.model.data.DataTypeImpl
equals, getAlignment, getDefaultSettings, getLastChangeTimeInSourceArchive, getParents, getPathName, getSettingsDefinitions, getSourceArchive, getUniversalID, getValueClass, hashCode, notifyDeleted, notifyNameChanged, notifyReplaced, notifySizeChanged, replaceWith, setDefaultSettings, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setSourceArchive, stateChanged
-
Methods inherited from class ghidra.program.model.data.AbstractDataType
getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDisplayName, getDocs, getName, isDeleted, isNotYetDefined, toString
-
-
-
-
Field Detail
-
dataType
public static DefaultDataType dataType
A statically defined DefaultDataType used when an Undefined byte is needed.
-
-
Method Detail
-
getMnemonic
public java.lang.String getMnemonic(Settings settings)
Description copied from interface:DataType
Get the mnemonic for this DataType.- Specified by:
getMnemonic
in interfaceDataType
- Overrides:
getMnemonic
in classAbstractDataType
- Returns:
- the mnemonic for this DataType.
- See Also:
DataType.getMnemonic(Settings)
-
getLength
public int getLength()
Description copied from interface:DataType
Get the length (number of 8-bit bytes) of this DataType.- Returns:
- the length of this DataType
- See Also:
DataType.getLength()
-
isDynamicallySized
public boolean isDynamicallySized()
Description copied from interface:DataType
Indicates if this data-type is dynamically sized based upon DataOrganization.- Specified by:
isDynamicallySized
in interfaceDataType
- Overrides:
isDynamicallySized
in classAbstractDataType
- See Also:
DataType.isDynamicallySized()
-
getDescription
public java.lang.String getDescription()
Description copied from interface:DataType
Get a String briefly describing this DataType.- Returns:
- a one-liner describing this DataType.
- See Also:
DataType.getDescription()
-
getRepresentation
public java.lang.String getRepresentation(MemBuffer buf, Settings settings, int length)
Description copied from interface:DataType
Get bytes from memory in a printable format for this type.- Parameters:
buf
- the data.settings
- the settings to use for the representation.length
- the number of bytes to represent.- Returns:
- the representation of the data in this format, never null.
- See Also:
DataType.getRepresentation(MemBuffer, Settings, int)
-
getValue
public java.lang.Object getValue(MemBuffer buf, Settings settings, int length)
Get the Undefined byte as a Scalar.- Parameters:
buf
- the data buffer.settings
- the display settings to use.length
- the number of bytes to get the value from.- Returns:
- the data Object.
-
clone
public DataType clone(DataTypeManager dtm)
Description copied from interface:DataType
Returns a new instance of this DataType with its universalID and SourceArchive identity retained. Note: for built-in DataType's, clone and copy should have the same affect.- Parameters:
dtm
- the data-type manager instance whose data-organization should apply.
-
copy
public DataType copy(DataTypeManager dtm)
Description copied from interface:DataType
Returns a new instance of this DataType with a new identity. Note: for built-in DataType's, clone and copy should have the same affect.- Parameters:
dtm
- the data-type manager instance whose data-organization should apply.
-
dataTypeSizeChanged
public void dataTypeSizeChanged(DataType dt)
Description copied from interface:DataType
Notification that the given dataType's size has changed. DataTypes may need to make internal changes in response.
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!- Specified by:
dataTypeSizeChanged
in interfaceDataType
- Overrides:
dataTypeSizeChanged
in classAbstractDataType
- Parameters:
dt
- the dataType that has changed.- See Also:
DataType.dataTypeSizeChanged(ghidra.program.model.data.DataType)
-
isEquivalent
public boolean isEquivalent(DataType dt)
Description copied from interface:DataType
Returns true if the given dataType is equivalent to this dataType. The precise meaning of "equivalent" is dataType dependent.- Parameters:
dt
- the dataType being tested for equivalence.- Returns:
- true if the if the given dataType is equivalent to this dataType.
- See Also:
DataType.isEquivalent(ghidra.program.model.data.DataType)
-
setCategoryPath
public void setCategoryPath(CategoryPath path) throws DuplicateNameException
- Specified by:
setCategoryPath
in interfaceDataType
- Overrides:
setCategoryPath
in classAbstractDataType
- Parameters:
path
- set the categoryPath associated with this data type- Throws:
DuplicateNameException
- See Also:
DataType.setCategoryPath(ghidra.program.model.data.CategoryPath)
-
setName
public void setName(java.lang.String name)
Description copied from interface:DataType
Sets the name of the dataType- Specified by:
setName
in interfaceDataType
- Overrides:
setName
in classAbstractDataType
- Parameters:
name
- the new name for this dataType.- See Also:
DataType.setName(java.lang.String)
-
setNameAndCategory
public void setNameAndCategory(CategoryPath path, java.lang.String name) throws InvalidNameException, DuplicateNameException
Description copied from interface:DataType
Sets the name and category of a dataType at the same time.- Specified by:
setNameAndCategory
in interfaceDataType
- Overrides:
setNameAndCategory
in classAbstractDataType
- Parameters:
path
- the new category path.name
- the new name- Throws:
InvalidNameException
- if the name is invalidDuplicateNameException
- if a dataType already exists with that name and- See Also:
DataType.setNameAndCategory(ghidra.program.model.data.CategoryPath, java.lang.String)
-
dataTypeDeleted
public void dataTypeDeleted(DataType dt)
Description copied from interface:DataType
Informs this dataType that the given dataType has been deleted.
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!- Specified by:
dataTypeDeleted
in interfaceDataType
- Overrides:
dataTypeDeleted
in classAbstractDataType
- Parameters:
dt
- the dataType that has been deleted.- See Also:
DataType.dataTypeDeleted(ghidra.program.model.data.DataType)
-
dataTypeNameChanged
public void dataTypeNameChanged(DataType dt, java.lang.String oldName)
Description copied from interface:DataType
Informs this data type that its name has changed from the indicated old name.
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!- Specified by:
dataTypeNameChanged
in interfaceDataType
- Overrides:
dataTypeNameChanged
in classAbstractDataType
- Parameters:
dt
- the data type whose name changedoldName
- the data type's old name- See Also:
DataType.dataTypeNameChanged(ghidra.program.model.data.DataType, java.lang.String)
-
dataTypeReplaced
public void dataTypeReplaced(DataType oldDt, DataType newDt)
Description copied from interface:DataType
Informs this data type that the given oldDT has been replaced with newDT
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!- Specified by:
dataTypeReplaced
in interfaceDataType
- Overrides:
dataTypeReplaced
in classAbstractDataType
- Parameters:
oldDt
- old data typenewDt
- new data type- See Also:
DataType.dataTypeReplaced(ghidra.program.model.data.DataType, ghidra.program.model.data.DataType)
-
dependsOn
public boolean dependsOn(DataType dt)
Description copied from interface:DataType
Returns true if this dataType depends on the existence of the given dataType. For example byte[] depends on byte. If byte were deleted, then byte[] would also be deleted.- Specified by:
dependsOn
in interfaceDataType
- Overrides:
dependsOn
in classAbstractDataType
- Parameters:
dt
- the dataType to test that this dataType depends on.- See Also:
DataType.dependsOn(ghidra.program.model.data.DataType)
-
addParent
public void addParent(DataType dt)
Description copied from interface:DataType
Inform this data type that it has the given parent
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!- Specified by:
addParent
in interfaceDataType
- Overrides:
addParent
in classDataTypeImpl
- Parameters:
dt
- parent data type- See Also:
DataType.addParent(ghidra.program.model.data.DataType)
-
removeParent
public void removeParent(DataType dt)
Description copied from interface:DataType
Remove a parent data type
TODO: This method is reserved for internal DB use and should be removed from the public DataType interface!!- Specified by:
removeParent
in interfaceDataType
- Overrides:
removeParent
in classDataTypeImpl
- Parameters:
dt
- parent data type- See Also:
DataType.removeParent(ghidra.program.model.data.DataType)
-
getLastChangeTime
public long getLastChangeTime()
Description copied from interface:DataType
Get the timestamp corresponding to the last time this type was changed within its data type manager- Specified by:
getLastChangeTime
in interfaceDataType
- Overrides:
getLastChangeTime
in classDataTypeImpl
- Returns:
- timestamp of last change within data type manager
-
-