Selection of multiple enum value from a list of choices.
More...
Selection of multiple enum value from a list of choices.
- See also
- neml2::EnumSelectionBase
#include <MultiEnumSelection.h>
|
| | MultiEnumSelection ()=default |
| |
| | MultiEnumSelection (const std::vector< std::string > &choices, const std::vector< std::string > &selections) |
| | Create a multi-enum selection from a list of choices and default selections.
|
| |
| | MultiEnumSelection (const std::vector< std::string > &choices, const std::vector< int > &values, const std::vector< std::string > &selections) |
| | Create a multi-enum selection from a list of choices, their corresponding values, and default selections.
|
| |
| void | select (const std::vector< std::string > &selections) |
| |
| std::size_t | size () const |
| | Number of selected values.
|
| |
| bool | operator== (const MultiEnumSelection &other) const |
| | Test for inequality.
|
| |
| bool | operator!= (const MultiEnumSelection &other) const |
| | Test for inequality.
|
| |
| const std::vector< std::string > & | selections () const |
| | Poor man's reflection implementation.
|
| |
| const std::vector< int > & | values () const |
| | Selected values cast to int.
|
| |
| template<typename T > |
| std::vector< T > | as () const |
| | Statically cast the enum value to a C++ enum class.
|
| |
| | EnumSelectionBase ()=default |
| |
| | EnumSelectionBase (const std::vector< std::string > &choices) |
| | Create an enum selection from a list of choices.
|
| |
| | EnumSelectionBase (const std::vector< std::string > &choices, const std::vector< int > &values) |
| | Create an enum selection from a list of choices and their corresponding values.
|
| |
| const std::unordered_map< std::string, int > & | choices () const |
| | Choices.
|
| |
| std::string | join (const std::string &separator=", ") const |
| | Join the choices into a single string with the given separator.
|
| |
|
| std::unordered_map< std::string, int > | _choice_map |
| | Mapping enum options to int.
|
| |
◆ MultiEnumSelection() [1/3]
◆ MultiEnumSelection() [2/3]
| MultiEnumSelection |
( |
const std::vector< std::string > & | choices, |
|
|
const std::vector< std::string > & | selections ) |
Create a multi-enum selection from a list of choices and default selections.
◆ MultiEnumSelection() [3/3]
| MultiEnumSelection |
( |
const std::vector< std::string > & | choices, |
|
|
const std::vector< int > & | values, |
|
|
const std::vector< std::string > & | selections ) |
Create a multi-enum selection from a list of choices, their corresponding values, and default selections.
◆ as()
template<typename T >
| std::vector< T > as |
( |
| ) |
const |
|
inline |
Statically cast the enum value to a C++ enum class.
◆ operator!=()
◆ operator==()
◆ select()
| void select |
( |
const std::vector< std::string > & | selections | ) |
|
Select new values
- Note
- This will clear the current selection
◆ selections()
| const std::vector< std::string > & selections |
( |
| ) |
const |
|
inline |
Poor man's reflection implementation.
◆ size()
| std::size_t size |
( |
| ) |
const |
Number of selected values.
◆ values()
| const std::vector< int > & values |
( |
| ) |
const |
|
inline |
Selected values cast to int.