decompiler  1.0.0
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Private Attributes | List of all members
ghidra::PrintLanguageCapability Class Referenceabstract

Base class for high-level language capabilities. More...

#include <printlanguage.hh>

Inheritance diagram for ghidra::PrintLanguageCapability:
ghidra::CapabilityPoint ghidra::PrintCCapability ghidra::PrintJavaCapability

Public Member Functions

const string & getName (void) const
 Get the high-level language name.
 
virtual void initialize (void)
 Complete initialization of an extension point. More...
 
virtual PrintLanguagebuildLanguage (Architecture *glb)=0
 Build the main PrintLanguage object corresponding to this capability. More...
 
- Public Member Functions inherited from ghidra::CapabilityPoint
virtual ~CapabilityPoint (void)
 Destructor.
 

Static Public Member Functions

static PrintLanguageCapabilitygetDefault (void)
 Retrieve the default language capability. More...
 
static PrintLanguageCapabilityfindCapability (const string &name)
 Find a language capability by name. More...
 
- Static Public Member Functions inherited from ghidra::CapabilityPoint
static void initializeAll (void)
 Finish initialization for all extension points. More...
 

Protected Attributes

string name
 Unique identifier for language capability.
 
bool isdefault
 Set to true to treat this as the default language.
 

Static Private Attributes

static vector< PrintLanguageCapability * > thelist
 The static array of registered high-level languages.
 

Additional Inherited Members

- Protected Member Functions inherited from ghidra::CapabilityPoint
 CapabilityPoint (void)
 Construct extension capability exactly once. More...
 

Detailed Description

Base class for high-level language capabilities.

This class is overridden to introduce a new high-level language back-end to the system. A static singleton is instantiated to automatically register the new capability with the system. A static array keeps track of all the registered capabilities.

The singleton is registered with a name, which the user can use to select the language, and it acts as a factory for the main language printing class for the capability, which must be derived from PrintLanguage. The factory method for the capability to override is buildLanguage().

Member Function Documentation

◆ buildLanguage()

virtual PrintLanguage* ghidra::PrintLanguageCapability::buildLanguage ( Architecture glb)
pure virtual

Build the main PrintLanguage object corresponding to this capability.

An Architecture will call this once. All decompiling from this Architecture will use this same emitter.

Parameters
glbis the Architecture that will own the new emitter
Returns
the instantiated PrintLanguage emittter

Implemented in ghidra::PrintCCapability, and ghidra::PrintJavaCapability.

Referenced by ghidra::Architecture::Architecture(), getName(), and ghidra::Architecture::setPrintLanguage().

◆ findCapability()

PrintLanguageCapability * ghidra::PrintLanguageCapability::findCapability ( const string &  name)
static

Find a language capability by name.

Parameters
nameis the language name to search for
Returns
the matching language capability or NULL

References getName(), name, and thelist.

Referenced by getName(), and ghidra::Architecture::setPrintLanguage().

◆ getDefault()

PrintLanguageCapability * ghidra::PrintLanguageCapability::getDefault ( void  )
static

Retrieve the default language capability.

This retrieves the capability with its isdefault field set or the first capability registered.

Returns
the default language capability

References thelist.

Referenced by ghidra::Architecture::Architecture(), and getName().

◆ initialize()

void ghidra::PrintLanguageCapability::initialize ( void  )
virtual

Complete initialization of an extension point.

This method is implemented by each extension so it can do specialized integration

Implements ghidra::CapabilityPoint.

References isdefault, and thelist.

Referenced by getName().


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