Selection of an enum value from a list of candidates.
More...
Selection of an enum value from a list of candidates.
- See also
- neml2::EnumSelectionBase
#include <EnumSelection.h>
|
| | EnumSelection ()=default |
| |
| | EnumSelection (const std::vector< std::string > &candidates, const std::string &selection) |
| | Create an enum selection from a list of candidates and a default selection.
|
| |
| | EnumSelection (const std::vector< std::string > &candidates, const std::vector< int > &values, const std::string &selection) |
| | Create an enum selection from a list of candidates, a list of values, and a default selection.
|
| |
| void | select (const std::string &selection) |
| | Select a new value.
|
| |
| bool | operator== (const EnumSelection &other) const |
| | Test for equality.
|
| |
| bool | operator!= (const EnumSelection &other) const |
| | Test for inequality.
|
| |
| bool | operator== (const std::string &other) const |
| | Test for selection equality.
|
| |
| bool | operator!= (const std::string &other) const |
| | Test for selection inequality.
|
| |
| | operator std::string () const |
| | Poor man's reflection implementation.
|
| |
| | operator int () const |
| | Implicit conversion to int to let it behave more like a enum.
|
| |
| template<typename T > |
| T | as () const |
| | Statically cast the enum value to a C++ enum class.
|
| |
| | EnumSelectionBase ()=default |
| |
| | EnumSelectionBase (const std::vector< std::string > &candidates) |
| | Create an enum selection from a list of candidates.
|
| |
| | EnumSelectionBase (const std::vector< std::string > &candidates, const std::vector< int > &values) |
| | Create an enum selection from a list of candidates and their corresponding values.
|
| |
| const std::unordered_map< std::string, int > & | candidates () const |
| | Candidates.
|
| |
| std::string | candidates_str () const |
| | Stringified candidates.
|
| |
|
| std::unordered_map< std::string, int > | _candidate_map |
| | Mapping enum options to int.
|
| |
◆ EnumSelection() [1/3]
◆ EnumSelection() [2/3]
| EnumSelection |
( |
const std::vector< std::string > & | candidates, |
|
|
const std::string & | selection ) |
Create an enum selection from a list of candidates and a default selection.
◆ EnumSelection() [3/3]
| EnumSelection |
( |
const std::vector< std::string > & | candidates, |
|
|
const std::vector< int > & | values, |
|
|
const std::string & | selection ) |
Create an enum selection from a list of candidates, a list of values, and a default selection.
◆ as()
Statically cast the enum value to a C++ enum class.
◆ operator int()
Implicit conversion to int to let it behave more like a enum.
◆ operator std::string()
| operator std::string |
( |
| ) |
const |
|
inline |
Poor man's reflection implementation.
◆ operator!=() [1/2]
◆ operator!=() [2/2]
| bool operator!= |
( |
const std::string & | other | ) |
const |
Test for selection inequality.
◆ operator==() [1/2]
◆ operator==() [2/2]
| bool operator== |
( |
const std::string & | other | ) |
const |
Test for selection equality.
◆ select()
| void select |
( |
const std::string & | selection | ) |
|