mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-04 21:05:37 -04:00
[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
1 changed files with 10 additions and 0 deletions
|
@ -105,6 +105,16 @@ struct NamedEnumTable
|
||||||
// ok is still false
|
// ok is still false
|
||||||
return string_t();
|
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. */
|
/** @brief Smashes an enum value to its underlying type. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue