Package ghidra.app.util.bin.format.dwarf
Class NamespacePath
java.lang.Object
ghidra.app.util.bin.format.dwarf.NamespacePath
- All Implemented Interfaces:
Comparable<NamespacePath>
Represents a hierarchical path of containers that hold names of objects.
Each container of names (lets call them a namespace for short) can have a type that distinguishes it from other containers: classes, functions, c++ namespaces, etc.
A NamespacePath does not correlate directly to a Ghidra Namespace, as a Ghidra Namespace
is tied to a Program and has rules about what can be placed inside of it.
NamespacePath instances can be created without referring to a Ghidra Program and without concern as to what will be valid or have collisions.
Use a NamespacePath to represent and hold forward-engineering namespace nesting information (ie. namespace info recovered from debug info), and when a Ghidra Namespace is needed, convert to or lookup the live/'real' Ghidra Namespace.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionConverts this namespace path into aNamespacestyle string without the ROOT namespace included.Converts this namespace path into aNamespacestyle string.intcompareTo(NamespacePath otherPath) static NamespacePathcreate(NamespacePath parent, String name, SymbolType type) Creates a newNamespacePathinstance.booleangetName()Returns the name of this namespace element, ie.getNamespace(Program program) Returns a reference to the parent NamespacePath.getParts()Returns the individual parts of the path as elements in a list.getType()Returns theSymbolTypeof this namespace element (ie.inthashCode()booleanisRoot()Returns true if this namespace path points to the root of the namespace space.toString()
-
Field Details
-
ROOT
-
-
Method Details
-
create
Creates a newNamespacePathinstance.- Parameters:
parent- optional - parentNamespacePathinstance, default toROOTif null.name- string name of the new namespace.type-SymbolTypeof the named space - ie. a "namespace", a class,- Returns:
- new
NamespacePath
-
isRoot
public boolean isRoot()Returns true if this namespace path points to the root of the namespace space.- Returns:
- boolean true if ROOT
-
getName
Returns the name of this namespace element, ie. the last thing on the path.- Returns:
- string name.
-
getParent
Returns a reference to the parent NamespacePath.- Returns:
- parent NamespacePath
-
getType
Returns theSymbolTypeof this namespace element (ie. the symbol type of the last thing on the path).- Returns:
SymbolType
-
getNamespace
-
asNamespaceString
Converts this namespace path into aNamespacestyle string.- Returns:
- string path "ROOT::namespace1::namespace2"
-
asFormattedString
Converts this namespace path into aNamespacestyle string without the ROOT namespace included.- Returns:
- string path "namespace1::namespace2"
-
getParts
Returns the individual parts of the path as elements in a list.- Returns:
- list of strings containing individual parts of the path
-
toString
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<NamespacePath>
-