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

A Dispatcher for possible ArchOption commands. More...

#include <options.hh>

Public Member Functions

 OptionDatabase (Architecture *g)
 Construct given the owning Architecture. More...
 
 ~OptionDatabase (void)
 Destructor.
 
string set (uint4 nameId, const string &p1="", const string &p2="", const string &p3="")
 Issue an option command. More...
 
void decodeOne (Decoder &decoder)
 Parse and execute a single option element. More...
 
void decode (Decoder &decoder)
 Execute a series of option commands parsed from a stream. More...
 

Private Member Functions

void registerOption (ArchOption *option)
 Map from ArchOption name to its class instance. More...
 

Private Attributes

Architectureglb
 The Architecture affected by the contained ArchOption.
 
map< uint4, ArchOption * > optionmap
 A map from option id to registered ArchOption instance.
 

Detailed Description

A Dispatcher for possible ArchOption commands.

An option command is a specific request by a user to change the configuration options for an Architecture. This class takes care of dispatching the command to the proper ArchOption derived class, which does the work of actually modifying the configuration. The command is issued either through the set() method directly, or via an element handed to the decode() method. The decode() method expects an <optionslist> element with one or more children. The child names match the registered name of the option and have up to three child elements, <param1>, <param2> and <param3>, whose content is provided as the optional parameters to command.

Constructor & Destructor Documentation

◆ OptionDatabase()

ghidra::OptionDatabase::OptionDatabase ( Architecture g)

Construct given the owning Architecture.

Register all possible ArchOption objects with this database and set-up the parsing map.

Parameters
gis the Architecture owning this database

Member Function Documentation

◆ decode()

void ghidra::OptionDatabase::decode ( Decoder decoder)

Execute a series of option commands parsed from a stream.

Parse an <optionslist> element, treating each child as an option command.

Parameters
decoderis the stream decoder

References ghidra::Decoder::closeElement(), ghidra::Decoder::openElement(), and ghidra::Decoder::peekElement().

◆ decodeOne()

void ghidra::OptionDatabase::decodeOne ( Decoder decoder)

Parse and execute a single option element.

Scan the name and optional parameters and call method set()

Parameters
decoderis the stream decoder

References ghidra::Decoder::closeElement(), ghidra::Decoder::openElement(), and ghidra::Decoder::readString().

◆ registerOption()

void ghidra::OptionDatabase::registerOption ( ArchOption option)
private

Map from ArchOption name to its class instance.

To facilitate command parsing, enter the new ArchOption instance into the map based on its name

Parameters
optionis the new ArchOption instance

References ghidra::ElementId::find(), and ghidra::ArchOption::getName().

◆ set()

string ghidra::OptionDatabase::set ( uint4  nameId,
const string &  p1 = "",
const string &  p2 = "",
const string &  p3 = "" 
)

Issue an option command.

Perform an option command directly, given its id and optional parameters

Parameters
nameIdis the id of the option
p1is the first optional parameter
p2is the second optional parameter
p3is the third optional parameter
Returns
the confirmation/failure method after trying to apply the option

References ghidra::ArchOption::apply().


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