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
- Direct Known Subclasses:
AbstractComplexDataType,AbstractFloatDataType,AbstractIntegerDataType,AbstractLeb128DataType,AbstractStringDataType,AIFFDataType,AlignmentDataType,AUDataType,BadDataType,DwarfEncodingModeDataType,DynamicDataType,FactoryStructureDataType,FileTimeDataType,GifDataType,GuidDataType,HTMLResourceDataType,ImageBaseOffset32DataType,ImageBaseOffset64DataType,JPEGDataType,MacintoshTimeStampDataType,PcRelative31AddressDataType,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.
-
-
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 voidaddParent(DataType dt)Inform this datatype that it has the given parentDataTypecopy(DataTypeManager dtm)Returns a clone of this built-in DataTypevoiddataTypeDeleted(DataType dt)Informs this datatype that the given datatype has been deleted.voiddataTypeNameChanged(DataType dt, java.lang.String oldName)Informs this datatype that its name has changed from the indicated old name.voiddataTypeReplaced(DataType oldDt, DataType newDt)Informs this datatype that the given oldDT has been replaced with newDTvoiddataTypeSizeChanged(DataType dt)Notification that the given datatype's size has changed.booleandependsOn(DataType dt)Check 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.StringgetCTypeDeclaration(BuiltIn dt, boolean signed, DataOrganization dataOrganization, boolean useDefine)java.lang.StringgetCTypeDeclaration(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.StringgetCTypeDeclaration(java.lang.String typeName, int typeLen, boolean signed, DataOrganization dataOrganization, boolean useDefine)protected java.lang.StringgetCTypeDeclaration(java.lang.String typeName, java.lang.String ctypeName, boolean useDefine)java.lang.StringgetDecompilerDisplayName(DecompilerLanguage language)Return token used to represent this type in decompiler/source-code outputlonggetLastChangeTime()Get the timestamp corresponding to the last time this type was changed within its datatype managerSettingsDefinition[]getSettingsDefinitions()Gets a list of all the settingsDefinitions used by this datatype.UniversalIDgetUniversalID()Get the universal ID for this datatype.booleanisEquivalent(DataType dt)Check if the given datatype is equivalent to this datatype.voidremoveParent(DataType dt)Remove a parent datatypevoidsetCategoryPath(CategoryPath path)Set the categoryPath associated with this datatypevoidsetName(java.lang.String name)Sets the name of the datatypevoidsetNameAndCategory(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, notifyAlignmentChanged, notifyDeleted, notifyNameChanged, notifyParents, notifyReplaced, notifySizeChanged, replaceWith, setDefaultSettings, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setSourceArchive
-
Methods inherited from class ghidra.program.model.data.AbstractDataType
dataTypeAlignmentChanged, encodeRepresentation, encodeValue, getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDisplayName, getDocs, getMnemonic, getName, hasLanguageDependantLength, isDeleted, isEncodable, isNotYetDefined, isZeroLength, 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, dataTypeAlignmentChanged, encodeRepresentation, encodeValue, getAlignment, getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDefaultSettings, getDescription, getDisplayName, getDocs, getLastChangeTimeInSourceArchive, getLength, getMnemonic, getName, getParents, getPathName, getRepresentation, getSourceArchive, getValue, getValueClass, hasLanguageDependantLength, isDeleted, isEncodable, isNotYetDefined, isZeroLength, 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:
copyin interfaceDataType- Parameters:
dtm- the data-type manager instance whose data-organization should apply.- Returns:
- new instanceof of this datatype
- 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:
getSettingsDefinitionsin interfaceDataType- Overrides:
getSettingsDefinitionsin 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:DataTypeCheck if the given datatype is equivalent to this datatype.The precise meaning of "equivalent" is datatype dependent.
NOTE: if invoked by a DB object or manager it should be invoked on the DataTypeDB object passing the other datatype as the argument.- Specified by:
isEquivalentin 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:DataTypeNotification 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.- Specified by:
dataTypeSizeChangedin interfaceDataType- Overrides:
dataTypeSizeChangedin classAbstractDataType- Parameters:
dt- the datatype that has changed.
-
setCategoryPath
public final void setCategoryPath(CategoryPath path) throws DuplicateNameException
Description copied from interface:DataTypeSet the categoryPath associated with this datatype- Specified by:
setCategoryPathin interfaceDataType- Overrides:
setCategoryPathin classAbstractDataType- Parameters:
path- the new path- Throws:
DuplicateNameException- if an attempt to place this datatype into the specified category resulted in a name collision. This should not occur for non-DB DataType instances.
-
setName
public final void setName(java.lang.String name) throws InvalidNameExceptionDescription copied from interface:DataTypeSets the name of the datatype- Specified by:
setNamein interfaceDataType- Overrides:
setNamein 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:DataTypeSets the name and category of a datatype at the same time.- Specified by:
setNameAndCategoryin interfaceDataType- Overrides:
setNameAndCategoryin classAbstractDataType- Parameters:
path- the new category path.name- the new name- Throws:
InvalidNameException- if the name is invalidDuplicateNameException- if name change on storedDataTypeis a duplicate of another datatype within the same category (only applies to DB storedDataType).
-
addParent
public final void addParent(DataType dt)
Description copied from interface:DataTypeInform this datatype that it has the given parentTODO: This method is reserved for internal DB use.
- Specified by:
addParentin interfaceDataType- Overrides:
addParentin classDataTypeImpl- Parameters:
dt- parent datatype
-
removeParent
public final void removeParent(DataType dt)
Description copied from interface:DataTypeRemove a parent datatypeTODO: This method is reserved for internal DB use.
- Specified by:
removeParentin interfaceDataType- Overrides:
removeParentin classDataTypeImpl- Parameters:
dt- parent datatype
-
dataTypeNameChanged
public void dataTypeNameChanged(DataType dt, java.lang.String oldName)
Description copied from interface:DataTypeInforms this datatype that its name has changed from the indicated old name.TODO: This method is reserved for internal DB use.
- Specified by:
dataTypeNameChangedin interfaceDataType- Overrides:
dataTypeNameChangedin classAbstractDataType- Parameters:
dt- the datatype whose name changedoldName- the datatype's old name
-
dataTypeReplaced
public void dataTypeReplaced(DataType oldDt, DataType newDt)
Description copied from interface:DataTypeInforms this datatype that the given oldDT has been replaced with newDTTODO: This method is reserved for internal DB use.
- Specified by:
dataTypeReplacedin interfaceDataType- Overrides:
dataTypeReplacedin classAbstractDataType- Parameters:
oldDt- old datatypenewDt- new datatype
-
dataTypeDeleted
public void dataTypeDeleted(DataType dt)
Description copied from interface:DataTypeInforms this datatype that the given datatype has been deleted.TODO: This method is reserved for internal DB use.
- Specified by:
dataTypeDeletedin interfaceDataType- Overrides:
dataTypeDeletedin classAbstractDataType- Parameters:
dt- the datatype that has been deleted.
-
dependsOn
public boolean dependsOn(DataType dt)
Description copied from interface:DataTypeCheck 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:
dependsOnin interfaceDataType- Overrides:
dependsOnin classAbstractDataType- Parameters:
dt- the datatype to test that this datatype depends on.- Returns:
- true if the existence of this datatype relies on the existence of the specified datatype dt.
-
getUniversalID
public UniversalID getUniversalID()
Description copied from interface:DataTypeGet the universal ID for this datatype.This value is intended to be a unique identifier across all programs and archives. The same ID indicates that two datatypes were originally the same one. Keep in mind names, categories, and component makeup may differ and have changed since there origin.
- Specified by:
getUniversalIDin interfaceDataType- Overrides:
getUniversalIDin classDataTypeImpl- Returns:
- datatype UniversalID
-
getLastChangeTime
public long getLastChangeTime()
Description copied from interface:DataTypeGet the timestamp corresponding to the last time this type was changed within its datatype manager- Specified by:
getLastChangeTimein interfaceDataType- Overrides:
getLastChangeTimein classDataTypeImpl- Returns:
- timestamp of last change within datatype 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:
getCTypeDeclarationin 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)
-
-