72 if (
auto iter =
find(name); iter !=
_items.end())
74 else if (
auto subs =
find(value); subs !=
_items.end() && integer)
79 mooseError(context ? (*context +
":\n\n") : std::string(
""),
82 "\" in MooseEnum. Valid options (not case-sensitive) are \"",
102 if (
auto iter =
find(value); iter !=
_items.end())
107 "\" in MooseEnum. Valid ids are \"",
117 std::set<MooseEnumItem>::const_iterator iter =
find(item);
121 "\" in MooseEnum. Valid ids are \"",
136 "Invalid string comparison \"" + upper +
137 "\" in MooseEnum. Valid options (not case-sensitive) are \"" +
getRawNames() +
146 return !(*
this == name);
191 mooseDeprecated(
"This method will be removed because the meaning is not well defined, please use "
192 "the 'compareCurrent' method instead.");
199 mooseDeprecated(
"This method will be removed because the meaning is not well defined, please use "
200 "the 'compareCurrent' method instead.");
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
The base class for both the MooseEnum and MultiMooseEnum classes.
bool _allow_out_of_range
Flag to enable enumeration items not previously defined.
std::set< MooseEnumItem > _items
Storage for the assigned items.
int getNextValidID() const
Compute the next valid ID.
std::set< MooseEnumItem >::const_iterator find(const MooseEnumItem &other) const
Locate an item.
virtual void checkDeprecated() const =0
Method that must be implemented to check derived class values against the _deprecated_names.
std::string getRawNames() const
Method for returning the raw name strings for this instance.
const std::set< MooseEnumItem > & items() const
Return the complete set of available flags.
std::vector< int > getIDs() const
Method for returning a vector of ids for this instance.
Class for containing MooseEnum item information.
const std::string & name() const
const int & id() const
Return the numeric, name, or raw name.
static const int INVALID_ID
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
CompareMode
Enum item for controlling comparison in the compareCurrent method.
virtual void checkDeprecated() const override
Check whether the current value is deprecated when called.
MooseEnum & operator=(const MooseEnum &other_enum)=default
Copy Assignment operator must be explicitly defined when a copy ctor exists and this method is used.
MooseEnumItem _current
The current id.
bool operator!=(const char *value) const
void assign(const std::string &name, const std::optional< std::string > &context={})
bool operator==(const char *value) const
Comparison operators for comparing with character constants, MooseEnums or integer values.
MooseEnum()
Constructor for use by libmesh::Parameters and ReporterMode.
bool compareCurrent(const MooseEnum &other, CompareMode mode=CompareMode::COMPARE_NAME) const
Method for comparing currently set values between MooseEnum.
std::string toUpper(std::string name)
Convert supplied string to upper case.
std::string trim(const std::string &str, const std::string &white_space=" \t\n\v\f\r")
Standard scripting language trim function.
std::string stringify(const T &t)
conversion to string