Package ghidra.program.model.data
Interface Enum
-
- All Superinterfaces:
DataType
- All Known Implementing Classes:
CliAbstractSig.CliTypeCodeDataType
,CliBlobMarshalSpec.CliNativeTypeDataType
,CliBlobMarshalSpec.CliSafeArrayElemTypeDataType
,CliFlags.CliEnumAssemblyFlags
,CliFlags.CliEnumAssemblyHashAlgorithm
,CliFlags.CliEnumEventAttributes
,CliFlags.CliEnumFieldAttributes
,CliFlags.CliEnumFileAttributes
,CliFlags.CliEnumGenericParamAttributes
,CliFlags.CliEnumManifestResourceAttributes
,CliFlags.CliEnumMethodAttributes
,CliFlags.CliEnumMethodImplAttributes
,CliFlags.CliEnumMethodSemanticsAttributes
,CliFlags.CliEnumParamAttributes
,CliFlags.CliEnumPInvokeAttributes
,CliFlags.CliEnumPropertyAttributes
,CliFlags.CliEnumTypeAttributes
,EnumDataType
,ImageCor20Header.ImageCor20Flags
public interface Enum extends DataType
-
-
Field Summary
-
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 Abstract Methods Modifier and Type Method Description void
add(java.lang.String name, long value)
Add a enum entry.void
add(java.lang.String name, long value, java.lang.String comment)
Add a enum entry.java.lang.String
getComment(java.lang.String name)
Get the comment for the given name.int
getCount()
Get the number of entries in this Enum.java.lang.String
getName(long value)
Get the name for the given value.java.lang.String[]
getNames()
Get the names of the enum entries.java.lang.String
getRepresentation(java.math.BigInteger bigInt, Settings settings, int bitLength)
Get enum representation of the big-endian value.long
getValue(java.lang.String name)
Get the value for the given name.long[]
getValues()
Get the values of the enum entries.void
remove(java.lang.String name)
Remove the enum entry with the given name.void
setDescription(java.lang.String description)
Set the description for this Enum.-
Methods inherited from interface ghidra.program.model.data.DataType
addParent, clone, copy, dataTypeAlignmentChanged, dataTypeDeleted, dataTypeNameChanged, dataTypeReplaced, dataTypeSizeChanged, dependsOn, encodeRepresentation, encodeValue, getAlignment, getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDefaultSettings, getDescription, getDisplayName, getDocs, getLastChangeTime, getLastChangeTimeInSourceArchive, getLength, getMnemonic, getName, getParents, getPathName, getRepresentation, getSettingsDefinitions, getSourceArchive, getUniversalID, getValue, getValueClass, hasLanguageDependantLength, isDeleted, isEncodable, isEquivalent, isNotYetDefined, isZeroLength, removeParent, replaceWith, setCategoryPath, setDefaultSettings, setLastChangeTime, setLastChangeTimeInSourceArchive, setName, setNameAndCategory, setSourceArchive
-
-
-
-
Method Detail
-
getValue
long getValue(java.lang.String name) throws java.util.NoSuchElementException
Get the value for the given name.- Parameters:
name
- name of the entry.- Returns:
- the value.
- Throws:
java.util.NoSuchElementException
- if the name does not exist in this Enum.
-
getName
java.lang.String getName(long value)
Get the name for the given value.- Parameters:
value
- value of the enum entry.- Returns:
- null if the name with the given value was not found.
-
getComment
java.lang.String getComment(java.lang.String name)
Get the comment for the given name.- Parameters:
name
- name of the entry.- Returns:
- the comment or the empty string if the name does not exist in this enum or if no comment is set.
-
getValues
long[] getValues()
Get the values of the enum entries.- Returns:
- values sorted in ascending order
-
getNames
java.lang.String[] getNames()
Get the names of the enum entries. The returned names are first sorted by the enum int value, then sub-sorted by name value where there are multiple name values per int value.- Returns:
- the names of the enum entries.
-
getCount
int getCount()
Get the number of entries in this Enum.- Returns:
- the number of entries in this Enum.
-
add
void add(java.lang.String name, long value)
Add a enum entry.- Parameters:
name
- name of the new entryvalue
- value of the new entry
-
add
void add(java.lang.String name, long value, java.lang.String comment)
Add a enum entry.- Parameters:
name
- name of the new entryvalue
- value of the new entrycomment
- comment of the new entry
-
remove
void remove(java.lang.String name)
Remove the enum entry with the given name.- Parameters:
name
- name of entry to remove.
-
setDescription
void setDescription(java.lang.String description)
Set the description for this Enum.- Specified by:
setDescription
in interfaceDataType
- Parameters:
description
- the description
-
getRepresentation
java.lang.String getRepresentation(java.math.BigInteger bigInt, Settings settings, int bitLength)
Get enum representation of the big-endian value.- Parameters:
bigInt
- BigInteger value with the appropriate signsettings
- integer format settings (PADDING, FORMAT, etc.)bitLength
- the bit length- Returns:
- formatted integer string
-
-