decompiler  1.0.0
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
ghidra::ElementId Class Reference

An annotation for a specific collection of hierarchical data. More...

#include <marshal.hh>

Public Member Functions

 ElementId (const string &nm, uint4 i)
 Construct given a name and id. More...
 
const string & getName (void) const
 Get the element's name.
 
uint4 getId (void) const
 Get the element's id.
 
bool operator== (const ElementId &op2) const
 Test equality with another ElementId.
 

Static Public Member Functions

static uint4 find (const string &nm)
 Find the id associated with a specific element name. More...
 
static void initialize (void)
 Populate a hashtable with all ElementId objects. More...
 

Static Private Member Functions

static vector< ElementId * > & getList (void)
 Retrieve the list of static ElementId. More...
 

Private Attributes

string name
 The name of the element.
 
uint4 id
 The (internal) id of the attribute.
 

Static Private Attributes

static unordered_map< string, uint4 > lookupElementId
 A map of ElementId names to their associated id.
 

Friends

bool operator== (uint4 id, const ElementId &op2)
 Test equality of a raw integer id with an ElementId.
 
bool operator== (const ElementId &op1, uint4 id)
 Test equality of an ElementId with a raw integer id.
 
bool operator!= (uint4 id, const ElementId &op2)
 Test inequality of a raw integer id with an ElementId.
 
bool operator!= (const ElementId &op1, uint4 id)
 Test inequality of an ElementId with a raw integer id.
 

Detailed Description

An annotation for a specific collection of hierarchical data.

This class parallels the XML concept of an element. An ElementId describes a collection of data, where each piece is annotated by a specific AttributeId. In addition, each ElementId can contain zero or more child ElementId objects, forming a hierarchy of annotated data. Each ElementId has a name, which is unique at least within the context of its parent ElementId. Internally this name is associated with an integer id. A special AttributeId ATTRIB_CONTENT is used to label the XML element's text content, which is traditionally not labeled as an attribute.

Constructor & Destructor Documentation

◆ ElementId()

ghidra::ElementId::ElementId ( const string &  nm,
uint4  i 
)

Construct given a name and id.

This constructor should only be invoked for static objects. It registers the element for inclusion in the global hashtable.

Parameters
nmis the name of the element
iis an id to associate with the element

References getList().

Member Function Documentation

◆ find()

uint4 ghidra::ElementId::find ( const string &  nm)
inlinestatic

Find the id associated with a specific element name.

The name is looked up in the global list of all elements. If the element is not in the list, a special placeholder element, ELEM_UNKNOWN, is returned as a placeholder for elements with unrecognized names.

Parameters
nmis the name of the element
Returns
the associated id

References id.

Referenced by ghidra::XmlDecode::closeElement(), ghidra::XmlDecode::closeElementSkipping(), ghidra::IfcOption::execute(), ghidra::XmlDecode::openElement(), ghidra::XmlDecode::peekElement(), and ghidra::OptionDatabase::registerOption().

◆ getList()

vector< ElementId * > & ghidra::ElementId::getList ( void  )
staticprivate

Retrieve the list of static ElementId.

Access static vector of ElementId objects that are registered during static initialization The list itself is created once on the first call to this method.

Returns
a reference to the vector

Referenced by ElementId(), and initialize().

◆ initialize()

void ghidra::ElementId::initialize ( void  )
static

Populate a hashtable with all ElementId objects.

Fill the hashtable mapping element names to their id, from registered element objects.

References getList(), id, lookupElementId, and name.

Referenced by ghidra::GhidraDecompCapability::initialize().


The documentation for this class was generated from the following files: