Namespace display options

This commit is contained in:
caheckman 2020-06-26 16:48:00 -04:00
parent 05c3358fe4
commit e339d91ffd
12 changed files with 129 additions and 75 deletions

View file

@ -81,6 +81,7 @@ OptionDatabase::OptionDatabase(Architecture *g)
registerOption(new OptionToggleRule());
registerOption(new OptionAliasBlock());
registerOption(new OptionMaxInstruction());
registerOption(new OptionNamespaceStrategy());
}
OptionDatabase::~OptionDatabase(void)
@ -833,3 +834,23 @@ string OptionMaxInstruction::apply(Architecture *glb,const string &p1,const stri
glb->max_instructions = newMax;
return "Maximum instructions per function set";
}
/// \class OptionNamespaceStrategy
/// \brief How should namespace tokens be displayed
///
/// The first parameter gives the strategy identifier, mapping to PrintLanguage::namespace_strategy.
string OptionNamespaceStrategy::apply(Architecture *glb,const string &p1,const string &p2,const string &p3) const
{
PrintLanguage::namespace_strategy strategy;
if (p1 == "minimal")
strategy = PrintLanguage::MINIMAL_NAMESPACES;
else if (p1 == "all")
strategy = PrintLanguage::ALL_NAMESPACES;
else if (p1 == "none")
strategy = PrintLanguage::NO_NAMESPACES;
else
throw ParseError("Must specify a valid strategy");
glb->print->setNamespaceStrategy(strategy);
return "Namespace strategy set";
}