[libcalamares] Add a more convenient find() to NamedEnum
- In most cases, you **know** the table covers all the enum values, and the extra parameter *ok* is just annoying. Provide a convenience that doesn't distinguish empty from empty-but-valid.
This commit is contained in:
parent
197cb9982c
commit
f0c4164515
@ -105,6 +105,16 @@ struct NamedEnumTable
|
||||
// ok is still false
|
||||
return string_t();
|
||||
}
|
||||
|
||||
/** @brief Find a value @p s in the table and return its name.
|
||||
*
|
||||
* Returns emptry string if the value is not found.
|
||||
*/
|
||||
string_t find( enum_t s ) const
|
||||
{
|
||||
bool ok = false;
|
||||
return find( s, ok );
|
||||
}
|
||||
};
|
||||
|
||||
/** @brief Smashes an enum value to its underlying type. */
|
||||
|
Loading…
Reference in New Issue
Block a user