Package ghidra.program.model.data
Class BuiltIn
- java.lang.Object
-
- ghidra.program.model.data.AbstractDataType
-
- ghidra.program.model.data.DataTypeImpl
-
- ghidra.program.model.data.BuiltIn
-
- All Implemented Interfaces:
BuiltInDataType
,DataType
,ExtensionPoint
,java.util.EventListener
,javax.swing.event.ChangeListener
- Direct Known Subclasses:
AbstractComplexDataType
,AbstractFloatDataType
,AbstractIntegerDataType
,AbstractStringDataType
,AIFFDataType
,AlignmentDataType
,AUDataType
,BadDataType
,DynamicDataType
,FactoryStructureDataType
,FileTimeDataType
,GifDataType
,GuidDataType
,HTMLResourceDataType
,ImageBaseOffset32DataType
,ImageBaseOffset64DataType
,JPEGDataType
,MacintoshTimeStampDataType
,PngDataType
,PointerDataType
,SegmentedCodePointerDataType
,ShiftedAddressDataType
,Undefined
,VoidDataType
,WAVEDataType
,WideChar16DataType
,WideChar32DataType
,WideCharDataType
public abstract class BuiltIn extends DataTypeImpl implements BuiltInDataType
NOTE: ALL DATATYPE CLASSES MUST END IN "DataType". If not, the ClassSearcher will not find them. Base class for built-in Datatypes. A built-in data type is searched for in the classpath and added automatically to the available data types in the data type manager.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ghidra.util.classfinder.ExtensionPoint
ExtensionPoint.Exclude, ExtensionPoint.Util
-
-
Field Summary
-
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
-
-
Constructor Summary
Constructors Constructor Description BuiltIn(CategoryPath path, java.lang.String name, DataTypeManager dataMgr)
-
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
copy(DataTypeManager dtm)
Returns a clone of this built-in DataTypevoid
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.protected SettingsDefinition[]
getBuiltInSettingsDefinitions()
Gets a list of all the settingsDefinitions used by this datatype.protected java.lang.String
getCTypeDeclaration(BuiltIn dt, boolean signed, DataOrganization dataOrganization, boolean useDefine)
java.lang.String
getCTypeDeclaration(DataOrganization dataOrganization)
Returns null for FactoryDataType (which should never be used) and Dynamic types which should generally be replaced by a primitive array (e.g., char[5]) or, a primitive pointer (e.g., char *).protected java.lang.String
getCTypeDeclaration(java.lang.String typeName, int typeLen, boolean signed, DataOrganization dataOrganization, boolean useDefine)
protected java.lang.String
getCTypeDeclaration(java.lang.String typeName, java.lang.String ctypeName, boolean useDefine)
java.lang.String
getDecompilerDisplayName(DecompilerLanguage language)
Return token used to represent this type in decompiler/source-code outputlong
getLastChangeTime()
Get the timestamp corresponding to the last time this type was changed within its data type managerSettingsDefinition[]
getSettingsDefinitions()
Gets a list of all the settingsDefinitions used by this datatype.UniversalID
getUniversalID()
Get the universal ID for this data type.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, getSourceArchive, 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, getMnemonic, getName, isDeleted, isDynamicallySized, isNotYetDefined, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ghidra.program.model.data.DataType
clone, getAlignment, getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDefaultSettings, getDescription, getDisplayName, getDocs, getLastChangeTimeInSourceArchive, getLength, getMnemonic, getName, getParents, getPathName, getRepresentation, getSourceArchive, getValue, getValueClass, isDeleted, isDynamicallySized, isNotYetDefined, replaceWith, setDefaultSettings, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setSourceArchive
-
-
-
-
Constructor Detail
-
BuiltIn
public BuiltIn(CategoryPath path, java.lang.String name, DataTypeManager dataMgr)
-
-
Method Detail
-
copy
public final DataType copy(DataTypeManager dtm)
Returns a clone of this built-in DataType- Specified by:
copy
in interfaceDataType
- Parameters:
dtm
- the data-type manager instance whose data-organization should apply.- See Also:
DataType.copy(ghidra.program.model.data.DataTypeManager)
-
getSettingsDefinitions
public final SettingsDefinition[] getSettingsDefinitions()
Gets a list of all the settingsDefinitions used by this datatype.- Specified by:
getSettingsDefinitions
in interfaceDataType
- Overrides:
getSettingsDefinitions
in classDataTypeImpl
- Returns:
- a list of the settingsDefinitions used by this datatype.
-
getBuiltInSettingsDefinitions
protected SettingsDefinition[] getBuiltInSettingsDefinitions()
Gets a list of all the settingsDefinitions used by this datatype.- Returns:
- a list of the settingsDefinitions used by this 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.- Specified by:
isEquivalent
in interfaceDataType
- Parameters:
dt
- the dataType being tested for equivalence.- Returns:
- true if the if the given dataType is equivalent to this dataType.
-
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.
-
setCategoryPath
public final 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
-
setName
public final void setName(java.lang.String name) throws InvalidNameException
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.- Throws:
InvalidNameException
- if the given name does not form a valid name.
-
setNameAndCategory
public final 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
-
addParent
public final 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
-
removeParent
public final 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
-
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
-
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
-
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.
-
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.
-
getUniversalID
public UniversalID getUniversalID()
Description copied from interface:DataType
Get the universal ID for this data type. This value is intended to be a unique identifier across all programs and archives. The same ID indicates that two data types were originally the same one. Keep in mind names, categories, and component makeup may differ and have changed since there origin.- Specified by:
getUniversalID
in interfaceDataType
- Overrides:
getUniversalID
in classDataTypeImpl
- Returns:
- data type UniversalID
-
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
-
getDecompilerDisplayName
public java.lang.String getDecompilerDisplayName(DecompilerLanguage language)
Return token used to represent this type in decompiler/source-code output- Parameters:
language
- is the language being displayed- Returns:
- the name string
-
getCTypeDeclaration
protected java.lang.String getCTypeDeclaration(java.lang.String typeName, java.lang.String ctypeName, boolean useDefine)
-
getCTypeDeclaration
protected java.lang.String getCTypeDeclaration(java.lang.String typeName, int typeLen, boolean signed, DataOrganization dataOrganization, boolean useDefine)
-
getCTypeDeclaration
protected java.lang.String getCTypeDeclaration(BuiltIn dt, boolean signed, DataOrganization dataOrganization, boolean useDefine)
-
getCTypeDeclaration
public java.lang.String getCTypeDeclaration(DataOrganization dataOrganization)
Returns null for FactoryDataType (which should never be used) and Dynamic types which should generally be replaced by a primitive array (e.g., char[5]) or, a primitive pointer (e.g., char *). For other types an appropriately sized unsigned integer typedef is returned.- Specified by:
getCTypeDeclaration
in interfaceBuiltInDataType
- Parameters:
dataOrganization
- or null for default- Returns:
- definition C-statement (e.g., #define or typedef) or null if type name is a standard C-primitive name or if type is FactoryDataType or Dynamic.
- See Also:
BuiltInDataType.getCTypeDeclaration(ghidra.program.model.data.DataOrganization)
-
-