Package ghidra.program.model.data
Interface ArrayStringable
-
- All Superinterfaces:
DataType
- All Known Implementing Classes:
AbstractIntegerDataType
,ByteDataType
,CharDataType
,DWordDataType
,Integer16DataType
,Integer3DataType
,Integer5DataType
,Integer6DataType
,Integer7DataType
,IntegerDataType
,LongDataType
,LongLongDataType
,QWordDataType
,ShortDataType
,SignedByteDataType
,SignedCharDataType
,SignedDWordDataType
,SignedQWordDataType
,SignedWordDataType
,UnsignedCharDataType
,UnsignedInteger16DataType
,UnsignedInteger3DataType
,UnsignedInteger5DataType
,UnsignedInteger6DataType
,UnsignedInteger7DataType
,UnsignedIntegerDataType
,UnsignedLongDataType
,UnsignedLongLongDataType
,UnsignedShortDataType
,WideChar16DataType
,WideChar32DataType
,WideCharDataType
,WordDataType
public interface ArrayStringable extends DataType
ArrayStringable
identifies those data types which when formed into an array can be interpreted as a string (e.g., character array). TheArray
implementations will leverage this interface as both a marker and to generate appropriate representations and values for data instances.
-
-
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 Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.String
getArrayDefaultLabelPrefix(MemBuffer buf, Settings settings, int len, DataTypeDisplayOptions options)
For cases where an array of this type exists, get the appropriate string to use as the default label prefix for the array.java.lang.String
getArrayDefaultOffcutLabelPrefix(MemBuffer buf, Settings settings, int len, DataTypeDisplayOptions options, int offcutLength)
For cases where an array of this type exists, get the appropriate string to use as the default label prefix, taking into account the fact that there exists a reference to the data that references offcutLength bytes into this typedefault java.lang.String
getArrayRepresentation(MemBuffer buf, Settings settings, int length)
For cases where an array of this type exists, get the representation string which corresponds to the array (example: String for an array of chars).default java.lang.String
getArrayString(MemBuffer buf, Settings settings, int length)
For cases where an array of this type exists, get the array value as a String.static ArrayStringable
getArrayStringable(DataType dt)
Get the ArrayStringable for a specified data type.static java.lang.String
getArrayStringableLabelPrefix(Array arrayDt, MemBuffer buf, Settings settings, int len, DataTypeDisplayOptions options)
Get the appropriate string to use as the label prefix for an array which corresponds to an ArrayStringable element data type.static java.lang.String
getArrayStringableOffcutLabelPrefix(Array arrayDt, MemBuffer buf, Settings settings, int len, DataTypeDisplayOptions options, int offcutLength)
Get the appropriate string to use as the offcut label prefix for an array which corresponds to an ArrayStringable element data type.default StringDataInstance
getStringDataInstance(MemBuffer buf, Settings settings, int length)
Returns aStringDataInstance
representing this ArrayStringable's contents.boolean
hasStringValue(Settings settings)
For cases where an array of this type exists, determines if a String value will be returned.-
Methods inherited from interface ghidra.program.model.data.DataType
addParent, clone, copy, dataTypeDeleted, dataTypeNameChanged, dataTypeReplaced, dataTypeSizeChanged, dependsOn, getAlignment, getCategoryPath, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDefaultSettings, getDescription, getDisplayName, getDocs, getLastChangeTime, getLastChangeTimeInSourceArchive, getLength, getMnemonic, getName, getParents, getPathName, getRepresentation, getSettingsDefinitions, getSourceArchive, getUniversalID, getValue, getValueClass, isDeleted, isDynamicallySized, isEquivalent, isNotYetDefined, removeParent, replaceWith, setCategoryPath, setDefaultSettings, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setName, setNameAndCategory, setSourceArchive
-
-
-
-
Method Detail
-
hasStringValue
boolean hasStringValue(Settings settings)
For cases where an array of this type exists, determines if a String value will be returned.- Parameters:
settings
-- Returns:
- true if array of this type with the specified settings will return a String value.
-
getStringDataInstance
default StringDataInstance getStringDataInstance(MemBuffer buf, Settings settings, int length)
Returns aStringDataInstance
representing this ArrayStringable's contents.- Parameters:
buf
-MemBuffer
containing the data bytes.settings
-Settings
object containing settings, usually theData
element.length
- number of bytes that this data object contains (ie. how big was the array)- Returns:
- a new
StringDataInstance
representing this ArrayStringable's contents, never NULL. SeeStringDataInstance.NULL_INSTANCE
.
-
getArrayString
default java.lang.String getArrayString(MemBuffer buf, Settings settings, int length)
For cases where an array of this type exists, get the array value as a String. When data corresponds to character data it should generally be expressed as a string. A null value is returned if not supported or memory is uninitialized.- Parameters:
buf
- data buffersettings
- data settingslength
- length of array- Returns:
- array value expressed as a string or null if data is not character data
-
getArrayRepresentation
default java.lang.String getArrayRepresentation(MemBuffer buf, Settings settings, int length)
For cases where an array of this type exists, get the representation string which corresponds to the array (example: String for an array of chars).- Parameters:
buf
- memory buffer containing the bytes.settings
- the Settings objectlength
- the length of the data.- Returns:
- array representation or null of an array representation is not supported.
-
getArrayDefaultLabelPrefix
java.lang.String getArrayDefaultLabelPrefix(MemBuffer buf, Settings settings, int len, DataTypeDisplayOptions options)
For cases where an array of this type exists, get the appropriate string to use as the default label prefix for the array.- Parameters:
buf
- memory buffer containing the bytes.settings
- the Settings objectlength
- the length of the data.options
- options for how to format the default label prefix.- Returns:
- the default label prefix or null if none specified.
-
getArrayDefaultOffcutLabelPrefix
java.lang.String getArrayDefaultOffcutLabelPrefix(MemBuffer buf, Settings settings, int len, DataTypeDisplayOptions options, int offcutLength)
For cases where an array of this type exists, get the appropriate string to use as the default label prefix, taking into account the fact that there exists a reference to the data that references offcutLength bytes into this type- Parameters:
buf
- memory buffer containing the bytes.settings
- the Settings objectlength
- the length of the data.options
- options for how to format the default label prefix.offcutOffset
-- Returns:
- the default label prefix or null if none specified.
-
getArrayStringable
static ArrayStringable getArrayStringable(DataType dt)
Get the ArrayStringable for a specified data type. Not used on an Array DataType, but on Array's element's type.- Parameters:
dt
- data type- Returns:
- ArrayStringable object, or null.
-
getArrayStringableLabelPrefix
static java.lang.String getArrayStringableLabelPrefix(Array arrayDt, MemBuffer buf, Settings settings, int len, DataTypeDisplayOptions options)
Get the appropriate string to use as the label prefix for an array which corresponds to an ArrayStringable element data type.- Parameters:
arrayDt
- array data typebuf
- memory buffer containing the bytes.settings
- the Settings objectlength
- the length of the data.options
- options for how to format the default label prefix.- Returns:
- the ArrayStringable label prefix or null if not applicable
-
getArrayStringableOffcutLabelPrefix
static java.lang.String getArrayStringableOffcutLabelPrefix(Array arrayDt, MemBuffer buf, Settings settings, int len, DataTypeDisplayOptions options, int offcutLength)
Get the appropriate string to use as the offcut label prefix for an array which corresponds to an ArrayStringable element data type.- Parameters:
arrayDt
- array data typebuf
- memory buffer containing the bytes.settings
- the Settings objectlength
- the length of the data.options
- options for how to format the default label prefix.offcutLength
- offcut offset from start of buf- Returns:
- the ArrayStringable offcut label prefix or null if not applicable
-
-