Properly handle aliases
This commit is contained in:
Juergen Spitzmueller 2022-04-24 16:51:16 +02:00
parent d8f540f51b
commit 64ec812da5
3 changed files with 15 additions and 2 deletions

View File

@ -89,7 +89,7 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
DebugVector dmap;
for (int i = 0 ; i < level_count; i++) {
Debug::Type const level = Debug::value(i);
string const dbgname = Debug::name(level);
string const dbgname = Debug::realName(i);
// ignore these
if (dbgname == "any" || dbgname == "all"
|| dbgname == "none" || dbgname == "latex")

View File

@ -118,6 +118,14 @@ string const Debug::name(Debug::Type val)
}
string const Debug::realName(int idx)
{
if (idx < numErrorTags)
return errorTags[idx].name;
return "unknown index";
}
Debug::Type Debug::value(string const & val)
{
Type l = Debug::NONE;

View File

@ -130,9 +130,14 @@ namespace Debug {
/// Return description of level
std::string const description(Type val);
/// Return name of level
/// Return name of level from value. In case of aliases,
/// this returns the first entry found
std::string const name(Type val);
/// Return name of level from index, in case of aliases
/// this is unambiguous
std::string const realName(int i);
/// Display the tags and descriptions of the current debug level
void showLevel(std::ostream & os, Type level);