Package ghidra.program.model.symbol
Class SymbolType
- java.lang.Object
-
- ghidra.program.model.symbol.SymbolType
-
public abstract class SymbolType extends java.lang.ObjectClass to represent the various types of Symbols.
-
-
Field Summary
Fields Modifier and Type Field Description static SymbolTypeCLASSstatic SymbolTypeCODEDeprecated, for removal: This API element is subject to removal in a future version.useLABELinstead.static SymbolTypeFUNCTIONstatic SymbolTypeGLOBALstatic SymbolTypeGLOBAL_VARstatic SymbolTypeLABELstatic SymbolTypeLIBRARYstatic SymbolTypeLOCAL_VARstatic SymbolTypeNAMESPACEstatic SymbolTypePARAMETER
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanallowsDuplicates()Returns true of this symbol type allows duplicate names.booleanequals(java.lang.Object obj)bytegetID()Returns the id of this symbol type.static SymbolTypegetSymbolType(int id)Returns the SymbolType for the given id.inthashCode()booleanisNamespace()Returns true if this symbol represents a namespace.abstract booleanisValidAddress(Program program, Address symbolAddress)Returns true if the given address is valid for this symbol type.abstract booleanisValidParent(Program program, Namespace parent, Address symbolAddr, boolean isExternalSymbol)Returns true if the given namespace is a valid parent for a symbol of this type if it has the given address and whether or not it is external.abstract booleanisValidSourceType(SourceType sourceType, Address symbolAddress)Returns true if the given SourceType is valid for this symbol type.java.lang.StringtoString()
-
-
-
Field Detail
-
LABEL
public static final SymbolType LABEL
-
CODE
@Deprecated(since="9.1", forRemoval=true) public static final SymbolType CODEDeprecated, for removal: This API element is subject to removal in a future version.useLABELinstead.
-
LIBRARY
public static final SymbolType LIBRARY
-
NAMESPACE
public static final SymbolType NAMESPACE
-
CLASS
public static final SymbolType CLASS
-
FUNCTION
public static final SymbolType FUNCTION
-
PARAMETER
public static final SymbolType PARAMETER
-
LOCAL_VAR
public static final SymbolType LOCAL_VAR
-
GLOBAL_VAR
public static final SymbolType GLOBAL_VAR
-
GLOBAL
public static final SymbolType GLOBAL
-
-
Method Detail
-
isValidParent
public abstract boolean isValidParent(Program program, Namespace parent, Address symbolAddr, boolean isExternalSymbol)
Returns true if the given namespace is a valid parent for a symbol of this type if it has the given address and whether or not it is external.- Parameters:
program- the program to contain the symbolparent- the namespace where a symbol will potentially be parented.symbolAddr- the address of they symbol to be parented.isExternalSymbol- true if the symbol is external.- Returns:
- true if the given namespace is a valid parent for a symbol if it has the given address and whether or not it is external.
-
isValidAddress
public abstract boolean isValidAddress(Program program, Address symbolAddress)
Returns true if the given address is valid for this symbol type.- Parameters:
program- the program to test for a valid address.symbolAddress- the address of the symbol to be tested.- Returns:
- true if the given address is valid within the given program.
-
isValidSourceType
public abstract boolean isValidSourceType(SourceType sourceType, Address symbolAddress)
Returns true if the given SourceType is valid for this symbol type. (For example, Some symbols don't support the SymbolType.DEFAULT)- Parameters:
sourceType- the sourceType to test.symbolAddress- the address of the symbol to be tested.- Returns:
- true if the given SourceType is valid for this symbol type.
-
allowsDuplicates
public boolean allowsDuplicates()
Returns true of this symbol type allows duplicate names.- Returns:
- true of this symbol type allows duplicate names.
-
isNamespace
public boolean isNamespace()
Returns true if this symbol represents a namespace.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getID
public byte getID()
Returns the id of this symbol type.
-
getSymbolType
public static SymbolType getSymbolType(int id)
Returns the SymbolType for the given id.- Parameters:
id- the id for the SymbolType to find.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-